| 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 "gpu/config/gpu_util.h" | 5 #include "gpu/config/gpu_util.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_split.h" | 13 #include "base/strings/string_split.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "gpu/config/gpu_control_list_jsons.h" | 15 #include "gpu/config/gpu_control_list_jsons.h" |
| 16 #include "gpu/config/gpu_driver_bug_list.h" | 16 #include "gpu/config/gpu_driver_bug_list.h" |
| 17 #include "gpu/config/gpu_info_collector.h" | 17 #include "gpu/config/gpu_info_collector.h" |
| 18 #include "gpu/config/gpu_switches.h" | 18 #include "gpu/config/gpu_switches.h" |
| 19 #include "ui/gl/gl_switches.h" | 19 #include "ui/gl/gl_switches.h" |
| 20 #include "ui/gl/gpu_switching_manager.h" |
| 20 | 21 |
| 21 namespace gpu { | 22 namespace gpu { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 // Combine the integers into a string, seperated by ','. | 26 // Combine the integers into a string, seperated by ','. |
| 26 std::string IntSetToString(const std::set<int>& list) { | 27 std::string IntSetToString(const std::set<int>& list) { |
| 27 std::string rt; | 28 std::string rt; |
| 28 for (std::set<int>::const_iterator it = list.begin(); | 29 for (std::set<int>::const_iterator it = list.begin(); |
| 29 it != list.end(); ++it) { | 30 it != list.end(); ++it) { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 gpu_info->secondary_gpus.clear(); | 139 gpu_info->secondary_gpus.clear(); |
| 139 for (size_t i = 0; i < vendor_ids.size() && i < device_ids.size(); ++i) { | 140 for (size_t i = 0; i < vendor_ids.size() && i < device_ids.size(); ++i) { |
| 140 gpu::GPUInfo::GPUDevice secondary_device; | 141 gpu::GPUInfo::GPUDevice secondary_device; |
| 141 secondary_device.active = false; | 142 secondary_device.active = false; |
| 142 secondary_device.vendor_id = vendor_ids[i]; | 143 secondary_device.vendor_id = vendor_ids[i]; |
| 143 secondary_device.device_id = device_ids[i]; | 144 secondary_device.device_id = device_ids[i]; |
| 144 gpu_info->secondary_gpus.push_back(secondary_device); | 145 gpu_info->secondary_gpus.push_back(secondary_device); |
| 145 } | 146 } |
| 146 } | 147 } |
| 147 | 148 |
| 149 void InitializeDualGpusIfSupported( |
| 150 const std::set<int>& driver_bug_workarounds) { |
| 151 ui::GpuSwitchingManager* switching_manager = |
| 152 ui::GpuSwitchingManager::GetInstance(); |
| 153 if (!switching_manager->SupportsDualGpus()) |
| 154 return; |
| 155 if (driver_bug_workarounds.count(gpu::FORCE_DISCRETE_GPU) == 1) |
| 156 ui::GpuSwitchingManager::GetInstance()->ForceUseOfDiscreteGpu(); |
| 157 else if (driver_bug_workarounds.count(gpu::FORCE_INTEGRATED_GPU) == 1) |
| 158 ui::GpuSwitchingManager::GetInstance()->ForceUseOfIntegratedGpu(); |
| 159 } |
| 160 |
| 148 } // namespace gpu | 161 } // namespace gpu |
| OLD | NEW |