From bd822e1e139c4ff9cc51d4d99860938237587504 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Mon, 4 Dec 2023 18:33:16 +0200 Subject: Add support wl_output version 4 and agl_shell v8 This adds support for wl_output version 4 that allows to match an output name to a string that can be passed using gRPC APIs. With this it allows events being sent out by the compositor which the shell client can react upon. This can be seen as an intermediary step until flutter-homescreen from ICS gains (direct) support for gRPC to handle activation that way. Bug-AGL: SPEC-5004 Change-Id: I143c9dbbc044720c3dee642177d3ae175bfa9a75 Signed-off-by: Marius Vlad --- ...splay-Add-support-for-wl_output-version-4.patch | 117 +++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 meta-agl-flutter/recipes-graphics/toyota/files/0001-display-Add-support-for-wl_output-version-4.patch (limited to 'meta-agl-flutter/recipes-graphics/toyota/files/0001-display-Add-support-for-wl_output-version-4.patch') diff --git a/meta-agl-flutter/recipes-graphics/toyota/files/0001-display-Add-support-for-wl_output-version-4.patch b/meta-agl-flutter/recipes-graphics/toyota/files/0001-display-Add-support-for-wl_output-version-4.patch new file mode 100644 index 00000000..6b1b3e4c --- /dev/null +++ b/meta-agl-flutter/recipes-graphics/toyota/files/0001-display-Add-support-for-wl_output-version-4.patch @@ -0,0 +1,117 @@ +From 10d1d855a0ce4557cb710e73e3e7c9ab0dd0e734 Mon Sep 17 00:00:00 2001 +From: Marius Vlad +Date: Mon, 4 Dec 2023 14:16:36 +0200 +Subject: [PATCH 1/2] display: Add support for wl_output version 4 + +This allows support for wl_output.name and wl_output.desc be sent out +by the compositor that supports it. + +Signed-off-by: Marius Vlad +--- + shell/wayland/display.cc | 34 ++++++++++++++++++++++++++++++---- + shell/wayland/display.h | 28 ++++++++++++++++++++++++++++ + 2 files changed, 58 insertions(+), 4 deletions(-) + +diff --git a/shell/wayland/display.cc b/shell/wayland/display.cc +index 8e309ef..3ee814a 100644 +--- a/shell/wayland/display.cc ++++ b/shell/wayland/display.cc +@@ -191,9 +191,16 @@ void Display::registry_handle_global(void* data, + auto oi = std::make_shared(); + std::fill_n(oi.get(), 1, output_info_t{}); + oi->global_id = name; +- oi->output = static_cast( +- wl_registry_bind(registry, name, &wl_output_interface, +- std::min(static_cast(2), version))); ++ // be compat with v2 as well ++ if (version >= WL_OUTPUT_NAME_SINCE_VERSION && ++ version >= WL_OUTPUT_DESCRIPTION_SINCE_VERSION) ++ oi->output = static_cast( ++ wl_registry_bind(registry, name, &wl_output_interface, ++ std::min(static_cast(4), version))); ++ else ++ oi->output = static_cast( ++ wl_registry_bind(registry, name, &wl_output_interface, ++ std::min(static_cast(2), version))); + wl_output_add_listener(oi->output, &output_listener, oi.get()); + SPDLOG_DEBUG("Wayland: Output [{}]", d->m_all_outputs.size()); + d->m_all_outputs.push_back(oi); +@@ -299,9 +306,28 @@ void Display::display_handle_done(void* data, + oi->done = true; + } + ++void Display::display_handle_name(void* data, ++ struct wl_output* /* wl_output */, ++ const char* name) { ++ auto* oi = static_cast(data); ++ oi->name = std::string(name); ++} ++ ++void Display::display_handle_desc(void* data, ++ struct wl_output* /* wl_output */, ++ const char* desc) { ++ auto* oi = static_cast(data); ++ oi->desc = std::string(desc); ++} ++ + const struct wl_output_listener Display::output_listener = { + display_handle_geometry, display_handle_mode, display_handle_done, +- display_handle_scale}; ++ display_handle_scale ++#if defined(WL_OUTPUT_NAME_SINCE_VERSION) && \ ++ defined(WL_OUTPUT_DESCRIPTION_SINCE_VERSION) ++ , display_handle_name, display_handle_desc ++#endif ++}; + + void Display::shm_format(void* /* data */, + struct wl_shm* /* wl_shm */, +diff --git a/shell/wayland/display.h b/shell/wayland/display.h +index cc3f4be..a0756f0 100644 +--- a/shell/wayland/display.h ++++ b/shell/wayland/display.h +@@ -329,6 +329,8 @@ class Display { + int32_t scale; + MAYBE_UNUSED bool done; + int transform; ++ std::string name; ++ std::string desc; + } output_info_t; + + struct pointer_event { +@@ -520,6 +522,32 @@ class Display { + */ + static void display_handle_done(void* data, struct wl_output* wl_output); + ++ /** ++ * @brief Set the display output name ++ * @param[in,out] data Data of type output_info_t* ++ * @param[in] wl_output No use ++ * @param[in] output_name Display name ++ * @return void ++ * @relation ++ * wayland - since @v4 of wl_output ++ */ ++ static void display_handle_name(void* data, ++ struct wl_output* wl_output, ++ const char* output_name); ++ ++ /** ++ * @brief Set the display description ++ * @param[in,out] data Data of type output_info_t* ++ * @param[in] wl_output No use ++ * @param[in] desc_name Display description name ++ * @return void ++ * @relation ++ * wayland - since @v4 of wl_output ++ */ ++ static void display_handle_desc(void* data, ++ struct wl_output* wl_output, ++ const char* desc_name); ++ + static const struct wl_shm_listener shm_listener; + + /** +-- +2.35.1 + -- cgit 1.2.3-korg