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

Unified Diff: cc/raster/gpu_raster_buffer_provider.cc

Issue 2560253003: Delay Activation/Draw in smoothness mode.
Patch Set: more unit tests 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
« no previous file with comments | « cc/raster/gpu_raster_buffer_provider.h ('k') | cc/raster/one_copy_raster_buffer_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..62b38c4396ae395a7159b46ece4af0368082ca05 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,39 @@ bool GpuRasterBufferProvider::CanPartialRasterIntoProvidedResource() const {
return msaa_sample_count_ == 0;
}
+bool GpuRasterBufferProvider::IsResourceReadyToDraw(
+ ResourceId resource_id) const {
+ if (async_worker_context_enabled_) {
+ gpu::SyncToken sync_token =
+ resource_provider_->GetSyncTokenForResource(resource_id);
+ if (sync_token.HasData()) {
+ return compositor_context_provider_->ContextSupport()
+ ->IsFenceSyncReleased(sync_token.release_count());
+ }
+ }
+ return true;
+}
+
+uint64_t GpuRasterBufferProvider::SetReadyToDrawCallback(
+ const ResourceProvider::ResourceIdArray& resource_ids,
+ const base::Callback<void(uint64_t)>& 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 (callback_id != pending_callback_id) {
+ compositor_context_provider_->ContextSupport()->SignalSyncToken(
+ sync_token, base::Bind(callback, callback_id));
+ }
+
+ return callback_id;
+}
+
void GpuRasterBufferProvider::Shutdown() {
pending_raster_buffers_.clear();
}
« no previous file with comments | « cc/raster/gpu_raster_buffer_provider.h ('k') | cc/raster/one_copy_raster_buffer_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698