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 <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 typedef base::Callback<void(const std::vector<ui::LatencyInfo>&)> | 68 typedef base::Callback<void(const std::vector<ui::LatencyInfo>&)> |
69 LatencyInfoCallback; | 69 LatencyInfoCallback; |
70 | 70 |
71 GpuCommandBufferStub( | 71 GpuCommandBufferStub( |
72 GpuChannel* channel, | 72 GpuChannel* channel, |
73 base::SingleThreadTaskRunner* task_runner, | 73 base::SingleThreadTaskRunner* task_runner, |
74 GpuCommandBufferStub* share_group, | 74 GpuCommandBufferStub* share_group, |
75 const gfx::GLSurfaceHandle& handle, | 75 const gfx::GLSurfaceHandle& handle, |
76 gpu::gles2::MailboxManager* mailbox_manager, | 76 gpu::gles2::MailboxManager* mailbox_manager, |
| 77 gpu::PreemptionFlag* preempt_by_flag, |
77 gpu::gles2::SubscriptionRefSet* subscription_ref_set, | 78 gpu::gles2::SubscriptionRefSet* subscription_ref_set, |
78 gpu::ValueStateMap* pending_valuebuffer_state, | 79 gpu::ValueStateMap* pending_valuebuffer_state, |
79 const gfx::Size& size, | 80 const gfx::Size& size, |
80 const gpu::gles2::DisallowedFeatures& disallowed_features, | 81 const gpu::gles2::DisallowedFeatures& disallowed_features, |
81 const std::vector<int32>& attribs, | 82 const std::vector<int32>& attribs, |
82 gfx::GpuPreference gpu_preference, | 83 gfx::GpuPreference gpu_preference, |
83 int32 stream_id, | 84 int32 stream_id, |
84 int32 route_id, | 85 int32 route_id, |
85 int32 surface_id, | 86 bool offscreen, |
86 GpuWatchdog* watchdog, | 87 GpuWatchdog* watchdog, |
87 bool software, | |
88 const GURL& active_url); | 88 const GURL& active_url); |
89 | 89 |
90 ~GpuCommandBufferStub() override; | 90 ~GpuCommandBufferStub() override; |
91 | 91 |
92 // IPC::Listener implementation: | 92 // IPC::Listener implementation: |
93 bool OnMessageReceived(const IPC::Message& message) override; | 93 bool OnMessageReceived(const IPC::Message& message) override; |
94 | 94 |
95 // IPC::Sender implementation: | 95 // IPC::Sender implementation: |
96 bool Send(IPC::Message* msg) override; | 96 bool Send(IPC::Message* msg) override; |
97 | 97 |
(...skipping 10 matching lines...) Expand all Loading... |
108 // Whether there are commands in the buffer that haven't been processed. | 108 // Whether there are commands in the buffer that haven't been processed. |
109 bool HasUnprocessedCommands(); | 109 bool HasUnprocessedCommands(); |
110 | 110 |
111 gpu::gles2::GLES2Decoder* decoder() const { return decoder_.get(); } | 111 gpu::gles2::GLES2Decoder* decoder() const { return decoder_.get(); } |
112 gpu::GpuScheduler* scheduler() const { return scheduler_.get(); } | 112 gpu::GpuScheduler* scheduler() const { return scheduler_.get(); } |
113 GpuChannel* channel() const { return channel_; } | 113 GpuChannel* channel() const { return channel_; } |
114 | 114 |
115 // Unique command buffer ID for this command buffer stub. | 115 // Unique command buffer ID for this command buffer stub. |
116 uint64_t command_buffer_id() const { return command_buffer_id_; } | 116 uint64_t command_buffer_id() const { return command_buffer_id_; } |
117 | 117 |
118 // Identifies the target surface. | |
119 int32 surface_id() const { return surface_id_; } | |
120 | |
121 // Identifies the various GpuCommandBufferStubs in the GPU process belonging | 118 // Identifies the various GpuCommandBufferStubs in the GPU process belonging |
122 // to the same renderer process. | 119 // to the same renderer process. |
123 int32 route_id() const { return route_id_; } | 120 int32 route_id() const { return route_id_; } |
124 | 121 |
125 // Identifies the stream for this command buffer. | 122 // Identifies the stream for this command buffer. |
126 int32 stream_id() const { return stream_id_; } | 123 int32 stream_id() const { return stream_id_; } |
127 | 124 |
128 gfx::GpuPreference gpu_preference() { return gpu_preference_; } | 125 gfx::GpuPreference gpu_preference() { return gpu_preference_; } |
129 | 126 |
130 int32 GetRequestedAttribute(int attr) const; | 127 int32 GetRequestedAttribute(int attr) const; |
131 | 128 |
132 // Sends a message to the console. | 129 // Sends a message to the console. |
133 void SendConsoleMessage(int32 id, const std::string& message); | 130 void SendConsoleMessage(int32 id, const std::string& message); |
134 | 131 |
135 void SendCachedShader(const std::string& key, const std::string& shader); | 132 void SendCachedShader(const std::string& key, const std::string& shader); |
136 | 133 |
137 gfx::GLSurface* surface() const { return surface_.get(); } | 134 gfx::GLSurface* surface() const { return surface_.get(); } |
138 | 135 |
139 void AddDestructionObserver(DestructionObserver* observer); | 136 void AddDestructionObserver(DestructionObserver* observer); |
140 void RemoveDestructionObserver(DestructionObserver* observer); | 137 void RemoveDestructionObserver(DestructionObserver* observer); |
141 | 138 |
142 // Associates a sync point to this stub. When the stub is destroyed, it will | 139 // Associates a sync point to this stub. When the stub is destroyed, it will |
143 // retire all sync points that haven't been previously retired. | 140 // retire all sync points that haven't been previously retired. |
144 void AddSyncPoint(uint32 sync_point, bool retire); | 141 void AddSyncPoint(uint32 sync_point, bool retire); |
145 | 142 |
146 void SetPreemptByFlag(scoped_refptr<gpu::PreemptionFlag> flag); | |
147 | |
148 void SetLatencyInfoCallback(const LatencyInfoCallback& callback); | 143 void SetLatencyInfoCallback(const LatencyInfoCallback& callback); |
149 | 144 |
150 void MarkContextLost(); | 145 void MarkContextLost(); |
151 | 146 |
152 const gpu::gles2::FeatureInfo* GetFeatureInfo() const; | 147 const gpu::gles2::FeatureInfo* GetFeatureInfo() const; |
153 | 148 |
154 void SendSwapBuffersCompleted( | 149 void SendSwapBuffersCompleted( |
155 const std::vector<ui::LatencyInfo>& latency_info, | 150 const std::vector<ui::LatencyInfo>& latency_info, |
156 gfx::SwapResult result); | 151 gfx::SwapResult result); |
157 void SendUpdateVSyncParameters(base::TimeTicks timebase, | 152 void SendUpdateVSyncParameters(base::TimeTicks timebase, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 bool initialized_; | 252 bool initialized_; |
258 gfx::GLSurfaceHandle handle_; | 253 gfx::GLSurfaceHandle handle_; |
259 gfx::Size initial_size_; | 254 gfx::Size initial_size_; |
260 gpu::gles2::DisallowedFeatures disallowed_features_; | 255 gpu::gles2::DisallowedFeatures disallowed_features_; |
261 std::vector<int32> requested_attribs_; | 256 std::vector<int32> requested_attribs_; |
262 gfx::GpuPreference gpu_preference_; | 257 gfx::GpuPreference gpu_preference_; |
263 bool use_virtualized_gl_context_; | 258 bool use_virtualized_gl_context_; |
264 const uint64_t command_buffer_id_; | 259 const uint64_t command_buffer_id_; |
265 const int32 stream_id_; | 260 const int32 stream_id_; |
266 const int32 route_id_; | 261 const int32 route_id_; |
267 const int32 surface_id_; | 262 const bool offscreen_; |
268 bool software_; | |
269 uint32 last_flush_count_; | 263 uint32 last_flush_count_; |
270 | 264 |
271 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 265 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
272 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; | 266 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; |
273 scoped_ptr<gpu::GpuScheduler> scheduler_; | 267 scoped_ptr<gpu::GpuScheduler> scheduler_; |
274 scoped_ptr<gpu::SyncPointClient> sync_point_client_; | 268 scoped_ptr<gpu::SyncPointClient> sync_point_client_; |
275 scoped_refptr<gfx::GLSurface> surface_; | 269 scoped_refptr<gfx::GLSurface> surface_; |
276 | 270 |
277 scoped_ptr<GpuMemoryManagerClientState> memory_manager_client_state_; | 271 scoped_ptr<GpuMemoryManagerClientState> memory_manager_client_state_; |
278 // The last memory allocation received from the GpuMemoryManager (used to | 272 // The last memory allocation received from the GpuMemoryManager (used to |
(...skipping 23 matching lines...) Expand all Loading... |
302 size_t total_gpu_memory_; | 296 size_t total_gpu_memory_; |
303 scoped_ptr<WaitForCommandState> wait_for_token_; | 297 scoped_ptr<WaitForCommandState> wait_for_token_; |
304 scoped_ptr<WaitForCommandState> wait_for_get_offset_; | 298 scoped_ptr<WaitForCommandState> wait_for_get_offset_; |
305 | 299 |
306 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 300 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
307 }; | 301 }; |
308 | 302 |
309 } // namespace content | 303 } // namespace content |
310 | 304 |
311 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 305 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
OLD | NEW |