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

Side by Side Diff: gpu/ipc/service/gpu_command_buffer_stub.h

Issue 2752393002: gpu: Add SequenceId for identifying sync point sequences. (Closed)
Patch Set: piman's review 3 Created 3 years, 9 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/ipc/service/gpu_channel_manager.cc ('k') | gpu/ipc/service/gpu_command_buffer_stub.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_IPC_SERVICE_GPU_COMMAND_BUFFER_STUB_H_ 5 #ifndef GPU_IPC_SERVICE_GPU_COMMAND_BUFFER_STUB_H_
6 #define GPU_IPC_SERVICE_GPU_COMMAND_BUFFER_STUB_H_ 6 #define GPU_IPC_SERVICE_GPU_COMMAND_BUFFER_STUB_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <deque> 11 #include <deque>
12 #include <memory> 12 #include <memory>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/observer_list.h" 18 #include "base/observer_list.h"
19 #include "base/time/time.h" 19 #include "base/time/time.h"
20 #include "gpu/command_buffer/common/command_buffer_id.h" 20 #include "gpu/command_buffer/common/command_buffer_id.h"
21 #include "gpu/command_buffer/common/constants.h" 21 #include "gpu/command_buffer/common/constants.h"
22 #include "gpu/command_buffer/common/gpu_memory_allocation.h" 22 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
23 #include "gpu/command_buffer/service/command_buffer_service.h" 23 #include "gpu/command_buffer/service/command_buffer_service.h"
24 #include "gpu/command_buffer/service/command_executor.h" 24 #include "gpu/command_buffer/service/command_executor.h"
25 #include "gpu/command_buffer/service/context_group.h" 25 #include "gpu/command_buffer/service/context_group.h"
26 #include "gpu/command_buffer/service/sequence_id.h"
26 #include "gpu/gpu_export.h" 27 #include "gpu/gpu_export.h"
27 #include "gpu/ipc/common/surface_handle.h" 28 #include "gpu/ipc/common/surface_handle.h"
28 #include "gpu/ipc/service/gpu_memory_manager.h" 29 #include "gpu/ipc/service/gpu_memory_manager.h"
29 #include "gpu/ipc/service/image_transport_surface_delegate.h" 30 #include "gpu/ipc/service/image_transport_surface_delegate.h"
30 #include "ipc/ipc_listener.h" 31 #include "ipc/ipc_listener.h"
31 #include "ipc/ipc_sender.h" 32 #include "ipc/ipc_sender.h"
32 #include "ui/events/latency_info.h" 33 #include "ui/events/latency_info.h"
33 #include "ui/gfx/geometry/size.h" 34 #include "ui/gfx/geometry/size.h"
34 #include "ui/gfx/gpu_memory_buffer.h" 35 #include "ui/gfx/gpu_memory_buffer.h"
35 #include "ui/gfx/swap_result.h" 36 #include "ui/gfx/swap_result.h"
36 #include "ui/gl/gl_surface.h" 37 #include "ui/gl/gl_surface.h"
37 #include "ui/gl/gpu_preference.h" 38 #include "ui/gl/gpu_preference.h"
38 #include "url/gurl.h" 39 #include "url/gurl.h"
39 40
40 namespace gl { 41 namespace gl {
41 class GLShareGroup; 42 class GLShareGroup;
42 } 43 }
43 44
44 namespace gpu { 45 namespace gpu {
45 struct Mailbox; 46 struct Mailbox;
46 struct SyncToken; 47 struct SyncToken;
47 class SyncPointClient; 48 class SyncPointClientState;
48 } 49 }
49 50
50 struct GPUCreateCommandBufferConfig; 51 struct GPUCreateCommandBufferConfig;
51 struct GpuCommandBufferMsg_CreateImage_Params; 52 struct GpuCommandBufferMsg_CreateImage_Params;
52 53
53 namespace gpu { 54 namespace gpu {
54 55
55 class GpuChannel; 56 class GpuChannel;
56 struct WaitForCommandState; 57 struct WaitForCommandState;
57 58
58 class GPU_EXPORT GpuCommandBufferStub 59 class GPU_EXPORT GpuCommandBufferStub
59 : public IPC::Listener, 60 : public IPC::Listener,
60 public IPC::Sender, 61 public IPC::Sender,
61 public ImageTransportSurfaceDelegate, 62 public ImageTransportSurfaceDelegate,
62 public base::SupportsWeakPtr<GpuCommandBufferStub> { 63 public base::SupportsWeakPtr<GpuCommandBufferStub> {
63 public: 64 public:
64 class DestructionObserver { 65 class DestructionObserver {
65 public: 66 public:
66 // Called in Destroy(), before the context/surface are released. 67 // Called in Destroy(), before the context/surface are released.
67 virtual void OnWillDestroyStub() = 0; 68 virtual void OnWillDestroyStub() = 0;
68 69
69 protected: 70 protected:
70 virtual ~DestructionObserver() {} 71 virtual ~DestructionObserver() {}
71 }; 72 };
72 73
73 typedef base::Callback<void(const std::vector<ui::LatencyInfo>&)> 74 typedef base::Callback<void(const std::vector<ui::LatencyInfo>&)>
74 LatencyInfoCallback; 75 LatencyInfoCallback;
75 76
76 static std::unique_ptr<GpuCommandBufferStub> Create( 77 static std::unique_ptr<GpuCommandBufferStub> Create(
77 GpuChannel* channel, 78 GpuChannel* channel,
78 GpuCommandBufferStub* share_group, 79 GpuCommandBufferStub* share_group,
79 const GPUCreateCommandBufferConfig& init_params, 80 const GPUCreateCommandBufferConfig& init_params,
80 int32_t route_id, 81 CommandBufferId command_buffer_id,
81 std::unique_ptr<base::SharedMemory> shared_state_shm); 82 SequenceId sequence_id,
83 int32_t stream_id,
84 int32_t route_id,
85 std::unique_ptr<base::SharedMemory> shared_state_shm);
82 86
83 ~GpuCommandBufferStub() override; 87 ~GpuCommandBufferStub() override;
84 88
85 // IPC::Listener implementation: 89 // IPC::Listener implementation:
86 bool OnMessageReceived(const IPC::Message& message) override; 90 bool OnMessageReceived(const IPC::Message& message) override;
87 91
88 // IPC::Sender implementation: 92 // IPC::Sender implementation:
89 bool Send(IPC::Message* msg) override; 93 bool Send(IPC::Message* msg) override;
90 94
91 // ImageTransportSurfaceDelegate implementation: 95 // ImageTransportSurfaceDelegate implementation:
(...skipping 19 matching lines...) Expand all
111 // Whether there are commands in the buffer that haven't been processed. 115 // Whether there are commands in the buffer that haven't been processed.
112 bool HasUnprocessedCommands(); 116 bool HasUnprocessedCommands();
113 117
114 gles2::GLES2Decoder* decoder() const { return decoder_.get(); } 118 gles2::GLES2Decoder* decoder() const { return decoder_.get(); }
115 CommandExecutor* scheduler() const { return executor_.get(); } 119 CommandExecutor* scheduler() const { return executor_.get(); }
116 GpuChannel* channel() const { return channel_; } 120 GpuChannel* channel() const { return channel_; }
117 121
118 // Unique command buffer ID for this command buffer stub. 122 // Unique command buffer ID for this command buffer stub.
119 CommandBufferId command_buffer_id() const { return command_buffer_id_; } 123 CommandBufferId command_buffer_id() const { return command_buffer_id_; }
120 124
121 // Identifies the stream for this command buffer. 125 SequenceId sequence_id() const { return sequence_id_; }
126
122 int32_t stream_id() const { return stream_id_; } 127 int32_t stream_id() const { return stream_id_; }
123 128
124 // Sends a message to the console. 129 // Sends a message to the console.
125 void SendConsoleMessage(int32_t id, const std::string& message); 130 void SendConsoleMessage(int32_t id, const std::string& message);
126 131
127 void SendCachedShader(const std::string& key, const std::string& shader); 132 void SendCachedShader(const std::string& key, const std::string& shader);
128 133
129 gl::GLSurface* surface() const { return surface_.get(); } 134 gl::GLSurface* surface() const { return surface_.get(); }
130 135
131 void AddDestructionObserver(DestructionObserver* observer); 136 void AddDestructionObserver(DestructionObserver* observer);
132 void RemoveDestructionObserver(DestructionObserver* observer); 137 void RemoveDestructionObserver(DestructionObserver* observer);
133 138
134 void MarkContextLost(); 139 void MarkContextLost();
135 140
136 private: 141 private:
137 GpuCommandBufferStub(GpuChannel* channel, 142 GpuCommandBufferStub(GpuChannel* channel,
138 const GPUCreateCommandBufferConfig& init_params, 143 const GPUCreateCommandBufferConfig& init_params,
144 CommandBufferId command_buffer_id,
145 SequenceId sequence_id,
146 int32_t stream_id,
139 int32_t route_id); 147 int32_t route_id);
140 148
141 bool Initialize(GpuCommandBufferStub* share_group, 149 bool Initialize(GpuCommandBufferStub* share_group,
142 const GPUCreateCommandBufferConfig& init_params, 150 const GPUCreateCommandBufferConfig& init_params,
143 std::unique_ptr<base::SharedMemory> shared_state_shm); 151 std::unique_ptr<base::SharedMemory> shared_state_shm);
144 152
145 GpuMemoryManager* GetMemoryManager() const; 153 GpuMemoryManager* GetMemoryManager() const;
146 154
147 void Destroy(); 155 void Destroy();
148 156
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // are destroyed. So a raw pointer is safe. 221 // are destroyed. So a raw pointer is safe.
214 GpuChannel* const channel_; 222 GpuChannel* const channel_;
215 223
216 // The group of contexts that share namespaces with this context. 224 // The group of contexts that share namespaces with this context.
217 scoped_refptr<gles2::ContextGroup> context_group_; 225 scoped_refptr<gles2::ContextGroup> context_group_;
218 226
219 bool initialized_; 227 bool initialized_;
220 const SurfaceHandle surface_handle_; 228 const SurfaceHandle surface_handle_;
221 bool use_virtualized_gl_context_; 229 bool use_virtualized_gl_context_;
222 const CommandBufferId command_buffer_id_; 230 const CommandBufferId command_buffer_id_;
231 const SequenceId sequence_id_;
223 const int32_t stream_id_; 232 const int32_t stream_id_;
224 const int32_t route_id_; 233 const int32_t route_id_;
225 uint32_t last_flush_count_; 234 uint32_t last_flush_count_;
226 235
227 std::unique_ptr<CommandBufferService> command_buffer_; 236 std::unique_ptr<CommandBufferService> command_buffer_;
228 std::unique_ptr<gles2::GLES2Decoder> decoder_; 237 std::unique_ptr<gles2::GLES2Decoder> decoder_;
229 std::unique_ptr<CommandExecutor> executor_; 238 std::unique_ptr<CommandExecutor> executor_;
230 std::unique_ptr<SyncPointClient> sync_point_client_; 239 scoped_refptr<SyncPointClientState> sync_point_client_state_;
231 scoped_refptr<gl::GLSurface> surface_; 240 scoped_refptr<gl::GLSurface> surface_;
232 scoped_refptr<gl::GLShareGroup> share_group_; 241 scoped_refptr<gl::GLShareGroup> share_group_;
233 242
234 base::ObserverList<DestructionObserver> destruction_observers_; 243 base::ObserverList<DestructionObserver> destruction_observers_;
235 244
236 bool waiting_for_sync_point_; 245 bool waiting_for_sync_point_;
237 246
238 base::TimeTicks process_delayed_work_time_; 247 base::TimeTicks process_delayed_work_time_;
239 uint32_t previous_processed_num_; 248 uint32_t previous_processed_num_;
240 base::TimeTicks last_idle_time_; 249 base::TimeTicks last_idle_time_;
241 250
242 LatencyInfoCallback latency_info_callback_; 251 LatencyInfoCallback latency_info_callback_;
243 252
244 GURL active_url_; 253 GURL active_url_;
245 size_t active_url_hash_; 254 size_t active_url_hash_;
246 255
247 std::unique_ptr<WaitForCommandState> wait_for_token_; 256 std::unique_ptr<WaitForCommandState> wait_for_token_;
248 std::unique_ptr<WaitForCommandState> wait_for_get_offset_; 257 std::unique_ptr<WaitForCommandState> wait_for_get_offset_;
249 258
250 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); 259 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub);
251 }; 260 };
252 261
253 } // namespace gpu 262 } // namespace gpu
254 263
255 #endif // GPU_IPC_SERVICE_GPU_COMMAND_BUFFER_STUB_H_ 264 #endif // GPU_IPC_SERVICE_GPU_COMMAND_BUFFER_STUB_H_
OLDNEW
« no previous file with comments | « gpu/ipc/service/gpu_channel_manager.cc ('k') | gpu/ipc/service/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698