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

Side by Side Diff: ppapi/proxy/compositor_layer_resource.cc

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mock gpu video accelerator factory Created 5 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/compositor_layer_resource.h" 5 #include "ppapi/proxy/compositor_layer_resource.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "gpu/GLES2/gl2extchromium.h" 10 #include "gpu/GLES2/gl2extchromium.h"
11 #include "gpu/command_buffer/client/gles2_implementation.h" 11 #include "gpu/command_buffer/client/gles2_implementation.h"
12 #include "gpu/command_buffer/common/mailbox.h" 12 #include "gpu/command_buffer/common/mailbox.h"
13 #include "gpu/command_buffer/common/sync_token.h"
13 #include "ppapi/proxy/compositor_resource.h" 14 #include "ppapi/proxy/compositor_resource.h"
14 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h" 15 #include "ppapi/shared_impl/ppb_graphics_3d_shared.h"
15 #include "ppapi/thunk/enter.h" 16 #include "ppapi/thunk/enter.h"
16 #include "ppapi/thunk/ppb_graphics_3d_api.h" 17 #include "ppapi/thunk/ppb_graphics_3d_api.h"
17 #include "ppapi/thunk/ppb_image_data_api.h" 18 #include "ppapi/thunk/ppb_image_data_api.h"
18 19
19 using gpu::gles2::GLES2Implementation; 20 using gpu::gles2::GLES2Implementation;
20 using ppapi::thunk::EnterResourceNoLock; 21 using ppapi::thunk::EnterResourceNoLock;
21 using ppapi::thunk::PPB_ImageData_API; 22 using ppapi::thunk::PPB_ImageData_API;
22 using ppapi::thunk::PPB_Graphics3D_API; 23 using ppapi::thunk::PPB_Graphics3D_API;
23 24
24 namespace ppapi { 25 namespace ppapi {
25 namespace proxy { 26 namespace proxy {
26 27
27 namespace { 28 namespace {
28 29
29 float clamp(float value) { 30 float clamp(float value) {
30 return std::min(std::max(value, 0.0f), 1.0f); 31 return std::min(std::max(value, 0.0f), 1.0f);
31 } 32 }
32 33
33 void OnTextureReleased( 34 void OnTextureReleased(const ScopedPPResource& layer,
34 const ScopedPPResource& layer, 35 const ScopedPPResource& context,
35 const ScopedPPResource& context, 36 uint32_t texture,
36 uint32_t texture, 37 const scoped_refptr<TrackedCallback>& release_callback,
37 const scoped_refptr<TrackedCallback>& release_callback, 38 int32_t result,
38 int32_t result, 39 uint32_t sync_point,
39 uint32_t sync_point, 40 const gpu::SyncToken& sync_token,
40 bool is_lost) { 41 bool is_lost) {
41 if (!TrackedCallback::IsPending(release_callback)) 42 if (!TrackedCallback::IsPending(release_callback))
42 return; 43 return;
43 44
44 if (result != PP_OK) { 45 if (result != PP_OK) {
45 release_callback->Run(result); 46 release_callback->Run(result);
46 return; 47 return;
47 } 48 }
48 49
49 do { 50 do {
50 if (!sync_point) 51 if (!sync_point && !sync_token.HasData())
51 break; 52 break;
52 53
53 EnterResourceNoLock<PPB_Graphics3D_API> enter(context.get(), true); 54 EnterResourceNoLock<PPB_Graphics3D_API> enter(context.get(), true);
54 if (enter.failed()) 55 if (enter.failed())
55 break; 56 break;
56 57
57 PPB_Graphics3D_Shared* graphics = 58 PPB_Graphics3D_Shared* graphics =
58 static_cast<PPB_Graphics3D_Shared*>(enter.object()); 59 static_cast<PPB_Graphics3D_Shared*>(enter.object());
59 60
60 GLES2Implementation* gl = graphics->gles2_impl(); 61 GLES2Implementation* gl = graphics->gles2_impl();
61 gl->WaitSyncPointCHROMIUM(sync_point); 62 gl->WaitSyncPointCHROMIUM(sync_point, sync_token.GetConstData());
62 } while (false); 63 } while (false);
63 64
64 release_callback->Run(is_lost ? PP_ERROR_FAILED : PP_OK); 65 release_callback->Run(is_lost ? PP_ERROR_FAILED : PP_OK);
65 } 66 }
66 67
67 void OnImageReleased( 68 void OnImageReleased(const ScopedPPResource& layer,
68 const ScopedPPResource& layer, 69 const ScopedPPResource& image,
69 const ScopedPPResource& image, 70 const scoped_refptr<TrackedCallback>& release_callback,
70 const scoped_refptr<TrackedCallback>& release_callback, 71 int32_t result,
71 int32_t result, 72 uint32_t sync_point,
72 uint32_t sync_point, 73 const gpu::SyncToken& sync_token,
73 bool is_lost) { 74 bool is_lost) {
74 if (!TrackedCallback::IsPending(release_callback)) 75 if (!TrackedCallback::IsPending(release_callback))
75 return; 76 return;
76 release_callback->Run(result); 77 release_callback->Run(result);
77 } 78 }
78 79
79 } // namespace 80 } // namespace
80 81
81 CompositorLayerResource::CompositorLayerResource( 82 CompositorLayerResource::CompositorLayerResource(
82 Connection connection, 83 Connection connection,
83 PP_Instance instance, 84 PP_Instance instance,
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 380
380 // Do not allow using a block callback as a release callback. 381 // Do not allow using a block callback as a release callback.
381 if (release_callback->is_blocking()) 382 if (release_callback->is_blocking())
382 return PP_ERROR_BADARGUMENT; 383 return PP_ERROR_BADARGUMENT;
383 384
384 return PP_OK; 385 return PP_OK;
385 } 386 }
386 387
387 } // namespace proxy 388 } // namespace proxy
388 } // namespace ppapi 389 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698