meta-agl-core: add Upstream-Status tag to patches
[AGL/meta-agl.git] / meta-agl-core / recipes-graphics / wayland / weston / 0001-libweston-Send-name-description-update-wl_output-to-.patch
1 From 5361d157ff6b11d5cb7a9f989abe5f376c9e2efa Mon Sep 17 00:00:00 2001
2 From: Marius Vlad <marius.vlad@collabora.com>
3 Date: Wed, 24 Aug 2022 11:43:06 +0300
4 Subject: [PATCH] libweston: Send name,description, update wl_output to ver 4
5
6 These have been in wayland a while back with version 1.20.0.
7
8 We also need to update the test client helper with this bump, as
9 those bind to version 4.
10
11 Upstream-Status: Pending
12
13 Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
14 ---
15  libweston/compositor.c            | 14 +++++++++++++-
16  tests/weston-test-client-helper.c | 18 ++++++++++++++++++
17  tests/weston-test-client-helper.h |  2 ++
18  3 files changed, 33 insertions(+), 1 deletion(-)
19
20 diff --git a/libweston/compositor.c b/libweston/compositor.c
21 index 1670c50..af7c71e 100644
22 --- a/libweston/compositor.c
23 +++ b/libweston/compositor.c
24 @@ -184,6 +184,12 @@ weston_mode_switch_send_events(struct weston_head *head,
25                 if (version >= WL_OUTPUT_SCALE_SINCE_VERSION && scale_changed)
26                         wl_output_send_scale(resource, output->current_scale);
27  
28 +               if (version >= WL_OUTPUT_NAME_SINCE_VERSION)
29 +                       wl_output_send_name(resource, head->name);
30 +
31 +               if (version >= WL_OUTPUT_DESCRIPTION_SINCE_VERSION)
32 +                       wl_output_send_description(resource, head->model);
33 +
34                 if (version >= WL_OUTPUT_DONE_SINCE_VERSION)
35                         wl_output_send_done(resource);
36         }
37 @@ -5198,6 +5204,12 @@ bind_output(struct wl_client *client,
38                                     mode->refresh);
39         }
40  
41 +       if (version >= WL_OUTPUT_NAME_SINCE_VERSION)
42 +               wl_output_send_name(resource, head->name);
43 +
44 +       if (version >= WL_OUTPUT_DESCRIPTION_SINCE_VERSION)
45 +               wl_output_send_description(resource, head->model);
46 +
47         if (version >= WL_OUTPUT_DONE_SINCE_VERSION)
48                 wl_output_send_done(resource);
49  }
50 @@ -5206,7 +5218,7 @@ static void
51  weston_head_add_global(struct weston_head *head)
52  {
53         head->global = wl_global_create(head->compositor->wl_display,
54 -                                       &wl_output_interface, 3,
55 +                                       &wl_output_interface, 4,
56                                         head, bind_output);
57  }
58  
59 diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c
60 index 01c4b80..8369c40 100644
61 --- a/tests/weston-test-client-helper.c
62 +++ b/tests/weston-test-client-helper.c
63 @@ -715,6 +715,20 @@ output_handle_scale(void *data,
64         output->scale = scale;
65  }
66  
67 +static void
68 +output_handle_name(void *data, struct wl_output *wl_output, const char *name)
69 +{
70 +       struct output *output = data;
71 +       output->name = strdup(name);
72 +}
73 +
74 +static void
75 +output_handle_description(void *data, struct wl_output *wl_output, const char *desc)
76 +{
77 +       struct output *output = data;
78 +       output->name = strdup(desc);
79 +}
80 +
81  static void
82  output_handle_done(void *data,
83                    struct wl_output *wl_output)
84 @@ -729,6 +743,8 @@ static const struct wl_output_listener output_listener = {
85         output_handle_mode,
86         output_handle_done,
87         output_handle_scale,
88 +       output_handle_name,
89 +       output_handle_description,
90  };
91  
92  static void
93 @@ -737,6 +753,8 @@ output_destroy(struct output *output)
94         assert(wl_proxy_get_version((struct wl_proxy *)output->wl_output) >= 3);
95         wl_output_release(output->wl_output);
96         wl_list_remove(&output->link);
97 +       free(output->name);
98 +       free(output->desc);
99         free(output);
100  }
101  
102 diff --git a/tests/weston-test-client-helper.h b/tests/weston-test-client-helper.h
103 index 8e1505d..9e05009 100644
104 --- a/tests/weston-test-client-helper.h
105 +++ b/tests/weston-test-client-helper.h
106 @@ -163,6 +163,8 @@ struct output {
107         int height;
108         int scale;
109         int initialized;
110 +       char *name;
111 +       char *desc;
112  };
113  
114  struct buffer {
115 -- 
116 2.35.1
117