From d26651f556470efecbb52d95c65690bd7fb50f25 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Thu, 31 Oct 2024 10:45:46 +0200 Subject: 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 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 --- ...kend-wayland_egl-Add-a-fallback-eglConfig.patch | 88 ++++++++++++++++++++++ .../toyota/flutter-auto_aglflutter.inc | 2 + 2 files changed, 90 insertions(+) create mode 100644 meta-agl-flutter/recipes-graphics/toyota/files/0001-backend-wayland_egl-Add-a-fallback-eglConfig.patch (limited to 'meta-agl-flutter') 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 +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 +--- + 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 kEglConfigAttribs = {{ + // clang-format on + }}; + ++ ++static constexpr std::array 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 + diff --git a/meta-agl-flutter/recipes-graphics/toyota/flutter-auto_aglflutter.inc b/meta-agl-flutter/recipes-graphics/toyota/flutter-auto_aglflutter.inc index 54b834922..6c1503024 100644 --- a/meta-agl-flutter/recipes-graphics/toyota/flutter-auto_aglflutter.inc +++ b/meta-agl-flutter/recipes-graphics/toyota/flutter-auto_aglflutter.inc @@ -1,6 +1,8 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/files:" +EGLCONFIG_FALLBACK = "${@bb.utils.contains_any('AGL_FEATURES', 'agl-rdp agl-kvm-guest', '', 'file://0001-backend-wayland_egl-Add-a-fallback-eglConfig.patch', d)}" SRC_URI:append:use-nxp-bsp = " file://0001-Disable-on_frame_base_surface-wl_surface_commit.patch" +SRC_URI:append = " ${EGLCONFIG_FALLBACK}" # Disable WIP webview plugin on 32-bit ARM platforms for now, as build # failures have been seen on qemuarm and beaglebone. -- cgit 1.2.3-korg