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

Unified Diff: cc/raster/one_copy_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/one_copy_raster_buffer_provider.cc
diff --git a/cc/raster/one_copy_raster_buffer_provider.cc b/cc/raster/one_copy_raster_buffer_provider.cc
index a16e61b9dd6231e8de25b1e9cd67613f4690ba68..c19ab4b8384e1b894a93ba615b8ca5e2ed8ea2d4 100644
--- a/cc/raster/one_copy_raster_buffer_provider.cc
+++ b/cc/raster/one_copy_raster_buffer_provider.cc
@@ -21,6 +21,7 @@
#include "cc/resources/resource_util.h"
#include "cc/resources/scoped_resource.h"
#include "gpu/GLES2/gl2extchromium.h"
+#include "gpu/command_buffer/client/context_support.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
#include "ui/gfx/buffer_format_util.h"
@@ -162,6 +163,44 @@ bool OneCopyRasterBufferProvider::CanPartialRasterIntoProvidedResource() const {
return false;
}
+bool OneCopyRasterBufferProvider::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 OneCopyRasterBufferProvider::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 Same here.
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 OneCopyRasterBufferProvider::Shutdown() {
staging_pool_.Shutdown();
pending_raster_buffers_.clear();

Powered by Google App Engine
This is Rietveld 408576698