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

Unified Diff: content/gpu/gpu_info_collector_win.cc

Issue 9959085: Make it possible to blacklist gpu's based on the Windows experience index. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1025/src/
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/content_common.gypi ('k') | content/public/common/gpu_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/gpu/gpu_info_collector_win.cc
===================================================================
--- content/gpu/gpu_info_collector_win.cc (revision 130192)
+++ content/gpu/gpu_info_collector_win.cc (working copy)
@@ -7,6 +7,7 @@
#include <windows.h>
#include <d3d9.h>
#include <setupapi.h>
+#include <winsatcominterfacei.h>
#include "base/command_line.h"
#include "base/file_path.h"
@@ -32,6 +33,82 @@
return base::IntToString(hi) + "." + base::IntToString(low);
}
+float GetAssessmentScore(IProvideWinSATResultsInfo* results,
+ WINSAT_ASSESSMENT_TYPE type) {
+ IProvideWinSATAssessmentInfo* subcomponent = NULL;
+ if (FAILED(results->GetAssessmentInfo(type, &subcomponent)))
+ return 0.0;
+
+ float score = 0.0;
+ if (FAILED(subcomponent->get_Score(&score)))
+ score = 0.0;
+ subcomponent->Release();
+ return score;
+}
+
+content::GpuPerformanceStats RetrieveGpuPerformanceStats() {
+ IQueryRecentWinSATAssessment* assessment = NULL;
+ IProvideWinSATResultsInfo* results = NULL;
+
+ content::GpuPerformanceStats stats;
+
+ do {
+ HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
+ if (FAILED(hr)) {
+ LOG(ERROR) << "CoInitializeEx() failed";
+ break;
+ }
+
+ hr = CoCreateInstance(__uuidof(CQueryWinSAT),
+ NULL,
+ CLSCTX_INPROC_SERVER,
+ __uuidof(IQueryRecentWinSATAssessment),
+ reinterpret_cast<void**>(&assessment));
+ if (FAILED(hr)) {
+ LOG(ERROR) << "CoCreateInstance() failed";
+ break;
+ }
+
+ hr = assessment->get_Info(&results);
+ if (FAILED(hr)) {
+ LOG(ERROR) << "get_Info() failed";
+ break;
+ }
+
+ WINSAT_ASSESSMENT_STATE state = WINSAT_ASSESSMENT_STATE_UNKNOWN;
+ hr = results->get_AssessmentState(&state);
+ if (FAILED(hr)) {
+ LOG(ERROR) << "get_AssessmentState() failed";
+ break;
+ }
+ if (state != WINSAT_ASSESSMENT_STATE_VALID &&
+ state != WINSAT_ASSESSMENT_STATE_INCOHERENT_WITH_HARDWARE) {
+ LOG(ERROR) << "Can't retrieve a valid assessment";
+ break;
+ }
+
+ hr = results->get_SystemRating(&stats.overall);
+ if (FAILED(hr))
+ LOG(ERROR) << "Get overall score failed";
+
+ stats.gaming = GetAssessmentScore(results, WINSAT_ASSESSMENT_D3D);
+ if (stats.gaming == 0.0)
+ LOG(ERROR) << "Get gaming score failed";
+
+ stats.graphics = GetAssessmentScore(results, WINSAT_ASSESSMENT_GRAPHICS);
+ if (stats.graphics == 0.0)
+ LOG(ERROR) << "Get graphics score failed";
+ } while (false);
+
+ if (assessment)
+ assessment->Release();
+ if (results)
+ results->Release();
+ CoUninitialize();
+
+ return stats;
+}
+
} // namespace anonymous
// Setup API functions
@@ -64,6 +141,8 @@
bool CollectGraphicsInfo(content::GPUInfo* gpu_info) {
DCHECK(gpu_info);
+ gpu_info->performance_stats = RetrieveGpuPerformanceStats();
+
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) {
std::string requested_implementation_name =
CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kUseGL);
@@ -113,6 +192,8 @@
if (!CollectVideoCardInfo(gpu_info))
rt = false;
+ gpu_info->performance_stats = RetrieveGpuPerformanceStats();
+
return rt;
}
« no previous file with comments | « content/content_common.gypi ('k') | content/public/common/gpu_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698