From dba05ca55844cbac56af5fdafa31bee8b3c80fa6 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 23 Nov 2023 20:17:07 +0100 Subject: [PATCH] egl/wayland: ensure wl_drm is available before use Avoid crashing if wl_drm is unavailable. Instead, gracefully error out. Signed-off-by: Simon Ser Acked-by: Pierre-Eric Pelloux-Prayer Fixes: c60fea8c228a ("Revert "egl/wayland: deprecate drm_handle_format() and drm_handle_capabilities()"") Part-of: (cherry picked from commit 35143febbaca5e3f0bbc57ae104322696aae34ad) --- .pick_status.json | 2 +- src/egl/drivers/dri2/platform_wayland.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 069c76a64d0..18d11b17c15 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4344,7 +4344,7 @@ "description": "egl/wayland: ensure wl_drm is available before use", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "c60fea8c228ae3f32e20d6b65c473d9f04871d20", "notes": null diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 00d53e9b3fe..e0fe7b3ac9d 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -1487,7 +1487,7 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy, ret = zwp_linux_buffer_params_v1_create_immed(params, width, height, fourcc, 0); zwp_linux_buffer_params_v1_destroy(params); - } else { + } else if (dri2_dpy->wl_drm) { struct wl_drm *wl_drm = dri2_surf ? dri2_surf->wl_drm_wrapper : dri2_dpy->wl_drm; int fd = -1, stride;