meta-raspberrypi/recipes-graphics/userland/files/0016-Allow-multiple-wayland-compositor-state-data-per-pro.patch
Martin Jansa 195c7d59bc *.patch: add Upstream-Status to all patches
There is new patch-status QA check in oe-core:
https://git.openembedded.org/openembedded-core/commit/?id=76a685bfcf927593eac67157762a53259089ea8a

This is temporary work around just to hide _many_ warnings from
optional patch-status (if you add it to WARN_QA).

This just added
Upstream-Status: Pending
everywhere without actually investigating what's the proper status.

This is just to hide current QA warnings and to catch new .patch files being
added without Upstream-Status, but the number of Pending patches is now terrible:
Patches in Pending state: 41 (57%)

With recent change to enable patch-status not only for all .patch
files in oe-core, but for all recipes from oe-core:
https://git.openembedded.org/openembedded-core/commit/?id=61a881fdbe8b5a21c6276b8a5d06cc30486b1eb3
this causes bluez5 do_patch failures as reported in:
https://lists.openembedded.org/g/openembedded-core/message/183177

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
2023-06-22 00:04:40 +01:00

144 lines
4.5 KiB
Diff

From c5969e5e5c50e2c9b32c6f945040a8e5763ba06c Mon Sep 17 00:00:00 2001
From: Jeff Wannamaker <jeff_wannamaker@cable.comcast.com>
Date: Sat, 27 Jan 2018 12:28:31 -0500
Subject: [PATCH] Allow multiple wayland compositor state data per process
When eglBindWaylandDisplayWL is called store the wl_global
created in a list associated with the wayland display.
This allows multiple wayland compositor instances to be
created and used per process. This scenario is common for
applications integrating externl process UI elements
via embedded composition e.g. westeros
Signed-off-by: Jeff Wannamaker <jeff_wannamaker@cable.comcast.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Pending
interface/khronos/common/khrn_client.c | 2 +-
interface/khronos/common/khrn_client.h | 11 +++++-
interface/khronos/ext/egl_wayland.c | 50 ++++++++++++++++++++++----
3 files changed, 55 insertions(+), 8 deletions(-)
diff --git a/interface/khronos/common/khrn_client.c b/interface/khronos/common/khrn_client.c
index d7e798e..60bdb63 100644
--- a/interface/khronos/common/khrn_client.c
+++ b/interface/khronos/common/khrn_client.c
@@ -147,7 +147,7 @@ bool client_process_state_init(CLIENT_PROCESS_STATE_T *process)
{
if (!process->inited) {
#ifdef BUILD_WAYLAND
- process->wl_global = NULL;
+ process->wlStateMap = NULL;
#endif
if (!khrn_pointer_map_init(&process->contexts, 64))
diff --git a/interface/khronos/common/khrn_client.h b/interface/khronos/common/khrn_client.h
index 615f7b4..4fa86f7 100644
--- a/interface/khronos/common/khrn_client.h
+++ b/interface/khronos/common/khrn_client.h
@@ -170,6 +170,15 @@ static INLINE CLIENT_THREAD_STATE_T *CLIENT_GET_CHECK_THREAD_STATE(void)
return (CLIENT_THREAD_STATE_T *)platform_tls_get_check(client_tls);
}
+#ifdef BUILD_WAYLAND
+typedef struct WAYLAND_STATE
+{
+ struct WAYLAND_STATE *next;
+ struct wl_display *display;
+ struct wl_global *wl_global;
+} WAYLAND_STATE_T;
+#endif
+
/*
per-process state
@@ -318,7 +327,7 @@ struct CLIENT_PROCESS_STATE {
struct wl_event_queue *wl_queue;
/* Compositor-side Wayland state */
- struct wl_global *wl_global;
+ WAYLAND_STATE_T *wlStateMap;
#endif
};
diff --git a/interface/khronos/ext/egl_wayland.c b/interface/khronos/ext/egl_wayland.c
index 9ef89cd..abd5ab3 100644
--- a/interface/khronos/ext/egl_wayland.c
+++ b/interface/khronos/ext/egl_wayland.c
@@ -208,17 +208,38 @@ eglBindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display)
{
CLIENT_THREAD_STATE_T *thread;
CLIENT_PROCESS_STATE_T *process;
+ WAYLAND_STATE_T *stateIter;
+ WAYLAND_STATE_T *stateNew;
+ struct wl_global *wl_global;
if (!CLIENT_LOCK_AND_GET_STATES(dpy, &thread, &process))
return EGL_FALSE;
- if (process->wl_global != NULL)
+ stateIter= process->wlStateMap;
+ while( stateIter )
+ {
+ if ( stateIter->display == display )
+ goto error;
+ stateIter= stateIter->next;
+ }
+
+ wl_global = wl_global_create(display, &wl_dispmanx_interface, 1,
+ NULL, bind_dispmanx);
+ if (wl_global == NULL)
goto error;
- process->wl_global = wl_global_create(display, &wl_dispmanx_interface, 1,
- NULL, bind_dispmanx);
- if (process->wl_global == NULL)
+ stateNew= (WAYLAND_STATE_T*)calloc( 1, sizeof(WAYLAND_STATE_T));
+ if (stateNew == NULL )
+ {
+ wl_global_destroy(wl_global);
goto error;
+ }
+
+ stateNew->next= process->wlStateMap;
+ stateNew->display= display;
+ stateNew->wl_global= wl_global;
+ process->wlStateMap= stateNew;
+ CLIENT_UNLOCK();
return EGL_TRUE;
@@ -232,12 +253,29 @@ eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display)
{
CLIENT_THREAD_STATE_T *thread;
CLIENT_PROCESS_STATE_T *process;
+ WAYLAND_STATE_T *stateIter;
+ WAYLAND_STATE_T *statePrev;
if (!CLIENT_LOCK_AND_GET_STATES(dpy, &thread, &process))
return EGL_FALSE;
- wl_global_destroy(process->wl_global);
- process->wl_global = NULL;
+ statePrev= NULL;
+ stateIter= process->wlStateMap;
+ while( stateIter )
+ {
+ if ( stateIter->display == display )
+ {
+ wl_global_destroy(stateIter->wl_global);
+ if ( statePrev )
+ statePrev->next= stateIter->next;
+ else
+ process->wlStateMap= stateIter->next;
+ free( stateIter );
+ break;
+ }
+ statePrev= stateIter;
+ stateIter= stateIter->next;
+ }
CLIENT_UNLOCK();