summaryrefslogtreecommitdiffstats
path: root/chromium/gpu/command_buffer
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/gpu/command_buffer')
-rw-r--r--chromium/gpu/command_buffer/client/raster_implementation.cc18
-rw-r--r--chromium/gpu/command_buffer/client/raster_implementation.h4
-rw-r--r--chromium/gpu/command_buffer/client/raster_implementation_unittest.cc7
-rw-r--r--chromium/gpu/command_buffer/service/raster_decoder.cc28
-rw-r--r--chromium/gpu/command_buffer/service/shared_context_state.cc2
-rw-r--r--chromium/gpu/command_buffer/service/shared_context_state.h2
6 files changed, 44 insertions, 17 deletions
diff --git a/chromium/gpu/command_buffer/client/raster_implementation.cc b/chromium/gpu/command_buffer/client/raster_implementation.cc
index a4ad95d85a2..2a8d060343f 100644
--- a/chromium/gpu/command_buffer/client/raster_implementation.cc
+++ b/chromium/gpu/command_buffer/client/raster_implementation.cc
@@ -191,11 +191,12 @@ class RasterImplementation::PaintOpSerializer {
TransferCacheSerializeHelperImpl* transfer_cache_helper,
ClientFontManager* font_manager)
: ri_(ri),
- buffer_(static_cast<char*>(ri_->MapRasterCHROMIUM(initial_size))),
stashing_image_provider_(stashing_image_provider),
transfer_cache_helper_(transfer_cache_helper),
- font_manager_(font_manager),
- free_bytes_(buffer_ ? initial_size : 0) {}
+ font_manager_(font_manager) {
+ buffer_ =
+ static_cast<char*>(ri_->MapRasterCHROMIUM(initial_size, &free_bytes_));
+ }
~PaintOpSerializer() {
// Need to call SendSerializedData;
@@ -213,12 +214,11 @@ class RasterImplementation::PaintOpSerializer {
ri_->paint_cache_->AbortPendingEntries();
SendSerializedData();
- buffer_ = static_cast<char*>(ri_->MapRasterCHROMIUM(kBlockAlloc));
+ buffer_ =
+ static_cast<char*>(ri_->MapRasterCHROMIUM(kBlockAlloc, &free_bytes_));
if (!buffer_) {
- free_bytes_ = 0;
return 0;
}
- free_bytes_ = kBlockAlloc;
size = op->Serialize(buffer_ + written_bytes_, free_bytes_, options);
}
DCHECK_LE(size, free_bytes_);
@@ -919,7 +919,9 @@ void RasterImplementation::WaitSyncTokenCHROMIUM(
gpu_control_->WaitSyncToken(verified_sync_token);
}
-void* RasterImplementation::MapRasterCHROMIUM(GLsizeiptr size) {
+void* RasterImplementation::MapRasterCHROMIUM(uint32_t size,
+ uint32_t* size_allocated) {
+ *size_allocated = 0u;
if (size < 0) {
SetGLError(GL_INVALID_VALUE, "glMapRasterCHROMIUM", "negative size");
return nullptr;
@@ -934,7 +936,7 @@ void* RasterImplementation::MapRasterCHROMIUM(GLsizeiptr size) {
raster_mapped_buffer_ = base::nullopt;
return nullptr;
}
-
+ *size_allocated = raster_mapped_buffer_->size();
return raster_mapped_buffer_->address();
}
diff --git a/chromium/gpu/command_buffer/client/raster_implementation.h b/chromium/gpu/command_buffer/client/raster_implementation.h
index 444379df337..c4e01fd8628 100644
--- a/chromium/gpu/command_buffer/client/raster_implementation.h
+++ b/chromium/gpu/command_buffer/client/raster_implementation.h
@@ -242,7 +242,9 @@ class RASTER_EXPORT RasterImplementation : public RasterInterface,
GLenum value,
const char* label);
- void* MapRasterCHROMIUM(GLsizeiptr size);
+ // Try to map a transfer buffer of |size|. Will return a pointer to a
+ // buffer of |size_allocated|, which will be equal to or lesser than |size|.
+ void* MapRasterCHROMIUM(uint32_t size, uint32_t* size_allocated);
// |raster_written_size| is the size of buffer used by raster commands.
// |total_written_size| is the total size of the buffer written to, including
diff --git a/chromium/gpu/command_buffer/client/raster_implementation_unittest.cc b/chromium/gpu/command_buffer/client/raster_implementation_unittest.cc
index d78df6c45af..99cf3a984ab 100644
--- a/chromium/gpu/command_buffer/client/raster_implementation_unittest.cc
+++ b/chromium/gpu/command_buffer/client/raster_implementation_unittest.cc
@@ -202,13 +202,6 @@ class RasterImplementationTest : public testing::Test {
QueryTracker* GetQueryTracker() { return gl_->query_tracker_.get(); }
- void* MapRasterCHROMIUM(GLsizeiptr size) {
- return gl_->MapRasterCHROMIUM(size);
- }
- void UnmapRasterCHROMIUM(GLsizeiptr written_size) {
- gl_->UnmapRasterCHROMIUM(written_size, written_size);
- }
-
struct ContextInitOptions {
ContextInitOptions()
: bind_generates_resource_client(true),
diff --git a/chromium/gpu/command_buffer/service/raster_decoder.cc b/chromium/gpu/command_buffer/service/raster_decoder.cc
index c16915d4e8b..b306574e4a5 100644
--- a/chromium/gpu/command_buffer/service/raster_decoder.cc
+++ b/chromium/gpu/command_buffer/service/raster_decoder.cc
@@ -95,6 +95,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 {
@@ -2206,6 +2221,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(
@@ -2242,7 +2259,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();
diff --git a/chromium/gpu/command_buffer/service/shared_context_state.cc b/chromium/gpu/command_buffer/service/shared_context_state.cc
index 7b4ccdbe188..02acb107330 100644
--- a/chromium/gpu/command_buffer/service/shared_context_state.cc
+++ b/chromium/gpu/command_buffer/service/shared_context_state.cc
@@ -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(
diff --git a/chromium/gpu/command_buffer/service/shared_context_state.h b/chromium/gpu/command_buffer/service/shared_context_state.h
index 51a28b2ebc5..7883ac2af41 100644
--- a/chromium/gpu/command_buffer/service/shared_context_state.h
+++ b/chromium/gpu/command_buffer/service/shared_context_state.h
@@ -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;