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

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

Issue 10855014: Revert 149966 on 1180 (M21) - Merge 147334 to 1180 (M21) - Wire the AMD switchable videcard detecti… (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1180/src/
Patch Set: Created 8 years, 4 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 | « content/gpu/gpu_info_collector.h ('k') | gpu/DEPS » ('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) 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 "content/gpu/gpu_info_collector.h" 5 #include "content/gpu/gpu_info_collector.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <d3d9.h> 8 #include <d3d9.h>
9 #include <setupapi.h> 9 #include <setupapi.h>
10 10
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 UMA_HISTOGRAM_TIMES("GPU.WinSAT.ReadResultsFileTime", 146 UMA_HISTOGRAM_TIMES("GPU.WinSAT.ReadResultsFileTime",
147 base::TimeTicks::Now() - start_time); 147 base::TimeTicks::Now() - start_time);
148 148
149 return stats; 149 return stats;
150 } 150 }
151 151
152 } // namespace anonymous 152 } // namespace anonymous
153 153
154 namespace gpu_info_collector { 154 namespace gpu_info_collector {
155 155
156 #if !defined(OFFICIAL_BUILD)
157 AMDVideoCardType GetAMDVideocardType() {
158 return UNKNOWN;
159 }
160 #else
161 // This function has a real implementation for official builds that can
162 // be found in src/third_party/amd.
163 AMDVideoCardType GetAMDVideocardType();
164 #endif
165
166 bool CollectGraphicsInfo(content::GPUInfo* gpu_info) { 156 bool CollectGraphicsInfo(content::GPUInfo* gpu_info) {
167 TRACE_EVENT0("gpu", "CollectGraphicsInfo"); 157 TRACE_EVENT0("gpu", "CollectGraphicsInfo");
168 158
169 DCHECK(gpu_info); 159 DCHECK(gpu_info);
170 160
171 content::GpuPerformanceStats stats = RetrieveGpuPerformanceStats(); 161 content::GpuPerformanceStats stats = RetrieveGpuPerformanceStats();
172 UMA_HISTOGRAM_BOOLEAN( 162 UMA_HISTOGRAM_BOOLEAN(
173 "GPU.WinSAT.HasResults", 163 "GPU.WinSAT.HasResults",
174 stats.overall != 0.0 && stats.graphics != 0.0 && stats.gaming != 0.0); 164 stats.overall != 0.0 && stats.graphics != 0.0 && stats.gaming != 0.0);
175 gpu_info->performance_stats = stats; 165 gpu_info->performance_stats = stats;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 if (result == ERROR_SUCCESS) 337 if (result == ERROR_SUCCESS)
348 driver_date = WideToASCII(std::wstring(value)); 338 driver_date = WideToASCII(std::wstring(value));
349 339
350 std::string driver_vendor; 340 std::string driver_vendor;
351 dwcb_data = sizeof(value); 341 dwcb_data = sizeof(value);
352 result = RegQueryValueExW( 342 result = RegQueryValueExW(
353 key, L"ProviderName", NULL, NULL, 343 key, L"ProviderName", NULL, NULL,
354 reinterpret_cast<LPBYTE>(value), &dwcb_data); 344 reinterpret_cast<LPBYTE>(value), &dwcb_data);
355 if (result == ERROR_SUCCESS) { 345 if (result == ERROR_SUCCESS) {
356 driver_vendor = WideToASCII(std::wstring(value)); 346 driver_vendor = WideToASCII(std::wstring(value));
357 if (driver_vendor == "Advanced Micro Devices, Inc." || 347 // If it's an Intel GPU with a driver provided by AMD then it's
358 driver_vendor == "ATI Technologies Inc.") { 348 // probably AMD's Dynamic Switchable Graphics.
359 // We are conservative and assume that in the absense of a clear 349 // TODO: detect only AMD switchable
360 // signal the videocard is assumed to be switchable. 350 gpu_info->amd_switchable =
361 AMDVideoCardType amd_card_type = GetAMDVideocardType(); 351 driver_vendor == "Advanced Micro Devices, Inc." ||
362 gpu_info->amd_switchable = (amd_card_type != STANDALONE); 352 driver_vendor == "ATI Technologies Inc.";
363 }
364 } 353 }
365 354
366 gpu_info->driver_vendor = driver_vendor; 355 gpu_info->driver_vendor = driver_vendor;
367 gpu_info->driver_version = driver_version; 356 gpu_info->driver_version = driver_version;
368 gpu_info->driver_date = driver_date; 357 gpu_info->driver_date = driver_date;
369 found = true; 358 found = true;
370 RegCloseKey(key); 359 RegCloseKey(key);
371 break; 360 break;
372 } 361 }
373 } 362 }
(...skipping 14 matching lines...) Expand all
388 377
389 size_t pos = gl_version_string.find_last_not_of("0123456789."); 378 size_t pos = gl_version_string.find_last_not_of("0123456789.");
390 if (pos != std::string::npos && pos < gl_version_string.length() - 1) { 379 if (pos != std::string::npos && pos < gl_version_string.length() - 1) {
391 gpu_info->driver_version = gl_version_string.substr(pos + 1); 380 gpu_info->driver_version = gl_version_string.substr(pos + 1);
392 return true; 381 return true;
393 } 382 }
394 return false; 383 return false;
395 } 384 }
396 385
397 } // namespace gpu_info_collector 386 } // namespace gpu_info_collector
OLDNEW
« no previous file with comments | « content/gpu/gpu_info_collector.h ('k') | gpu/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698