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

Side by Side 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: [RFC] gpu: Reuse transfer buffers more aggressively 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 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/client/query_tracker.h" 5 #include "gpu/command_buffer/client/query_tracker.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 #include <GLES2/gl2extchromium.h> 9 #include <GLES2/gl2extchromium.h>
10 10
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 switch (target()) { 105 switch (target()) {
106 case GL_GET_ERROR_QUERY_CHROMIUM: 106 case GL_GET_ERROR_QUERY_CHROMIUM:
107 // To nothing on begin for error queries. 107 // To nothing on begin for error queries.
108 break; 108 break;
109 case GL_LATENCY_QUERY_CHROMIUM: 109 case GL_LATENCY_QUERY_CHROMIUM:
110 client_begin_time_us_ = MicrosecondsSinceOriginOfTime(); 110 client_begin_time_us_ = MicrosecondsSinceOriginOfTime();
111 // tell service about id, shared memory and count 111 // tell service about id, shared memory and count
112 gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset()); 112 gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset());
113 break; 113 break;
114 case GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM: 114 case GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM:
115 case GL_ASYNC_PIXEL_UNPACK_COMPLETED_PRIVATE_CHROMIUM:
115 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM: 116 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM:
116 default: 117 default:
117 // tell service about id, shared memory and count 118 // tell service about id, shared memory and count
118 gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset()); 119 gl->helper()->BeginQueryEXT(target(), id(), shm_id(), shm_offset());
119 break; 120 break;
120 } 121 }
121 } 122 }
122 123
123 void QueryTracker::Query::End(GLES2Implementation* gl) { 124 void QueryTracker::Query::End(GLES2Implementation* gl) {
124 switch (target()) { 125 switch (target()) {
(...skipping 30 matching lines...) Expand all
155 case GL_COMMANDS_ISSUED_CHROMIUM: 156 case GL_COMMANDS_ISSUED_CHROMIUM:
156 result_ = std::min(info_.sync->result, 157 result_ = std::min(info_.sync->result,
157 static_cast<uint64>(0xFFFFFFFFL)); 158 static_cast<uint64>(0xFFFFFFFFL));
158 break; 159 break;
159 case GL_LATENCY_QUERY_CHROMIUM: 160 case GL_LATENCY_QUERY_CHROMIUM:
160 DCHECK(info_.sync->result >= client_begin_time_us_); 161 DCHECK(info_.sync->result >= client_begin_time_us_);
161 result_ = std::min(info_.sync->result - client_begin_time_us_, 162 result_ = std::min(info_.sync->result - client_begin_time_us_,
162 static_cast<uint64>(0xFFFFFFFFL)); 163 static_cast<uint64>(0xFFFFFFFFL));
163 break; 164 break;
164 case GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM: 165 case GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM:
166 case GL_ASYNC_PIXEL_UNPACK_COMPLETED_PRIVATE_CHROMIUM:
165 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM: 167 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM:
166 default: 168 default:
167 result_ = info_.sync->result; 169 result_ = info_.sync->result;
168 break; 170 break;
169 } 171 }
170 state_ = kComplete; 172 state_ = kComplete;
171 } else { 173 } else {
172 if (!flushed_) { 174 if (!flushed_) {
173 // TODO(gman): We could reduce the number of flushes by having a 175 // TODO(gman): We could reduce the number of flushes by having a
174 // flush count, recording that count at the time we insert the 176 // flush count, recording that count at the time we insert the
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 257 }
256 258
257 query_sync_manager_.Free(query->info_); 259 query_sync_manager_.Free(query->info_);
258 it = removed_queries_.erase(it); 260 it = removed_queries_.erase(it);
259 delete query; 261 delete query;
260 } 262 }
261 } 263 }
262 264
263 } // namespace gles2 265 } // namespace gles2
264 } // namespace gpu 266 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698