diff options
Diffstat (limited to 'meta-agl-flutter/recipes-graphics/toyota/files')
4 files changed, 315 insertions, 0 deletions
diff --git a/meta-agl-flutter/recipes-graphics/toyota/files/0001-Allow-the-embedder-to-run-as-a-regular-normal-applic.patch b/meta-agl-flutter/recipes-graphics/toyota/files/0001-Allow-the-embedder-to-run-as-a-regular-normal-applic.patch new file mode 100644 index 00000000..5b63e20e --- /dev/null +++ b/meta-agl-flutter/recipes-graphics/toyota/files/0001-Allow-the-embedder-to-run-as-a-regular-normal-applic.patch @@ -0,0 +1,181 @@ +From 7f3f913ec5bea1d94c04f8a029db659c33e56dbf Mon Sep 17 00:00:00 2001 +From: Marius Vlad <mv0@users.noreply.github.com> +Date: Sun, 24 Jul 2022 21:15:54 +0300 +Subject: [PATCH 1/3] Allow the embedder to run as a regular/normal application + (#71) + +* shell: Do not issue always the ready request + +Rather than sending the ready request always, just do it when we've +found at least a background type of surface. + +This way we can have a flutter instance as a regular application but +also as a shell client. + +This is a work-around for the time being, a much more suitable approach +would be to have a mechanism that tells us when the client has finished +loading or has it's first frame swapped (or something similar to that). + +Note that we need at least a background surface so not finding one +assumes that we're a regular application (WINDOW_NORMAL). + +Signed-off-by: Marius Vlad <marius.vlad@collabora.com> + +* shell: Do not attempt always bind to agl-shell interface + +This helps up running as a regular application in +situations where we already have a client bound to the agl-shell +interface. + +We can't really accept more than one client to bind to the interface and +without a change in the protocol to avoid racy situations, it seems more +natural for the embedder to infer if it actually needs to do that. + +When the protocol has been updated to include additional events to let +clients that they've lost the race, we can remove this change. + +Signed-off-by: Marius Vlad <marius.vlad@collabora.com> + +Co-authored-by: Marius Vlad <marius.vlad@collabora.com> +--- + shell/app.cc | 13 +++++++++++-- + shell/wayland/display.cc | 18 +++++++++++++++--- + shell/wayland/display.h | 8 +++++++- + shell/wayland/window.h | 2 +- + 4 files changed, 34 insertions(+), 7 deletions(-) + +diff --git a/shell/app.cc b/shell/app.cc +index 03c33ff..3ca183b 100644 +--- a/shell/app.cc ++++ b/shell/app.cc +@@ -25,8 +25,10 @@ + + App::App(const std::vector<Configuration::Config>& configs) + : m_wayland_display(std::make_shared<Display>(!configs[0].disable_cursor, +- configs[0].cursor_theme)) { ++ configs[0].cursor_theme, ++ configs)) { + FML_DLOG(INFO) << "+App::App"; ++ bool found_view_with_bg = false; + + size_t index = 0; + m_views.reserve(configs.size()); +@@ -35,9 +37,16 @@ App::App(const std::vector<Configuration::Config>& configs) + view->Initialize(); + m_views.emplace_back(std::move(view)); + index++; ++ ++ if (WaylandWindow::get_window_type(cfg.view.window_type) == ++ WaylandWindow::WINDOW_BG) ++ found_view_with_bg = true; + } + +- m_wayland_display->AglShellDoReady(); ++ // check that if we had a BG type and issue a ready() request for it, ++ // otherwise we're going to assume that this is a NORMAL/REGULAR application. ++ if (found_view_with_bg) ++ m_wayland_display->AglShellDoReady(); + + FML_DLOG(INFO) << "-App::App"; + } +diff --git a/shell/wayland/display.cc b/shell/wayland/display.cc +index 06eba8c..5d78471 100644 +--- a/shell/wayland/display.cc ++++ b/shell/wayland/display.cc +@@ -27,7 +27,9 @@ + #include "constants.h" + #include "engine.h" + +-Display::Display(bool enable_cursor, std::string cursor_theme_name) ++Display::Display(bool enable_cursor, ++ std::string cursor_theme_name, ++ const std::vector<Configuration::Config>& configs) + : m_xkb_context(xkb_context_new(XKB_CONTEXT_NO_FLAGS)), + m_buffer_scale(1), + m_last_buffer_scale(m_buffer_scale), +@@ -35,6 +37,15 @@ Display::Display(bool enable_cursor, std::string cursor_theme_name) + m_cursor_theme_name(std::move(cursor_theme_name)) { + FML_DLOG(INFO) << "+ Display()"; + ++ for (auto const& cfg : configs) { ++ // check if we actually need to bind to agl-shell ++ auto window_type = WaylandWindow::get_window_type(cfg.view.window_type); ++ if (window_type != WaylandWindow::WINDOW_NORMAL) { ++ m_bind_to_agl_shell = true; ++ break; ++ } ++ } ++ + m_display = wl_display_connect(nullptr); + if (m_display == nullptr) { + FML_LOG(ERROR) << "Failed to connect to Wayland display. " +@@ -46,7 +57,7 @@ Display::Display(bool enable_cursor, std::string cursor_theme_name) + wl_registry_add_listener(m_registry, ®istry_listener, this); + wl_display_dispatch(m_display); + +- if (!m_agl_shell) { ++ if (!m_agl_shell && m_bind_to_agl_shell) { + FML_LOG(INFO) << "agl_shell extension not present"; + } + +@@ -152,7 +163,8 @@ void Display::registry_handle_global(void* data, + wl_registry_bind(registry, name, &wl_seat_interface, + std::min(static_cast<uint32_t>(5), version))); + wl_seat_add_listener(d->m_seat, &seat_listener, d); +- } else if (strcmp(interface, agl_shell_interface.name) == 0) { ++ } else if (strcmp(interface, agl_shell_interface.name) == 0 && ++ d->m_bind_to_agl_shell) { + d->m_agl_shell = static_cast<struct agl_shell*>( + wl_registry_bind(registry, name, &agl_shell_interface, + std::min(static_cast<uint32_t>(1), version))); +diff --git a/shell/wayland/display.h b/shell/wayland/display.h +index af3d460..bf05b27 100644 +--- a/shell/wayland/display.h ++++ b/shell/wayland/display.h +@@ -32,11 +32,15 @@ + #include "static_plugins/text_input/text_input.h" + #include "xdg-shell-client-protocol.h" + ++#include "configuration/configuration.h" ++ + class Engine; + + class Display { + public: +- explicit Display(bool enable_cursor, std::string cursor_theme_name); ++ explicit Display(bool enable_cursor, ++ std::string cursor_theme_name, ++ const std::vector<Configuration::Config>& configs); + + ~Display(); + +@@ -96,6 +100,8 @@ class Display { + struct wl_shm* m_shm{}; + struct wl_surface* m_base_surface{}; + ++ bool m_bind_to_agl_shell = false; ++ + std::map<wl_surface*, Engine*> m_surface_engine_map; + wl_surface* m_active_surface{}; + Engine* m_active_engine{}; +diff --git a/shell/wayland/window.h b/shell/wayland/window.h +index c4fe5e6..4b5c726 100644 +--- a/shell/wayland/window.h ++++ b/shell/wayland/window.h +@@ -79,6 +79,7 @@ class WaylandWindow { + wl_surface* GetBaseSurface() { return m_base_surface; } + + uint32_t m_fps_counter; ++ static window_type get_window_type(const std::string& type); + + private: + struct shm_buffer { +@@ -157,5 +158,4 @@ class WaylandWindow { + + static const struct wl_callback_listener frame_listener; + +- static window_type get_window_type(const std::string& type); + }; +-- +2.35.3 + diff --git a/meta-agl-flutter/recipes-graphics/toyota/files/0002-shell-configuration-Obey-json-configuration-file.patch b/meta-agl-flutter/recipes-graphics/toyota/files/0002-shell-configuration-Obey-json-configuration-file.patch new file mode 100644 index 00000000..b9a864c5 --- /dev/null +++ b/meta-agl-flutter/recipes-graphics/toyota/files/0002-shell-configuration-Obey-json-configuration-file.patch @@ -0,0 +1,44 @@ +From 36c7deb35719d2219dc6e868ab14d9a4ce984d1f Mon Sep 17 00:00:00 2001 +From: Marius Vlad <marius.vlad@collabora.com> +Date: Mon, 25 Jul 2022 15:51:06 +0300 +Subject: [PATCH 2/3] shell/configuration: Obey json configuration file + +Setting the name of the application to kApplicationName, by default, +would cause the check in getCliOverrides to always be true, which in +turn will ignore whatever the user specified in the configuration file. + +Signed-off-by: Marius Vlad <marius.vlad@collabora.com> +--- + shell/configuration/configuration.cc | 2 ++ + shell/main.cc | 2 +- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/shell/configuration/configuration.cc b/shell/configuration/configuration.cc +index f8b1e13..616de48 100644 +--- a/shell/configuration/configuration.cc ++++ b/shell/configuration/configuration.cc +@@ -220,6 +220,8 @@ std::vector<struct Configuration::Config> Configuration::ParseConfig( + if (cfg.view.height == 0) { + cfg.view.height = kDefaultViewHeight; + } ++ if (cfg.app_id.empty()) ++ cfg.app_id = kApplicationName; + + res.emplace_back(cfg); + } +diff --git a/shell/main.cc b/shell/main.cc +index 65c3f37..6fdd907 100644 +--- a/shell/main.cc ++++ b/shell/main.cc +@@ -44,7 +44,7 @@ void RemoveArgument(std::vector<std::string>& args, const std::string& arg) { + + int main(int argc, char** argv) { + struct Configuration::Config config { +- .app_id = kApplicationName, .json_configuration_path{}, .cursor_theme{}, ++ .app_id = {}, .json_configuration_path{}, .cursor_theme{}, + .disable_cursor{}, .debug_backend{}, .view {} + }; + +-- +2.35.3 + diff --git a/meta-agl-flutter/recipes-graphics/toyota/files/0003-shell-configuration-Fixes-to-general-options.patch b/meta-agl-flutter/recipes-graphics/toyota/files/0003-shell-configuration-Fixes-to-general-options.patch new file mode 100644 index 00000000..f06d4548 --- /dev/null +++ b/meta-agl-flutter/recipes-graphics/toyota/files/0003-shell-configuration-Fixes-to-general-options.patch @@ -0,0 +1,52 @@ +From a3a1421c3986bbafd9f91997eec7f2606ef67fc3 Mon Sep 17 00:00:00 2001 +From: Marius Vlad <marius.vlad@collabora.com> +Date: Mon, 25 Jul 2022 15:53:17 +0300 +Subject: [PATCH 3/3] shell/configuration: Fixes to general options + +This patch avoids an automatic overwrite of the debug_backend and +disable_cursor entries. If enabled in the configuration file, the test +will always return true, basically overwriting to false. + +Also, use the correct entry in the README file for debug_backend. + +Signed-off-by: Marius Vlad <marius.vlad@collabora.com> +--- + README.md | 2 +- + shell/configuration/configuration.cc | 6 ++++-- + 2 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/README.md b/README.md +index 7c162eb..d459f4c 100644 +--- a/README.md ++++ b/README.md +@@ -175,7 +175,7 @@ Loads Single View + + { + "disable_cursor":true, +- "backend_debug":true, ++ "debug_backend":true, + "accessibility_features":31, + "view":{ + "bundle_path":"/home/joel/development/gallery/.homescreen/x86/release", +diff --git a/shell/configuration/configuration.cc b/shell/configuration/configuration.cc +index 616de48..773724c 100644 +--- a/shell/configuration/configuration.cc ++++ b/shell/configuration/configuration.cc +@@ -152,10 +152,12 @@ void Configuration::getCliOverrides(Config& instance, Config& cli) { + if (!cli.cursor_theme.empty()) { + instance.cursor_theme = cli.cursor_theme; + } +- if (cli.disable_cursor != instance.disable_cursor) { ++ if (cli.disable_cursor == true && ++ cli.disable_cursor != instance.disable_cursor) { + instance.disable_cursor = cli.disable_cursor; + } +- if (cli.debug_backend != instance.debug_backend) { ++ if (cli.debug_backend == true && ++ cli.debug_backend != instance.debug_backend) { + instance.debug_backend = cli.debug_backend; + } + if (!cli.view.vm_args.empty()) { +-- +2.35.3 + diff --git a/meta-agl-flutter/recipes-graphics/toyota/files/0004-Add-app-id-command-line-argument.patch b/meta-agl-flutter/recipes-graphics/toyota/files/0004-Add-app-id-command-line-argument.patch new file mode 100644 index 00000000..6b9d4c3a --- /dev/null +++ b/meta-agl-flutter/recipes-graphics/toyota/files/0004-Add-app-id-command-line-argument.patch @@ -0,0 +1,38 @@ +From 6a62efbebcdf17e3af57f04603aa5f0d61b0c1e2 Mon Sep 17 00:00:00 2001 +From: Scott Murray <scott.murray@konsulko.com> +Date: Wed, 27 Jul 2022 18:23:32 -0400 +Subject: [PATCH] Add app-id command-line argument + +Add a command-line argument for specifying the app id, so that basic +applications do not need to supply a full JSON configuration just to +do so. + +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +--- + shell/main.cc | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/shell/main.cc b/shell/main.cc +index 6fdd907..662b7d1 100644 +--- a/shell/main.cc ++++ b/shell/main.cc +@@ -151,6 +151,16 @@ int main(int argc, char** argv) { + FML_DLOG(INFO) << "Cursor Theme: " << config.cursor_theme; + RemoveArgument(config.view.vm_args, "--t=" + config.cursor_theme); + } ++ if (cl.HasOption("app-id")) { ++ cl.GetOptionValue("app-id", &config.app_id); ++ if (config.app_id.empty()) { ++ FML_LOG(ERROR) ++ << "--app-id option requires an argument (e.g. --app-id=gallery)"; ++ return EXIT_FAILURE; ++ } ++ FML_DLOG(INFO) << "Application ID: " << config.app_id; ++ RemoveArgument(config.view.vm_args, "--app-id=" + config.app_id); ++ } + } + + auto vm_arg_count = config.view.vm_args.size(); +-- +2.35.3 + |