Commit 040e397b authored by Bo Liu's avatar Bo Liu
Browse files

Fork: Skip gralloc unbind on all except NVIDIA

Also add system property ro.sys.gralloc_unbind (set to
either 1 or 0) to override this behavior.

BUG: 11392857

Change-Id: Id85642e9f9fefd392bc66874f395c1a7b128331c
parent ad8795de
...@@ -7,6 +7,28 @@ ...@@ -7,6 +7,28 @@
#include "ui/gl/gl_bindings.h" #include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_surface_egl.h" #include "ui/gl/gl_surface_egl.h"
// === START ANDROID WORKAROUND b/11392857
#include <sys/system_properties.h>
namespace {
bool RequiresGrallocUnbind() {
static const char* kPropertyName = "ro.webview.gralloc_unbind";
char prop_value[PROP_VALUE_MAX];
int prop_value_length = __system_property_get(kPropertyName, prop_value);
if (prop_value_length == 1) {
if (strcmp(prop_value, "1") == 0) {
return true;
} else if (strcmp(prop_value, "0") == 0) {
return false;
}
}
LOG_IF(WARNING, prop_value_length > 0)
<< "Unrecognized value for " << kPropertyName << ": " << prop_value;
return strcmp((char*)glGetString(GL_VENDOR), "NVIDIA Corporation") == 0;
}
}
// === END ANDROID WORKAROUND b/11392857
namespace gfx { namespace gfx {
GLImageEGL::GLImageEGL(gfx::Size size) GLImageEGL::GLImageEGL(gfx::Size size)
...@@ -75,11 +97,10 @@ void GLImageEGL::Destroy() { ...@@ -75,11 +97,10 @@ void GLImageEGL::Destroy() {
} }
void GLImageEGL::ReleaseTexImage() { void GLImageEGL::ReleaseTexImage() {
// === START ANDROID WORKAROUND http://b/10205015 and http://b/10892941 // === START ANDROID WORKAROUND b/11392857
static bool is_qcom = strcmp((char*)glGetString(GL_VENDOR), "Qualcomm") == 0; static bool requires_gralloc_unbind = RequiresGrallocUnbind();
static bool is_arm = strcmp((char*)glGetString(GL_VENDOR), "ARM") == 0; if (!requires_gralloc_unbind) return;
if (is_qcom || is_arm) return; // === END ANDROID WORKAROUND b/11392857
// === END ANDROID WORKAROUND http://b/10205015 and http://b/10892941
char zero[4] = { 0, }; char zero[4] = { 0, };
glTexImage2D(GL_TEXTURE_2D, glTexImage2D(GL_TEXTURE_2D,
0, 0,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment