summaryrefslogtreecommitdiffstats
path: root/meta-agl-flutter/recipes-graphics/toyota/files/0001-backend-wayland_egl-Add-a-fallback-eglConfig.patch
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2024-10-31 10:45:46 +0200
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2024-11-04 09:45:22 +0000
commitd26651f556470efecbb52d95c65690bd7fb50f25 (patch)
treea299b493673252fd1e309840faf72537a53e5e41 /meta-agl-flutter/recipes-graphics/toyota/files/0001-backend-wayland_egl-Add-a-fallback-eglConfig.patch
parentc4edb8b167b07b26b92517c58544bb6cbb817644 (diff)
backend/wayland_egl: Add a fallback eglConfig
On agl-kvm-guest and agl-rdp, flutter-auto with its eglConfig will have a black image as opposed to regular one. This is a work-around by using a fallback eglConfig until flutter-auto gains some sort of heuristic choosing between the eglConfig available and pick one that can work. Bug-AGL: SPEC-5260 Change-Id: I1f9f95d2bba1d218b9b1fb12ff11df3209dc2e03 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/30477 ci-image-build: Jenkins Job builder account Tested-by: Jenkins Job builder account ci-image-boot-test: Jenkins Job builder account Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Diffstat (limited to 'meta-agl-flutter/recipes-graphics/toyota/files/0001-backend-wayland_egl-Add-a-fallback-eglConfig.patch')
-rw-r--r--meta-agl-flutter/recipes-graphics/toyota/files/0001-backend-wayland_egl-Add-a-fallback-eglConfig.patch88
1 files changed, 88 insertions, 0 deletions
diff --git a/meta-agl-flutter/recipes-graphics/toyota/files/0001-backend-wayland_egl-Add-a-fallback-eglConfig.patch b/meta-agl-flutter/recipes-graphics/toyota/files/0001-backend-wayland_egl-Add-a-fallback-eglConfig.patch
new file mode 100644
index 000000000..f2195dddc
--- /dev/null
+++ b/meta-agl-flutter/recipes-graphics/toyota/files/0001-backend-wayland_egl-Add-a-fallback-eglConfig.patch
@@ -0,0 +1,88 @@
+From 372b9c4edd42b67827b75863b978091ba5cff5cd Mon Sep 17 00:00:00 2001
+From: Marius Vlad <marius.vlad@collabora.com>
+Date: Thu, 17 Oct 2024 17:25:41 +0300
+Subject: [PATCH 1/2] backend/wayland_egl: Add a fallback eglConfig
+
+This seems to aid flutter-auto at displaying an image on agl-rdp
+with software rendering, and on agl-kvm with virgl. Makes uses of a fallback
+eGLConfig (< 24 bit) and tries to use that one rather than the default one (24-bit).
+
+Bug-AGL: SPEC-5260
+Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
+---
+ cmake/config_common.h.in | 17 ++++++++++++++++-
+ shell/backend/wayland_egl/egl.cc | 23 ++++++++++++++++++++---
+ 2 files changed, 36 insertions(+), 4 deletions(-)
+
+diff --git a/cmake/config_common.h.in b/cmake/config_common.h.in
+index 07ce9b7..2c54c67 100644
+--- a/cmake/config_common.h.in
++++ b/cmake/config_common.h.in
+@@ -155,6 +155,21 @@ static constexpr std::array<EGLint, 27> kEglConfigAttribs = {{
+ // clang-format on
+ }};
+
++
++static constexpr std::array<EGLint, 27> kEglConfigAttribsFallBack = {{
++ // clang-format off
++ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
++ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
++
++ EGL_RED_SIZE, 1,
++ EGL_GREEN_SIZE, 1,
++ EGL_BLUE_SIZE, 1,
++ EGL_ALPHA_SIZE, 2,
++ EGL_NONE // termination sentinel
++ // clang-format on
++}};
++
++
+ // All vkCreate* functions take an optional allocator. For now, we select the
+ // default allocator by passing in a null pointer, and we highlight the argument
+ // by using the VKALLOC constant.
+@@ -181,4 +196,4 @@ constexpr struct VkAllocationCallbacks* VKALLOC = nullptr;
+ #cmakedefine01 ENV32BIT
+ #cmakedefine01 ENV64BIT
+
+-#endif //CONFIG_COMMON_H_
+\ No newline at end of file
++#endif //CONFIG_COMMON_H_
+diff --git a/shell/backend/wayland_egl/egl.cc b/shell/backend/wayland_egl/egl.cc
+index 99555d6..70164ba 100644
+--- a/shell/backend/wayland_egl/egl.cc
++++ b/shell/backend/wayland_egl/egl.cc
+@@ -62,11 +62,28 @@ Egl::Egl(void* native_display, int buffer_size, bool debug)
+ break;
+ }
+ }
+- free(configs);
+ if (m_config == nullptr) {
+- spdlog::critical("did not find config with buffer size {}", m_buffer_size);
+- assert(false);
++ // try with the fallback one
++ spdlog::critical("Could not use default EGLConfig trying with fallback.");
++ ret = eglChooseConfig(m_dpy, kEglConfigAttribsFallBack.data(), configs,
++ count, &n);
++ assert(ret && n >= 1);
++
++ for (EGLint i = 0; i < n; i++) {
++ eglGetConfigAttrib(m_dpy, configs[i], EGL_BUFFER_SIZE, &size);
++ SPDLOG_DEBUG("Buffer size for config {} is {}", i, size);
++ if (m_buffer_size <= size) {
++ memcpy(&m_config, &configs[i], sizeof(EGLConfig));
++ break;
++ }
++ }
++ if (m_config == nullptr) {
++ spdlog::critical("did not find config with buffer size {}",
++ m_buffer_size);
++ assert(false);
++ }
+ }
++ free(configs);
+
+ m_context = eglCreateContext(m_dpy, m_config, EGL_NO_CONTEXT,
+ kEglContextAttribs.data());
+--
+2.43.0
+