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

Unified Diff: content/renderer/pepper/ppb_graphics_3d_impl.cc

Issue 1586883002: Converted Ppapi post swap buffer sync point to use sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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: content/renderer/pepper/ppb_graphics_3d_impl.cc
diff --git a/content/renderer/pepper/ppb_graphics_3d_impl.cc b/content/renderer/pepper/ppb_graphics_3d_impl.cc
index b999aac88bc295ef4aea874d93c094b528093f35..b533737a57889948a7c107f313f724d806e2cf88 100644
--- a/content/renderer/pepper/ppb_graphics_3d_impl.cc
+++ b/content/renderer/pepper/ppb_graphics_3d_impl.cc
@@ -50,7 +50,6 @@ PPB_Graphics3D_Impl::PPB_Graphics3D_Impl(PP_Instance instance)
: PPB_Graphics3D_Shared(instance),
bound_to_instance_(false),
commit_pending_(false),
- sync_point_(0),
has_alpha_(false),
weak_ptr_factory_(this) {}
@@ -175,17 +174,20 @@ gpu::GpuControl* PPB_Graphics3D_Impl::GetGpuControl() {
return command_buffer_.get();
}
-int32_t PPB_Graphics3D_Impl::DoSwapBuffers() {
+int32_t PPB_Graphics3D_Impl::DoSwapBuffers(const gpu::SyncToken& sync_token) {
DCHECK(command_buffer_);
+ if (sync_token.HasData())
+ sync_token_ = sync_token;
+
// We do not have a GLES2 implementation when using an OOP proxy.
// The plugin-side proxy is responsible for adding the SwapBuffers command
// to the command buffer in that case.
- if (gpu::gles2::GLES2Interface* gl = gles2_interface())
+ if (gpu::gles2::GLES2Interface* gl = gles2_interface()) {
gl->SwapBuffers();
-
- // Since the backing texture has been updated, a new sync point should be
- // inserted.
- sync_point_ = command_buffer_->InsertSyncPoint();
+ const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM();
+ gl->OrderingBarrierCHROMIUM();
piman 2016/01/14 00:21:36 nit: maybe DCHECK(!sync_token.HasData()) in this c
David Yen 2016/01/14 00:36:38 Done.
+ gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token_.GetData());
+ }
if (bound_to_instance_) {
// If we are bound to the instance, we need to ask the compositor
@@ -199,8 +201,8 @@ int32_t PPB_Graphics3D_Impl::DoSwapBuffers() {
commit_pending_ = true;
} else {
// Wait for the command to complete on the GPU to allow for throttling.
- command_buffer_->SignalSyncPoint(
- sync_point_,
+ command_buffer_->SignalSyncToken(
+ sync_token_,
base::Bind(&PPB_Graphics3D_Impl::OnSwapBuffers,
weak_ptr_factory_.GetWeakPtr()));
}
@@ -315,7 +317,6 @@ bool PPB_Graphics3D_Impl::InitRaw(
mailbox_ = gpu::Mailbox::Generate();
if (!command_buffer_->ProduceFrontBuffer(mailbox_))
return false;
- sync_point_ = command_buffer_->InsertSyncPoint();
command_buffer_->SetContextLostCallback(base::Bind(
&PPB_Graphics3D_Impl::OnContextLost, weak_ptr_factory_.GetWeakPtr()));

Powered by Google App Engine
This is Rietveld 408576698