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
This commit is contained in:
Jonas Ådahl 2019-09-12 21:56:17 +02:00
parent b9fe9c736a
commit cb05b16414

View File

@ -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,