summaryrefslogtreecommitdiff
path: root/src/wayland/meta-wayland-dma-buf.c
diff options
context:
space:
mode:
authorJonas Ã…dahl <jadahl@gmail.com>2021-12-08 21:23:54 +0100
committerMarge Bot <marge-bot@gnome.org>2022-01-05 20:00:36 +0000
commit8a2fcf3be0189cd949ca19897fa7a8624a3f4a68 (patch)
treecbdfaccd9f93f91cb778a52daef6c443589b8596 /src/wayland/meta-wayland-dma-buf.c
parenta14923e9937dae02a1b3fccb7229fb82a8c9093a (diff)
downloadmutter-8a2fcf3be0189cd949ca19897fa7a8624a3f4a68.tar.gz
wayland: Use new KMS update test API to try acquiring scanout
This significantly increases the chance of a fullscreen surface buffer being scanned out instead of being painted via composition. This is assuming the client supports the DMA buffer feedback Wayland protocol. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2146>
Diffstat (limited to 'src/wayland/meta-wayland-dma-buf.c')
-rw-r--r--src/wayland/meta-wayland-dma-buf.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/wayland/meta-wayland-dma-buf.c b/src/wayland/meta-wayland-dma-buf.c
index f7e929c5b..f7b334b49 100644
--- a/src/wayland/meta-wayland-dma-buf.c
+++ b/src/wayland/meta-wayland-dma-buf.c
@@ -528,17 +528,14 @@ meta_wayland_dma_buf_try_acquire_scanout (MetaWaylandDmaBufBuffer *dma_buf,
MetaBackend *backend = meta_get_backend ();
MetaRenderer *renderer = meta_backend_get_renderer (backend);
MetaRendererNative *renderer_native = META_RENDERER_NATIVE (renderer);
+ int n_planes;
MetaDeviceFile *device_file;
MetaGpuKms *gpu_kms;
- int n_planes;
- uint32_t drm_format;
- uint64_t drm_modifier;
- uint32_t stride;
struct gbm_bo *gbm_bo;
gboolean use_modifier;
g_autoptr (GError) error = NULL;
MetaDrmBufferFlags flags;
- MetaDrmBufferGbm *fb;
+ g_autoptr (MetaDrmBufferGbm) fb = NULL;
for (n_planes = 0; n_planes < META_WAYLAND_DMA_BUF_MAX_FDS; n_planes++)
{
@@ -546,15 +543,6 @@ meta_wayland_dma_buf_try_acquire_scanout (MetaWaylandDmaBufBuffer *dma_buf,
break;
}
- drm_format = dma_buf->drm_format;
- drm_modifier = dma_buf->drm_modifier;
- stride = dma_buf->strides[0];
- if (!meta_onscreen_native_is_buffer_scanout_compatible (onscreen,
- drm_format,
- drm_modifier,
- stride))
- return NULL;
-
device_file = meta_renderer_native_get_primary_device_file (renderer_native);
gpu_kms = meta_renderer_native_get_primary_gpu (renderer_native);
gbm_bo = import_scanout_gbm_bo (dma_buf, gpu_kms, n_planes, &use_modifier);
@@ -576,7 +564,11 @@ meta_wayland_dma_buf_try_acquire_scanout (MetaWaylandDmaBufBuffer *dma_buf,
return NULL;
}
- return COGL_SCANOUT (fb);
+ if (!meta_onscreen_native_is_buffer_scanout_compatible (onscreen,
+ META_DRM_BUFFER (fb)))
+ return NULL;
+
+ return COGL_SCANOUT (g_steal_pointer (&fb));
#else
return NULL;
#endif