From cb05b164140dc6934ff5a00cb4354a5dbf4593ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 12 Sep 2019 21:56:17 +0200 Subject: [PATCH] wayland/dma-buf: Don't advertise modifier support by default Advertising support for modifiers means we will most likely not not be able to scan out client buffers directly, meaning it just as likely that we won't be able to scan out even fullscreen windows without atomic KMS. When we have atomic support, we should advertise support for modifiers if atomic is used to drive the CRTCs, as we by then can check whether we can scan out directly, place in an overlay plane, etc. https://gitlab.gnome.org/GNOME/mutter/merge_requests/798 --- src/wayland/meta-wayland-dma-buf.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/wayland/meta-wayland-dma-buf.c b/src/wayland/meta-wayland-dma-buf.c index ac412d214..6d05896e6 100644 --- a/src/wayland/meta-wayland-dma-buf.c +++ b/src/wayland/meta-wayland-dma-buf.c @@ -454,6 +454,15 @@ static const struct zwp_linux_dmabuf_v1_interface dma_buf_implementation = dma_buf_handle_create_buffer_params, }; +static gboolean +should_send_modifiers (MetaBackend *backend) +{ + MetaSettings *settings = meta_backend_get_settings (backend); + + return meta_settings_is_experimental_feature_enabled ( + settings, META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS); +} + static void send_modifiers (struct wl_resource *resource, uint32_t format) @@ -476,6 +485,14 @@ send_modifiers (struct wl_resource *resource, if (wl_resource_get_version (resource) < ZWP_LINUX_DMABUF_V1_MODIFIER_SINCE_VERSION) return; + if (!should_send_modifiers (backend)) + { + zwp_linux_dmabuf_v1_send_modifier (resource, format, + DRM_FORMAT_MOD_INVALID >> 32, + DRM_FORMAT_MOD_INVALID & 0xffffffff); + return; + } + /* First query the number of available modifiers, then allocate an array, * then fill the array. */ ret = meta_egl_query_dma_buf_modifiers (egl, egl_display, format, 0, NULL,