Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Unified Diff: cc/raster/gpu_raster_buffer_provider.cc

Issue 2555743004: Delay activation/draw on GPU tile work completion (Closed)
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/raster/gpu_raster_buffer_provider.cc
diff --git a/cc/raster/gpu_raster_buffer_provider.cc b/cc/raster/gpu_raster_buffer_provider.cc
index e7e4f9200ad100c02c050b101cf3b22872ec4fb7..500b761f7db69d7d43f2ba2b14466f08be1eca2c 100644
--- a/cc/raster/gpu_raster_buffer_provider.cc
+++ b/cc/raster/gpu_raster_buffer_provider.cc
@@ -17,6 +17,7 @@
#include "cc/playback/raster_source.h"
#include "cc/raster/scoped_gpu_raster.h"
#include "cc/resources/resource.h"
+#include "gpu/command_buffer/client/context_support.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "third_party/skia/include/core/SkMultiPictureDraw.h"
#include "third_party/skia/include/core/SkPictureRecorder.h"
@@ -186,6 +187,44 @@ bool GpuRasterBufferProvider::CanPartialRasterIntoProvidedResource() const {
return msaa_sample_count_ == 0;
}
+bool GpuRasterBufferProvider::IsResourceReadyToDraw(
+ ResourceId resource_id) const {
+ if (!async_worker_context_enabled_)
+ return true;
+
+ gpu::SyncToken sync_token =
+ resource_provider_->GetSyncTokenForResource(resource_id);
+ if (!sync_token.HasData())
+ return true;
+
+ // IsSyncTokenSignalled is threadsafe, no need for worker context lock.
+ return worker_context_provider_->ContextSupport()->IsSyncTokenSignalled(
+ sync_token);
+}
+
+uint64_t GpuRasterBufferProvider::SetReadyToDrawCallback(
+ const ResourceProvider::ResourceIdArray& resource_ids,
+ const base::Closure& callback,
+ uint64_t pending_callback_id) const {
+ if (!async_worker_context_enabled_)
+ return 0;
+
+ gpu::SyncToken sync_token =
+ resource_provider_->GetSyncTokenForResources(resource_ids);
+ uint64_t callback_id = sync_token.release_count();
+ DCHECK_NE(callback_id, 0u);
+
+ // If the callback we are about to request has the same ID as the one which
vmpstr 2017/01/05 22:00:46 It's a bit awkward that this comment is talking ab
ericrk 2017/01/09 23:05:21 Done.
+ // our caller is waiting on, then the request is redundant.
+ if (callback_id != pending_callback_id) {
+ // SignalSyncToken is threadsafe, no need for worker context lock.
+ worker_context_provider_->ContextSupport()->SignalSyncToken(sync_token,
+ callback);
+ }
+
+ return callback_id;
+}
+
void GpuRasterBufferProvider::Shutdown() {
pending_raster_buffers_.clear();
}

Powered by Google App Engine
This is Rietveld 408576698