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

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

Issue 864943002: Replaces instances of the deprecated TimeTicks::HighResNow() with TimeTicks::Now(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More changes based on review comments. Created 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/async_pixel_transfer_manager_egl.h" 5 #include "gpu/command_buffer/service/async_pixel_transfer_manager_egl.h"
6 6
7 #include <list> 7 #include <list>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 DCHECK_EQ(0, tex_params.level); 249 DCHECK_EQ(0, tex_params.level);
250 if (EGL_NO_IMAGE_KHR != egl_image_) { 250 if (EGL_NO_IMAGE_KHR != egl_image_) {
251 MarkAsCompleted(); 251 MarkAsCompleted();
252 return; 252 return;
253 } 253 }
254 254
255 void* data = mem_params.GetDataAddress(); 255 void* data = mem_params.GetDataAddress();
256 256
257 base::TimeTicks begin_time; 257 base::TimeTicks begin_time;
258 if (texture_upload_stats.get()) 258 if (texture_upload_stats.get())
259 begin_time = base::TimeTicks::HighResNow(); 259 begin_time = base::TimeTicks::Now();
260 260
261 { 261 {
262 TRACE_EVENT0("gpu", "glTexImage2D no data"); 262 TRACE_EVENT0("gpu", "glTexImage2D no data");
263 glGenTextures(1, &thread_texture_id_); 263 glGenTextures(1, &thread_texture_id_);
264 glActiveTexture(GL_TEXTURE0); 264 glActiveTexture(GL_TEXTURE0);
265 glBindTexture(GL_TEXTURE_2D, thread_texture_id_); 265 glBindTexture(GL_TEXTURE_2D, thread_texture_id_);
266 266
267 SetGlParametersForEglImageTexture(); 267 SetGlParametersForEglImageTexture();
268 268
269 // If we need to use image_preserved, we pass the data with 269 // If we need to use image_preserved, we pass the data with
(...skipping 14 matching lines...) Expand all
284 // the data yet, so we do this with a full texSubImage. 284 // the data yet, so we do this with a full texSubImage.
285 if (!use_image_preserved_) 285 if (!use_image_preserved_)
286 DoFullTexSubImage2D(tex_params, data); 286 DoFullTexSubImage2D(tex_params, data);
287 } 287 }
288 288
289 WaitForLastUpload(); 289 WaitForLastUpload();
290 MarkAsCompleted(); 290 MarkAsCompleted();
291 291
292 DCHECK(CHECK_GL()); 292 DCHECK(CHECK_GL());
293 if (texture_upload_stats.get()) { 293 if (texture_upload_stats.get()) {
294 texture_upload_stats->AddUpload(base::TimeTicks::HighResNow() - 294 texture_upload_stats->AddUpload(base::TimeTicks::Now() - begin_time);
295 begin_time);
296 } 295 }
297 } 296 }
298 297
299 void PerformAsyncTexSubImage2D( 298 void PerformAsyncTexSubImage2D(
300 AsyncTexSubImage2DParams tex_params, 299 AsyncTexSubImage2DParams tex_params,
301 AsyncMemoryParams mem_params, 300 AsyncMemoryParams mem_params,
302 scoped_refptr<AsyncPixelTransferUploadStats> texture_upload_stats) { 301 scoped_refptr<AsyncPixelTransferUploadStats> texture_upload_stats) {
303 TRACE_EVENT2("gpu", 302 TRACE_EVENT2("gpu",
304 "PerformAsyncTexSubImage2D", 303 "PerformAsyncTexSubImage2D",
305 "width", 304 "width",
306 tex_params.width, 305 tex_params.width,
307 "height", 306 "height",
308 tex_params.height); 307 tex_params.height);
309 308
310 DCHECK_NE(EGL_NO_IMAGE_KHR, egl_image_); 309 DCHECK_NE(EGL_NO_IMAGE_KHR, egl_image_);
311 DCHECK_EQ(0, tex_params.level); 310 DCHECK_EQ(0, tex_params.level);
312 311
313 void* data = mem_params.GetDataAddress(); 312 void* data = mem_params.GetDataAddress();
314 313
315 base::TimeTicks begin_time; 314 base::TimeTicks begin_time;
316 if (texture_upload_stats.get()) 315 if (texture_upload_stats.get())
317 begin_time = base::TimeTicks::HighResNow(); 316 begin_time = base::TimeTicks::Now();
318 317
319 if (!thread_texture_id_) { 318 if (!thread_texture_id_) {
320 TRACE_EVENT0("gpu", "glEGLImageTargetTexture2DOES"); 319 TRACE_EVENT0("gpu", "glEGLImageTargetTexture2DOES");
321 glGenTextures(1, &thread_texture_id_); 320 glGenTextures(1, &thread_texture_id_);
322 glActiveTexture(GL_TEXTURE0); 321 glActiveTexture(GL_TEXTURE0);
323 glBindTexture(GL_TEXTURE_2D, thread_texture_id_); 322 glBindTexture(GL_TEXTURE_2D, thread_texture_id_);
324 glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, egl_image_); 323 glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, egl_image_);
325 } else { 324 } else {
326 glActiveTexture(GL_TEXTURE0); 325 glActiveTexture(GL_TEXTURE0);
327 glBindTexture(GL_TEXTURE_2D, thread_texture_id_); 326 glBindTexture(GL_TEXTURE_2D, thread_texture_id_);
328 } 327 }
329 { 328 {
330 TRACE_EVENT0("gpu", "glTexSubImage2D"); 329 TRACE_EVENT0("gpu", "glTexSubImage2D");
331 DoTexSubImage2D(tex_params, data); 330 DoTexSubImage2D(tex_params, data);
332 } 331 }
333 WaitForLastUpload(); 332 WaitForLastUpload();
334 MarkAsCompleted(); 333 MarkAsCompleted();
335 334
336 DCHECK(CHECK_GL()); 335 DCHECK(CHECK_GL());
337 if (texture_upload_stats.get()) { 336 if (texture_upload_stats.get()) {
338 texture_upload_stats->AddUpload(base::TimeTicks::HighResNow() - 337 texture_upload_stats->AddUpload(base::TimeTicks::Now() - begin_time);
339 begin_time);
340 } 338 }
341 } 339 }
342 340
343 protected: 341 protected:
344 friend class base::RefCountedThreadSafe<TransferStateInternal>; 342 friend class base::RefCountedThreadSafe<TransferStateInternal>;
345 friend class gpu::AsyncPixelTransferDelegateEGL; 343 friend class gpu::AsyncPixelTransferDelegateEGL;
346 344
347 static void DeleteTexture(GLuint id) { 345 static void DeleteTexture(GLuint id) {
348 glDeleteTextures(1, &id); 346 glDeleteTextures(1, &id);
349 } 347 }
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 DCHECK_EQ(tex_params.yoffset, 0); 632 DCHECK_EQ(tex_params.yoffset, 0);
635 DCHECK_EQ(state_->define_params_.width, tex_params.width); 633 DCHECK_EQ(state_->define_params_.width, tex_params.width);
636 DCHECK_EQ(state_->define_params_.height, tex_params.height); 634 DCHECK_EQ(state_->define_params_.height, tex_params.height);
637 DCHECK_EQ(state_->define_params_.level, tex_params.level); 635 DCHECK_EQ(state_->define_params_.level, tex_params.level);
638 DCHECK_EQ(state_->define_params_.format, tex_params.format); 636 DCHECK_EQ(state_->define_params_.format, tex_params.format);
639 DCHECK_EQ(state_->define_params_.type, tex_params.type); 637 DCHECK_EQ(state_->define_params_.type, tex_params.type);
640 638
641 void* data = mem_params.GetDataAddress(); 639 void* data = mem_params.GetDataAddress();
642 base::TimeTicks begin_time; 640 base::TimeTicks begin_time;
643 if (shared_state_->texture_upload_stats.get()) 641 if (shared_state_->texture_upload_stats.get())
644 begin_time = base::TimeTicks::HighResNow(); 642 begin_time = base::TimeTicks::Now();
645 { 643 {
646 TRACE_EVENT0("gpu", "glTexSubImage2D"); 644 TRACE_EVENT0("gpu", "glTexSubImage2D");
647 // Note we use define_params_ instead of tex_params. 645 // Note we use define_params_ instead of tex_params.
648 // The DCHECKs above verify this is always the same. 646 // The DCHECKs above verify this is always the same.
649 DoTexImage2D(state_->define_params_, data); 647 DoTexImage2D(state_->define_params_, data);
650 } 648 }
651 if (shared_state_->texture_upload_stats.get()) { 649 if (shared_state_->texture_upload_stats.get()) {
652 shared_state_->texture_upload_stats 650 shared_state_->texture_upload_stats
653 ->AddUpload(base::TimeTicks::HighResNow() - begin_time); 651 ->AddUpload(base::TimeTicks::Now() - begin_time);
654 } 652 }
655 653
656 DCHECK(CHECK_GL()); 654 DCHECK(CHECK_GL());
657 return true; 655 return true;
658 } 656 }
659 657
660 AsyncPixelTransferManagerEGL::SharedState::SharedState() 658 AsyncPixelTransferManagerEGL::SharedState::SharedState()
661 // TODO(reveman): Skip this if --enable-gpu-benchmarking is not present. 659 // TODO(reveman): Skip this if --enable-gpu-benchmarking is not present.
662 : texture_upload_stats(new AsyncPixelTransferUploadStats) { 660 : texture_upload_stats(new AsyncPixelTransferUploadStats) {
663 const char* vendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR)); 661 const char* vendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 737
740 AsyncPixelTransferDelegate* 738 AsyncPixelTransferDelegate*
741 AsyncPixelTransferManagerEGL::CreatePixelTransferDelegateImpl( 739 AsyncPixelTransferManagerEGL::CreatePixelTransferDelegateImpl(
742 gles2::TextureRef* ref, 740 gles2::TextureRef* ref,
743 const AsyncTexImage2DParams& define_params) { 741 const AsyncTexImage2DParams& define_params) {
744 return new AsyncPixelTransferDelegateEGL( 742 return new AsyncPixelTransferDelegateEGL(
745 &shared_state_, ref->service_id(), define_params); 743 &shared_state_, ref->service_id(), define_params);
746 } 744 }
747 745
748 } // namespace gpu 746 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/time.h ('k') | gpu/command_buffer/service/async_pixel_transfer_manager_idle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698