From 35e7feac8c4a3eba888e2d7db35f0d59d668b449 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 31 Jan 2023 11:55:35 +0100 Subject: [PATCH] wayland: Check that the current backend is native before using DMA-BUF FDs We may fall through these paths on --nested too, resulting in us poking the wrong internals from the wrong MetaRenderer subclass. Fixes launching of clients using wl_drm in --nested. Part-of: --- src/wayland/meta-wayland-dma-buf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wayland/meta-wayland-dma-buf.c b/src/wayland/meta-wayland-dma-buf.c index 6f265a83e..4b44ada75 100644 --- a/src/wayland/meta-wayland-dma-buf.c +++ b/src/wayland/meta-wayland-dma-buf.c @@ -712,13 +712,17 @@ meta_wayland_dma_buf_fds_for_wayland_buffer (MetaWaylandBuffer *buffer) meta_wayland_compositor_get_context (buffer->compositor); MetaBackend *backend = meta_context_get_backend (context); MetaRenderer *renderer = meta_backend_get_renderer (backend); - MetaRendererNative *renderer_native = META_RENDERER_NATIVE (renderer); + MetaRendererNative *renderer_native; MetaGpuKms *gpu_kms; struct gbm_device *gbm_device; struct gbm_bo *gbm_bo; MetaWaylandDmaBufBuffer *dma_buf; uint32_t i, n_planes; + if (!META_IS_RENDERER_NATIVE (renderer)) + return NULL; + + renderer_native = META_RENDERER_NATIVE (renderer); gpu_kms = meta_renderer_native_get_primary_gpu (renderer_native); if (!gpu_kms) return NULL;