From c62bbc18add70eaa5560740fa655ef9f78f5176e Mon Sep 17 00:00:00 2001 From: richardexfo <94012149+richardexfo@users.noreply.github.com> Date: Mon, 2 Dec 2024 16:16:22 -0500 Subject: [PATCH] Fix linux on vivante drivers. (flutter/engine#56862) The same problem with NVIDIA drivers which causes issue [152099](https://github.com/flutter/flutter/issues/152099) occurs with Vivante Corporation drivers. Quick fix for issue on Vivante drivers: https://github.com/flutter/flutter/issues/152099 - [ 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] and the [C++, Objective-C, Java style guides]. - [ x] I listed at least one issue that this PR fixes in the description above. - [ x] I added new tests to check the change I am making or feature I am adding, or the PR is [test-exempt]. See [testing the engine] for instructions on writing and running engine tests. - [ x] I updated/added relevant documentation (doc comments with `///`). - [ x] I signed the [CLA]. - [ x] All existing and new tests are passing. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- .../src/flutter/shell/platform/linux/fl_renderer.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/engine/src/flutter/shell/platform/linux/fl_renderer.cc b/engine/src/flutter/shell/platform/linux/fl_renderer.cc index 63e0a8186b..2465390a29 100644 --- a/engine/src/flutter/shell/platform/linux/fl_renderer.cc +++ b/engine/src/flutter/shell/platform/linux/fl_renderer.cc @@ -89,6 +89,12 @@ static gboolean is_nvidia() { 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; +} + // Returns the log for the given OpenGL shader. Must be freed by the caller. static gchar* get_shader_log(GLuint shader) { GLint log_length; @@ -568,11 +574,12 @@ void fl_renderer_setup(FlRenderer* self) { g_return_if_fail(FL_IS_RENDERER(self)); - // Note: NVIDIA is temporarily disabled due to + // Note: NVIDIA and Vivante are temporarily disabled due to // https://github.com/flutter/flutter/issues/152099 priv->has_gl_framebuffer_blit = - !is_nvidia() && (epoxy_gl_version() >= 30 || - epoxy_has_gl_extension("GL_EXT_framebuffer_blit")); + !is_nvidia() && !is_vivante() && + (epoxy_gl_version() >= 30 || + epoxy_has_gl_extension("GL_EXT_framebuffer_blit")); if (!priv->has_gl_framebuffer_blit) { setup_shader(self);