summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordyen <dyen@chromium.org>2016-01-12 10:30:42 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-12 18:31:28 +0000
commit4de3d345f1cd4238dd56edf883a5fbd0636a5215 (patch)
treef6df66914cd741ae87d499e88b7ba288e1bb5f68
parent9a07ab330a5e6dcfe0c7c3a26f9b1aaa77bdac6d (diff)
downloadchromium_src-4de3d345f1cd4238dd56edf883a5fbd0636a5215.zip
chromium_src-4de3d345f1cd4238dd56edf883a5fbd0636a5215.tar.gz
chromium_src-4de3d345f1cd4238dd56edf883a5fbd0636a5215.tar.bz2
Added a Ppapi method to validate flushes reached the GPU process.
In order to be sure Ppapi applications can properly pass around sync tokens, they need to ensure sync tokens have been received by the Gpu process before passing the sync token. This is done through a synchronous Nop IPC which gets passed to the Ppapi Host which then passes a synchronous Nop IPC to the Gpu Process. BUG=574269, 514815 Review URL: https://codereview.chromium.org/1579013002 Cr-Commit-Position: refs/heads/master@{#368917}
-rw-r--r--content/renderer/pepper/ppb_graphics_3d_impl.cc4
-rw-r--r--content/renderer/pepper/ppb_graphics_3d_impl.h1
-rw-r--r--ppapi/proxy/ppapi_command_buffer_proxy.cc19
-rw-r--r--ppapi/proxy/ppapi_command_buffer_proxy.h1
-rw-r--r--ppapi/proxy/ppapi_messages.h2
-rw-r--r--ppapi/proxy/ppb_graphics_3d_proxy.cc12
-rw-r--r--ppapi/proxy/ppb_graphics_3d_proxy.h2
-rw-r--r--ppapi/thunk/ppb_graphics_3d_api.h1
8 files changed, 37 insertions, 5 deletions
diff --git a/content/renderer/pepper/ppb_graphics_3d_impl.cc b/content/renderer/pepper/ppb_graphics_3d_impl.cc
index 33e5326..b999aac 100644
--- a/content/renderer/pepper/ppb_graphics_3d_impl.cc
+++ b/content/renderer/pepper/ppb_graphics_3d_impl.cc
@@ -144,6 +144,10 @@ void PPB_Graphics3D_Impl::RetireSyncPoint(uint32_t sync_point) {
return command_buffer_->RetireSyncPoint(sync_point);
}
+void PPB_Graphics3D_Impl::EnsureWorkVisible() {
+ command_buffer_->EnsureWorkVisible();
+}
+
bool PPB_Graphics3D_Impl::BindToInstance(bool bind) {
bound_to_instance_ = bind;
return true;
diff --git a/content/renderer/pepper/ppb_graphics_3d_impl.h b/content/renderer/pepper/ppb_graphics_3d_impl.h
index 3d103f2..8f816a3 100644
--- a/content/renderer/pepper/ppb_graphics_3d_impl.h
+++ b/content/renderer/pepper/ppb_graphics_3d_impl.h
@@ -48,6 +48,7 @@ class PPB_Graphics3D_Impl : public ppapi::PPB_Graphics3D_Shared {
uint32_t InsertSyncPoint() override;
uint32_t InsertFutureSyncPoint() override;
void RetireSyncPoint(uint32_t) override;
+ void EnsureWorkVisible() override;
// Binds/unbinds the graphics of this context with the associated instance.
// Returns true if binding/unbinding is successful.
diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.cc b/ppapi/proxy/ppapi_command_buffer_proxy.cc
index 14cb226..c645927 100644
--- a/ppapi/proxy/ppapi_command_buffer_proxy.cc
+++ b/ppapi/proxy/ppapi_command_buffer_proxy.cc
@@ -27,7 +27,8 @@ PpapiCommandBufferProxy::PpapiCommandBufferProxy(
dispatcher_(dispatcher),
next_fence_sync_release_(1),
pending_fence_sync_release_(0),
- flushed_fence_sync_release_(0) {
+ flushed_fence_sync_release_(0),
+ validated_fence_sync_release_(0) {
shared_state_shm_.reset(
new base::SharedMemory(shared_state.shmem(), false));
shared_state_shm_->Map(shared_state.size());
@@ -184,7 +185,10 @@ bool PpapiCommandBufferProxy::IsGpuChannelLost() {
}
void PpapiCommandBufferProxy::EnsureWorkVisible() {
- NOTIMPLEMENTED();
+ DCHECK_GE(flushed_fence_sync_release_, validated_fence_sync_release_);
+ Send(new PpapiHostMsg_PPBGraphics3D_EnsureWorkVisible(
+ ppapi::API_ID_PPB_GRAPHICS_3D, resource_));
+ validated_fence_sync_release_ = flushed_fence_sync_release_;
}
gpu::CommandBufferNamespace PpapiCommandBufferProxy::GetNamespaceID() const {
@@ -208,9 +212,14 @@ bool PpapiCommandBufferProxy::IsFenceSyncFlushed(uint64_t release) {
}
bool PpapiCommandBufferProxy::IsFenceSyncFlushReceived(uint64_t release) {
- // TODO(dyen): This needs a synchronous NOP to the PpapiHost which
- // also sends a synchronous NOP to the actual server.
- return IsFenceSyncFlushed(release);
+ if (!IsFenceSyncFlushed(release))
+ return false;
+
+ if (release <= validated_fence_sync_release_)
+ return true;
+
+ EnsureWorkVisible();
+ return release <= validated_fence_sync_release_;
}
void PpapiCommandBufferProxy::SignalSyncToken(const gpu::SyncToken& sync_token,
diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.h b/ppapi/proxy/ppapi_command_buffer_proxy.h
index e18115d..8e34506 100644
--- a/ppapi/proxy/ppapi_command_buffer_proxy.h
+++ b/ppapi/proxy/ppapi_command_buffer_proxy.h
@@ -110,6 +110,7 @@ class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer,
uint64_t next_fence_sync_release_;
uint64_t pending_fence_sync_release_;
uint64_t flushed_fence_sync_release_;
+ uint64_t validated_fence_sync_release_;
DISALLOW_COPY_AND_ASSIGN(PpapiCommandBufferProxy);
};
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 9a1f45c..0284079 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -1053,6 +1053,8 @@ IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBGraphics3D_InsertFutureSyncPoint,
IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBGraphics3D_RetireSyncPoint,
ppapi::HostResource /* context */,
uint32_t /* sync_point */)
+IPC_SYNC_MESSAGE_ROUTED1_0(PpapiHostMsg_PPBGraphics3D_EnsureWorkVisible,
+ ppapi::HostResource /* context */)
// PPB_ImageData.
IPC_SYNC_MESSAGE_ROUTED4_3(PpapiHostMsg_PPBImageData_CreatePlatform,
diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.cc b/ppapi/proxy/ppb_graphics_3d_proxy.cc
index 06db5af..e05aba2 100644
--- a/ppapi/proxy/ppb_graphics_3d_proxy.cc
+++ b/ppapi/proxy/ppb_graphics_3d_proxy.cc
@@ -114,6 +114,10 @@ void Graphics3D::RetireSyncPoint(uint32_t sync_point) {
NOTREACHED();
}
+void Graphics3D::EnsureWorkVisible() {
+ NOTREACHED();
+}
+
gpu::CommandBuffer* Graphics3D::GetCommandBuffer() {
return command_buffer_.get();
}
@@ -217,6 +221,8 @@ bool PPB_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) {
OnMsgInsertFutureSyncPoint)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_RetireSyncPoint,
OnMsgRetireSyncPoint)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_EnsureWorkVisible,
+ OnMsgEnsureWorkVisible)
#endif // !defined(OS_NACL)
IPC_MESSAGE_HANDLER(PpapiMsg_PPBGraphics3D_SwapBuffersACK,
@@ -368,6 +374,12 @@ void PPB_Graphics3D_Proxy::OnMsgRetireSyncPoint(const HostResource& context,
if (enter.succeeded())
enter.object()->RetireSyncPoint(sync_point);
}
+
+void PPB_Graphics3D_Proxy::OnMsgEnsureWorkVisible(const HostResource& context) {
+ EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
+ if (enter.succeeded())
+ enter.object()->EnsureWorkVisible();
+}
#endif // !defined(OS_NACL)
void PPB_Graphics3D_Proxy::OnMsgSwapBuffersACK(const HostResource& resource,
diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.h b/ppapi/proxy/ppb_graphics_3d_proxy.h
index acbaa81..98acb58 100644
--- a/ppapi/proxy/ppb_graphics_3d_proxy.h
+++ b/ppapi/proxy/ppb_graphics_3d_proxy.h
@@ -56,6 +56,7 @@ class PPAPI_PROXY_EXPORT Graphics3D : public PPB_Graphics3D_Shared {
uint32_t InsertSyncPoint() override;
uint32_t InsertFutureSyncPoint() override;
void RetireSyncPoint(uint32_t sync_point) override;
+ void EnsureWorkVisible() override;
private:
// PPB_Graphics3D_Shared overrides.
@@ -114,6 +115,7 @@ class PPB_Graphics3D_Proxy : public InterfaceProxy {
void OnMsgInsertFutureSyncPoint(const HostResource& context,
uint32_t* sync_point);
void OnMsgRetireSyncPoint(const HostResource& context, uint32_t sync_point);
+ void OnMsgEnsureWorkVisible(const HostResource& context);
// Renderer->plugin message handlers.
void OnMsgSwapBuffersACK(const HostResource& context,
int32_t pp_error);
diff --git a/ppapi/thunk/ppb_graphics_3d_api.h b/ppapi/thunk/ppb_graphics_3d_api.h
index a75efa1..1d28ff3 100644
--- a/ppapi/thunk/ppb_graphics_3d_api.h
+++ b/ppapi/thunk/ppb_graphics_3d_api.h
@@ -57,6 +57,7 @@ class PPAPI_THUNK_EXPORT PPB_Graphics3D_API {
virtual uint32_t InsertSyncPoint() = 0;
virtual uint32_t InsertFutureSyncPoint() = 0;
virtual void RetireSyncPoint(uint32_t sync_point) = 0;
+ virtual void EnsureWorkVisible() = 0;
};
} // namespace thunk