mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-29 16:05:59 +01:00
render/egl: stop advertising render support for external-only formats
Some formats like YUV are only supported by Mesa for sampling, not for rendering. However we always unconditionally added the INVALID modifier to the list of render formats. Check whether all modifiers are external-only, in that case, don't add INVALID to the list of render formats.
This commit is contained in:
parent
80074d95fb
commit
f12cdc53f3
1 changed files with 17 additions and 12 deletions
25
render/egl.c
25
render/egl.c
|
@ -136,11 +136,25 @@ static void init_dmabuf_formats(struct wlr_egl *egl) {
|
||||||
|
|
||||||
has_modifiers = has_modifiers || modifiers_len > 0;
|
has_modifiers = has_modifiers || modifiers_len > 0;
|
||||||
|
|
||||||
// EGL always supports implicit modifiers
|
bool all_external_only = true;
|
||||||
|
for (int j = 0; j < modifiers_len; j++) {
|
||||||
|
wlr_drm_format_set_add(&egl->dmabuf_texture_formats, fmt,
|
||||||
|
modifiers[j]);
|
||||||
|
if (!external_only[j]) {
|
||||||
|
wlr_drm_format_set_add(&egl->dmabuf_render_formats, fmt,
|
||||||
|
modifiers[j]);
|
||||||
|
all_external_only = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// EGL always supports implicit modifiers. If at least one modifier supports rendering,
|
||||||
|
// assume the implicit modifier supports rendering too.
|
||||||
wlr_drm_format_set_add(&egl->dmabuf_texture_formats, fmt,
|
wlr_drm_format_set_add(&egl->dmabuf_texture_formats, fmt,
|
||||||
DRM_FORMAT_MOD_INVALID);
|
DRM_FORMAT_MOD_INVALID);
|
||||||
|
if (modifiers_len == 0 || !all_external_only) {
|
||||||
wlr_drm_format_set_add(&egl->dmabuf_render_formats, fmt,
|
wlr_drm_format_set_add(&egl->dmabuf_render_formats, fmt,
|
||||||
DRM_FORMAT_MOD_INVALID);
|
DRM_FORMAT_MOD_INVALID);
|
||||||
|
}
|
||||||
|
|
||||||
if (modifiers_len == 0) {
|
if (modifiers_len == 0) {
|
||||||
// Asume the linear layout is supported if the driver doesn't
|
// Asume the linear layout is supported if the driver doesn't
|
||||||
|
@ -151,15 +165,6 @@ static void init_dmabuf_formats(struct wlr_egl *egl) {
|
||||||
DRM_FORMAT_MOD_LINEAR);
|
DRM_FORMAT_MOD_LINEAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < modifiers_len; j++) {
|
|
||||||
wlr_drm_format_set_add(&egl->dmabuf_texture_formats, fmt,
|
|
||||||
modifiers[j]);
|
|
||||||
if (!external_only[j]) {
|
|
||||||
wlr_drm_format_set_add(&egl->dmabuf_render_formats, fmt,
|
|
||||||
modifiers[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wlr_log_get_verbosity() >= WLR_DEBUG) {
|
if (wlr_log_get_verbosity() >= WLR_DEBUG) {
|
||||||
char *fmt_name = drmGetFormatName(fmt);
|
char *fmt_name = drmGetFormatName(fmt);
|
||||||
wlr_log(WLR_DEBUG, " %s (0x%08"PRIX32")",
|
wlr_log(WLR_DEBUG, " %s (0x%08"PRIX32")",
|
||||||
|
|
Loading…
Reference in a new issue