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

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

Issue 1331843005: Implemented new fence syncs which replaces the old sync points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Some fixes Created 5 years, 3 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
(Empty)
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef GPU_COMMAND_BUFFER_SERVICE_SYNC_FENCE_MANAGER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_SYNC_FENCE_MANAGER_H_
7
8 #include <functional>
9 #include <queue>
10
11 #include "base/callback.h"
12 #include "gpu/gpu_export.h"
13
14 namespace gpu {
15
16 // This class manages the sync fences, which allow cross-channel
17 // synchronization.
18 class GPU_EXPORT FenceSyncManager {
19 public:
20 FenceSyncManager();
21 ~FenceSyncManager();
22
23 void AddFenceSyncCallback(uint32_t max_order_number,
24 uint32_t release,
25 const base::Closure& callback);
26
27 bool IsFenceSyncReleased(uint32_t release) const {
28 return release <= fence_sync_release_;
29 }
30
31 void ReleaseFenceSync(uint32_t release);
32
33 private:
34 struct FenceSyncCallback {
35 uint32_t release_count;
36 base::Closure callback_closure;
37
38 FenceSyncCallback(uint32_t release, const base::Closure& callback);
39 ~FenceSyncCallback();
40
41 bool operator>(const FenceSyncCallback& rhs) const {
42 return release_count > rhs.release_count;
43 }
44 };
45 typedef std::priority_queue<FenceSyncCallback,
46 std::vector<FenceSyncCallback>,
47 std::greater<FenceSyncCallback>> CallbackQueue;
48
49 // Current fence sync release that has been signaled.
50 uint32_t fence_sync_release_;
51
52 // In well defined fence sync operations, fence syncs are released in order
53 // so simply having a priority queue for callbacks is enough.
54 CallbackQueue fence_callback_queue_;
55
56 DISALLOW_COPY_AND_ASSIGN(FenceSyncManager);
57 };
58
59 } // namespace gpu
60
61 #endif // GPU_COMMAND_BUFFER_SERVICE_SYNC_FENCE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698