From 5c4edc244f4fb5c78ff6438cbf334a7bf08160fe Mon Sep 17 00:00:00 2001 From: richardexfo <94012149+richardexfo@users.noreply.github.com> Date: Mon, 2 Jun 2025 20:20:08 -0400 Subject: [PATCH] Fix Linux OpenGL compositor on ARM driver (#166753) Fix Linux OpenGL compositor on ARM driver. Add "ARM" to the list of drivers unsupported by the gl_framebuffer_blit based rendering. https://github.com/flutter/flutter/issues/152099 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --------- Co-authored-by: Robert Ancell --- .../platform/linux/fl_compositor_opengl.cc | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/engine/src/flutter/shell/platform/linux/fl_compositor_opengl.cc b/engine/src/flutter/shell/platform/linux/fl_compositor_opengl.cc index aab93f71997..d27dda8e635 100644 --- a/engine/src/flutter/shell/platform/linux/fl_compositor_opengl.cc +++ b/engine/src/flutter/shell/platform/linux/fl_compositor_opengl.cc @@ -87,16 +87,26 @@ G_DEFINE_TYPE(FlCompositorOpenGL, fl_compositor_opengl, fl_compositor_get_type()) -// Check if running on an NVIDIA driver. -static gboolean is_nvidia() { +// Check if running on driver supporting blit. +static gboolean driver_supports_blit() { const gchar* vendor = reinterpret_cast(glGetString(GL_VENDOR)); - return strstr(vendor, "NVIDIA") != nullptr; -} -// Check if running on an Vivante Corporation driver. -static gboolean is_vivante() { - const gchar* vendor = reinterpret_cast(glGetString(GL_VENDOR)); - return strstr(vendor, "Vivante Corporation") != nullptr; + // Note: List of unsupported vendors due to issue + // https://github.com/flutter/flutter/issues/152099 + const char* unsupported_vendors_exact[] = {"Vivante Corporation", "ARM"}; + const char* unsupported_vendors_fuzzy[] = {"NVIDIA"}; + + for (const char* unsupported : unsupported_vendors_fuzzy) { + if (strstr(vendor, unsupported) != nullptr) { + return FALSE; + } + } + for (const char* unsupported : unsupported_vendors_exact) { + if (strcmp(vendor, unsupported) == 0) { + return FALSE; + } + } + return TRUE; } // Returns the log for the given OpenGL shader. Must be freed by the caller. @@ -445,10 +455,8 @@ static void fl_compositor_opengl_setup(FlCompositor* compositor) { fl_opengl_manager_make_current(self->opengl_manager); - // Note: NVIDIA and Vivante are temporarily disabled due to - // https://github.com/flutter/flutter/issues/152099 self->has_gl_framebuffer_blit = - !is_nvidia() && !is_vivante() && + driver_supports_blit() && (epoxy_gl_version() >= 30 || epoxy_has_gl_extension("GL_EXT_framebuffer_blit"));