File U_xwayland-glamor-gbm-Handle-DRM_FORMAT_MOD_INVALID-gracefully.patch of Package xorg-x11-server.28361
From edf964434eac10ffbe27cc883e3ab95505669aee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Fri, 13 Sep 2019 17:11:27 +0200
Subject: [PATCH] xwayland/glamor-gbm: Handle DRM_FORMAT_MOD_INVALID gracefully
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The compositor may send DRM_FORMAT_MOD_INVALID instead of a list of
modifiers for various reasons. Handle this gracefully by ignoring it.
Without this, if a compositor would send DRM_FORMAT_MOD_INVALID, it'd
result in empty windows provided by Xwayland.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
---
hw/xwayland/xwayland-glamor-gbm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index c13515c3c..e2a240c23 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -789,6 +789,10 @@ xwl_dmabuf_handle_modifier(void *data, struct zwp_linux_dmabuf_v1 *dmabuf,
struct xwl_format *xwl_format = NULL;
int i;
+ if (modifier_hi == (DRM_FORMAT_MOD_INVALID >> 32) &&
+ modifier_lo == (DRM_FORMAT_MOD_INVALID & 0xffffffff))
+ return;
+
for (i = 0; i < xwl_screen->num_formats; i++) {
if (xwl_screen->formats[i].format == format) {
xwl_format = &xwl_screen->formats[i];
--
2.26.2