aboutsummaryrefslogtreecommitdiffstats
path: root/src/egl/drivers
diff options
context:
space:
mode:
authorDerek Foreman <[email protected]>2017-10-30 15:52:22 -0500
committerEmil Velikov <[email protected]>2017-11-14 15:38:43 +0000
commit0db36caa192b129cb4f22d152f82f38fcf6f06d4 (patch)
tree64daf500b20ad2f663bd12d449dcf85f6d4c800a /src/egl/drivers
parent89e669d2fd512e99922b095a34192b8fc6509d28 (diff)
egl/wayland: Add a fallback when fourcc query isn't supported
When queryImage doesn't support __DRI_IMAGE_ATTRIB_FOURCC wayland clients will die with a NULL derefence in wl_proxy_add_listener. Attempt to provide a simple fallback to keep ancient systems working. Fixes: 6595c699511 ("egl/wayland: Remove more surface specifics from create_wl_buffer") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103519 Signed-off-by: Derek Foreman <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Acked-by: Daniel Stone <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src/egl/drivers')
-rw-r--r--src/egl/drivers/dri2/platform_wayland.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index b38eb1c3354..7010dfdcb2b 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -671,6 +671,35 @@ static const struct wl_callback_listener throttle_listener = {
.done = wayland_throttle_callback
};
+static EGLBoolean
+get_fourcc(struct dri2_egl_display *dri2_dpy,
+ __DRIimage *image, int *fourcc)
+{
+ EGLBoolean query;
+ uint32_t dri_format;
+
+ query = dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_FOURCC,
+ fourcc);
+ if (query)
+ return true;
+
+ query = dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_FORMAT,
+ &dri_format);
+ if (!query)
+ return false;
+
+ switch (dri_format) {
+ case __DRI_IMAGE_FORMAT_ARGB8888:
+ *fourcc = __DRI_IMAGE_FOURCC_ARGB8888;
+ return true;
+ case __DRI_IMAGE_FORMAT_XRGB8888:
+ *fourcc = __DRI_IMAGE_FOURCC_XRGB8888;
+ return true;
+ default:
+ return false;
+ }
+}
+
static struct wl_buffer *
create_wl_buffer(struct dri2_egl_display *dri2_dpy,
struct dri2_egl_surface *dri2_surf,
@@ -684,8 +713,7 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy,
query = dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_WIDTH, &width);
query &= dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_HEIGHT,
&height);
- query &= dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_FOURCC,
- &fourcc);
+ query &= get_fourcc(dri2_dpy, image, &fourcc);
if (!query)
return NULL;