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

Side by Side Diff: gpu/command_buffer/service/sync_point_manager.h

Issue 1975663002: Invalid sync token waits now automatically get released. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Combine the 2 while loops into 1 Created 4 years, 7 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 | « no previous file | gpu/command_buffer/service/sync_point_manager.cc » ('j') | 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 #ifndef GPU_COMMAND_BUFFER_SERVICE_SYNC_POINT_MANAGER_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_SYNC_POINT_MANAGER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_SYNC_POINT_MANAGER_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_SYNC_POINT_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <functional> 10 #include <functional>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 return !paused_ && current_order_num_ > processed_order_num(); 66 return !paused_ && current_order_num_ > processed_order_num();
67 } 67 }
68 68
69 private: 69 private:
70 friend class base::RefCountedThreadSafe<SyncPointOrderData>; 70 friend class base::RefCountedThreadSafe<SyncPointOrderData>;
71 friend class SyncPointClientState; 71 friend class SyncPointClientState;
72 72
73 struct OrderFence { 73 struct OrderFence {
74 uint32_t order_num; 74 uint32_t order_num;
75 uint64_t fence_release; 75 uint64_t fence_release;
76 base::Closure release_callback;
76 scoped_refptr<SyncPointClientState> client_state; 77 scoped_refptr<SyncPointClientState> client_state;
77 78
78 OrderFence(uint32_t order, 79 OrderFence(uint32_t order,
79 uint64_t release, 80 uint64_t release,
81 const base::Closure& release_callback,
80 scoped_refptr<SyncPointClientState> state); 82 scoped_refptr<SyncPointClientState> state);
81 OrderFence(const OrderFence& other); 83 OrderFence(const OrderFence& other);
82 ~OrderFence(); 84 ~OrderFence();
83 85
84 bool operator>(const OrderFence& rhs) const { 86 bool operator>(const OrderFence& rhs) const {
85 return (order_num > rhs.order_num) || 87 return (order_num > rhs.order_num) ||
86 ((order_num == rhs.order_num) && 88 ((order_num == rhs.order_num) &&
87 (fence_release > rhs.fence_release)); 89 (fence_release > rhs.fence_release));
88 } 90 }
89 }; 91 };
90 typedef std::priority_queue<OrderFence, 92 typedef std::priority_queue<OrderFence,
91 std::vector<OrderFence>, 93 std::vector<OrderFence>,
92 std::greater<OrderFence>> OrderFenceQueue; 94 std::greater<OrderFence>> OrderFenceQueue;
93 95
94 SyncPointOrderData(); 96 SyncPointOrderData();
95 ~SyncPointOrderData(); 97 ~SyncPointOrderData();
96 98
97 bool ValidateReleaseOrderNumber( 99 bool ValidateReleaseOrderNumber(
98 scoped_refptr<SyncPointClientState> client_state, 100 scoped_refptr<SyncPointClientState> client_state,
99 uint32_t wait_order_num, 101 uint32_t wait_order_num,
100 uint64_t fence_release); 102 uint64_t fence_release,
103 const base::Closure& release_callback);
101 104
102 // Non thread-safe functions need to be called from a single thread. 105 // Non thread-safe functions need to be called from a single thread.
103 base::ThreadChecker processing_thread_checker_; 106 base::ThreadChecker processing_thread_checker_;
104 107
105 // Current IPC order number being processed (only used on processing thread). 108 // Current IPC order number being processed (only used on processing thread).
106 uint32_t current_order_num_; 109 uint32_t current_order_num_;
107 110
108 // Whether or not the current order number is being processed or paused. 111 // Whether or not the current order number is being processed or paused.
109 bool paused_; 112 bool paused_;
110 113
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 178
176 // Queues the callback to be called if the release is valid. If the release 179 // Queues the callback to be called if the release is valid. If the release
177 // is invalid this function will return False and the callback will never 180 // is invalid this function will return False and the callback will never
178 // be called. 181 // be called.
179 bool WaitForRelease(CommandBufferNamespace namespace_id, 182 bool WaitForRelease(CommandBufferNamespace namespace_id,
180 CommandBufferId client_id, 183 CommandBufferId client_id,
181 uint32_t wait_order_num, 184 uint32_t wait_order_num,
182 uint64_t release, 185 uint64_t release,
183 const base::Closure& callback); 186 const base::Closure& callback);
184 187
188 // Releases a fence sync and all fence syncs below.
185 void ReleaseFenceSync(uint64_t release); 189 void ReleaseFenceSync(uint64_t release);
186 void EnsureReleased(uint64_t release); 190
187 void ReleaseFenceSyncLocked(uint64_t release, 191 // Does not release the fence sync, but releases callbacks waiting on that
188 std::vector<base::Closure>* callback_list); 192 // fence sync.
193 void EnsureWaitReleased(uint64_t release, const base::Closure& callback);
189 194
190 typedef base::Callback<void(CommandBufferNamespace, CommandBufferId)> 195 typedef base::Callback<void(CommandBufferNamespace, CommandBufferId)>
191 OnWaitCallback; 196 OnWaitCallback;
192 void SetOnWaitCallback(const OnWaitCallback& callback); 197 void SetOnWaitCallback(const OnWaitCallback& callback);
193 198
194 // Global order data where releases will originate from. 199 // Global order data where releases will originate from.
195 scoped_refptr<SyncPointOrderData> order_data_; 200 scoped_refptr<SyncPointOrderData> order_data_;
196 201
197 // Protects fence_sync_release_, fence_callback_queue_. 202 // Protects fence_sync_release_, fence_callback_queue_.
198 base::Lock fence_sync_lock_; 203 base::Lock fence_sync_lock_;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 // Client map holds a map of clients id to client for each namespace. 328 // Client map holds a map of clients id to client for each namespace.
324 base::Lock client_maps_lock_; 329 base::Lock client_maps_lock_;
325 ClientMap client_maps_[NUM_COMMAND_BUFFER_NAMESPACES]; 330 ClientMap client_maps_[NUM_COMMAND_BUFFER_NAMESPACES];
326 331
327 DISALLOW_COPY_AND_ASSIGN(SyncPointManager); 332 DISALLOW_COPY_AND_ASSIGN(SyncPointManager);
328 }; 333 };
329 334
330 } // namespace gpu 335 } // namespace gpu
331 336
332 #endif // GPU_COMMAND_BUFFER_SERVICE_SYNC_POINT_MANAGER_H_ 337 #endif // GPU_COMMAND_BUFFER_SERVICE_SYNC_POINT_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/sync_point_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698