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

Unified Diff: cc/raster/gpu_raster_buffer_provider.cc

Issue 2555743004: Delay activation/draw on GPU tile work completion (Closed)
Patch Set: Fix tile release logic. Created 4 years 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 9bc475d80c55ca6583f22e31f0b522c81a016e44..14bbdad31db79493648265db45a36392193d0c69 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,42 @@ 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;
+
+ return compositor_context_provider_->ContextSupport()->IsFenceSyncReleased(
+ sync_token.release_count());
vmiura 2017/01/05 01:54:41 This should be checking the release count on worke
ericrk 2017/01/05 21:20:40 Good catch. Thanks!
+}
+
+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
+ // our caller is waiting on, then the request is redundant.
+ if (callback_id != pending_callback_id) {
+ compositor_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