| 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 CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
| 6 #define CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 6 #define CONTENT_COMMON_GPU_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 <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
| 20 #include "content/common/gpu/gpu_memory_manager.h" | 20 #include "content/common/gpu/gpu_memory_manager.h" |
| 21 #include "gpu/command_buffer/common/command_buffer_id.h" |
| 21 #include "gpu/command_buffer/common/constants.h" | 22 #include "gpu/command_buffer/common/constants.h" |
| 22 #include "gpu/command_buffer/common/gpu_memory_allocation.h" | 23 #include "gpu/command_buffer/common/gpu_memory_allocation.h" |
| 23 #include "gpu/command_buffer/service/command_buffer_service.h" | 24 #include "gpu/command_buffer/service/command_buffer_service.h" |
| 24 #include "gpu/command_buffer/service/context_group.h" | 25 #include "gpu/command_buffer/service/context_group.h" |
| 25 #include "gpu/command_buffer/service/gpu_scheduler.h" | 26 #include "gpu/command_buffer/service/gpu_scheduler.h" |
| 26 #include "ipc/ipc_listener.h" | 27 #include "ipc/ipc_listener.h" |
| 27 #include "ipc/ipc_sender.h" | 28 #include "ipc/ipc_sender.h" |
| 28 #include "media/video/video_decode_accelerator.h" | 29 #include "media/video/video_decode_accelerator.h" |
| 29 #include "ui/events/latency_info.h" | 30 #include "ui/events/latency_info.h" |
| 30 #include "ui/gfx/geometry/size.h" | 31 #include "ui/gfx/geometry/size.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 bool IsScheduled(); | 109 bool IsScheduled(); |
| 109 | 110 |
| 110 // Whether there are commands in the buffer that haven't been processed. | 111 // Whether there are commands in the buffer that haven't been processed. |
| 111 bool HasUnprocessedCommands(); | 112 bool HasUnprocessedCommands(); |
| 112 | 113 |
| 113 gpu::gles2::GLES2Decoder* decoder() const { return decoder_.get(); } | 114 gpu::gles2::GLES2Decoder* decoder() const { return decoder_.get(); } |
| 114 gpu::GpuScheduler* scheduler() const { return scheduler_.get(); } | 115 gpu::GpuScheduler* scheduler() const { return scheduler_.get(); } |
| 115 GpuChannel* channel() const { return channel_; } | 116 GpuChannel* channel() const { return channel_; } |
| 116 | 117 |
| 117 // Unique command buffer ID for this command buffer stub. | 118 // Unique command buffer ID for this command buffer stub. |
| 118 uint64_t command_buffer_id() const { return command_buffer_id_; } | 119 gpu::CommandBufferId command_buffer_id() const { return command_buffer_id_; } |
| 119 | 120 |
| 120 // Identifies the various GpuCommandBufferStubs in the GPU process belonging | 121 // Identifies the various GpuCommandBufferStubs in the GPU process belonging |
| 121 // to the same renderer process. | 122 // to the same renderer process. |
| 122 int32_t route_id() const { return route_id_; } | 123 int32_t route_id() const { return route_id_; } |
| 123 | 124 |
| 124 // Identifies the stream for this command buffer. | 125 // Identifies the stream for this command buffer. |
| 125 int32_t stream_id() const { return stream_id_; } | 126 int32_t stream_id() const { return stream_id_; } |
| 126 | 127 |
| 127 gfx::GpuPreference gpu_preference() { return gpu_preference_; } | 128 gfx::GpuPreference gpu_preference() { return gpu_preference_; } |
| 128 | 129 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 IPC::Message* reply_message); | 193 IPC::Message* reply_message); |
| 193 | 194 |
| 194 void OnEnsureBackbuffer(); | 195 void OnEnsureBackbuffer(); |
| 195 | 196 |
| 196 void OnSignalSyncToken(const gpu::SyncToken& sync_token, uint32_t id); | 197 void OnSignalSyncToken(const gpu::SyncToken& sync_token, uint32_t id); |
| 197 void OnSignalAck(uint32_t id); | 198 void OnSignalAck(uint32_t id); |
| 198 void OnSignalQuery(uint32_t query, uint32_t id); | 199 void OnSignalQuery(uint32_t query, uint32_t id); |
| 199 | 200 |
| 200 void OnFenceSyncRelease(uint64_t release); | 201 void OnFenceSyncRelease(uint64_t release); |
| 201 bool OnWaitFenceSync(gpu::CommandBufferNamespace namespace_id, | 202 bool OnWaitFenceSync(gpu::CommandBufferNamespace namespace_id, |
| 202 uint64_t command_buffer_id, | 203 gpu::CommandBufferId command_buffer_id, |
| 203 uint64_t release); | 204 uint64_t release); |
| 204 void OnWaitFenceSyncCompleted(gpu::CommandBufferNamespace namespace_id, | 205 void OnWaitFenceSyncCompleted(gpu::CommandBufferNamespace namespace_id, |
| 205 uint64_t command_buffer_id, | 206 gpu::CommandBufferId command_buffer_id, |
| 206 uint64_t release); | 207 uint64_t release); |
| 207 | 208 |
| 208 void OnCreateImage(const GpuCommandBufferMsg_CreateImage_Params& params); | 209 void OnCreateImage(const GpuCommandBufferMsg_CreateImage_Params& params); |
| 209 void OnDestroyImage(int32_t id); | 210 void OnDestroyImage(int32_t id); |
| 210 void OnCreateStreamTexture(uint32_t texture_id, | 211 void OnCreateStreamTexture(uint32_t texture_id, |
| 211 int32_t stream_id, | 212 int32_t stream_id, |
| 212 bool* succeeded); | 213 bool* succeeded); |
| 213 | 214 |
| 214 void OnCommandProcessed(); | 215 void OnCommandProcessed(); |
| 215 void OnParseError(); | 216 void OnParseError(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 226 | 227 |
| 227 // Schedule processing of delayed work. This updates the time at which | 228 // Schedule processing of delayed work. This updates the time at which |
| 228 // delayed work should be processed. |process_delayed_work_time_| is | 229 // delayed work should be processed. |process_delayed_work_time_| is |
| 229 // updated to current time + delay. Call this after processing some amount | 230 // updated to current time + delay. Call this after processing some amount |
| 230 // of delayed work. | 231 // of delayed work. |
| 231 void ScheduleDelayedWork(base::TimeDelta delay); | 232 void ScheduleDelayedWork(base::TimeDelta delay); |
| 232 | 233 |
| 233 bool CheckContextLost(); | 234 bool CheckContextLost(); |
| 234 void CheckCompleteWaits(); | 235 void CheckCompleteWaits(); |
| 235 void PullTextureUpdates(gpu::CommandBufferNamespace namespace_id, | 236 void PullTextureUpdates(gpu::CommandBufferNamespace namespace_id, |
| 236 uint64_t command_buffer_id, | 237 gpu::CommandBufferId command_buffer_id, |
| 237 uint32_t release); | 238 uint32_t release); |
| 238 | 239 |
| 239 // The lifetime of objects of this class is managed by a GpuChannel. The | 240 // The lifetime of objects of this class is managed by a GpuChannel. The |
| 240 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they | 241 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they |
| 241 // are destroyed. So a raw pointer is safe. | 242 // are destroyed. So a raw pointer is safe. |
| 242 GpuChannel* channel_; | 243 GpuChannel* channel_; |
| 243 | 244 |
| 244 // Outlives the stub. | 245 // Outlives the stub. |
| 245 gpu::SyncPointManager* sync_point_manager_; | 246 gpu::SyncPointManager* sync_point_manager_; |
| 246 | 247 |
| 247 // Task runner for main thread. | 248 // Task runner for main thread. |
| 248 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 249 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 249 | 250 |
| 250 // The group of contexts that share namespaces with this context. | 251 // The group of contexts that share namespaces with this context. |
| 251 scoped_refptr<gpu::gles2::ContextGroup> context_group_; | 252 scoped_refptr<gpu::gles2::ContextGroup> context_group_; |
| 252 | 253 |
| 253 bool initialized_; | 254 bool initialized_; |
| 254 gfx::GLSurfaceHandle handle_; | 255 gfx::GLSurfaceHandle handle_; |
| 255 gfx::Size initial_size_; | 256 gfx::Size initial_size_; |
| 256 gpu::gles2::DisallowedFeatures disallowed_features_; | 257 gpu::gles2::DisallowedFeatures disallowed_features_; |
| 257 std::vector<int32_t> requested_attribs_; | 258 std::vector<int32_t> requested_attribs_; |
| 258 gfx::GpuPreference gpu_preference_; | 259 gfx::GpuPreference gpu_preference_; |
| 259 bool use_virtualized_gl_context_; | 260 bool use_virtualized_gl_context_; |
| 260 const uint64_t command_buffer_id_; | 261 const gpu::CommandBufferId command_buffer_id_; |
| 261 const int32_t stream_id_; | 262 const int32_t stream_id_; |
| 262 const int32_t route_id_; | 263 const int32_t route_id_; |
| 263 const bool offscreen_; | 264 const bool offscreen_; |
| 264 uint32_t last_flush_count_; | 265 uint32_t last_flush_count_; |
| 265 | 266 |
| 266 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 267 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
| 267 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; | 268 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; |
| 268 scoped_ptr<gpu::GpuScheduler> scheduler_; | 269 scoped_ptr<gpu::GpuScheduler> scheduler_; |
| 269 scoped_ptr<gpu::SyncPointClient> sync_point_client_; | 270 scoped_ptr<gpu::SyncPointClient> sync_point_client_; |
| 270 scoped_refptr<gfx::GLSurface> surface_; | 271 scoped_refptr<gfx::GLSurface> surface_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 289 | 290 |
| 290 scoped_ptr<WaitForCommandState> wait_for_token_; | 291 scoped_ptr<WaitForCommandState> wait_for_token_; |
| 291 scoped_ptr<WaitForCommandState> wait_for_get_offset_; | 292 scoped_ptr<WaitForCommandState> wait_for_get_offset_; |
| 292 | 293 |
| 293 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 294 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
| 294 }; | 295 }; |
| 295 | 296 |
| 296 } // namespace content | 297 } // namespace content |
| 297 | 298 |
| 298 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 299 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
| OLD | NEW |