Chromium Code Reviews| Index: gpu/command_buffer/client/query_tracker.cc |
| diff --git a/gpu/command_buffer/client/query_tracker.cc b/gpu/command_buffer/client/query_tracker.cc |
| index 285560590b34a403ba5e2abb763d8c9d340ffc8d..baf9e3d1ba6d1c3f18d50c9379f4ba3fe1cf1c08 100644 |
| --- a/gpu/command_buffer/client/query_tracker.cc |
| +++ b/gpu/command_buffer/client/query_tracker.cc |
| @@ -93,6 +93,7 @@ QueryTracker::Query::Query(GLuint id, GLenum target, |
| submit_count_(0), |
| token_(0), |
| flushed_(false), |
| + serial_(0), |
| client_begin_time_us_(0), |
| result_(0) { |
| } |
| @@ -109,13 +110,15 @@ void QueryTracker::Query::Begin(GLES2Implementation* gl) { |
| case GL_LATENCY_QUERY_CHROMIUM: |
| client_begin_time_us_ = MicrosecondsSinceOriginOfTime(); |
| // tell service about id, shared memory and count |
| - gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset()); |
| + gl->helper()->BeginQueryEXT( |
| + target(), id(), serial(), shm_id(), shm_offset()); |
| break; |
| case GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM: |
| case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM: |
| default: |
| // tell service about id, shared memory and count |
| - gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset()); |
| + gl->helper()->BeginQueryEXT( |
| + target(), id(), serial(), shm_id(), shm_offset()); |
| break; |
| } |
| } |
| @@ -127,7 +130,8 @@ void QueryTracker::Query::End(GLES2Implementation* gl) { |
| if (error == GL_NO_ERROR) { |
| // There was no error so start the query on the serivce. |
| // it will end immediately. |
| - gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset()); |
| + gl->helper()->BeginQueryEXT( |
| + target(), id(), serial(), shm_id(), shm_offset()); |
| } else { |
| // There's an error on the client, no need to bother the service. just |
| // set the query as completed and return the error. |
| @@ -139,7 +143,7 @@ void QueryTracker::Query::End(GLES2Implementation* gl) { |
| } |
| } |
| } |
| - gl->helper()->EndQueryEXT(target(), submit_count()); |
| + gl->helper()->EndQueryEXT(target(), serial(), submit_count()); |
| MarkAsPending(gl->helper()->InsertToken()); |
| } |
| @@ -191,7 +195,8 @@ uint32 QueryTracker::Query::GetResult() const { |
| } |
| QueryTracker::QueryTracker(MappedMemoryManager* manager) |
| - : query_sync_manager_(manager) { |
| + : query_sync_manager_(manager), |
| + next_serial_(1) { |
| } |
| QueryTracker::~QueryTracker() { |
| @@ -205,7 +210,8 @@ QueryTracker::~QueryTracker() { |
| } |
| } |
| -QueryTracker::Query* QueryTracker::CreateQuery(GLuint id, GLenum target) { |
| +QueryTracker::Query* QueryTracker::CreateQuery( |
| + GLuint id, GLenum target) { |
| DCHECK_NE(0u, id); |
| FreeCompletedQueries(); |
| QuerySyncManager::QueryInfo info; |
| @@ -219,6 +225,13 @@ QueryTracker::Query* QueryTracker::CreateQuery(GLuint id, GLenum target) { |
| return query; |
| } |
| +QueryTracker::Query* QueryTracker::CreateInternalQuery( |
| + GLuint id, GLenum target) { |
| + Query* query = CreateQuery(id, target); |
| + query->set_serial(NextSerial()); |
| + return query; |
| +} |
| + |
| QueryTracker::Query* QueryTracker::GetQuery( |
| GLuint client_id) { |
| QueryMap::iterator it = queries_.find(client_id); |
| @@ -260,5 +273,12 @@ void QueryTracker::FreeCompletedQueries() { |
| } |
| } |
| +uint32 QueryTracker::NextSerial() { |
| + uint32 serial = next_serial_++; |
| + if (serial == 0) |
| + return NextSerial(); |
|
piman
2014/01/11 02:02:32
In case of wrap around we need to Finish().
The re
jadahl
2014/01/16 16:24:39
Will Finish() really help anything? In the version
|
| + return serial; |
| +} |
| + |
| } // namespace gles2 |
| } // namespace gpu |