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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2818>
This commit is contained in:
Carlos Garnacho 2023-01-31 11:55:35 +01:00 committed by Marge Bot
parent 51735c218b
commit 35e7feac8c

View File

@ -712,13 +712,17 @@ meta_wayland_dma_buf_fds_for_wayland_buffer (MetaWaylandBuffer *buffer)
meta_wayland_compositor_get_context (buffer->compositor); meta_wayland_compositor_get_context (buffer->compositor);
MetaBackend *backend = meta_context_get_backend (context); MetaBackend *backend = meta_context_get_backend (context);
MetaRenderer *renderer = meta_backend_get_renderer (backend); MetaRenderer *renderer = meta_backend_get_renderer (backend);
MetaRendererNative *renderer_native = META_RENDERER_NATIVE (renderer); MetaRendererNative *renderer_native;
MetaGpuKms *gpu_kms; MetaGpuKms *gpu_kms;
struct gbm_device *gbm_device; struct gbm_device *gbm_device;
struct gbm_bo *gbm_bo; struct gbm_bo *gbm_bo;
MetaWaylandDmaBufBuffer *dma_buf; MetaWaylandDmaBufBuffer *dma_buf;
uint32_t i, n_planes; 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); gpu_kms = meta_renderer_native_get_primary_gpu (renderer_native);
if (!gpu_kms) if (!gpu_kms)
return NULL; return NULL;