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

Side by Side Diff: gpu/command_buffer/client/share_group.cc

Issue 613843003: Avoid holding locks across sync IPCs in command buffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « gpu/command_buffer/client/program_info_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stack> 5 #include <stack>
6 #include <vector> 6 #include <vector>
7 7
8 #include "gpu/command_buffer/client/share_group.h" 8 #include "gpu/command_buffer/client/share_group.h"
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 ids[ii] = id_allocator_.AllocateIDAtOrAbove(id_offset); 42 ids[ii] = id_allocator_.AllocateIDAtOrAbove(id_offset);
43 id_offset = ids[ii] + 1; 43 id_offset = ids[ii] + 1;
44 } 44 }
45 } 45 }
46 } 46 }
47 47
48 // Overridden from IdHandlerInterface. 48 // Overridden from IdHandlerInterface.
49 virtual bool FreeIds( 49 virtual bool FreeIds(
50 GLES2Implementation* gl_impl, 50 GLES2Implementation* gl_impl,
51 GLsizei n, const GLuint* ids, DeleteFn delete_fn) OVERRIDE { 51 GLsizei n, const GLuint* ids, DeleteFn delete_fn) OVERRIDE {
52 // Possibly may do a synchronous ipc, so can't hold a lock across it on
53 // pepper: http://crbug.com/418651
54 (gl_impl->*delete_fn)(n, ids);
55 // We need to ensure that the delete call is evaluated on the service side
56 // before any other contexts issue commands using these client ids.
57 // TODO(vmiura): Can remove this by virtualizing internal ids, however
58 // this code only affects PPAPI for now.
59 gl_impl->helper()->CommandBufferHelper::Flush();
60
52 base::AutoLock auto_lock(lock_); 61 base::AutoLock auto_lock(lock_);
53 62
54 for (GLsizei ii = 0; ii < n; ++ii) { 63 for (GLsizei ii = 0; ii < n; ++ii) {
55 id_allocator_.FreeID(ids[ii]); 64 id_allocator_.FreeID(ids[ii]);
56 } 65 }
piman 2014/10/02 21:44:02 I think this change would cause a potential race i
Peng 2014/12/05 18:16:42 I think delete_fn and Flush() do not use sync IPC
piman 2014/12/05 20:51:49 delete_fn will use a sync IPC in some cases, e.g.
57 66
58 (gl_impl->*delete_fn)(n, ids);
59 // We need to ensure that the delete call is evaluated on the service side
60 // before any other contexts issue commands using these client ids.
61 // TODO(vmiura): Can remove this by virtualizing internal ids, however
62 // this code only affects PPAPI for now.
63 gl_impl->helper()->CommandBufferHelper::Flush();
64 return true; 67 return true;
65 } 68 }
66 69
67 // Overridden from IdHandlerInterface. 70 // Overridden from IdHandlerInterface.
68 virtual bool MarkAsUsedForBind(GLuint id) OVERRIDE { 71 virtual bool MarkAsUsedForBind(GLuint id) OVERRIDE {
69 if (id == 0) 72 if (id == 0)
70 return true; 73 return true;
71 base::AutoLock auto_lock(lock_); 74 base::AutoLock auto_lock(lock_);
72 return id_allocator_.MarkAsUsed(id); 75 return id_allocator_.MarkAsUsed(id);
73 } 76 }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 } 253 }
251 254
252 void ShareGroup::set_program_info_manager(ProgramInfoManager* manager) { 255 void ShareGroup::set_program_info_manager(ProgramInfoManager* manager) {
253 program_info_manager_.reset(manager); 256 program_info_manager_.reset(manager);
254 } 257 }
255 258
256 ShareGroup::~ShareGroup() {} 259 ShareGroup::~ShareGroup() {}
257 260
258 } // namespace gles2 261 } // namespace gles2
259 } // namespace gpu 262 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/program_info_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698