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

Side by Side Diff: gpu/config/gpu_info_collector_win.cc

Issue 332843003: Use the updated AMD switchable info collection code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « gpu/config/gpu_info_collector.h ('k') | no next file » | 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) 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_info_collector.h" 5 #include "gpu/config/gpu_info_collector.h"
6 6
7 // This has to be included before windows.h. 7 // This has to be included before windows.h.
8 #include "third_party/re2/re2/re2.h" 8 #include "third_party/re2/re2/re2.h"
9 9
10 #include <windows.h> 10 #include <windows.h>
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 void CollectD3D11Support() { 356 void CollectD3D11Support() {
357 // D3D11 takes about 50ms to initialize so do this on a worker thread. 357 // D3D11 takes about 50ms to initialize so do this on a worker thread.
358 base::WorkerPool::PostTask( 358 base::WorkerPool::PostTask(
359 FROM_HERE, 359 FROM_HERE,
360 base::Bind(CollectD3D11SupportOnWorkerThread), 360 base::Bind(CollectD3D11SupportOnWorkerThread),
361 false); 361 false);
362 } 362 }
363 } // namespace anonymous 363 } // namespace anonymous
364 364
365 #if !defined(GOOGLE_CHROME_BUILD) 365 #if !defined(GOOGLE_CHROME_BUILD)
366 AMDVideoCardType GetAMDVideocardType() { 366 void GetAMDVideocardInfo(GPUInfo* gpu_info) {
367 return STANDALONE; 367 DCHECK(gpu_info);
368 return;
368 } 369 }
369 #else 370 #else
370 // This function has a real implementation for official builds that can 371 // This function has a real implementation for official builds that can
371 // be found in src/third_party/amd. 372 // be found in src/third_party/amd.
372 AMDVideoCardType GetAMDVideocardType(); 373 void GetAMDVideocardInfo(GPUInfo* gpu_info);
373 #endif 374 #endif
374 375
375 bool CollectDriverInfoD3D(const std::wstring& device_id, 376 bool CollectDriverInfoD3D(const std::wstring& device_id,
376 GPUInfo* gpu_info) { 377 GPUInfo* gpu_info) {
377 TRACE_EVENT0("gpu", "CollectDriverInfoD3D"); 378 TRACE_EVENT0("gpu", "CollectDriverInfoD3D");
378 379
379 // create device info for the display device 380 // create device info for the display device
380 HDEVINFO device_info = SetupDiGetClassDevsW( 381 HDEVINFO device_info = SetupDiGetClassDevsW(
381 NULL, device_id.c_str(), NULL, 382 NULL, device_id.c_str(), NULL,
382 DIGCF_PRESENT | DIGCF_PROFILE | DIGCF_ALLCLASSES); 383 DIGCF_PRESENT | DIGCF_PROFILE | DIGCF_ALLCLASSES);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 key, L"ProviderName", NULL, NULL, 427 key, L"ProviderName", NULL, NULL,
427 reinterpret_cast<LPBYTE>(value), &dwcb_data); 428 reinterpret_cast<LPBYTE>(value), &dwcb_data);
428 if (result == ERROR_SUCCESS) { 429 if (result == ERROR_SUCCESS) {
429 driver_vendor = base::UTF16ToASCII(std::wstring(value)); 430 driver_vendor = base::UTF16ToASCII(std::wstring(value));
430 if (driver_vendor == "Advanced Micro Devices, Inc." || 431 if (driver_vendor == "Advanced Micro Devices, Inc." ||
431 driver_vendor == "ATI Technologies Inc.") { 432 driver_vendor == "ATI Technologies Inc.") {
432 // We are conservative and assume that in the absence of a clear 433 // We are conservative and assume that in the absence of a clear
433 // signal the videocard is assumed to be switchable. Additionally, 434 // signal the videocard is assumed to be switchable. Additionally,
434 // some switchable systems with Intel GPUs aren't correctly 435 // some switchable systems with Intel GPUs aren't correctly
435 // detected, so always count them. 436 // detected, so always count them.
436 AMDVideoCardType amd_card_type = GetAMDVideocardType(); 437 GetAMDVideocardInfo(gpu_info);
437 gpu_info->amd_switchable = (gpu_info->gpu.vendor_id == 0x8086) || 438 if (!gpu_info->amd_switchable &&
438 (amd_card_type != STANDALONE); 439 gpu_info->gpu.vendor_id == 0x8086) {
440 gpu_info->amd_switchable = true;
441 gpu_info->secondary_gpus.push_back(gpu_info->gpu);
442 gpu_info->gpu.vendor_id = 0x1002;
443 gpu_info->gpu.device_id = 0; // Unknown discrete AMD GPU.
444 }
439 } 445 }
440 } 446 }
441 447
442 gpu_info->driver_vendor = driver_vendor; 448 gpu_info->driver_vendor = driver_vendor;
443 gpu_info->driver_version = driver_version; 449 gpu_info->driver_version = driver_version;
444 gpu_info->driver_date = driver_date; 450 gpu_info->driver_date = driver_date;
445 found = true; 451 found = true;
446 RegCloseKey(key); 452 RegCloseKey(key);
447 break; 453 break;
448 } 454 }
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 basic_gpu_info->software_rendering = true; 653 basic_gpu_info->software_rendering = true;
648 return; 654 return;
649 } 655 }
650 656
651 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); 657 MergeGPUInfoGL(basic_gpu_info, context_gpu_info);
652 658
653 basic_gpu_info->dx_diagnostics = context_gpu_info.dx_diagnostics; 659 basic_gpu_info->dx_diagnostics = context_gpu_info.dx_diagnostics;
654 } 660 }
655 661
656 } // namespace gpu 662 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/config/gpu_info_collector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698