OLD | NEW |
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_TESTS_GL_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_TESTS_GL_MANAGER_H_ |
6 #define GPU_COMMAND_BUFFER_TESTS_GL_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_TESTS_GL_MANAGER_H_ |
7 | 7 |
8 #include "base/containers/scoped_ptr_hash_map.h" | 8 #include "base/containers/scoped_ptr_hash_map.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 class GLContext; | 23 class GLContext; |
24 class GLShareGroup; | 24 class GLShareGroup; |
25 class GLSurface; | 25 class GLSurface; |
26 | 26 |
27 } | 27 } |
28 | 28 |
29 namespace gpu { | 29 namespace gpu { |
30 | 30 |
31 class CommandBufferService; | 31 class CommandBufferService; |
32 class GpuScheduler; | 32 class GpuScheduler; |
| 33 class SyncPointClient; |
| 34 class SyncPointOrderData; |
| 35 class SyncPointManager; |
33 class TransferBuffer; | 36 class TransferBuffer; |
34 | 37 |
35 namespace gles2 { | 38 namespace gles2 { |
36 | 39 |
37 class ContextGroup; | 40 class ContextGroup; |
38 class MailboxManager; | 41 class MailboxManager; |
39 class GLES2Decoder; | 42 class GLES2Decoder; |
40 class GLES2CmdHelper; | 43 class GLES2CmdHelper; |
41 class GLES2Implementation; | 44 class GLES2Implementation; |
42 class ImageManager; | 45 class ImageManager; |
43 class ShareGroup; | 46 class ShareGroup; |
44 | 47 |
45 }; | 48 }; |
46 | 49 |
47 class GLManager : private GpuControl { | 50 class GLManager : private GpuControl { |
48 public: | 51 public: |
49 struct Options { | 52 struct Options { |
50 Options(); | 53 Options(); |
51 // The size of the backbuffer. | 54 // The size of the backbuffer. |
52 gfx::Size size; | 55 gfx::Size size; |
| 56 // If not null will have a corresponding sync point manager. |
| 57 SyncPointManager* sync_point_manager; |
53 // If not null will share resources with this context. | 58 // If not null will share resources with this context. |
54 GLManager* share_group_manager; | 59 GLManager* share_group_manager; |
55 // If not null will share a mailbox manager with this context. | 60 // If not null will share a mailbox manager with this context. |
56 GLManager* share_mailbox_manager; | 61 GLManager* share_mailbox_manager; |
57 // If not null will create a virtual manager based on this context. | 62 // If not null will create a virtual manager based on this context. |
58 GLManager* virtual_manager; | 63 GLManager* virtual_manager; |
59 // Whether or not glBindXXX generates a resource. | 64 // Whether or not glBindXXX generates a resource. |
60 bool bind_generates_resource; | 65 bool bind_generates_resource; |
61 // Whether or not the context is auto-lost when GL_OUT_OF_MEMORY occurs. | 66 // Whether or not the context is auto-lost when GL_OUT_OF_MEMORY occurs. |
62 bool lose_context_when_out_of_memory; | 67 bool lose_context_when_out_of_memory; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 void RetireSyncPoint(uint32 sync_point) override; | 125 void RetireSyncPoint(uint32 sync_point) override; |
121 void SignalSyncPoint(uint32 sync_point, | 126 void SignalSyncPoint(uint32 sync_point, |
122 const base::Closure& callback) override; | 127 const base::Closure& callback) override; |
123 void SignalQuery(uint32 query, const base::Closure& callback) override; | 128 void SignalQuery(uint32 query, const base::Closure& callback) override; |
124 void SetSurfaceVisible(bool visible) override; | 129 void SetSurfaceVisible(bool visible) override; |
125 uint32 CreateStreamTexture(uint32 texture_id) override; | 130 uint32 CreateStreamTexture(uint32 texture_id) override; |
126 void SetLock(base::Lock*) override; | 131 void SetLock(base::Lock*) override; |
127 bool IsGpuChannelLost() override; | 132 bool IsGpuChannelLost() override; |
128 gpu::CommandBufferNamespace GetNamespaceID() const override; | 133 gpu::CommandBufferNamespace GetNamespaceID() const override; |
129 uint64_t GetCommandBufferID() const override; | 134 uint64_t GetCommandBufferID() const override; |
| 135 uint64_t GenerateFenceSyncRelease() override; |
| 136 bool IsFenceSyncRelease(uint64_t release) override; |
| 137 bool IsFenceSyncFlushed(uint64_t release) override; |
130 | 138 |
131 private: | 139 private: |
132 void PumpCommands(); | 140 void PumpCommands(); |
133 bool GetBufferChanged(int32 transfer_buffer_id); | 141 bool GetBufferChanged(int32 transfer_buffer_id); |
134 void SetupBaseContext(); | 142 void SetupBaseContext(); |
| 143 void OnFenceSyncRelease(uint64_t release); |
| 144 bool OnWaitFenceSync(gpu::CommandBufferNamespace namespace_id, |
| 145 uint64_t command_buffer_id, |
| 146 uint64_t release); |
135 | 147 |
| 148 SyncPointManager* sync_point_manager_; // Non-owning. |
| 149 |
| 150 scoped_refptr<SyncPointOrderData> sync_point_order_data_; |
| 151 scoped_ptr<SyncPointClient> sync_point_client_; |
136 scoped_refptr<gles2::MailboxManager> mailbox_manager_; | 152 scoped_refptr<gles2::MailboxManager> mailbox_manager_; |
137 scoped_refptr<gfx::GLShareGroup> share_group_; | 153 scoped_refptr<gfx::GLShareGroup> share_group_; |
138 scoped_ptr<CommandBufferService> command_buffer_; | 154 scoped_ptr<CommandBufferService> command_buffer_; |
139 scoped_ptr<gles2::GLES2Decoder> decoder_; | 155 scoped_ptr<gles2::GLES2Decoder> decoder_; |
140 scoped_ptr<GpuScheduler> gpu_scheduler_; | 156 scoped_ptr<GpuScheduler> gpu_scheduler_; |
141 scoped_refptr<gfx::GLSurface> surface_; | 157 scoped_refptr<gfx::GLSurface> surface_; |
142 scoped_refptr<gfx::GLContext> context_; | 158 scoped_refptr<gfx::GLContext> context_; |
143 scoped_ptr<gles2::GLES2CmdHelper> gles2_helper_; | 159 scoped_ptr<gles2::GLES2CmdHelper> gles2_helper_; |
144 scoped_ptr<TransferBuffer> transfer_buffer_; | 160 scoped_ptr<TransferBuffer> transfer_buffer_; |
145 scoped_ptr<gles2::GLES2Implementation> gles2_implementation_; | 161 scoped_ptr<gles2::GLES2Implementation> gles2_implementation_; |
146 bool context_lost_allowed_; | 162 bool context_lost_allowed_; |
147 | 163 |
| 164 const uint64_t command_buffer_id_; |
| 165 uint64_t next_fence_sync_release_; |
| 166 |
148 // Used on Android to virtualize GL for all contexts. | 167 // Used on Android to virtualize GL for all contexts. |
149 static int use_count_; | 168 static int use_count_; |
150 static scoped_refptr<gfx::GLShareGroup>* base_share_group_; | 169 static scoped_refptr<gfx::GLShareGroup>* base_share_group_; |
151 static scoped_refptr<gfx::GLSurface>* base_surface_; | 170 static scoped_refptr<gfx::GLSurface>* base_surface_; |
152 static scoped_refptr<gfx::GLContext>* base_context_; | 171 static scoped_refptr<gfx::GLContext>* base_context_; |
153 }; | 172 }; |
154 | 173 |
155 } // namespace gpu | 174 } // namespace gpu |
156 | 175 |
157 #endif // GPU_COMMAND_BUFFER_TESTS_GL_MANAGER_H_ | 176 #endif // GPU_COMMAND_BUFFER_TESTS_GL_MANAGER_H_ |
OLD | NEW |