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

Side by Side Diff: content/gpu/gpu_main.cc

Issue 715273002: [content/gpu] Convert VLOGs to DVLOGs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <dwmapi.h> 8 #include <dwmapi.h>
9 #include <windows.h> 9 #include <windows.h>
10 #endif 10 #endif
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 if (gpu_info.gpu.vendor_id == 0x10de && // NVIDIA 298 if (gpu_info.gpu.vendor_id == 0x10de && // NVIDIA
299 gpu_info.driver_vendor == "NVIDIA" && 299 gpu_info.driver_vendor == "NVIDIA" &&
300 !CanAccessNvidiaDeviceFile()) 300 !CanAccessNvidiaDeviceFile())
301 dead_on_arrival = true; 301 dead_on_arrival = true;
302 #endif // !defined(OS_CHROMEOS) 302 #endif // !defined(OS_CHROMEOS)
303 #endif // defined(OS_LINUX) 303 #endif // defined(OS_LINUX)
304 #endif // !defined(OS_MACOSX) 304 #endif // !defined(OS_MACOSX)
305 collect_context_time = 305 collect_context_time =
306 base::TimeTicks::Now() - before_collect_context_graphics_info; 306 base::TimeTicks::Now() - before_collect_context_graphics_info;
307 } else { // gl_initialized 307 } else { // gl_initialized
308 VLOG(1) << "gfx::GLSurface::InitializeOneOff failed"; 308 DVLOG(1) << "gfx::GLSurface::InitializeOneOff failed";
piman 2014/11/14 00:23:25 Same, please keep.
309 dead_on_arrival = true; 309 dead_on_arrival = true;
310 } 310 }
311 311
312 initialize_one_off_time = 312 initialize_one_off_time =
313 base::TimeTicks::Now() - before_initialize_one_off; 313 base::TimeTicks::Now() - before_initialize_one_off;
314 314
315 if (enable_watchdog && delayed_watchdog_enable) { 315 if (enable_watchdog && delayed_watchdog_enable) {
316 watchdog_thread = new GpuWatchdogThread(kGpuTimeout); 316 watchdog_thread = new GpuWatchdogThread(kGpuTimeout);
317 base::Thread::Options options; 317 base::Thread::Options options;
318 options.timer_slack = base::TIMER_SLACK_MAXIMUM; 318 options.timer_slack = base::TIMER_SLACK_MAXIMUM;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 #if !defined(OS_MACOSX) 415 #if !defined(OS_MACOSX)
416 bool CollectGraphicsInfo(gpu::GPUInfo& gpu_info) { 416 bool CollectGraphicsInfo(gpu::GPUInfo& gpu_info) {
417 bool res = true; 417 bool res = true;
418 gpu::CollectInfoResult result = gpu::CollectContextGraphicsInfo(&gpu_info); 418 gpu::CollectInfoResult result = gpu::CollectContextGraphicsInfo(&gpu_info);
419 switch (result) { 419 switch (result) {
420 case gpu::kCollectInfoFatalFailure: 420 case gpu::kCollectInfoFatalFailure:
421 LOG(ERROR) << "gpu::CollectGraphicsInfo failed (fatal)."; 421 LOG(ERROR) << "gpu::CollectGraphicsInfo failed (fatal).";
422 res = false; 422 res = false;
423 break; 423 break;
424 case gpu::kCollectInfoNonFatalFailure: 424 case gpu::kCollectInfoNonFatalFailure:
425 VLOG(1) << "gpu::CollectGraphicsInfo failed (non-fatal)."; 425 DVLOG(1) << "gpu::CollectGraphicsInfo failed (non-fatal).";
426 break; 426 break;
427 case gpu::kCollectInfoNone: 427 case gpu::kCollectInfoNone:
428 NOTREACHED(); 428 NOTREACHED();
429 break; 429 break;
430 case gpu::kCollectInfoSuccess: 430 case gpu::kCollectInfoSuccess:
431 break; 431 break;
432 } 432 }
433 GetContentClient()->SetGpuInfo(gpu_info); 433 GetContentClient()->SetGpuInfo(gpu_info);
434 return res; 434 return res;
435 } 435 }
436 #endif 436 #endif
437 437
438 #if defined(OS_LINUX) 438 #if defined(OS_LINUX)
439 #if !defined(OS_CHROMEOS) 439 #if !defined(OS_CHROMEOS)
440 bool CanAccessNvidiaDeviceFile() { 440 bool CanAccessNvidiaDeviceFile() {
441 bool res = true; 441 bool res = true;
442 base::ThreadRestrictions::AssertIOAllowed(); 442 base::ThreadRestrictions::AssertIOAllowed();
443 if (access("/dev/nvidiactl", R_OK) != 0) { 443 if (access("/dev/nvidiactl", R_OK) != 0) {
444 VLOG(1) << "NVIDIA device file /dev/nvidiactl access denied"; 444 DVLOG(1) << "NVIDIA device file /dev/nvidiactl access denied";
445 res = false; 445 res = false;
446 } 446 }
447 return res; 447 return res;
448 } 448 }
449 #endif 449 #endif
450 450
451 void CreateDummyGlContext() { 451 void CreateDummyGlContext() {
452 scoped_refptr<gfx::GLSurface> surface( 452 scoped_refptr<gfx::GLSurface> surface(
453 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size())); 453 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()));
454 if (!surface.get()) { 454 if (!surface.get()) {
455 VLOG(1) << "gfx::GLSurface::CreateOffscreenGLSurface failed"; 455 DVLOG(1) << "gfx::GLSurface::CreateOffscreenGLSurface failed";
456 return; 456 return;
457 } 457 }
458 458
459 // On Linux, this is needed to make sure /dev/nvidiactl has 459 // On Linux, this is needed to make sure /dev/nvidiactl has
460 // been opened and its descriptor cached. 460 // been opened and its descriptor cached.
461 scoped_refptr<gfx::GLContext> context(gfx::GLContext::CreateGLContext( 461 scoped_refptr<gfx::GLContext> context(gfx::GLContext::CreateGLContext(
462 NULL, surface.get(), gfx::PreferDiscreteGpu)); 462 NULL, surface.get(), gfx::PreferDiscreteGpu));
463 if (!context.get()) { 463 if (!context.get()) {
464 VLOG(1) << "gfx::GLContext::CreateGLContext failed"; 464 DVLOG(1) << "gfx::GLContext::CreateGLContext failed";
465 return; 465 return;
466 } 466 }
467 467
468 // Similarly, this is needed for /dev/nvidia0. 468 // Similarly, this is needed for /dev/nvidia0.
469 if (context->MakeCurrent(surface.get())) { 469 if (context->MakeCurrent(surface.get())) {
470 context->ReleaseCurrent(surface.get()); 470 context->ReleaseCurrent(surface.get());
471 } else { 471 } else {
472 VLOG(1) << "gfx::GLContext::MakeCurrent failed"; 472 DVLOG(1) << "gfx::GLContext::MakeCurrent failed";
473 } 473 }
474 } 474 }
475 475
476 void WarmUpSandboxNvidia(const gpu::GPUInfo& gpu_info, 476 void WarmUpSandboxNvidia(const gpu::GPUInfo& gpu_info,
477 bool should_initialize_gl_context) { 477 bool should_initialize_gl_context) {
478 // We special case Optimus since the vendor_id we see may not be Nvidia. 478 // We special case Optimus since the vendor_id we see may not be Nvidia.
479 bool uses_nvidia_driver = (gpu_info.gpu.vendor_id == 0x10de && // NVIDIA. 479 bool uses_nvidia_driver = (gpu_info.gpu.vendor_id == 0x10de && // NVIDIA.
480 gpu_info.driver_vendor == "NVIDIA") || 480 gpu_info.driver_vendor == "NVIDIA") ||
481 gpu_info.optimus; 481 gpu_info.optimus;
482 if (uses_nvidia_driver && should_initialize_gl_context) { 482 if (uses_nvidia_driver && should_initialize_gl_context) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 return true; 536 return true;
537 } 537 }
538 538
539 return false; 539 return false;
540 } 540 }
541 #endif // defined(OS_WIN) 541 #endif // defined(OS_WIN)
542 542
543 } // namespace. 543 } // namespace.
544 544
545 } // namespace content 545 } // namespace content
OLDNEW
« content/gpu/gpu_child_thread.cc ('K') | « content/gpu/gpu_child_thread.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698