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

Unified Diff: gpu/command_buffer/client/query_tracker.cc

Issue 116863003: gpu: Reuse transfer buffers more aggresively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: [WIP] Review comments follow-up Created 6 years, 11 months 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 side-by-side diff with in-line comments
Download patch
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();
+ return serial;
+}
+
} // namespace gles2
} // namespace gpu

Powered by Google App Engine
This is Rietveld 408576698