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

Side by Side Diff: gpu/command_buffer/client/query_tracker.cc

Issue 1188013004: Added support for Time Elapsed queries through the command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed extra line Created 5 years, 5 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 168
169 bool QueryTracker::Query::CheckResultsAvailable( 169 bool QueryTracker::Query::CheckResultsAvailable(
170 CommandBufferHelper* helper) { 170 CommandBufferHelper* helper) {
171 if (Pending()) { 171 if (Pending()) {
172 if (base::subtle::Acquire_Load(&info_.sync->process_count) == 172 if (base::subtle::Acquire_Load(&info_.sync->process_count) ==
173 submit_count_ || 173 submit_count_ ||
174 helper->IsContextLost()) { 174 helper->IsContextLost()) {
175 switch (target()) { 175 switch (target()) {
176 case GL_COMMANDS_ISSUED_CHROMIUM: 176 case GL_COMMANDS_ISSUED_CHROMIUM:
177 result_ = base::saturated_cast<uint32>(info_.sync->result); 177 result_ = info_.sync->result;
178 break; 178 break;
179 case GL_LATENCY_QUERY_CHROMIUM: 179 case GL_LATENCY_QUERY_CHROMIUM:
180 // Disabled DCHECK because of http://crbug.com/419236. 180 // Disabled DCHECK because of http://crbug.com/419236.
181 //DCHECK(info_.sync->result >= client_begin_time_us_); 181 //DCHECK(info_.sync->result >= client_begin_time_us_);
182 result_ = base::saturated_cast<uint32>( 182 result_ = info_.sync->result - client_begin_time_us_;
183 info_.sync->result - client_begin_time_us_);
184 break; 183 break;
185 case GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM: 184 case GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM:
186 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM: 185 case GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM:
187 default: 186 default:
188 result_ = static_cast<uint32>(info_.sync->result); 187 result_ = info_.sync->result;
189 break; 188 break;
190 } 189 }
191 state_ = kComplete; 190 state_ = kComplete;
192 } else { 191 } else {
193 if ((helper->flush_generation() - flush_count_ - 1) >= 0x80000000) { 192 if ((helper->flush_generation() - flush_count_ - 1) >= 0x80000000) {
194 helper->Flush(); 193 helper->Flush();
195 } else { 194 } else {
196 // Insert no-ops so that eventually the GPU process will see more work. 195 // Insert no-ops so that eventually the GPU process will see more work.
197 helper->Noop(1); 196 helper->Noop(1);
198 } 197 }
199 } 198 }
200 } 199 }
201 return state_ == kComplete; 200 return state_ == kComplete;
202 } 201 }
203 202
204 uint32 QueryTracker::Query::GetResult() const { 203 uint64 QueryTracker::Query::GetResult() const {
205 DCHECK(state_ == kComplete || state_ == kUninitialized); 204 DCHECK(state_ == kComplete || state_ == kUninitialized);
206 return result_; 205 return result_;
207 } 206 }
208 207
209 QueryTracker::QueryTracker(MappedMemoryManager* manager) 208 QueryTracker::QueryTracker(MappedMemoryManager* manager)
210 : query_sync_manager_(manager) { 209 : query_sync_manager_(manager) {
211 } 210 }
212 211
213 QueryTracker::~QueryTracker() { 212 QueryTracker::~QueryTracker() {
214 while (!queries_.empty()) { 213 while (!queries_.empty()) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 return false; 319 return false;
321 } 320 }
322 321
323 target_it->second->End(gl); 322 target_it->second->End(gl);
324 current_queries_.erase(target_it); 323 current_queries_.erase(target_it);
325 return true; 324 return true;
326 } 325 }
327 326
328 } // namespace gles2 327 } // namespace gles2
329 } // namespace gpu 328 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698