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

Side by Side Diff: gpu/command_buffer/service/query_manager.cc

Issue 11412232: gpu: Add async upload functions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@ASYNC_uploads
Patch Set: Rebase. Created 8 years 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
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 #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
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 AsyncPixelTransfersCompletedQuery : public QueryManager::Query {
166 public:
167 AsyncPixelTransfersCompletedQuery(
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 ~AsyncPixelTransfersCompletedQuery();
177 };
178
179 AsyncPixelTransfersCompletedQuery::AsyncPixelTransfersCompletedQuery(
180 QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset)
181 : Query(manager, target, shm_id, shm_offset) {
182 }
183
184 bool AsyncPixelTransfersCompletedQuery::Begin() {
185 return true;
186 }
187
188 bool AsyncPixelTransfersCompletedQuery::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.
193 MarkAsPending(submit_count);
194 return MarkAsCompleted(1);
195 }
196
197 bool AsyncPixelTransfersCompletedQuery::Process() {
198 NOTREACHED();
199 return true;
200 }
201
202 void AsyncPixelTransfersCompletedQuery::Destroy(bool /* have_context */) {
203 if (!IsDeleted()) {
204 MarkAsDeleted();
205 }
206 }
207
208 AsyncPixelTransfersCompletedQuery::~AsyncPixelTransfersCompletedQuery() {
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
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 AsyncPixelTransfersCompletedQuery(
299 this, target, shm_id, shm_offset);
300 break;
251 case GL_GET_ERROR_QUERY_CHROMIUM: 301 case GL_GET_ERROR_QUERY_CHROMIUM:
252 query = new GetErrorQuery(this, target, shm_id, shm_offset); 302 query = new GetErrorQuery(this, target, shm_id, shm_offset);
253 break; 303 break;
254 default: { 304 default: {
255 GLuint service_id = 0; 305 GLuint service_id = 0;
256 glGenQueriesARB(1, &service_id); 306 glGenQueriesARB(1, &service_id);
257 DCHECK_NE(0u, service_id); 307 DCHECK_NE(0u, service_id);
258 query = new AllSamplesPassedQuery( 308 query = new AllSamplesPassedQuery(
259 this, target, shm_id, shm_offset, service_id); 309 this, target, shm_id, shm_offset, service_id);
260 break; 310 break;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 if (!RemovePendingQuery(query)) { 473 if (!RemovePendingQuery(query)) {
424 return false; 474 return false;
425 } 475 }
426 return query->End(submit_count); 476 return query->End(submit_count);
427 } 477 }
428 478
429 } // namespace gles2 479 } // namespace gles2
430 } // namespace gpu 480 } // namespace gpu
431 481
432 482
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h ('k') | third_party/khronos/GLES2/gl2chromium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698