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 #pragma once | 7 #pragma once |
8 | 8 |
9 #if defined(ENABLE_GPU) | 9 #if defined(ENABLE_GPU) |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 public: | 56 public: |
57 virtual ~GpuCommandBufferStubBase() {} | 57 virtual ~GpuCommandBufferStubBase() {} |
58 | 58 |
59 // Will not have surface state if this is an offscreen commandbuffer. | 59 // Will not have surface state if this is an offscreen commandbuffer. |
60 virtual bool has_surface_state() const = 0; | 60 virtual bool has_surface_state() const = 0; |
61 virtual const SurfaceState& surface_state() const = 0; | 61 virtual const SurfaceState& surface_state() const = 0; |
62 | 62 |
63 virtual bool IsInSameContextShareGroup( | 63 virtual bool IsInSameContextShareGroup( |
64 const GpuCommandBufferStubBase& other) const = 0; | 64 const GpuCommandBufferStubBase& other) const = 0; |
65 | 65 |
66 virtual void SendMemoryAllocationToProxy( | |
67 const GpuMemoryAllocation& allocation) = 0; | |
68 | |
69 virtual void SetMemoryAllocation( | 66 virtual void SetMemoryAllocation( |
70 const GpuMemoryAllocation& allocation) = 0; | 67 const GpuMemoryAllocation& allocation) = 0; |
71 }; | 68 }; |
72 | 69 |
73 class GpuCommandBufferStub | 70 class GpuCommandBufferStub |
74 : public GpuCommandBufferStubBase, | 71 : public GpuCommandBufferStubBase, |
75 public IPC::Channel::Listener, | 72 public IPC::Channel::Listener, |
76 public IPC::Message::Sender, | 73 public IPC::Message::Sender, |
77 public base::SupportsWeakPtr<GpuCommandBufferStub> { | 74 public base::SupportsWeakPtr<GpuCommandBufferStub> { |
78 public: | 75 public: |
(...skipping 29 matching lines...) Expand all Loading... |
108 | 105 |
109 // GpuCommandBufferStubBase implementation: | 106 // GpuCommandBufferStubBase implementation: |
110 virtual bool has_surface_state() const OVERRIDE; | 107 virtual bool has_surface_state() const OVERRIDE; |
111 virtual const GpuCommandBufferStubBase::SurfaceState& surface_state() const | 108 virtual const GpuCommandBufferStubBase::SurfaceState& surface_state() const |
112 OVERRIDE; | 109 OVERRIDE; |
113 | 110 |
114 // Returns true iff |other| is in the same context share group as this stub. | 111 // Returns true iff |other| is in the same context share group as this stub. |
115 virtual bool IsInSameContextShareGroup( | 112 virtual bool IsInSameContextShareGroup( |
116 const GpuCommandBufferStubBase& other) const OVERRIDE; | 113 const GpuCommandBufferStubBase& other) const OVERRIDE; |
117 | 114 |
118 // Sends memory allocation limits to render process. | |
119 virtual void SendMemoryAllocationToProxy( | |
120 const GpuMemoryAllocation& allocation) OVERRIDE; | |
121 | |
122 // Sets buffer usage depending on Memory Allocation | 115 // Sets buffer usage depending on Memory Allocation |
123 virtual void SetMemoryAllocation( | 116 virtual void SetMemoryAllocation( |
124 const GpuMemoryAllocation& allocation) OVERRIDE; | 117 const GpuMemoryAllocation& allocation) OVERRIDE; |
125 | 118 |
126 // Whether this command buffer can currently handle IPC messages. | 119 // Whether this command buffer can currently handle IPC messages. |
127 bool IsScheduled(); | 120 bool IsScheduled(); |
128 | 121 |
129 // Whether this command buffer needs to be polled again in the future. | 122 // Whether this command buffer needs to be polled again in the future. |
130 bool HasMoreWork(); | 123 bool HasMoreWork(); |
131 | 124 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 gfx::GLSurfaceHandle handle_; | 209 gfx::GLSurfaceHandle handle_; |
217 gfx::Size initial_size_; | 210 gfx::Size initial_size_; |
218 gpu::gles2::DisallowedFeatures disallowed_features_; | 211 gpu::gles2::DisallowedFeatures disallowed_features_; |
219 std::string allowed_extensions_; | 212 std::string allowed_extensions_; |
220 std::vector<int32> requested_attribs_; | 213 std::vector<int32> requested_attribs_; |
221 gfx::GpuPreference gpu_preference_; | 214 gfx::GpuPreference gpu_preference_; |
222 int32 route_id_; | 215 int32 route_id_; |
223 bool software_; | 216 bool software_; |
224 uint32 last_flush_count_; | 217 uint32 last_flush_count_; |
225 scoped_ptr<GpuCommandBufferStubBase::SurfaceState> surface_state_; | 218 scoped_ptr<GpuCommandBufferStubBase::SurfaceState> surface_state_; |
226 GpuMemoryAllocation allocation_; | |
227 | 219 |
228 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 220 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
229 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; | 221 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; |
230 scoped_ptr<gpu::GpuScheduler> scheduler_; | 222 scoped_ptr<gpu::GpuScheduler> scheduler_; |
231 scoped_refptr<gfx::GLContext> context_; | 223 scoped_refptr<gfx::GLContext> context_; |
232 scoped_refptr<gfx::GLSurface> surface_; | 224 scoped_refptr<gfx::GLSurface> surface_; |
233 | 225 |
234 // SetParent may be called before Initialize, in which case we need to keep | 226 // SetParent may be called before Initialize, in which case we need to keep |
235 // around the parent stub, so that Initialize can set the parent correctly. | 227 // around the parent stub, so that Initialize can set the parent correctly. |
236 base::WeakPtr<GpuCommandBufferStub> parent_stub_for_initialization_; | 228 base::WeakPtr<GpuCommandBufferStub> parent_stub_for_initialization_; |
237 uint32 parent_texture_for_initialization_; | 229 uint32 parent_texture_for_initialization_; |
238 | 230 |
239 GpuWatchdog* watchdog_; | 231 GpuWatchdog* watchdog_; |
240 | 232 |
241 std::deque<IPC::Message*> delayed_echos_; | 233 std::deque<IPC::Message*> delayed_echos_; |
242 | 234 |
243 // Zero or more video decoders owned by this stub, keyed by their | 235 // Zero or more video decoders owned by this stub, keyed by their |
244 // decoder_route_id. | 236 // decoder_route_id. |
245 IDMap<GpuVideoDecodeAccelerator, IDMapOwnPointer> video_decoders_; | 237 IDMap<GpuVideoDecodeAccelerator, IDMapOwnPointer> video_decoders_; |
246 | 238 |
247 ObserverList<DestructionObserver> destruction_observers_; | 239 ObserverList<DestructionObserver> destruction_observers_; |
248 | 240 |
249 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 241 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
250 }; | 242 }; |
251 | 243 |
252 #endif // defined(ENABLE_GPU) | 244 #endif // defined(ENABLE_GPU) |
253 | 245 |
254 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 246 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
OLD | NEW |