meta-agl-core: add Upstream-Status tag to patches
[AGL/meta-agl.git] / meta-agl-core / recipes-graphics / wayland / weston / 0001-libweston-weston-log-Add-an-iterator-for-going-over-.patch
1 From 82b05408e5ed8a8651a99b2dcc61a24c108d48f1 Mon Sep 17 00:00:00 2001
2 From: Marius Vlad <marius.vlad@collabora.com>
3 Date: Fri, 5 May 2023 11:33:40 +0300
4 Subject: [PATCH] libweston/weston-log: Add an iterator for going over scope
5  list
6
7 libweston users, with the weston-debug protocol doesn't have a way
8 to list the debug scopes. This adds an iterator function to browse
9 over the opaque weston_log_scope.
10
11 This also adds two helper functions to get the scope name and its
12 description.
13
14 Upstream-Status: Pending
15
16 Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
17 ---
18  include/libweston/weston-log.h |  9 +++++++++
19  libweston/weston-log.c         | 36 ++++++++++++++++++++++++++++++++++
20  2 files changed, 45 insertions(+)
21
22 diff --git a/include/libweston/weston-log.h b/include/libweston/weston-log.h
23 index aeb7768bf..846cdb089 100644
24 --- a/include/libweston/weston-log.h
25 +++ b/include/libweston/weston-log.h
26 @@ -131,9 +131,18 @@ struct weston_log_subscription *
27  weston_log_subscription_iterate(struct weston_log_scope *scope,
28                                 struct weston_log_subscription *sub_iter);
29  
30 +struct weston_log_scope *
31 +weston_log_scopes_iterate(struct weston_compositor *compositor,
32 +                         struct weston_log_scope *nscope);
33  void
34  weston_log_flight_recorder_display_buffer(FILE *file);
35  
36 +const char *
37 +weston_log_scope_get_description(struct weston_log_scope *scope);
38 +
39 +const char *
40 +weston_log_scope_get_name(struct weston_log_scope *scope);
41 +
42  #ifdef  __cplusplus
43  }
44  #endif
45 diff --git a/libweston/weston-log.c b/libweston/weston-log.c
46 index 276fde267..957c30c56 100644
47 --- a/libweston/weston-log.c
48 +++ b/libweston/weston-log.c
49 @@ -1009,3 +1009,39 @@ weston_log_subscription_iterate(struct weston_log_scope *scope,
50  
51         return container_of(node, struct weston_log_subscription, source_link);
52  }
53 +
54 +WL_EXPORT struct weston_log_scope *
55 +weston_log_scopes_iterate(struct weston_compositor *compositor,
56 +                         struct weston_log_scope *nscope)
57 +{
58 +       struct weston_log_context *log_ctx = compositor->weston_log_ctx;
59 +       struct wl_list *list;
60 +       struct wl_list *node;
61 +
62 +       assert(log_ctx);
63 +
64 +       list = &log_ctx->scope_list;
65 +
66 +       if (nscope) {
67 +               node = nscope->compositor_link.next;
68 +       } else {
69 +               node = list->next;
70 +       }
71 +
72 +       if (node == list)
73 +               return NULL;
74 +
75 +       return container_of(node, struct weston_log_scope, compositor_link);
76 +}
77 +
78 +WL_EXPORT const char *
79 +weston_log_scope_get_name(struct weston_log_scope *scope)
80 +{
81 +       return scope->name;
82 +}
83 +
84 +WL_EXPORT const char *
85 +weston_log_scope_get_description(struct weston_log_scope *scope)
86 +{
87 +       return scope->desc;
88 +}
89 -- 
90 2.39.2
91