From 3dac145f4645e18ad551d6c44c0bcc46b5c9205d Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Fri, 5 May 2023 11:38:40 +0300 Subject: [PATCH] weston_10.0_aglcore: Add helper iterator to loop over debug scopes This is helpful for users to list the available scopes, that other compoments of libweston subscribed to. Bug-AGL: SPEC-4593 Change-Id: Idec02efe997104f6af8164281eee0f2e46f996bf Signed-off-by: Marius Vlad Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/28804 Reviewed-by: Jan-Simon Moeller Tested-by: Jan-Simon Moeller --- ...eston-log-Add-an-iterator-for-going-over-.patch | 89 ++++++++++++++++++++++ .../wayland/weston_10.0_aglcore.inc | 3 +- 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-weston-log-Add-an-iterator-for-going-over-.patch diff --git a/meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-weston-log-Add-an-iterator-for-going-over-.patch b/meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-weston-log-Add-an-iterator-for-going-over-.patch new file mode 100644 index 000000000..2263a2f60 --- /dev/null +++ b/meta-agl-core/recipes-graphics/wayland/weston/0001-libweston-weston-log-Add-an-iterator-for-going-over-.patch @@ -0,0 +1,89 @@ +From 82b05408e5ed8a8651a99b2dcc61a24c108d48f1 Mon Sep 17 00:00:00 2001 +From: Marius Vlad +Date: Fri, 5 May 2023 11:33:40 +0300 +Subject: [PATCH] libweston/weston-log: Add an iterator for going over scope + list + +libweston users, with the weston-debug protocol doesn't have a way +to list the debug scopes. This adds an iterator function to browse +over the opaque weston_log_scope. + +This also adds two helper functions to get the scope name and its +description. + +Signed-off-by: Marius Vlad +--- + include/libweston/weston-log.h | 9 +++++++++ + libweston/weston-log.c | 36 ++++++++++++++++++++++++++++++++++ + 2 files changed, 45 insertions(+) + +diff --git a/include/libweston/weston-log.h b/include/libweston/weston-log.h +index aeb7768bf..846cdb089 100644 +--- a/include/libweston/weston-log.h ++++ b/include/libweston/weston-log.h +@@ -131,9 +131,18 @@ struct weston_log_subscription * + weston_log_subscription_iterate(struct weston_log_scope *scope, + struct weston_log_subscription *sub_iter); + ++struct weston_log_scope * ++weston_log_scopes_iterate(struct weston_compositor *compositor, ++ struct weston_log_scope *nscope); + void + weston_log_flight_recorder_display_buffer(FILE *file); + ++const char * ++weston_log_scope_get_description(struct weston_log_scope *scope); ++ ++const char * ++weston_log_scope_get_name(struct weston_log_scope *scope); ++ + #ifdef __cplusplus + } + #endif +diff --git a/libweston/weston-log.c b/libweston/weston-log.c +index 276fde267..957c30c56 100644 +--- a/libweston/weston-log.c ++++ b/libweston/weston-log.c +@@ -1009,3 +1009,39 @@ weston_log_subscription_iterate(struct weston_log_scope *scope, + + return container_of(node, struct weston_log_subscription, source_link); + } ++ ++WL_EXPORT struct weston_log_scope * ++weston_log_scopes_iterate(struct weston_compositor *compositor, ++ struct weston_log_scope *nscope) ++{ ++ struct weston_log_context *log_ctx = compositor->weston_log_ctx; ++ struct wl_list *list; ++ struct wl_list *node; ++ ++ assert(log_ctx); ++ ++ list = &log_ctx->scope_list; ++ ++ if (nscope) { ++ node = nscope->compositor_link.next; ++ } else { ++ node = list->next; ++ } ++ ++ if (node == list) ++ return NULL; ++ ++ return container_of(node, struct weston_log_scope, compositor_link); ++} ++ ++WL_EXPORT const char * ++weston_log_scope_get_name(struct weston_log_scope *scope) ++{ ++ return scope->name; ++} ++ ++WL_EXPORT const char * ++weston_log_scope_get_description(struct weston_log_scope *scope) ++{ ++ return scope->desc; ++} +-- +2.39.2 + diff --git a/meta-agl-core/recipes-graphics/wayland/weston_10.0_aglcore.inc b/meta-agl-core/recipes-graphics/wayland/weston_10.0_aglcore.inc index a77600776..546f5ec6f 100644 --- a/meta-agl-core/recipes-graphics/wayland/weston_10.0_aglcore.inc +++ b/meta-agl-core/recipes-graphics/wayland/weston_10.0_aglcore.inc @@ -8,7 +8,8 @@ PACKAGECONFIG:append = "${@bb.utils.contains('AGL_FEATURES', 'waltham-remoting', SRC_URI:append = "file://0001-libweston-Send-name-description-update-wl_output-to-.patch \ file://0001-libweston-desktop-xdg-shell-Add-tiled-orientation-st.patch \ - file://0001-simple-touch-Add-maximized-fullscreen-states.patch" + file://0001-simple-touch-Add-maximized-fullscreen-states.patch \ + file://0001-libweston-weston-log-Add-an-iterator-for-going-over-.patch" # seat management is only for waltham-transmitter-plugin SRC_URI:append = "${@bb.utils.contains('AGL_FEATURES', 'waltham-remoting', ' file://0001-libweston-Migrate-weston_seat_init-release-to-public.patch', '', d)}" -- 2.16.6