| 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..03e26d763f0a32894ec425aa9e890bbdfd9779dd 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,23 @@ 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())
|
| - gl->SwapBuffers();
|
| + if (gpu::gles2::GLES2Interface* gl = gles2_interface()) {
|
| + // A valid sync token would indicate a swap buffer already happened somehow.
|
| + DCHECK(!sync_token.HasData());
|
|
|
| - // Since the backing texture has been updated, a new sync point should be
|
| - // inserted.
|
| - sync_point_ = command_buffer_->InsertSyncPoint();
|
| + gl->SwapBuffers();
|
| + const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM();
|
| + gl->OrderingBarrierCHROMIUM();
|
| + 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 +204,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 +320,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()));
|
|
|