weston: Add weston_get_backend_type from Weston 14 80/30680/3
authorMarius Vlad <marius.vlad@collabora.com>
Fri, 13 Dec 2024 15:41:21 +0000 (17:41 +0200)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Mon, 6 Jan 2025 16:03:33 +0000 (16:03 +0000)
This helper is from Weston 14 and helps identify the outputs created by
other remote back-ends (like PipeWire/RDP/VNC) which we can further use to
further differentiate between different types of back- ends.

Bug-AGL: SPEC-5324
Change-Id: Ie7537380eaa81a4c48d4ef5c09598ab102310842
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/30680
Tested-by: Jenkins Job builder account
Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
meta-agl-core/recipes-graphics/wayland/weston/0001-backend-Add-weston_get_backend_type.patch [new file with mode: 0644]
meta-agl-core/recipes-graphics/wayland/weston_13.0_aglcore.inc

diff --git a/meta-agl-core/recipes-graphics/wayland/weston/0001-backend-Add-weston_get_backend_type.patch b/meta-agl-core/recipes-graphics/wayland/weston/0001-backend-Add-weston_get_backend_type.patch
new file mode 100644 (file)
index 0000000..01d5f91
--- /dev/null
@@ -0,0 +1,79 @@
+From fcccf1b63dc3cbf6063238c39a31197f0d32364c Mon Sep 17 00:00:00 2001
+From: Marius Vlad <marius.vlad@collabora.com>
+Date: Fri, 13 Dec 2024 17:14:44 +0200
+Subject: [PATCH] backend: Add weston_get_backend_type
+
+Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
+---
+ include/libweston/libweston.h |  3 +++
+ libweston/backend.h           |  5 +++++
+ libweston/compositor.c        | 19 +++++++++++++++++++
+ 3 files changed, 27 insertions(+)
+
+diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h
+index 077c16b..da6200d 100644
+--- a/include/libweston/libweston.h
++++ b/include/libweston/libweston.h
+@@ -2685,6 +2685,9 @@ weston_compositor_add_screenshot_authority(struct weston_compositor *compositor,
+ int
+ weston_compositor_backends_loaded(struct weston_compositor *compositor);
++enum weston_compositor_backend
++weston_get_backend_type(struct weston_backend *backend);
++
+ #ifdef  __cplusplus
+ }
+ #endif
+diff --git a/libweston/backend.h b/libweston/backend.h
+index 495d0a5..9b12544 100644
+--- a/libweston/backend.h
++++ b/libweston/backend.h
+@@ -120,6 +120,11 @@ struct weston_backend {
+        */
+       bool (*can_scanout_dmabuf)(struct weston_backend *backend,
+                                  struct linux_dmabuf_buffer *buffer);
++
++      /** Identifies a particular backend_type from one
++       * defined in weston_compositor_backend.
++       */
++      enum weston_compositor_backend backend_type;
+ };
+ /* weston_head */
+diff --git a/libweston/compositor.c b/libweston/compositor.c
+index 41459eb..ef1932f 100644
+--- a/libweston/compositor.c
++++ b/libweston/compositor.c
+@@ -9691,6 +9691,7 @@ weston_compositor_load_backend(struct weston_compositor *compositor,
+               return NULL;
+       b = wl_container_of(compositor->backend_list.next, b, link);
++      b->backend_type = backend;
+       /* Return the last loaded backend. */
+       return b;
+@@ -9954,3 +9955,21 @@ weston_output_finish_frame_from_timer(struct weston_output *output)
+       weston_output_finish_frame(output, &ts, 0);
+ }
++
++/** Retrieve the backend type of as described in enum
++ * weston_compositor_backend. 
++ *
++ * Note that the backend must be loaded, with weston_compositor_load_backend
++ *
++ * \param backend weston_backend in question
++ * \returns a type of enum weston_compositor_backend
++ *
++ * \sa weston_compositor_load_backend
++ *
++ */
++WL_EXPORT enum weston_compositor_backend
++weston_get_backend_type(struct weston_backend *backend)
++{
++      assert(backend);
++      return backend->backend_type;
++}
+-- 
+2.43.0
+
index 31e2a2b..f4f5e4c 100644 (file)
@@ -4,6 +4,7 @@ SRC_URI:append = " \
                  file://0001-clients-Handle-missing-pointer_surface-is-there-s-no.patch \
                  file://0001-backend-drm-don-t-leak-gem_handle_refcnt-in-drm_dest.patch \
                  file://0002-backend-drm-always-create-gem_handle_refcnt-hash-tab.patch \
+                 file://0001-backend-Add-weston_get_backend_type.patch \
 "
 
 WESTON_MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:1])}"