Commit 61977dfc authored by Khushal's avatar Khushal Committed by Commit Bot

gpu: Notify watchdog thread in DoEndRasterCHROMIUM.

In DoEndRasterCHROMIUM skia flushes the GL work for the complete tile
in its GrOpList in prepareForExternalIO which can be a slow operation.
Make sure the watchdog thread is notified to avoid spurious hangs.

R=piman@chromium.org

Bug: 934483
Change-Id: Ifb35ceb70da93796b59da5b9bff78636cd4cea0d
Reviewed-on: https://chromium-review.googlesource.com/c/1482032
Commit-Queue: Khushal <khushalsagar@chromium.org>
Auto-Submit: Khushal <khushalsagar@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634483}
parent bbbbfbc8
......@@ -97,6 +97,21 @@ namespace {
base::AtomicSequenceNumber g_raster_decoder_id;
class ScopedProgressReporter {
public:
ScopedProgressReporter(gl::ProgressReporter* reporter) : reporter_(reporter) {
if (reporter_)
reporter_->ReportProgress();
}
~ScopedProgressReporter() {
if (reporter_)
reporter_->ReportProgress();
}
private:
gl::ProgressReporter* reporter_;
};
// This class prevents any GL errors that occur when it is in scope from
// being reported to the client.
class ScopedGLErrorSuppressor {
......@@ -2158,6 +2173,8 @@ void RasterDecoderImpl::DoRasterCHROMIUM(GLuint raster_shm_id,
options.crash_dump_on_failure = true;
size_t paint_buffer_size = raster_shm_size;
ScopedProgressReporter report_progress(
shared_context_state_->progress_reporter());
while (paint_buffer_size > 0) {
size_t skip = 0;
cc::PaintOp* deserialized_op = cc::PaintOp::Deserialize(
......@@ -2194,7 +2211,16 @@ void RasterDecoderImpl::DoEndRasterCHROMIUM() {
recorder_ = nullptr;
sk_surface_->draw(ddl.get());
}
sk_surface_->prepareForExternalIO();
{
// This is a slow operation since skia will execute the GPU work for the
// complete tile. Make sure the progress reporter is notified to avoid
// hangs.
ScopedProgressReporter report_progress(
shared_context_state_->progress_reporter());
sk_surface_->prepareForExternalIO();
}
if (!shared_image_) {
// Test only path for SetUpForRasterCHROMIUMForTest.
sk_surface_.reset();
......
......@@ -74,6 +74,8 @@ void SharedContextState::InitializeGrContext(
GrContextOptions::PersistentCache* cache,
GpuProcessActivityFlags* activity_flags,
gl::ProgressReporter* progress_reporter) {
progress_reporter_ = progress_reporter;
if (!use_vulkan_gr_context_) {
DCHECK(context_->IsCurrent(nullptr));
sk_sp<GrGLInterface> interface(gl::init::CreateGrGLInterface(
......
......@@ -79,6 +79,7 @@ class GPU_GLES2_EXPORT SharedContextState
viz::VulkanContextProvider* vk_context_provider() {
return vk_context_provider_;
}
gl::ProgressReporter* progress_reporter() const { return progress_reporter_; }
GrContext* gr_context() { return gr_context_; }
gles2::FeatureInfo* feature_info() { return feature_info_.get(); }
gles2::ContextState* context_state() const { return context_state_.get(); }
......@@ -143,6 +144,7 @@ class GPU_GLES2_EXPORT SharedContextState
// raster decoders and display compositor share this context_state_.
std::unique_ptr<gles2::ContextState> context_state_;
gl::ProgressReporter* progress_reporter_ = nullptr;
sk_sp<GrContext> owned_gr_context_;
std::unique_ptr<ServiceTransferCache> transfer_cache_;
size_t glyph_cache_max_texture_bytes_ = 0u;
......
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