Commit 13e510ef authored by Khushal's avatar Khushal Committed by Commit Bot

gpu: Hook up activity flags for glProgramBinary for OOPR.

The activity flags are used to notify the browser if the GPU process
crashes during shader compilation which could indicate a corrupted disk
shader cache. Hook this up for the persistent shader caching on the
GrContext for OOPR.

R=ericrk@chromium.org, piman@chromium.org

Bug: 854416
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I4ed69d41768856b649a500dd5b86777bf0023d26
Reviewed-on: https://chromium-review.googlesource.com/1142367Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Khushal <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576819}
parent 56e2b194
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/memory_dump_manager.h" #include "base/trace_event/memory_dump_manager.h"
#include "gpu/command_buffer/common/activity_flags.h"
#include "gpu/command_buffer/service/service_transfer_cache.h" #include "gpu/command_buffer/service/service_transfer_cache.h"
#include "gpu/config/gpu_driver_bug_workarounds.h" #include "gpu/config/gpu_driver_bug_workarounds.h"
#include "ui/gl/gl_context.h" #include "ui/gl/gl_context.h"
...@@ -40,10 +41,11 @@ RasterDecoderContextState::~RasterDecoderContextState() { ...@@ -40,10 +41,11 @@ RasterDecoderContextState::~RasterDecoderContextState() {
void RasterDecoderContextState::InitializeGrContext( void RasterDecoderContextState::InitializeGrContext(
const GpuDriverBugWorkarounds& workarounds, const GpuDriverBugWorkarounds& workarounds,
GrContextOptions::PersistentCache* cache) { GrContextOptions::PersistentCache* cache,
GpuProcessActivityFlags* activity_flags) {
DCHECK(context->IsCurrent(surface.get())); DCHECK(context->IsCurrent(surface.get()));
sk_sp<const GrGLInterface> interface( sk_sp<GrGLInterface> interface(
gl::init::CreateGrGLInterface(*context->GetVersionInfo())); gl::init::CreateGrGLInterface(*context->GetVersionInfo()));
if (!interface) { if (!interface) {
LOG(ERROR) << "OOP raster support disabled: GrGLInterface creation " LOG(ERROR) << "OOP raster support disabled: GrGLInterface creation "
...@@ -51,6 +53,18 @@ void RasterDecoderContextState::InitializeGrContext( ...@@ -51,6 +53,18 @@ void RasterDecoderContextState::InitializeGrContext(
return; return;
} }
auto original_func = interface->fFunctions.fProgramBinary;
if (activity_flags && original_func && cache) {
interface->fFunctions.fProgramBinary = [&activity_flags, &original_func](
GrGLuint program,
GrGLenum binaryFormat,
void* binary, GrGLsizei length) {
GpuProcessActivityFlags::ScopedSetFlag scoped_set_flag(
activity_flags, ActivityFlagsBase::FLAG_LOADING_PROGRAM_BINARY);
return original_func(program, binaryFormat, binary, length);
};
}
// If you make any changes to the GrContext::Options here that could // If you make any changes to the GrContext::Options here that could
// affect text rendering, make sure to match the capabilities initialized // affect text rendering, make sure to match the capabilities initialized
// in GetCapabilities and ensuring these are also used by the // in GetCapabilities and ensuring these are also used by the
......
...@@ -20,6 +20,7 @@ class GLSurface; ...@@ -20,6 +20,7 @@ class GLSurface;
namespace gpu { namespace gpu {
class GpuDriverBugWorkarounds; class GpuDriverBugWorkarounds;
class GpuProcessActivityFlags;
class ServiceTransferCache; class ServiceTransferCache;
namespace raster { namespace raster {
...@@ -33,7 +34,8 @@ struct GPU_GLES2_EXPORT RasterDecoderContextState ...@@ -33,7 +34,8 @@ struct GPU_GLES2_EXPORT RasterDecoderContextState
scoped_refptr<gl::GLContext> context, scoped_refptr<gl::GLContext> context,
bool use_virtualized_gl_contexts); bool use_virtualized_gl_contexts);
void InitializeGrContext(const GpuDriverBugWorkarounds& workarounds, void InitializeGrContext(const GpuDriverBugWorkarounds& workarounds,
GrContextOptions::PersistentCache* cache); GrContextOptions::PersistentCache* cache,
GpuProcessActivityFlags* activity_flags = nullptr);
void PurgeMemory( void PurgeMemory(
base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
......
...@@ -434,7 +434,7 @@ GpuChannelManager::GetRasterDecoderContextState(ContextResult* result) { ...@@ -434,7 +434,7 @@ GpuChannelManager::GetRasterDecoderContextState(ContextResult* result) {
gpu::kGpuFeatureStatusEnabled; gpu::kGpuFeatureStatusEnabled;
if (enable_raster_transport) { if (enable_raster_transport) {
raster_decoder_context_state_->InitializeGrContext( raster_decoder_context_state_->InitializeGrContext(
gpu_driver_bug_workarounds_, gr_shader_cache()); gpu_driver_bug_workarounds_, gr_shader_cache(), &activity_flags_);
} }
gr_cache_controller_.emplace(raster_decoder_context_state_.get(), gr_cache_controller_.emplace(raster_decoder_context_state_.get(),
......
...@@ -45,7 +45,7 @@ const char* kBlacklistExtensions[] = { ...@@ -45,7 +45,7 @@ const char* kBlacklistExtensions[] = {
} // anonymous namespace } // anonymous namespace
sk_sp<const GrGLInterface> CreateGrGLInterface( sk_sp<GrGLInterface> CreateGrGLInterface(
const gl::GLVersionInfo& version_info) { const gl::GLVersionInfo& version_info) {
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;
...@@ -486,7 +486,7 @@ sk_sp<const GrGLInterface> CreateGrGLInterface( ...@@ -486,7 +486,7 @@ sk_sp<const GrGLInterface> CreateGrGLInterface(
interface->fStandard = standard; interface->fStandard = standard;
interface->fExtensions.swap(&extensions); interface->fExtensions.swap(&extensions);
sk_sp<const GrGLInterface> returned(interface); sk_sp<GrGLInterface> returned(interface);
return returned; return returned;
} }
......
...@@ -18,7 +18,7 @@ namespace init { ...@@ -18,7 +18,7 @@ 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<const GrGLInterface> CreateGrGLInterface( GL_INIT_EXPORT sk_sp<GrGLInterface> CreateGrGLInterface(
const gl::GLVersionInfo& version_info); const gl::GLVersionInfo& version_info);
} // namespace init } // namespace init
......
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