64 lines
2.2 KiB
Diff
64 lines
2.2 KiB
Diff
|
From bf278ee26628898b674d86d39198babe0174f8bf Mon Sep 17 00:00:00 2001
|
||
|
From: Simon Ser <contact@emersion.fr>
|
||
|
Date: Sat, 7 Dec 2024 13:15:57 +0100
|
||
|
Subject: [PATCH 3/3] 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 in 4c065158927d, 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: 4c065158927d ("dri: revert INVALID modifier special-casing")
|
||
|
---
|
||
|
src/egl/drivers/dri2/platform_wayland.c | 20 ++++++++++++++++++++
|
||
|
1 file changed, 20 insertions(+)
|
||
|
|
||
|
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
|
||
|
index 472665a36b0..2406bc18b74 100644
|
||
|
--- a/src/egl/drivers/dri2/platform_wayland.c
|
||
|
+++ b/src/egl/drivers/dri2/platform_wayland.c
|
||
|
@@ -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,25 @@ 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) {
|
||
|
+ /* 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 ||
|
||
|
--
|
||
|
2.43.0
|
||
|
|