Commit 21869271 authored by Jonathan Backer's avatar Jonathan Backer Committed by Commit Bot

Limit how frequently we call glCheckGraphicsResetStatus

This call can be slow on some GL driver stacks (e.g. ANGLE with D3D
backend). This reduced the number of checks on ie_chalkboard from ~900
to ~300 calls.

Bug: 1090232
Change-Id: I6f70e53269c6df967b0ce5050b3334da44cb3cde
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2229406Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Commit-Queue: Jonathan Backer <backer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#775230}
parent 08fdeb7c
...@@ -187,7 +187,7 @@ void RasterDecoderTestBase::InitDecoder(const InitState& init) { ...@@ -187,7 +187,7 @@ void RasterDecoderTestBase::InitDecoder(const InitState& init) {
new gl::GLShareGroup(), surface_, context_, new gl::GLShareGroup(), surface_, context_,
feature_info()->workarounds().use_virtualized_gl_contexts, feature_info()->workarounds().use_virtualized_gl_contexts,
base::DoNothing(), GpuPreferences().gr_context_type); base::DoNothing(), GpuPreferences().gr_context_type);
shared_context_state_->disable_check_reset_status_throttling_for_test_ = true;
shared_context_state_->InitializeGL(GpuPreferences(), feature_info_); shared_context_state_->InitializeGL(GpuPreferences(), feature_info_);
command_buffer_service_.reset(new FakeCommandBufferServiceBase()); command_buffer_service_.reset(new FakeCommandBufferServiceBase());
......
...@@ -682,6 +682,17 @@ bool SharedContextState::CheckResetStatus(bool needs_gl) { ...@@ -682,6 +682,17 @@ bool SharedContextState::CheckResetStatus(bool needs_gl) {
if (!GrContextIsGL() && !needs_gl) if (!GrContextIsGL() && !needs_gl)
return false; return false;
// Checking the reset status is expensive on some OS/drivers
// (https://crbug.com/1090232). Rate limit it.
constexpr base::TimeDelta kMinCheckDelay =
base::TimeDelta::FromMilliseconds(5);
base::Time now = base::Time::Now();
if (!disable_check_reset_status_throttling_for_test_ &&
now < last_gl_check_graphics_reset_status_ + kMinCheckDelay) {
return false;
}
last_gl_check_graphics_reset_status_ = now;
GLenum driver_status = context()->CheckStickyGraphicsResetStatus(); GLenum driver_status = context()->CheckStickyGraphicsResetStatus();
if (driver_status == GL_NO_ERROR) if (driver_status == GL_NO_ERROR)
return false; return false;
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/optional.h" #include "base/optional.h"
#include "base/time/time.h"
#include "base/trace_event/memory_dump_provider.h" #include "base/trace_event/memory_dump_provider.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "gpu/command_buffer/common/constants.h" #include "gpu/command_buffer/common/constants.h"
...@@ -50,6 +51,10 @@ class FeatureInfo; ...@@ -50,6 +51,10 @@ class FeatureInfo;
struct ContextState; struct ContextState;
} // namespace gles2 } // namespace gles2
namespace raster {
class RasterDecoderTestBase;
} // namespace raster
class GPU_GLES2_EXPORT SharedContextState class GPU_GLES2_EXPORT SharedContextState
: public base::trace_event::MemoryDumpProvider, : public base::trace_event::MemoryDumpProvider,
public gpu::GLContextVirtualDelegate, public gpu::GLContextVirtualDelegate,
...@@ -192,6 +197,7 @@ class GPU_GLES2_EXPORT SharedContextState ...@@ -192,6 +197,7 @@ class GPU_GLES2_EXPORT SharedContextState
private: private:
friend class base::RefCounted<SharedContextState>; friend class base::RefCounted<SharedContextState>;
friend class raster::RasterDecoderTestBase;
// Observer which is notified when SkiaOutputSurfaceImpl takes ownership of a // Observer which is notified when SkiaOutputSurfaceImpl takes ownership of a
// shared image, and forward information to both histograms and task manager. // shared image, and forward information to both histograms and task manager.
...@@ -282,6 +288,8 @@ class GPU_GLES2_EXPORT SharedContextState ...@@ -282,6 +288,8 @@ class GPU_GLES2_EXPORT SharedContextState
base::MRUCache<void*, sk_sp<SkSurface>> sk_surface_cache_; base::MRUCache<void*, sk_sp<SkSurface>> sk_surface_cache_;
bool device_needs_reset_ = false; bool device_needs_reset_ = false;
base::Time last_gl_check_graphics_reset_status_;
bool disable_check_reset_status_throttling_for_test_ = false;
base::WeakPtrFactory<SharedContextState> weak_ptr_factory_{this}; base::WeakPtrFactory<SharedContextState> weak_ptr_factory_{this};
......
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