|
@@ -0,0 +1,54 @@
|
|
|
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
+From: deepak1556 <[email protected]>
|
|
|
+Date: Sun, 5 Nov 2023 21:05:04 +0900
|
|
|
+Subject: Crash GPU process and clear shader cache when skia reports
|
|
|
+ compileError.
|
|
|
+
|
|
|
+Refs https://chromium-review.googlesource.com/c/chromium/src/+/4988290
|
|
|
+
|
|
|
+diff --git a/gpu/command_buffer/service/shared_context_state.cc b/gpu/command_buffer/service/shared_context_state.cc
|
|
|
+index 9960748b644a4f89919c6c19889d8cb3d875d3b8..71f9495306ad817a0d530f701d6ff35fc9966960 100644
|
|
|
+--- a/gpu/command_buffer/service/shared_context_state.cc
|
|
|
++++ b/gpu/command_buffer/service/shared_context_state.cc
|
|
|
+@@ -4,6 +4,7 @@
|
|
|
+
|
|
|
+ #include "gpu/command_buffer/service/shared_context_state.h"
|
|
|
+
|
|
|
++#include "base/immediate_crash.h"
|
|
|
+ #include "base/observer_list.h"
|
|
|
+ #include "base/strings/stringprintf.h"
|
|
|
+ #include "base/system/sys_info.h"
|
|
|
+@@ -82,6 +83,12 @@ void SharedContextState::compileError(const char* shader, const char* errors) {
|
|
|
+ << "------------------------\n"
|
|
|
+ << shader << "\nErrors:\n"
|
|
|
+ << errors;
|
|
|
++ // Increase shader cache shm count and crash the GPU process so that the
|
|
|
++ // browser process would clear the cache.
|
|
|
++ GpuProcessActivityFlags::ScopedSetFlag set_flag(
|
|
|
++ activity_flags_.get(), ActivityFlagsBase::FLAG_LOADING_PROGRAM_BINARY);
|
|
|
++
|
|
|
++ base::ImmediateCrash();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+@@ -271,6 +278,7 @@ bool SharedContextState::InitializeGanesh(
|
|
|
+ gl::ProgressReporter* progress_reporter) {
|
|
|
+ progress_reporter_ = progress_reporter;
|
|
|
+ gr_shader_cache_ = cache;
|
|
|
++ activity_flags_ = activity_flags;
|
|
|
+
|
|
|
+ size_t max_resource_cache_bytes;
|
|
|
+ size_t glyph_cache_max_texture_bytes;
|
|
|
+diff --git a/gpu/command_buffer/service/shared_context_state.h b/gpu/command_buffer/service/shared_context_state.h
|
|
|
+index c07796e90453c8ecbcfc4a8b3946deb1c46a3300..b795d0cf8e16218c01acdbe921bad067e0b63677 100644
|
|
|
+--- a/gpu/command_buffer/service/shared_context_state.h
|
|
|
++++ b/gpu/command_buffer/service/shared_context_state.h
|
|
|
+@@ -379,6 +379,8 @@ class GPU_GLES2_EXPORT SharedContextState
|
|
|
+ uint64_t skia_gr_cache_size_ = 0;
|
|
|
+ std::vector<uint8_t> scratch_deserialization_buffer_;
|
|
|
+ raw_ptr<gpu::raster::GrShaderCache> gr_shader_cache_ = nullptr;
|
|
|
++ raw_ptr<GpuProcessActivityFlags, DanglingUntriaged> activity_flags_ =
|
|
|
++ nullptr;
|
|
|
+
|
|
|
+ // |need_context_state_reset| is set whenever Skia may have altered the
|
|
|
+ // driver's GL state.
|