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

Side by Side Diff: ppapi/proxy/ppb_graphics_3d_proxy.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/proxy/ppb_graphics_3d_proxy.h" 5 #include "ppapi/proxy/ppb_graphics_3d_proxy.h"
6 6
7 #include "base/numerics/safe_conversions.h" 7 #include "base/numerics/safe_conversions.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "gpu/command_buffer/client/gles2_implementation.h" 9 #include "gpu/command_buffer/client/gles2_implementation.h"
10 #include "gpu/command_buffer/common/command_buffer.h" 10 #include "gpu/command_buffer/common/command_buffer.h"
11 #include "gpu/command_buffer/common/sync_token.h"
11 #include "ppapi/c/pp_errors.h" 12 #include "ppapi/c/pp_errors.h"
12 #include "ppapi/proxy/enter_proxy.h" 13 #include "ppapi/proxy/enter_proxy.h"
13 #include "ppapi/proxy/plugin_dispatcher.h" 14 #include "ppapi/proxy/plugin_dispatcher.h"
14 #include "ppapi/proxy/ppapi_command_buffer_proxy.h" 15 #include "ppapi/proxy/ppapi_command_buffer_proxy.h"
15 #include "ppapi/proxy/ppapi_messages.h" 16 #include "ppapi/proxy/ppapi_messages.h"
16 #include "ppapi/shared_impl/ppapi_globals.h" 17 #include "ppapi/shared_impl/ppapi_globals.h"
17 #include "ppapi/thunk/enter.h" 18 #include "ppapi/thunk/enter.h"
18 #include "ppapi/thunk/resource_creation_api.h" 19 #include "ppapi/thunk/resource_creation_api.h"
19 #include "ppapi/thunk/thunk.h" 20 #include "ppapi/thunk/thunk.h"
20 21
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 120 }
120 121
121 gpu::CommandBuffer* Graphics3D::GetCommandBuffer() { 122 gpu::CommandBuffer* Graphics3D::GetCommandBuffer() {
122 return command_buffer_.get(); 123 return command_buffer_.get();
123 } 124 }
124 125
125 gpu::GpuControl* Graphics3D::GetGpuControl() { 126 gpu::GpuControl* Graphics3D::GetGpuControl() {
126 return command_buffer_.get(); 127 return command_buffer_.get();
127 } 128 }
128 129
129 int32_t Graphics3D::DoSwapBuffers() { 130 int32_t Graphics3D::DoSwapBuffers(const gpu::SyncToken& sync_token) {
piman 2016/01/14 00:21:36 nit: maybe DCHECK(!sync_token.HasData());
David Yen 2016/01/14 00:36:38 Done.
130 gles2_impl()->SwapBuffers(); 131 gpu::gles2::GLES2Implementation* gl = gles2_impl();
132 gl->SwapBuffers();
133 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM();
134 gl->ShallowFlushCHROMIUM();
135
136 gpu::SyncToken new_sync_token;
137 gl->GenSyncTokenCHROMIUM(fence_sync, new_sync_token.GetData());
138
131 IPC::Message* msg = new PpapiHostMsg_PPBGraphics3D_SwapBuffers( 139 IPC::Message* msg = new PpapiHostMsg_PPBGraphics3D_SwapBuffers(
132 API_ID_PPB_GRAPHICS_3D, host_resource()); 140 API_ID_PPB_GRAPHICS_3D, host_resource(), new_sync_token);
133 msg->set_unblock(true); 141 msg->set_unblock(true);
134 PluginDispatcher::GetForResource(this)->Send(msg); 142 PluginDispatcher::GetForResource(this)->Send(msg);
135 143
136 return PP_OK_COMPLETIONPENDING; 144 return PP_OK_COMPLETIONPENDING;
137 } 145 }
138 146
139 PPB_Graphics3D_Proxy::PPB_Graphics3D_Proxy(Dispatcher* dispatcher) 147 PPB_Graphics3D_Proxy::PPB_Graphics3D_Proxy(Dispatcher* dispatcher)
140 : InterfaceProxy(dispatcher), 148 : InterfaceProxy(dispatcher),
141 callback_factory_(this) { 149 callback_factory_(this) {
142 } 150 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } 344 }
337 345
338 void PPB_Graphics3D_Proxy::OnMsgDestroyTransferBuffer( 346 void PPB_Graphics3D_Proxy::OnMsgDestroyTransferBuffer(
339 const HostResource& context, 347 const HostResource& context,
340 int32_t id) { 348 int32_t id) {
341 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); 349 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
342 if (enter.succeeded()) 350 if (enter.succeeded())
343 enter.object()->DestroyTransferBuffer(id); 351 enter.object()->DestroyTransferBuffer(id);
344 } 352 }
345 353
346 void PPB_Graphics3D_Proxy::OnMsgSwapBuffers(const HostResource& context) { 354 void PPB_Graphics3D_Proxy::OnMsgSwapBuffers(const HostResource& context,
355 const gpu::SyncToken& sync_token) {
347 EnterHostFromHostResourceForceCallback<PPB_Graphics3D_API> enter( 356 EnterHostFromHostResourceForceCallback<PPB_Graphics3D_API> enter(
348 context, callback_factory_, 357 context, callback_factory_,
349 &PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin, context); 358 &PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin, context);
350 if (enter.succeeded()) 359 if (enter.succeeded())
351 enter.SetResult(enter.object()->SwapBuffers(enter.callback())); 360 enter.SetResult(enter.object()->SwapBuffers(enter.callback(), sync_token));
352 } 361 }
353 362
354 void PPB_Graphics3D_Proxy::OnMsgInsertSyncPoint(const HostResource& context, 363 void PPB_Graphics3D_Proxy::OnMsgInsertSyncPoint(const HostResource& context,
355 uint32_t* sync_point) { 364 uint32_t* sync_point) {
356 *sync_point = 0; 365 *sync_point = 0;
357 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context); 366 EnterHostFromHostResource<PPB_Graphics3D_API> enter(context);
358 if (enter.succeeded()) 367 if (enter.succeeded())
359 *sync_point = enter.object()->InsertSyncPoint(); 368 *sync_point = enter.object()->InsertSyncPoint();
360 } 369 }
361 370
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin( 402 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin(
394 int32_t result, 403 int32_t result,
395 const HostResource& context) { 404 const HostResource& context) {
396 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( 405 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK(
397 API_ID_PPB_GRAPHICS_3D, context, result)); 406 API_ID_PPB_GRAPHICS_3D, context, result));
398 } 407 }
399 #endif // !defined(OS_NACL) 408 #endif // !defined(OS_NACL)
400 409
401 } // namespace proxy 410 } // namespace proxy
402 } // namespace ppapi 411 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698