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.

<!-- Links -->
[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 <robert.ancell@canonical.com>
This commit is contained in:
richardexfo 2025-06-02 20:20:08 -04:00 committed by GitHub
parent b6100b7c09
commit 5c4edc244f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -87,16 +87,26 @@ G_DEFINE_TYPE(FlCompositorOpenGL,
fl_compositor_opengl, fl_compositor_opengl,
fl_compositor_get_type()) fl_compositor_get_type())
// Check if running on an NVIDIA driver. // Check if running on driver supporting blit.
static gboolean is_nvidia() { static gboolean driver_supports_blit() {
const gchar* vendor = reinterpret_cast<const gchar*>(glGetString(GL_VENDOR)); const gchar* vendor = reinterpret_cast<const gchar*>(glGetString(GL_VENDOR));
return strstr(vendor, "NVIDIA") != nullptr;
}
// Check if running on an Vivante Corporation driver. // Note: List of unsupported vendors due to issue
static gboolean is_vivante() { // https://github.com/flutter/flutter/issues/152099
const gchar* vendor = reinterpret_cast<const gchar*>(glGetString(GL_VENDOR)); const char* unsupported_vendors_exact[] = {"Vivante Corporation", "ARM"};
return strstr(vendor, "Vivante Corporation") != nullptr; 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. // 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); 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 = self->has_gl_framebuffer_blit =
!is_nvidia() && !is_vivante() && driver_supports_blit() &&
(epoxy_gl_version() >= 30 || (epoxy_gl_version() >= 30 ||
epoxy_has_gl_extension("GL_EXT_framebuffer_blit")); epoxy_has_gl_extension("GL_EXT_framebuffer_blit"));