summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-18 21:52:36 +0000
committerjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-18 21:52:36 +0000
commit7fe4198bebda573b64e2bd8ec1ef2b2ebc902ac6 (patch)
tree74d4ac9ad50c41e19b3898436d08c03fe8ecc465 /ppapi
parent13a4860eac01a10ead94c7cf683f465756f1691a (diff)
downloadchromium_src-7fe4198bebda573b64e2bd8ec1ef2b2ebc902ac6.zip
chromium_src-7fe4198bebda573b64e2bd8ec1ef2b2ebc902ac6.tar.gz
chromium_src-7fe4198bebda573b64e2bd8ec1ef2b2ebc902ac6.tar.bz2
Replace command buffer FlushSync with WaitForTokenInRange and WaitForGetOffsetInRange
This allows the command-buffer interface to be more clear about what's happening, so we'll later be able to create IPCs that wait specifically for one of these events to happen. Currently both function are still implemented by looping on the GetStateFast IPC. BUG=349632 Review URL: https://codereview.chromium.org/189123004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257771 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/proxy/ppapi_command_buffer_proxy.cc47
-rw-r--r--ppapi/proxy/ppapi_command_buffer_proxy.h3
-rw-r--r--ppapi/proxy/ppapi_messages.h12
-rw-r--r--ppapi/proxy/ppb_graphics_3d_proxy.cc50
-rw-r--r--ppapi/proxy/ppb_graphics_3d_proxy.h27
-rw-r--r--ppapi/thunk/ppb_graphics_3d_api.h7
6 files changed, 95 insertions, 51 deletions
diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.cc b/ppapi/proxy/ppapi_command_buffer_proxy.cc
index 6d9a0ae..81bc442 100644
--- a/ppapi/proxy/ppapi_command_buffer_proxy.cc
+++ b/ppapi/proxy/ppapi_command_buffer_proxy.cc
@@ -72,23 +72,36 @@ void PpapiCommandBufferProxy::Flush(int32 put_offset) {
Send(message);
}
-gpu::CommandBuffer::State PpapiCommandBufferProxy::FlushSync(int32 put_offset,
- int32 last_known_get) {
- if (last_known_get == last_state_.get_offset) {
- // Send will flag state with lost context if IPC fails.
- if (last_state_.error == gpu::error::kNoError) {
- gpu::CommandBuffer::State state;
- bool success = false;
- if (Send(new PpapiHostMsg_PPBGraphics3D_Flush(
- ppapi::API_ID_PPB_GRAPHICS_3D, resource_, put_offset,
- last_known_get, &state, &success))) {
- UpdateState(state, success);
- }
- }
- } else {
- Flush(put_offset);
- }
- return last_state_;
+void PpapiCommandBufferProxy::WaitForTokenInRange(int32 start, int32 end) {
+ if (last_state_.error != gpu::error::kNoError)
+ return;
+
+ bool success;
+ gpu::CommandBuffer::State state;
+ if (Send(new PpapiHostMsg_PPBGraphics3D_WaitForTokenInRange(
+ ppapi::API_ID_PPB_GRAPHICS_3D,
+ resource_,
+ start,
+ end,
+ &state,
+ &success)))
+ UpdateState(state, success);
+}
+
+void PpapiCommandBufferProxy::WaitForGetOffsetInRange(int32 start, int32 end) {
+ if (last_state_.error != gpu::error::kNoError)
+ return;
+
+ bool success;
+ gpu::CommandBuffer::State state;
+ if (Send(new PpapiHostMsg_PPBGraphics3D_WaitForGetOffsetInRange(
+ ppapi::API_ID_PPB_GRAPHICS_3D,
+ resource_,
+ start,
+ end,
+ &state,
+ &success)))
+ UpdateState(state, success);
}
void PpapiCommandBufferProxy::SetGetBuffer(int32 transfer_buffer_id) {
diff --git a/ppapi/proxy/ppapi_command_buffer_proxy.h b/ppapi/proxy/ppapi_command_buffer_proxy.h
index 863ffd4..c875f89 100644
--- a/ppapi/proxy/ppapi_command_buffer_proxy.h
+++ b/ppapi/proxy/ppapi_command_buffer_proxy.h
@@ -34,7 +34,8 @@ class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer,
virtual State GetLastState() OVERRIDE;
virtual int32 GetLastToken() OVERRIDE;
virtual void Flush(int32 put_offset) OVERRIDE;
- virtual State FlushSync(int32 put_offset, int32 last_known_get) OVERRIDE;
+ virtual void WaitForTokenInRange(int32 start, int32 end) OVERRIDE;
+ virtual void WaitForGetOffsetInRange(int32 start, int32 end) OVERRIDE;
virtual void SetGetBuffer(int32 transfer_buffer_id) OVERRIDE;
virtual void SetGetOffset(int32 get_offset) OVERRIDE;
virtual gpu::Buffer CreateTransferBuffer(size_t size, int32* id) OVERRIDE;
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 71f791e..bf5048e 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -798,10 +798,16 @@ IPC_SYNC_MESSAGE_ROUTED1_2(PpapiHostMsg_PPBGraphics3D_GetState,
ppapi::HostResource /* context */,
gpu::CommandBuffer::State /* state */,
bool /* success */)
-IPC_SYNC_MESSAGE_ROUTED3_2(PpapiHostMsg_PPBGraphics3D_Flush,
+IPC_SYNC_MESSAGE_ROUTED3_2(PpapiHostMsg_PPBGraphics3D_WaitForTokenInRange,
ppapi::HostResource /* context */,
- int32 /* put_offset */,
- int32 /* last_known_get */,
+ int32 /* start */,
+ int32 /* end */,
+ gpu::CommandBuffer::State /* state */,
+ bool /* success */)
+IPC_SYNC_MESSAGE_ROUTED3_2(PpapiHostMsg_PPBGraphics3D_WaitForGetOffsetInRange,
+ ppapi::HostResource /* context */,
+ int32 /* start */,
+ int32 /* end */,
gpu::CommandBuffer::State /* state */,
bool /* success */)
IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBGraphics3D_AsyncFlush,
diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.cc b/ppapi/proxy/ppb_graphics_3d_proxy.cc
index 02e06f7..847e294 100644
--- a/ppapi/proxy/ppb_graphics_3d_proxy.cc
+++ b/ppapi/proxy/ppb_graphics_3d_proxy.cc
@@ -84,10 +84,6 @@ PP_Bool Graphics3D::Flush(int32_t put_offset) {
return PP_FALSE;
}
-gpu::CommandBuffer::State Graphics3D::FlushSync(int32_t put_offset) {
- return GetErrorState();
-}
-
int32_t Graphics3D::CreateTransferBuffer(uint32_t size) {
return PP_FALSE;
}
@@ -102,8 +98,13 @@ PP_Bool Graphics3D::GetTransferBuffer(int32_t id,
return PP_FALSE;
}
-gpu::CommandBuffer::State Graphics3D::FlushSyncFast(int32_t put_offset,
- int32_t last_known_get) {
+gpu::CommandBuffer::State Graphics3D::WaitForTokenInRange(int32_t start,
+ int32_t end) {
+ return GetErrorState();
+}
+
+gpu::CommandBuffer::State Graphics3D::WaitForGetOffsetInRange(int32_t start,
+ int32_t end) {
return GetErrorState();
}
@@ -193,10 +194,11 @@ bool PPB_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) {
OnMsgSetGetBuffer)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_GetState,
OnMsgGetState)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_Flush,
- OnMsgFlush)
- IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_AsyncFlush,
- OnMsgAsyncFlush)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_WaitForTokenInRange,
+ OnMsgWaitForTokenInRange)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_WaitForGetOffsetInRange,
+ OnMsgWaitForGetOffsetInRange)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_AsyncFlush, OnMsgAsyncFlush)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer,
OnMsgCreateTransferBuffer)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer,
@@ -259,17 +261,33 @@ void PPB_Graphics3D_Proxy::OnMsgGetState(const HostResource& context,
*success = true;
}
-void PPB_Graphics3D_Proxy::OnMsgFlush(const HostResource& context,
- int32 put_offset,
- int32 last_known_get,
- gpu::CommandBuffer::State* state,
- bool* success) {
+void PPB_Graphics3D_Proxy::OnMsgWaitForTokenInRange(
+ const HostResource& context,
+ int32 start,
+ int32 end,
+ gpu::CommandBuffer::State* state,
+ bool* success) {
+ EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
+ if (enter.failed()) {
+ *success = false;
+ return;
+ }
+ *state = enter.object()->WaitForTokenInRange(start, end);
+ *success = true;
+}
+
+void PPB_Graphics3D_Proxy::OnMsgWaitForGetOffsetInRange(
+ const HostResource& context,
+ int32 start,
+ int32 end,
+ gpu::CommandBuffer::State* state,
+ bool* success) {
EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
if (enter.failed()) {
*success = false;
return;
}
- *state = enter.object()->FlushSyncFast(put_offset, last_known_get);
+ *state = enter.object()->WaitForGetOffsetInRange(start, end);
*success = true;
}
diff --git a/ppapi/proxy/ppb_graphics_3d_proxy.h b/ppapi/proxy/ppb_graphics_3d_proxy.h
index 18ba9dd..70c96e9 100644
--- a/ppapi/proxy/ppb_graphics_3d_proxy.h
+++ b/ppapi/proxy/ppb_graphics_3d_proxy.h
@@ -37,15 +37,16 @@ class Graphics3D : public PPB_Graphics3D_Shared {
virtual PP_Bool SetGetBuffer(int32_t shm_id) OVERRIDE;
virtual gpu::CommandBuffer::State GetState() OVERRIDE;
virtual PP_Bool Flush(int32_t put_offset) OVERRIDE;
- virtual gpu::CommandBuffer::State FlushSync(int32_t put_offset) OVERRIDE;
virtual int32_t CreateTransferBuffer(uint32_t size) OVERRIDE;
virtual PP_Bool DestroyTransferBuffer(int32_t id) OVERRIDE;
virtual PP_Bool GetTransferBuffer(int32_t id,
int* shm_handle,
uint32_t* shm_size) OVERRIDE;
- virtual gpu::CommandBuffer::State FlushSyncFast(
- int32_t put_offset,
- int32_t last_known_get) OVERRIDE;
+ virtual gpu::CommandBuffer::State WaitForTokenInRange(int32_t start,
+ int32_t end) OVERRIDE;
+ virtual gpu::CommandBuffer::State WaitForGetOffsetInRange(int32_t start,
+ int32_t end)
+ OVERRIDE;
virtual uint32_t InsertSyncPoint() OVERRIDE;
private:
@@ -84,13 +85,17 @@ class PPB_Graphics3D_Proxy : public InterfaceProxy {
void OnMsgGetState(const HostResource& context,
gpu::CommandBuffer::State* state,
bool* success);
- void OnMsgFlush(const HostResource& context,
- int32 put_offset,
- int32 last_known_get,
- gpu::CommandBuffer::State* state,
- bool* success);
- void OnMsgAsyncFlush(const HostResource& context,
- int32 put_offset);
+ void OnMsgWaitForTokenInRange(const HostResource& context,
+ int32 start,
+ int32 end,
+ gpu::CommandBuffer::State* state,
+ bool* success);
+ void OnMsgWaitForGetOffsetInRange(const HostResource& context,
+ int32 start,
+ int32 end,
+ gpu::CommandBuffer::State* state,
+ bool* success);
+ void OnMsgAsyncFlush(const HostResource& context, int32 put_offset);
void OnMsgCreateTransferBuffer(const HostResource& context,
uint32 size,
int32* id);
diff --git a/ppapi/thunk/ppb_graphics_3d_api.h b/ppapi/thunk/ppb_graphics_3d_api.h
index 6c6a241..a88b4ab 100644
--- a/ppapi/thunk/ppb_graphics_3d_api.h
+++ b/ppapi/thunk/ppb_graphics_3d_api.h
@@ -38,9 +38,10 @@ class PPAPI_THUNK_EXPORT PPB_Graphics3D_API {
int* shm_handle,
uint32_t* shm_size) = 0;
virtual PP_Bool Flush(int32_t put_offset) = 0;
- virtual gpu::CommandBuffer::State FlushSync(int32_t put_offset) = 0;
- virtual gpu::CommandBuffer::State FlushSyncFast(int32_t put_offset,
- int32_t last_known_get) = 0;
+ virtual gpu::CommandBuffer::State WaitForTokenInRange(int32_t start,
+ int32_t end) = 0;
+ virtual gpu::CommandBuffer::State WaitForGetOffsetInRange(int32_t start,
+ int32_t end) = 0;
// GLESChromiumTextureMapping.
virtual void* MapTexSubImage2DCHROMIUM(GLenum target,