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

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

Issue 1463823002: Add DriverBugWorkaroundsInGpuProcessPage to gpu_process_test.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove "set gpu active in GPU process" from previous patch set. Created 4 years, 8 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 // crash. 299 // crash.
300 // By skipping the following code on Mac, we don't really lose anything, 300 // By skipping the following code on Mac, we don't really lose anything,
301 // because the basic GPU information is passed down from browser process 301 // because the basic GPU information is passed down from browser process
302 // and we already registered them through SetGpuInfo() above. 302 // and we already registered them through SetGpuInfo() above.
303 base::TimeTicks before_collect_context_graphics_info = 303 base::TimeTicks before_collect_context_graphics_info =
304 base::TimeTicks::Now(); 304 base::TimeTicks::Now();
305 #if !defined(OS_MACOSX) 305 #if !defined(OS_MACOSX)
306 if (!CollectGraphicsInfo(gpu_info)) 306 if (!CollectGraphicsInfo(gpu_info))
307 dead_on_arrival = true; 307 dead_on_arrival = true;
308 308
309 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_LINUX) 309 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_LINUX) || \
310 defined(OS_WIN)
310 // Recompute gpu driver bug workarounds. 311 // Recompute gpu driver bug workarounds.
311 // This is necessary on systems where vendor_id/device_id aren't available 312 // This is necessary on systems where vendor_id/device_id aren't available
312 // (Chrome OS, Android) or where workarounds may be dependent on GL_VENDOR 313 // (Chrome OS, Android) or where workarounds may be dependent on GL_VENDOR
313 // and GL_RENDERER strings which are lazily computed (Linux). 314 // and GL_RENDERER strings which are lazily computed (Linux).
314 if (!command_line.HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { 315 if (!command_line.HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) {
315 // TODO: this can not affect disabled extensions, since they're already 316 // TODO: this can not affect disabled extensions, since they're already
316 // initialized in the bindings. This should be moved before bindings 317 // initialized in the bindings. This should be moved before bindings
317 // initialization. However, populating GPUInfo fully works only on 318 // initialization. However, populating GPUInfo fully works only on
318 // Android. Other platforms would need the bindings to query GL strings. 319 // Android. Other platforms would need the bindings to query GL strings.
320 // TODO(j.isorce): Pass secondary gpus through the command line so that
321 // the local function GetGpuInfoFromCommandLine can generate a complete
322 // GpuInfo. This will allow for the call CollectGraphicsInfo above to
323 // to detect that a secondary gpu is active instead of the primary.
324 // Then the following call will make sure to get the workarounds for the
325 // active gpu.
319 gpu::ApplyGpuDriverBugWorkarounds( 326 gpu::ApplyGpuDriverBugWorkarounds(
320 gpu_info, const_cast<base::CommandLine*>(&command_line)); 327 gpu_info, const_cast<base::CommandLine*>(&command_line));
321 } 328 }
322 #endif 329 #endif
323 330
324 #if defined(OS_LINUX) 331 #if defined(OS_LINUX)
325 initialized_gl_context = true; 332 initialized_gl_context = true;
326 #if !defined(OS_CHROMEOS) 333 #if !defined(OS_CHROMEOS)
327 if (gpu_info.gpu.vendor_id == 0x10de && // NVIDIA 334 if (gpu_info.gpu.vendor_id == 0x10de && // NVIDIA
328 gpu_info.driver_vendor == "NVIDIA" && 335 gpu_info.driver_vendor == "NVIDIA" &&
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 &gpu_info.gpu.vendor_id); 441 &gpu_info.gpu.vendor_id);
435 DCHECK(success); 442 DCHECK(success);
436 success = base::HexStringToUInt( 443 success = base::HexStringToUInt(
437 command_line.GetSwitchValueASCII(switches::kGpuDeviceID), 444 command_line.GetSwitchValueASCII(switches::kGpuDeviceID),
438 &gpu_info.gpu.device_id); 445 &gpu_info.gpu.device_id);
439 DCHECK(success); 446 DCHECK(success);
440 gpu_info.driver_vendor = 447 gpu_info.driver_vendor =
441 command_line.GetSwitchValueASCII(switches::kGpuDriverVendor); 448 command_line.GetSwitchValueASCII(switches::kGpuDriverVendor);
442 gpu_info.driver_version = 449 gpu_info.driver_version =
443 command_line.GetSwitchValueASCII(switches::kGpuDriverVersion); 450 command_line.GetSwitchValueASCII(switches::kGpuDriverVersion);
451 gpu_info.driver_date =
452 command_line.GetSwitchValueASCII(switches::kGpuDriverDate);
444 GetContentClient()->SetGpuInfo(gpu_info); 453 GetContentClient()->SetGpuInfo(gpu_info);
445 } 454 }
446 455
447 bool WarmUpSandbox(const base::CommandLine& command_line) { 456 bool WarmUpSandbox(const base::CommandLine& command_line) {
448 { 457 {
449 TRACE_EVENT0("gpu", "Warm up rand"); 458 TRACE_EVENT0("gpu", "Warm up rand");
450 // Warm up the random subsystem, which needs to be done pre-sandbox on all 459 // Warm up the random subsystem, which needs to be done pre-sandbox on all
451 // platforms. 460 // platforms.
452 (void) base::RandUint64(); 461 (void) base::RandUint64();
453 } 462 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 return true; 593 return true;
585 } 594 }
586 595
587 return false; 596 return false;
588 } 597 }
589 #endif // defined(OS_WIN) 598 #endif // defined(OS_WIN)
590 599
591 } // namespace. 600 } // namespace.
592 601
593 } // namespace content 602 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698