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
This commit is contained in:
richardexfo 2024-12-02 16:16:22 -05:00 committed by GitHub
parent a7db4d6b56
commit c62bbc18ad

View File

@ -89,6 +89,12 @@ static gboolean is_nvidia() {
return strstr(vendor, "NVIDIA") != nullptr; return strstr(vendor, "NVIDIA") != nullptr;
} }
// Check if running on an Vivante Corporation driver.
static gboolean is_vivante() {
const gchar* vendor = reinterpret_cast<const gchar*>(glGetString(GL_VENDOR));
return strstr(vendor, "Vivante Corporation") != nullptr;
}
// 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.
static gchar* get_shader_log(GLuint shader) { static gchar* get_shader_log(GLuint shader) {
GLint log_length; GLint log_length;
@ -568,11 +574,12 @@ void fl_renderer_setup(FlRenderer* self) {
g_return_if_fail(FL_IS_RENDERER(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 // https://github.com/flutter/flutter/issues/152099
priv->has_gl_framebuffer_blit = priv->has_gl_framebuffer_blit =
!is_nvidia() && (epoxy_gl_version() >= 30 || !is_nvidia() && !is_vivante() &&
epoxy_has_gl_extension("GL_EXT_framebuffer_blit")); (epoxy_gl_version() >= 30 ||
epoxy_has_gl_extension("GL_EXT_framebuffer_blit"));
if (!priv->has_gl_framebuffer_blit) { if (!priv->has_gl_framebuffer_blit) {
setup_shader(self); setup_shader(self);