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 #include "gpu/command_buffer/service/query_manager.h" | 5 #include "gpu/command_buffer/service/query_manager.h" |
6 #include "base/atomicops.h" | 6 #include "base/atomicops.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 | 155 |
156 void CommandLatencyQuery::Destroy(bool /* have_context */) { | 156 void CommandLatencyQuery::Destroy(bool /* have_context */) { |
157 if (!IsDeleted()) { | 157 if (!IsDeleted()) { |
158 MarkAsDeleted(); | 158 MarkAsDeleted(); |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
162 CommandLatencyQuery::~CommandLatencyQuery() { | 162 CommandLatencyQuery::~CommandLatencyQuery() { |
163 } | 163 } |
164 | 164 |
165 class AsyncTasksCompletedQuery : public QueryManager::Query { | |
reveman
2012/11/30 03:10:20
AsyncPixelTransfersCompletedQuery?
epennerAtGoogle
2012/11/30 04:14:22
Done.
| |
166 public: | |
167 AsyncTasksCompletedQuery( | |
168 QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset); | |
169 | |
170 virtual bool Begin() OVERRIDE; | |
171 virtual bool End(uint32 submit_count) OVERRIDE; | |
172 virtual bool Process() OVERRIDE; | |
173 virtual void Destroy(bool have_context) OVERRIDE; | |
174 | |
175 protected: | |
176 virtual ~AsyncTasksCompletedQuery(); | |
177 }; | |
178 | |
179 AsyncTasksCompletedQuery::AsyncTasksCompletedQuery( | |
180 QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset) | |
181 : Query(manager, target, shm_id, shm_offset) { | |
182 } | |
183 | |
184 bool AsyncTasksCompletedQuery::Begin() { | |
185 return true; | |
186 } | |
187 | |
188 bool AsyncTasksCompletedQuery::End(uint32 submit_count) { | |
189 // TODO(epenner): Mark completion via an async task. | |
190 // TODO(epenner): This will be a boolean to start, indicating | |
191 // completion of all tasks in the query. We could change this | |
192 // to return a count of tasks completed instead. | |
reveman
2012/11/30 03:10:20
The actual completion of the query will be the ind
epennerAtGoogle
2012/11/30 04:14:22
I was thinking it could return the number of trans
reveman
2012/11/30 10:03:00
I think that's good for now.
| |
193 MarkAsPending(submit_count); | |
194 return MarkAsCompleted(1); | |
195 } | |
196 | |
197 bool AsyncTasksCompletedQuery::Process() { | |
198 NOTREACHED(); | |
199 return true; | |
200 } | |
201 | |
202 void AsyncTasksCompletedQuery::Destroy(bool /* have_context */) { | |
203 if (!IsDeleted()) { | |
204 MarkAsDeleted(); | |
205 } | |
206 } | |
207 | |
208 AsyncTasksCompletedQuery::~AsyncTasksCompletedQuery() { | |
209 } | |
210 | |
165 class GetErrorQuery : public QueryManager::Query { | 211 class GetErrorQuery : public QueryManager::Query { |
166 public: | 212 public: |
167 GetErrorQuery( | 213 GetErrorQuery( |
168 QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset); | 214 QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset); |
169 | 215 |
170 virtual bool Begin() OVERRIDE; | 216 virtual bool Begin() OVERRIDE; |
171 virtual bool End(uint32 submit_count) OVERRIDE; | 217 virtual bool End(uint32 submit_count) OVERRIDE; |
172 virtual bool Process() OVERRIDE; | 218 virtual bool Process() OVERRIDE; |
173 virtual void Destroy(bool have_context) OVERRIDE; | 219 virtual void Destroy(bool have_context) OVERRIDE; |
174 | 220 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 QueryManager::Query* QueryManager::CreateQuery( | 287 QueryManager::Query* QueryManager::CreateQuery( |
242 GLenum target, GLuint client_id, int32 shm_id, uint32 shm_offset) { | 288 GLenum target, GLuint client_id, int32 shm_id, uint32 shm_offset) { |
243 Query::Ref query; | 289 Query::Ref query; |
244 switch (target) { | 290 switch (target) { |
245 case GL_COMMANDS_ISSUED_CHROMIUM: | 291 case GL_COMMANDS_ISSUED_CHROMIUM: |
246 query = new CommandsIssuedQuery(this, target, shm_id, shm_offset); | 292 query = new CommandsIssuedQuery(this, target, shm_id, shm_offset); |
247 break; | 293 break; |
248 case GL_LATENCY_QUERY_CHROMIUM: | 294 case GL_LATENCY_QUERY_CHROMIUM: |
249 query = new CommandLatencyQuery(this, target, shm_id, shm_offset); | 295 query = new CommandLatencyQuery(this, target, shm_id, shm_offset); |
250 break; | 296 break; |
297 case GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM: | |
298 query = new AsyncTasksCompletedQuery(this, target, shm_id, shm_offset); | |
299 break; | |
251 case GL_GET_ERROR_QUERY_CHROMIUM: | 300 case GL_GET_ERROR_QUERY_CHROMIUM: |
252 query = new GetErrorQuery(this, target, shm_id, shm_offset); | 301 query = new GetErrorQuery(this, target, shm_id, shm_offset); |
253 break; | 302 break; |
254 default: { | 303 default: { |
255 GLuint service_id = 0; | 304 GLuint service_id = 0; |
256 glGenQueriesARB(1, &service_id); | 305 glGenQueriesARB(1, &service_id); |
257 DCHECK_NE(0u, service_id); | 306 DCHECK_NE(0u, service_id); |
258 query = new AllSamplesPassedQuery( | 307 query = new AllSamplesPassedQuery( |
259 this, target, shm_id, shm_offset, service_id); | 308 this, target, shm_id, shm_offset, service_id); |
260 break; | 309 break; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 if (!RemovePendingQuery(query)) { | 472 if (!RemovePendingQuery(query)) { |
424 return false; | 473 return false; |
425 } | 474 } |
426 return query->End(submit_count); | 475 return query->End(submit_count); |
427 } | 476 } |
428 | 477 |
429 } // namespace gles2 | 478 } // namespace gles2 |
430 } // namespace gpu | 479 } // namespace gpu |
431 | 480 |
432 | 481 |
OLD | NEW |