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

Side by Side Diff: content/browser/gpu/gpu_data_manager_impl_private.cc

Issue 2312173003: gpu: Unify code to initialize dual-gpu mode. (Closed)
Patch Set: . Created 4 years, 3 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
« no previous file with comments | « no previous file | content/gpu/gpu_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "content/browser/gpu/gpu_data_manager_impl_private.h" 5 #include "content/browser/gpu/gpu_data_manager_impl_private.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 void GpuDataManagerImplPrivate::UpdateGpuSwitchingManager( 1172 void GpuDataManagerImplPrivate::UpdateGpuSwitchingManager(
1173 const gpu::GPUInfo& gpu_info) { 1173 const gpu::GPUInfo& gpu_info) {
1174 // The vendor IDs might be 0 on non-PCI devices (like Android), but 1174 // The vendor IDs might be 0 on non-PCI devices (like Android), but
1175 // the length of the vector is all we care about in most cases. 1175 // the length of the vector is all we care about in most cases.
1176 std::vector<uint32_t> vendor_ids; 1176 std::vector<uint32_t> vendor_ids;
1177 vendor_ids.push_back(gpu_info.gpu.vendor_id); 1177 vendor_ids.push_back(gpu_info.gpu.vendor_id);
1178 for (const auto& device : gpu_info.secondary_gpus) { 1178 for (const auto& device : gpu_info.secondary_gpus) {
1179 vendor_ids.push_back(device.vendor_id); 1179 vendor_ids.push_back(device.vendor_id);
1180 } 1180 }
1181 ui::GpuSwitchingManager::GetInstance()->SetGpuVendorIds(vendor_ids); 1181 ui::GpuSwitchingManager::GetInstance()->SetGpuVendorIds(vendor_ids);
1182 1182 gpu::InitializeDualGpusIfSupported(gpu_driver_bugs_);
1183 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) {
1184 if (gpu_driver_bugs_.count(gpu::FORCE_DISCRETE_GPU) == 1)
1185 ui::GpuSwitchingManager::GetInstance()->ForceUseOfDiscreteGpu();
1186 else if (gpu_driver_bugs_.count(gpu::FORCE_INTEGRATED_GPU) == 1)
1187 ui::GpuSwitchingManager::GetInstance()->ForceUseOfIntegratedGpu();
1188 }
1189 } 1183 }
1190 1184
1191 void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() { 1185 void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() {
1192 observer_list_->Notify(FROM_HERE, &GpuDataManagerObserver::OnGpuInfoUpdate); 1186 observer_list_->Notify(FROM_HERE, &GpuDataManagerObserver::OnGpuInfoUpdate);
1193 } 1187 }
1194 1188
1195 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() { 1189 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() {
1196 if (!GpuAccessAllowed(NULL) || 1190 if (!GpuAccessAllowed(NULL) ||
1197 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_WEBGL)) { 1191 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_WEBGL)) {
1198 if (!swiftshader_path_.empty() && 1192 if (!swiftshader_path_.empty() &&
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; 1307 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure;
1314 #if defined(OS_WIN) 1308 #if defined(OS_WIN)
1315 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; 1309 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure;
1316 #endif 1310 #endif
1317 complete_gpu_info_already_requested_ = true; 1311 complete_gpu_info_already_requested_ = true;
1318 // Some observers might be waiting. 1312 // Some observers might be waiting.
1319 NotifyGpuInfoUpdate(); 1313 NotifyGpuInfoUpdate();
1320 } 1314 }
1321 1315
1322 } // namespace content 1316 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/gpu/gpu_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698