[mutter] wayland/dma-buf: Always advertise non-modifier fallback
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland/dma-buf: Always advertise non-modifier fallback
- Date: Wed, 5 Jan 2022 17:17:47 +0000 (UTC)
commit 2a16a750c556a916a6792adf10adbe4499d5e092
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Tue Dec 7 22:12:57 2021 +0100
wayland/dma-buf: Always advertise non-modifier fallback
This is done to explicitly tell clients that the compositor supports
implicit modifier paths (i.e. using modifier unaware API).
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1959>
src/wayland/meta-wayland-dma-buf.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/wayland/meta-wayland-dma-buf.c b/src/wayland/meta-wayland-dma-buf.c
index c41577f9d2..c194a35ff7 100644
--- a/src/wayland/meta-wayland-dma-buf.c
+++ b/src/wayland/meta-wayland-dma-buf.c
@@ -868,12 +868,18 @@ should_send_modifiers (MetaBackend *backend)
static void
send_modifiers (struct wl_resource *resource,
- MetaWaylandDmaBufFormat *format)
+ MetaWaylandDmaBufFormat *format,
+ GHashTable *sent_formats)
{
g_assert (wl_resource_get_version (resource) <
ZWP_LINUX_DMABUF_V1_GET_DEFAULT_FEEDBACK_SINCE_VERSION);
- zwp_linux_dmabuf_v1_send_format (resource, format->drm_format);
+ if (!g_hash_table_contains (sent_formats,
+ GUINT_TO_POINTER (format->drm_format)))
+ {
+ g_hash_table_add (sent_formats, GUINT_TO_POINTER (format->drm_format));
+ zwp_linux_dmabuf_v1_send_format (resource, format->drm_format);
+ }
if (wl_resource_get_version (resource) <
ZWP_LINUX_DMABUF_V1_MODIFIER_SINCE_VERSION)
@@ -901,8 +907,11 @@ dma_buf_bind (struct wl_client *client,
if (version < ZWP_LINUX_DMABUF_V1_GET_DEFAULT_FEEDBACK_SINCE_VERSION)
{
+ g_autoptr (GHashTable) sent_formats = NULL;
unsigned int i;
+ sent_formats = g_hash_table_new (NULL, NULL);
+
for (i = 0; i < dma_buf_manager->formats->len; i++)
{
MetaWaylandDmaBufFormat *format =
@@ -910,7 +919,7 @@ dma_buf_bind (struct wl_client *client,
MetaWaylandDmaBufFormat,
i);
- send_modifiers (resource, format);
+ send_modifiers (resource, format, sent_formats);
}
}
}
@@ -961,8 +970,6 @@ add_format (MetaWaylandDmaBufManager *dma_buf_manager,
g_array_append_val (dma_buf_manager->formats, format);
}
- return;
-
add_fallback:
format = (MetaWaylandDmaBufFormat) {
.drm_format = drm_format,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]