Commit 56d27fb4 authored by Khushal's avatar Khushal Committed by Commit Bot

gpu: Disable AImageReader for ARM GPUs on Android P and below.

This change adds a temporary workaround to effectively revert the
following changes. While the long term fix for this bug has landed, it
might be too risky to merge to M81. So this change reverts enabling of
AImageReader on these GPUs, to restore the behaviour prior to M80.

Reverted changes:
https://chromium-review.googlesource.com/c/chromium/src/+/2015553
https://chromium-review.googlesource.com/c/chromium/src/+/1873393

TBR=nyquist@chromium.org
R=dalecurtis@chromium.org

Bug: 1051705
Change-Id: I2f7f0828c8ba4a7279c2f6bb95de449402d88f92
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2087987
Commit-Queue: Khushal <khushalsagar@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747355}
parent c3e2bfe5
......@@ -22,6 +22,8 @@
namespace base {
namespace android {
bool AndroidImageReader::disable_support_ = false;
AndroidImageReader& AndroidImageReader::GetInstance() {
// C++11 static local variable initialization is
// thread-safe.
......@@ -29,8 +31,12 @@ AndroidImageReader& AndroidImageReader::GetInstance() {
return *instance;
}
void AndroidImageReader::DisableSupport() {
disable_support_ = true;
}
bool AndroidImageReader::IsSupported() {
return is_supported_;
return !disable_support_ && is_supported_;
}
AndroidImageReader::AndroidImageReader() {
......
......@@ -22,6 +22,9 @@ class BASE_EXPORT AndroidImageReader {
// Thread safe GetInstance.
static AndroidImageReader& GetInstance();
// Disable image reader support.
static void DisableSupport();
// Check if the image reader usage is supported. This function returns TRUE
// if android version is >=OREO, image reader support is not disabled and all
// the required functions are loaded.
......@@ -64,6 +67,7 @@ class BASE_EXPORT AndroidImageReader {
AndroidImageReader();
bool LoadFunctions();
static bool disable_support_;
bool is_supported_;
pAImage_delete AImage_delete_;
pAImage_deleteAsync AImage_deleteAsync_;
......
......@@ -3567,6 +3567,22 @@
"features": [
"dont_delete_source_texture_for_egl_image"
]
},
{
"id":335,
"cr_bugs": [1051705],
"description": "Disable AImageReader on ARM GPUs",
"os": {
"type": "android",
"version": {
"op": "<",
"value": "10"
}
},
"gl_vendor": "ARM.*",
"features": [
"disable_aimagereader"
]
}
]
}
......@@ -13,6 +13,7 @@ decode_encode_srgb_for_generatemipmap
depth_stencil_renderbuffer_resize_emulation
disable_2d_canvas_auto_flush
disable_accelerated_vpx_decode
disable_aimagereader
disable_async_readpixels
disable_av_sample_buffer_display_layer
disable_blend_equation_advanced
......
......@@ -506,6 +506,12 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line,
ui::OzonePlatform::GetInstance()->AfterSandboxEntry();
#endif
#if defined(OS_ANDROID)
// Disable AImageReader if the workaround is enabled.
if (gpu_feature_info_.IsWorkaroundEnabled(DISABLE_AIMAGEREADER)) {
base::android::AndroidImageReader::DisableSupport();
}
#endif
#if defined(USE_OZONE)
gpu_feature_info_.supported_buffer_formats_for_allocation_and_texturing =
std::move(supported_buffer_formats_for_texturing);
......@@ -532,6 +538,11 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line,
default_offscreen_surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size());
// Disable AImageReader if the workaround is enabled.
if (gpu_feature_info_.IsWorkaroundEnabled(DISABLE_AIMAGEREADER)) {
base::android::AndroidImageReader::DisableSupport();
}
UMA_HISTOGRAM_ENUMERATION("GPU.GLImplementation", gl::GetGLImplementation());
}
#else
......
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