egl/wayland: fallback to implicit modifiers if advertised by compositor
The Wayland protocol defines INVALID as a special marker indicating that implicit modifiers are supported. If the driver doesn't support explicit modifiers and the compositor advertises support for implicit modifiers, fallback to these. This effectively restores logic removed in4c06515892
, but only for the specific case of Wayland instead of affecting all APIs. (Wayland is one of the few APIs defining a special meaning for INVALID.) Signed-off-by: Simon Ser <contact@emersion.fr> Fixes:4c06515892
("dri: revert INVALID modifier special-casing") (cherry picked from commitda555982b3
) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32730>
This commit is contained in:
@@ -1010,6 +1010,7 @@ create_dri_image(struct dri2_egl_surface *dri2_surf,
|
||||
uint64_t *modifiers;
|
||||
unsigned int num_modifiers;
|
||||
struct u_vector *modifiers_present;
|
||||
bool implicit_mod_supported;
|
||||
|
||||
assert(visual_idx != -1);
|
||||
|
||||
@@ -1049,6 +1050,26 @@ create_dri_image(struct dri2_egl_surface *dri2_surf,
|
||||
num_modifiers = u_vector_length(modifiers_present);
|
||||
}
|
||||
|
||||
if (!dri2_dpy->dri_screen_render_gpu->base.screen->resource_create_with_modifiers &&
|
||||
dri2_dpy->wl_dmabuf) {
|
||||
/* We don't support explicit modifiers, check if the compositor supports
|
||||
* implicit modifiers. */
|
||||
implicit_mod_supported = false;
|
||||
for (unsigned int i = 0; i < num_modifiers; i++) {
|
||||
if (modifiers[i] == DRM_FORMAT_MOD_INVALID) {
|
||||
implicit_mod_supported = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!implicit_mod_supported) {
|
||||
return;
|
||||
}
|
||||
|
||||
num_modifiers = 0;
|
||||
modifiers = NULL;
|
||||
}
|
||||
|
||||
/* For the purposes of this function, an INVALID modifier on
|
||||
* its own means the modifiers aren't supported. */
|
||||
if (num_modifiers == 0 ||
|
||||
|
Reference in New Issue
Block a user