| OLD | NEW |
| 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 Loading... |
| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 return true; | 591 return true; |
| 585 } | 592 } |
| 586 | 593 |
| 587 return false; | 594 return false; |
| 588 } | 595 } |
| 589 #endif // defined(OS_WIN) | 596 #endif // defined(OS_WIN) |
| 590 | 597 |
| 591 } // namespace. | 598 } // namespace. |
| 592 | 599 |
| 593 } // namespace content | 600 } // namespace content |
| OLD | NEW |