Commit 1d055599 authored by Khushal's avatar Khushal Committed by Commit Bot

gpu: Limit skia to OpenGL ES 2.0 for OOP raster.

Currently skia is limited to ES 2.0 for GPU raster, also apply this
limitation for OOP raster since we suspect this might be causing
crashes on Adreno (TM) 405 devices.

TBR=vollick@chromium.org
R=piman@chromium.org

Bug: 866613
Change-Id: Icd4ed5116a28a31e3b4ba2121955fa595d837f33
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:linux_vr;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Reviewed-on: https://chromium-review.googlesource.com/1083883
Commit-Queue: Khushal <khushalsagar@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578895}
parent 79be0a02
...@@ -24,8 +24,9 @@ GaneshSurfaceProvider::GaneshSurfaceProvider() { ...@@ -24,8 +24,9 @@ GaneshSurfaceProvider::GaneshSurfaceProvider() {
std::string extensions_string(gl::GetGLExtensionsFromCurrentContext()); std::string extensions_string(gl::GetGLExtensionsFromCurrentContext());
gfx::ExtensionSet extensions(gfx::MakeExtensionSet(extensions_string)); gfx::ExtensionSet extensions(gfx::MakeExtensionSet(extensions_string));
gl::GLVersionInfo gl_version_info(version_str, renderer_str, extensions); gl::GLVersionInfo gl_version_info(version_str, renderer_str, extensions);
const bool use_version_es2 = false;
sk_sp<const GrGLInterface> gr_interface = sk_sp<const GrGLInterface> gr_interface =
gl::init::CreateGrGLInterface(gl_version_info); gl::init::CreateGrGLInterface(gl_version_info, use_version_es2);
DCHECK(gr_interface.get()); DCHECK(gr_interface.get());
gr_context_ = GrContext::MakeGL(std::move(gr_interface)); gr_context_ = GrContext::MakeGL(std::move(gr_interface));
DCHECK(gr_context_.get()); DCHECK(gr_context_.get());
......
...@@ -334,7 +334,9 @@ bool GpuServiceImpl::GetGrContextForGLSurface(gl::GLSurface* surface, ...@@ -334,7 +334,9 @@ bool GpuServiceImpl::GetGrContextForGLSurface(gl::GLSurface* surface,
} }
const auto* gl_version_info = data.gl_context->GetVersionInfo(); const auto* gl_version_info = data.gl_context->GetVersionInfo();
auto native_interface = gl::init::CreateGrGLInterface(*gl_version_info); const bool use_version_es2 = false;
auto native_interface =
gl::init::CreateGrGLInterface(*gl_version_info, use_version_es2);
DCHECK(native_interface); DCHECK(native_interface);
GrContextOptions options; GrContextOptions options;
......
...@@ -297,6 +297,10 @@ int GpuMain(const MainFunctionParams& parameters) { ...@@ -297,6 +297,10 @@ int GpuMain(const MainFunctionParams& parameters) {
gpu_init->set_sandbox_helper(&sandbox_helper); gpu_init->set_sandbox_helper(&sandbox_helper);
// Since GPU initialization calls into skia, its important to initialize skia
// before it.
InitializeSkia();
// Gpu initialization may fail for various reasons, in which case we will need // Gpu initialization may fail for various reasons, in which case we will need
// to tear down this process. However, we can not do so safely until the IPC // to tear down this process. However, we can not do so safely until the IPC
// channel is set up, because the detection of early return of a child process // channel is set up, because the detection of early return of a child process
...@@ -331,8 +335,6 @@ int GpuMain(const MainFunctionParams& parameters) { ...@@ -331,8 +335,6 @@ int GpuMain(const MainFunctionParams& parameters) {
gpu_process.set_main_thread(child_thread); gpu_process.set_main_thread(child_thread);
InitializeSkia();
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
tracing::GraphicsMemoryDumpProvider::GetInstance(), "AndroidGraphics", tracing::GraphicsMemoryDumpProvider::GetInstance(), "AndroidGraphics",
......
...@@ -46,8 +46,8 @@ void RasterDecoderContextState::InitializeGrContext( ...@@ -46,8 +46,8 @@ void RasterDecoderContextState::InitializeGrContext(
GpuProcessActivityFlags* activity_flags) { GpuProcessActivityFlags* activity_flags) {
DCHECK(context->IsCurrent(surface.get())); DCHECK(context->IsCurrent(surface.get()));
sk_sp<GrGLInterface> interface( sk_sp<GrGLInterface> interface(gl::init::CreateGrGLInterface(
gl::init::CreateGrGLInterface(*context->GetVersionInfo())); *context->GetVersionInfo(), workarounds.use_es2_for_oopr));
if (!interface) { if (!interface) {
LOG(ERROR) << "OOP raster support disabled: GrGLInterface creation " LOG(ERROR) << "OOP raster support disabled: GrGLInterface creation "
"failed."; "failed.";
......
...@@ -2975,6 +2975,22 @@ ...@@ -2975,6 +2975,22 @@
"features": [ "features": [
"disable_timestamp_queries" "disable_timestamp_queries"
] ]
},
{
"id":273,
"cr_bugs": [866613],
"description": "Frequent crashes on Adreno (TM) 405 on L",
"os": {
"type": "android",
"version": {
"op": "<",
"value": "6.0"
}
},
"gl_renderer": "Adreno \\(TM\\) 4.*",
"features": [
"use_es2_for_oopr"
]
} }
] ]
} }
...@@ -114,12 +114,9 @@ int StringContainsName( ...@@ -114,12 +114,9 @@ int StringContainsName(
} }
bool SupportsOOPRaster(const gl::GLVersionInfo& gl_info) { bool SupportsOOPRaster(const gl::GLVersionInfo& gl_info) {
// TODO(backer): Thread-safe and idempotent. Still, see if we consolidate with const bool use_version_es2 = false;
// call in content/gpu/gpu_main.cc?
SkGraphics::Init();
sk_sp<const GrGLInterface> gl_interface( sk_sp<const GrGLInterface> gl_interface(
gl::init::CreateGrGLInterface(gl_info)); gl::init::CreateGrGLInterface(gl_info, use_version_es2));
if (!gl_interface) { if (!gl_interface) {
return false; return false;
} }
......
...@@ -106,4 +106,5 @@ use_virtualized_gl_contexts ...@@ -106,4 +106,5 @@ use_virtualized_gl_contexts
validate_multisample_buffer_allocation validate_multisample_buffer_allocation
wake_up_gpu_before_drawing wake_up_gpu_before_drawing
disable_2d_canvas_auto_flush disable_2d_canvas_auto_flush
clear_pixel_unpack_buffer_before_copyteximage clear_pixel_unpack_buffer_before_copyteximage
\ No newline at end of file use_es2_for_oopr
...@@ -46,7 +46,11 @@ const char* kBlacklistExtensions[] = { ...@@ -46,7 +46,11 @@ const char* kBlacklistExtensions[] = {
} // anonymous namespace } // anonymous namespace
sk_sp<GrGLInterface> CreateGrGLInterface( sk_sp<GrGLInterface> CreateGrGLInterface(
const gl::GLVersionInfo& version_info) { const gl::GLVersionInfo& version_info,
bool use_version_es2) {
// Can't fake ES with desktop GL.
use_version_es2 &= version_info.is_es;
gl::ProcsGL* gl = &gl::g_current_gl_driver->fn; gl::ProcsGL* gl = &gl::g_current_gl_driver->fn;
gl::GLApi* api = gl::g_current_gl_context; gl::GLApi* api = gl::g_current_gl_context;
...@@ -60,8 +64,16 @@ sk_sp<GrGLInterface> CreateGrGLInterface( ...@@ -60,8 +64,16 @@ sk_sp<GrGLInterface> CreateGrGLInterface(
// handles but bindings don't. // handles but bindings don't.
// TODO(piman): add bindings for missing entrypoints. // TODO(piman): add bindings for missing entrypoints.
GrGLFunction<GrGLGetStringProc> get_string; GrGLFunction<GrGLGetStringProc> get_string;
if (version_info.IsAtLeastGL(3, 3) || version_info.IsAtLeastGLES(3, 1)) { const bool apply_version_override = use_version_es2 ||
const char* fake_version = version_info.is_es ? "OpenGL ES 3.0" : "3.2"; version_info.IsAtLeastGL(3, 3) ||
version_info.IsAtLeastGLES(3, 1);
if (apply_version_override) {
const char* fake_version = nullptr;
if (use_version_es2) {
fake_version = "OpenGL ES 2.0";
} else {
fake_version = version_info.is_es ? "OpenGL ES 3.0" : "3.2";
}
get_string = [fake_version](GLenum name) { get_string = [fake_version](GLenum name) {
return GetStringHook(fake_version, name); return GetStringHook(fake_version, name);
}; };
......
...@@ -19,7 +19,8 @@ namespace init { ...@@ -19,7 +19,8 @@ namespace init {
// Creates a GrGLInterface by taking function pointers from the current // Creates a GrGLInterface by taking function pointers from the current
// GL bindings. // GL bindings.
GL_INIT_EXPORT sk_sp<GrGLInterface> CreateGrGLInterface( GL_INIT_EXPORT sk_sp<GrGLInterface> CreateGrGLInterface(
const gl::GLVersionInfo& version_info); const gl::GLVersionInfo& version_info,
bool use_version_es2);
} // namespace init } // namespace init
} // namespace gl } // namespace gl
......
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