summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/gpu_blacklist.cc169
-rw-r--r--chrome/browser/gpu_blacklist.h62
-rw-r--r--chrome/browser/gpu_blacklist_unittest.cc88
-rw-r--r--chrome/browser/gpu_performance_stats.cc32
-rw-r--r--chrome/browser/gpu_performance_stats.h25
-rw-r--r--chrome/browser/gpu_performance_stats_win.cc68
-rw-r--r--chrome/browser/gpu_util.cc12
-rw-r--r--chrome/browser/metrics/metrics_log.cc9
-rw-r--r--chrome/browser/resources/gpu_internals/info_view.html2
-rw-r--r--chrome/browser/resources/gpu_internals/info_view.js10
-rw-r--r--chrome/browser/ui/webui/gpu_internals_ui.cc5
-rw-r--r--chrome/chrome_browser.gypi3
-rw-r--r--chrome/common/metrics/proto/system_profile.proto2
-rw-r--r--content/common/gpu/gpu_messages.h7
-rw-r--r--content/content_common.gypi1
-rw-r--r--content/gpu/gpu_info_collector_win.cc66
-rw-r--r--content/public/common/gpu_info.h4
-rw-r--r--content/public/common/gpu_performance_stats.h23
18 files changed, 410 insertions, 178 deletions
diff --git a/chrome/browser/gpu_blacklist.cc b/chrome/browser/gpu_blacklist.cc
index 405cd8c..0f59815 100644
--- a/chrome/browser/gpu_blacklist.cc
+++ b/chrome/browser/gpu_blacklist.cc
@@ -43,7 +43,7 @@ Version* GetDateFromString(const std::string& date_string) {
GpuBlacklist::VersionInfo::VersionInfo(const std::string& version_op,
const std::string& version_string,
const std::string& version_string2) {
- op_ = StringToOp(version_op);
+ op_ = StringToNumericOp(version_op);
if (op_ == kUnknown || op_ == kAny)
return;
version_.reset(Version::GetVersionFromString(version_string));
@@ -99,25 +99,6 @@ bool GpuBlacklist::VersionInfo::IsValid() const {
return op_ != kUnknown;
}
-GpuBlacklist::VersionInfo::Op GpuBlacklist::VersionInfo::StringToOp(
- const std::string& version_op) {
- if (version_op == "=")
- return kEQ;
- else if (version_op == "<")
- return kLT;
- else if (version_op == "<=")
- return kLE;
- else if (version_op == ">")
- return kGT;
- else if (version_op == ">=")
- return kGE;
- else if (version_op == "any")
- return kAny;
- else if (version_op == "between")
- return kBetween;
- return kUnknown;
-}
-
GpuBlacklist::OsInfo::OsInfo(const std::string& os,
const std::string& version_op,
const std::string& version_string,
@@ -202,6 +183,52 @@ GpuBlacklist::StringInfo::Op GpuBlacklist::StringInfo::StringToOp(
return kUnknown;
}
+GpuBlacklist::FloatInfo::FloatInfo(const std::string& float_op,
+ const std::string& float_value,
+ const std::string& float_value2)
+ : op_(kUnknown),
+ value_(0.f),
+ value2_(0.f) {
+ double dvalue = 0;
+ if (!base::StringToDouble(float_value, &dvalue)) {
+ op_ = kUnknown;
+ return;
+ }
+ value_ = static_cast<float>(dvalue);
+ op_ = StringToNumericOp(float_op);
+ if (op_ == kBetween) {
+ if (!base::StringToDouble(float_value2, &dvalue)) {
+ op_ = kUnknown;
+ return;
+ }
+ value2_ = static_cast<float>(dvalue);
+ }
+}
+
+bool GpuBlacklist::FloatInfo::Contains(float value) const {
+ if (op_ == kUnknown)
+ return false;
+ if (op_ == kAny)
+ return true;
+ if (op_ == kEQ)
+ return (value == value_);
+ if (op_ == kLT)
+ return (value < value_);
+ if (op_ == kLE)
+ return (value <= value_);
+ if (op_ == kGT)
+ return (value > value_);
+ if (op_ == kGE)
+ return (value >= value_);
+ DCHECK(op_ == kBetween);
+ return ((value_ <= value && value <= value2_) ||
+ (value2_ <= value && value <= value_));
+}
+
+bool GpuBlacklist::FloatInfo::IsValid() const {
+ return op_ != kUnknown;
+}
+
// static
GpuBlacklist::ScopedGpuBlacklistEntry
GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue(
@@ -377,6 +404,51 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue(
dictionary_entry_count++;
}
+ DictionaryValue* perf_graphics_value = NULL;
+ if (value->GetDictionary("perf_graphics", &perf_graphics_value)) {
+ std::string op;
+ std::string float_value;
+ std::string float_value2;
+ perf_graphics_value->GetString("op", &op);
+ perf_graphics_value->GetString("value", &float_value);
+ perf_graphics_value->GetString("value2", &float_value2);
+ if (!entry->SetPerfGraphicsInfo(op, float_value, float_value2)) {
+ LOG(WARNING) << "Malformed perf_graphics entry " << entry->id();
+ return NULL;
+ }
+ dictionary_entry_count++;
+ }
+
+ DictionaryValue* perf_gaming_value = NULL;
+ if (value->GetDictionary("perf_gaming", &perf_gaming_value)) {
+ std::string op;
+ std::string float_value;
+ std::string float_value2;
+ perf_gaming_value->GetString("op", &op);
+ perf_gaming_value->GetString("value", &float_value);
+ perf_gaming_value->GetString("value2", &float_value2);
+ if (!entry->SetPerfGamingInfo(op, float_value, float_value2)) {
+ LOG(WARNING) << "Malformed perf_gaming entry " << entry->id();
+ return NULL;
+ }
+ dictionary_entry_count++;
+ }
+
+ DictionaryValue* perf_overall_value = NULL;
+ if (value->GetDictionary("perf_overall", &perf_overall_value)) {
+ std::string op;
+ std::string float_value;
+ std::string float_value2;
+ perf_overall_value->GetString("op", &op);
+ perf_overall_value->GetString("value", &float_value);
+ perf_overall_value->GetString("value2", &float_value2);
+ if (!entry->SetPerfOverallInfo(op, float_value, float_value2)) {
+ LOG(WARNING) << "Malformed perf_overall entry " << entry->id();
+ return NULL;
+ }
+ dictionary_entry_count++;
+ }
+
if (top_level) {
ListValue* blacklist_value = NULL;
if (!value->GetList("blacklist", &blacklist_value)) {
@@ -528,6 +600,33 @@ bool GpuBlacklist::GpuBlacklistEntry::SetGLRendererInfo(
return gl_renderer_info_->IsValid();
}
+bool GpuBlacklist::GpuBlacklistEntry::SetPerfGraphicsInfo(
+ const std::string& op,
+ const std::string& float_string,
+ const std::string& float_string2) {
+ perf_graphics_info_.reset(
+ new FloatInfo(op, float_string, float_string2));
+ return perf_graphics_info_->IsValid();
+}
+
+bool GpuBlacklist::GpuBlacklistEntry::SetPerfGamingInfo(
+ const std::string& op,
+ const std::string& float_string,
+ const std::string& float_string2) {
+ perf_gaming_info_.reset(
+ new FloatInfo(op, float_string, float_string2));
+ return perf_gaming_info_->IsValid();
+}
+
+bool GpuBlacklist::GpuBlacklistEntry::SetPerfOverallInfo(
+ const std::string& op,
+ const std::string& float_string,
+ const std::string& float_string2) {
+ perf_overall_info_.reset(
+ new FloatInfo(op, float_string, float_string2));
+ return perf_overall_info_->IsValid();
+}
+
bool GpuBlacklist::GpuBlacklistEntry::SetBlacklistedFeatures(
const std::vector<std::string>& blacklisted_features) {
size_t size = blacklisted_features.size();
@@ -600,6 +699,15 @@ bool GpuBlacklist::GpuBlacklistEntry::Contains(
if (gl_renderer_info_.get() != NULL &&
!gl_renderer_info_->Contains(gpu_info.gl_renderer))
return false;
+ if (perf_graphics_info_.get() != NULL &&
+ !perf_graphics_info_->Contains(gpu_info.performance_stats.graphics))
+ return false;
+ if (perf_gaming_info_.get() != NULL &&
+ !perf_gaming_info_->Contains(gpu_info.performance_stats.gaming))
+ return false;
+ if (perf_overall_info_.get() != NULL &&
+ !perf_overall_info_->Contains(gpu_info.performance_stats.overall))
+ return false;
for (size_t i = 0; i < exceptions_.size(); ++i) {
if (exceptions_[i]->Contains(os_type, os_version, gpu_info))
return false;
@@ -863,3 +971,24 @@ GpuBlacklist::IsEntrySupportedByCurrentBrowserVersion(
void GpuBlacklist::OnGpuInfoUpdate() {
UpdateGpuDataManager();
}
+
+// static
+GpuBlacklist::NumericOp GpuBlacklist::StringToNumericOp(
+ const std::string& op) {
+ if (op == "=")
+ return kEQ;
+ if (op == "<")
+ return kLT;
+ if (op == "<=")
+ return kLE;
+ if (op == ">")
+ return kGT;
+ if (op == ">=")
+ return kGE;
+ if (op == "any")
+ return kAny;
+ if (op == "between")
+ return kBetween;
+ return kUnknown;
+}
+
diff --git a/chrome/browser/gpu_blacklist.h b/chrome/browser/gpu_blacklist.h
index ca02cf9..0a472cb 100644
--- a/chrome/browser/gpu_blacklist.h
+++ b/chrome/browser/gpu_blacklist.h
@@ -109,6 +109,17 @@ class GpuBlacklist : public content::GpuDataManagerObserver {
kMalformed
};
+ enum NumericOp {
+ kBetween, // <= * <=
+ kEQ, // =
+ kLT, // <
+ kLE, // <=
+ kGT, // >
+ kGE, // >=
+ kAny,
+ kUnknown // Indicates the data is invalid.
+ };
+
class VersionInfo {
public:
VersionInfo(const std::string& version_op,
@@ -123,21 +134,7 @@ class GpuBlacklist : public content::GpuDataManagerObserver {
bool IsValid() const;
private:
- enum Op {
- kBetween, // <= * <=
- kEQ, // =
- kLT, // <
- kLE, // <=
- kGT, // >
- kGE, // >=
- kAny,
- kUnknown // Indicates VersionInfo data is invalid.
- };
-
- // Maps string to Op; returns kUnknown if it's not a valid Op.
- static Op StringToOp(const std::string& version_op);
-
- Op op_;
+ NumericOp op_;
scoped_ptr<Version> version_;
scoped_ptr<Version> version2_;
};
@@ -192,6 +189,24 @@ class GpuBlacklist : public content::GpuDataManagerObserver {
std::string value_;
};
+ class FloatInfo {
+ public:
+ FloatInfo(const std::string& float_op,
+ const std::string& float_value,
+ const std::string& float_value2);
+
+ // Determines if a given float is included in the FloatInfo.
+ bool Contains(float value) const;
+
+ // Determines if the FloatInfo contains valid information.
+ bool IsValid() const;
+
+ private:
+ NumericOp op_;
+ float value_;
+ float value2_;
+ };
+
class GpuBlacklistEntry;
typedef scoped_refptr<GpuBlacklistEntry> ScopedGpuBlacklistEntry;
@@ -271,6 +286,18 @@ class GpuBlacklist : public content::GpuDataManagerObserver {
bool SetGLRendererInfo(const std::string& renderer_op,
const std::string& renderer_value);
+ bool SetPerfGraphicsInfo(const std::string& op,
+ const std::string& float_string,
+ const std::string& float_string2);
+
+ bool SetPerfGamingInfo(const std::string& op,
+ const std::string& float_string,
+ const std::string& float_string2);
+
+ bool SetPerfOverallInfo(const std::string& op,
+ const std::string& float_string,
+ const std::string& float_string2);
+
bool SetBlacklistedFeatures(
const std::vector<std::string>& blacklisted_features);
@@ -289,6 +316,9 @@ class GpuBlacklist : public content::GpuDataManagerObserver {
scoped_ptr<VersionInfo> driver_date_info_;
scoped_ptr<StringInfo> gl_vendor_info_;
scoped_ptr<StringInfo> gl_renderer_info_;
+ scoped_ptr<FloatInfo> perf_graphics_info_;
+ scoped_ptr<FloatInfo> perf_gaming_info_;
+ scoped_ptr<FloatInfo> perf_overall_info_;
content::GpuFeatureType feature_type_;
std::vector<ScopedGpuBlacklistEntry> exceptions_;
bool contains_unknown_fields_;
@@ -320,6 +350,8 @@ class GpuBlacklist : public content::GpuDataManagerObserver {
// Check if any entries contain unknown fields. This is only for tests.
bool contains_unknown_fields() const { return contains_unknown_fields_; }
+ static NumericOp StringToNumericOp(const std::string& op);
+
scoped_ptr<Version> version_;
std::vector<ScopedGpuBlacklistEntry> blacklist_;
diff --git a/chrome/browser/gpu_blacklist_unittest.cc b/chrome/browser/gpu_blacklist_unittest.cc
index 6472800..f07f943 100644
--- a/chrome/browser/gpu_blacklist_unittest.cc
+++ b/chrome/browser/gpu_blacklist_unittest.cc
@@ -40,6 +40,9 @@ class GpuBlacklistTest : public testing::Test {
gpu_info_.driver_date = "7-14-2009";
gpu_info_.gl_vendor = "NVIDIA Corporation";
gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine";
+ gpu_info_.performance_stats.graphics = 5.0;
+ gpu_info_.performance_stats.gaming = 5.0;
+ gpu_info_.performance_stats.overall = 5.0;
}
void TearDown() {
@@ -637,6 +640,91 @@ TEST_F(GpuBlacklistTest, GlRenderer) {
EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
}
+TEST_F(GpuBlacklistTest, PerfGraphics) {
+ const std::string json =
+ "{\n"
+ " \"name\": \"gpu blacklist\",\n"
+ " \"version\": \"0.1\",\n"
+ " \"entries\": [\n"
+ " {\n"
+ " \"id\": 1,\n"
+ " \"perf_graphics\": {\n"
+ " \"op\": \"<\",\n"
+ " \"value\": \"6.0\"\n"
+ " },\n"
+ " \"blacklist\": [\n"
+ " \"webgl\"\n"
+ " ]\n"
+ " }\n"
+ " ]\n"
+ "}";
+ scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+
+ scoped_ptr<GpuBlacklist> blacklist(Create());
+ EXPECT_TRUE(blacklist->LoadGpuBlacklist(
+ "1.0", json, GpuBlacklist::kAllOs));
+ GpuFeatureType type = blacklist->DetermineGpuFeatureType(
+ GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
+}
+
+TEST_F(GpuBlacklistTest, PerfGaming) {
+ const std::string json =
+ "{\n"
+ " \"name\": \"gpu blacklist\",\n"
+ " \"version\": \"0.1\",\n"
+ " \"entries\": [\n"
+ " {\n"
+ " \"id\": 1,\n"
+ " \"perf_gaming\": {\n"
+ " \"op\": \"<=\",\n"
+ " \"value\": \"4.0\"\n"
+ " },\n"
+ " \"blacklist\": [\n"
+ " \"webgl\"\n"
+ " ]\n"
+ " }\n"
+ " ]\n"
+ "}";
+ scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+
+ scoped_ptr<GpuBlacklist> blacklist(Create());
+ EXPECT_TRUE(blacklist->LoadGpuBlacklist(
+ "1.0", json, GpuBlacklist::kAllOs));
+ GpuFeatureType type = blacklist->DetermineGpuFeatureType(
+ GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ EXPECT_EQ(type, 0);
+}
+
+TEST_F(GpuBlacklistTest, PerfOverall) {
+ const std::string json =
+ "{\n"
+ " \"name\": \"gpu blacklist\",\n"
+ " \"version\": \"0.1\",\n"
+ " \"entries\": [\n"
+ " {\n"
+ " \"id\": 1,\n"
+ " \"perf_overall\": {\n"
+ " \"op\": \"between\",\n"
+ " \"value\": \"1.0\",\n"
+ " \"value2\": \"9.0\"\n"
+ " },\n"
+ " \"blacklist\": [\n"
+ " \"webgl\"\n"
+ " ]\n"
+ " }\n"
+ " ]\n"
+ "}";
+ scoped_ptr<Version> os_version(Version::GetVersionFromString("10.6.4"));
+
+ scoped_ptr<GpuBlacklist> blacklist(Create());
+ EXPECT_TRUE(blacklist->LoadGpuBlacklist(
+ "1.0", json, GpuBlacklist::kAllOs));
+ GpuFeatureType type = blacklist->DetermineGpuFeatureType(
+ GpuBlacklist::kOsWin, os_version.get(), gpu_info());
+ EXPECT_EQ(type, content::GPU_FEATURE_TYPE_WEBGL);
+}
+
TEST_F(GpuBlacklistTest, DisabledEntry) {
const std::string disabled_json =
"{\n"
diff --git a/chrome/browser/gpu_performance_stats.cc b/chrome/browser/gpu_performance_stats.cc
deleted file mode 100644
index 93d1932..0000000
--- a/chrome/browser/gpu_performance_stats.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/gpu_performance_stats.h"
-
-#include "base/stringprintf.h"
-
-namespace {
-DictionaryValue* NewDescriptionValuePairFromFloat(const std::string& desc,
- float value) {
- DictionaryValue* dict = new DictionaryValue();
- dict->SetString("description", desc);
- dict->SetString("value", base::StringPrintf("%.1f", value));
- return dict;
-}
-} // namespace
-
-#if !defined(OS_WIN)
-// No data for other operating systems yet, just return 0.0s.
-GpuPerformanceStats GpuPerformanceStats::RetrieveGpuPerformanceStats() {
- return GpuPerformanceStats();
-}
-#endif
-
-base::Value* GpuPerformanceStats::ToValue() const {
- ListValue* result = new ListValue();
- result->Append(NewDescriptionValuePairFromFloat("Graphics", graphics));
- result->Append(NewDescriptionValuePairFromFloat("Gaming", gaming));
- result->Append(NewDescriptionValuePairFromFloat("Overall", overall));
- return result;
-}
diff --git a/chrome/browser/gpu_performance_stats.h b/chrome/browser/gpu_performance_stats.h
deleted file mode 100644
index d6aa019..0000000
--- a/chrome/browser/gpu_performance_stats.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_GPU_PERFORMANCE_STATS_H_
-#define CHROME_BROWSER_GPU_PERFORMANCE_STATS_H_
-
-#include "base/values.h"
-
-class GpuPerformanceStats {
- public:
- GpuPerformanceStats() : graphics(0.f), gaming(0.f), overall(0.f) {
- }
-
- static GpuPerformanceStats RetrieveGpuPerformanceStats();
-
- base::Value* ToValue() const;
-
- float graphics;
- float gaming;
- float overall;
-};
-
-
-#endif // CHROME_BROWSER_GPU_PERFORMANCE_STATS_H_
diff --git a/chrome/browser/gpu_performance_stats_win.cc b/chrome/browser/gpu_performance_stats_win.cc
deleted file mode 100644
index 7472e92..0000000
--- a/chrome/browser/gpu_performance_stats_win.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/gpu_performance_stats.h"
-
-#include <winsatcominterfacei.h>
-
-static float GetComponentScore(IProvideWinSATAssessmentInfo* subcomponent) {
- float score;
- HRESULT hr = subcomponent->get_Score(&score);
- if (FAILED(hr))
- return 0.0;
- return score;
-}
-
-GpuPerformanceStats GpuPerformanceStats::RetrieveGpuPerformanceStats() {
- HRESULT hr = S_OK;
- IQueryRecentWinSATAssessment* assessment = NULL;
- IProvideWinSATResultsInfo* results = NULL;
- IProvideWinSATAssessmentInfo* subcomponent = NULL;
- GpuPerformanceStats stats;
-
- hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
- if (FAILED(hr))
- goto cleanup;
-
- hr = CoCreateInstance(__uuidof(CQueryWinSAT),
- NULL,
- CLSCTX_INPROC_SERVER,
- __uuidof(IQueryRecentWinSATAssessment),
- reinterpret_cast<void**>(&assessment));
- if (FAILED(hr))
- goto cleanup;
-
- hr = assessment->get_Info(&results);
- if (FAILED(hr))
- goto cleanup;
-
- hr = results->get_SystemRating(&stats.overall);
- if (FAILED(hr))
- goto cleanup;
-
- hr = results->GetAssessmentInfo(WINSAT_ASSESSMENT_D3D, &subcomponent);
- if (FAILED(hr))
- goto cleanup;
- stats.gaming = GetComponentScore(subcomponent);
- subcomponent->Release();
- subcomponent = NULL;
-
- hr = results->GetAssessmentInfo(WINSAT_ASSESSMENT_GRAPHICS, &subcomponent);
- if (FAILED(hr))
- goto cleanup;
- stats.graphics = GetComponentScore(subcomponent);
- subcomponent->Release();
- subcomponent = NULL;
-
- cleanup:
- if (assessment)
- assessment->Release();
- if (results)
- results->Release();
- if (subcomponent)
- subcomponent->Release();
- CoUninitialize();
-
- return stats;
-}
diff --git a/chrome/browser/gpu_util.cc b/chrome/browser/gpu_util.cc
index 3ca6c79..5fc6b70 100644
--- a/chrome/browser/gpu_util.cc
+++ b/chrome/browser/gpu_util.cc
@@ -337,6 +337,18 @@ DictionaryValue* GpuInfoAsDictionaryValue() {
info->Set("basic_info", basic_info);
#if defined(OS_WIN)
+ ListValue* perf_info = new ListValue();
+ perf_info->Append(NewDescriptionValuePair(
+ "Graphics",
+ base::StringPrintf("%.1f", gpu_info.performance_stats.graphics)));
+ perf_info->Append(NewDescriptionValuePair(
+ "Gaming",
+ base::StringPrintf("%.1f", gpu_info.performance_stats.gaming)));
+ perf_info->Append(NewDescriptionValuePair(
+ "Overall",
+ base::StringPrintf("%.1f", gpu_info.performance_stats.overall)));
+ info->Set("performance_info", perf_info);
+
Value* dx_info;
if (gpu_info.dx_diagnostics.children.size())
dx_info = DxDiagNodeToList(gpu_info.dx_diagnostics);
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
index ec83684..841eebd0 100644
--- a/chrome/browser/metrics/metrics_log.cc
+++ b/chrome/browser/metrics/metrics_log.cc
@@ -21,7 +21,6 @@
#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/gpu_performance_stats.h"
#include "chrome/browser/plugin_prefs.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -627,8 +626,6 @@ void MetricsLog::RecordEnvironment(
OPEN_ELEMENT_FOR_SCOPE("gpu");
const content::GPUInfo& gpu_info =
GpuDataManager::GetInstance()->GetGPUInfo();
- GpuPerformanceStats gpu_performance_stats =
- GpuPerformanceStats::RetrieveGpuPerformanceStats();
// Write the XML version.
WriteIntAttribute("vendorid", gpu_info.vendor_id);
@@ -642,9 +639,9 @@ void MetricsLog::RecordEnvironment(
gpu->set_driver_date(gpu_info.driver_date);
SystemProfileProto::Hardware::Graphics::PerformanceStatistics*
gpu_performance = gpu->mutable_performance_statistics();
- gpu_performance->set_graphics_score(gpu_performance_stats.graphics);
- gpu_performance->set_gaming_score(gpu_performance_stats.gaming);
- gpu_performance->set_overall_score(gpu_performance_stats.overall);
+ gpu_performance->set_graphics_score(gpu_info.performance_stats.graphics);
+ gpu_performance->set_gaming_score(gpu_info.performance_stats.gaming);
+ gpu_performance->set_overall_score(gpu_info.performance_stats.overall);
}
{
diff --git a/chrome/browser/resources/gpu_internals/info_view.html b/chrome/browser/resources/gpu_internals/info_view.html
index 5dbf836..b9ea809 100644
--- a/chrome/browser/resources/gpu_internals/info_view.html
+++ b/chrome/browser/resources/gpu_internals/info_view.html
@@ -20,7 +20,7 @@ found in the LICENSE file.
<div id="client-info"></div>
</div>
- <div>
+ <div class="performance-div">
<h3>Performance Information</h3>
<div id="performance-info"></div>
</div>
diff --git a/chrome/browser/resources/gpu_internals/info_view.js b/chrome/browser/resources/gpu_internals/info_view.js
index ceee0ee..2827127 100644
--- a/chrome/browser/resources/gpu_internals/info_view.js
+++ b/chrome/browser/resources/gpu_internals/info_view.js
@@ -66,8 +66,6 @@ cr.define('gpu', function() {
description: '2D graphics backend',
value: clientInfo.graphics_backend
}]);
-
- this.setTable_('performance-info', clientInfo.performance);
} else {
this.setText_('client-info', '... loading...');
}
@@ -105,6 +103,7 @@ cr.define('gpu', function() {
var featureStatusList = this.querySelector('.feature-status-list');
var problemsDiv = this.querySelector('.problems-div');
var problemsList = this.querySelector('.problems-list');
+ var performanceDiv = this.querySelector('.performance-div');
var gpuInfo = browserBridge.gpuInfo;
var i;
if (gpuInfo) {
@@ -158,6 +157,13 @@ cr.define('gpu', function() {
else
this.setTable_('basic-info', []);
+ if (gpuInfo.performance_info) {
+ performanceDiv.hidden = false;
+ this.setTable_('performance-info', gpuInfo.performance_info);
+ } else {
+ performanceDiv.hidden = true;
+ }
+
if (gpuInfo.diagnostics) {
diagnosticsDiv.hidden = false;
diagnosticsLoadingDiv.hidden = true;
diff --git a/chrome/browser/ui/webui/gpu_internals_ui.cc b/chrome/browser/ui/webui/gpu_internals_ui.cc
index 133b7c8..75d379d 100644
--- a/chrome/browser/ui/webui/gpu_internals_ui.cc
+++ b/chrome/browser/ui/webui/gpu_internals_ui.cc
@@ -14,7 +14,6 @@
#include "base/sys_info.h"
#include "base/values.h"
#include "chrome/browser/gpu_blacklist.h"
-#include "chrome/browser/gpu_performance_stats.h"
#include "chrome/browser/gpu_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
@@ -206,10 +205,6 @@ Value* GpuMessageHandler::OnRequestClientInfo(const ListValue* list) {
dict->SetString("blacklist_version",
GpuBlacklist::GetInstance()->GetVersion());
- GpuPerformanceStats stats =
- GpuPerformanceStats::RetrieveGpuPerformanceStats();
- dict->Set("performance", stats.ToValue());
-
return dict;
}
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index bfbdb3e..8c0f828 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1458,9 +1458,6 @@
'browser/google/google_util.h',
'browser/gpu_blacklist.cc',
'browser/gpu_blacklist.h',
- 'browser/gpu_performance_stats.cc',
- 'browser/gpu_performance_stats.h',
- 'browser/gpu_performance_stats_win.cc',
'browser/gpu_util.cc',
'browser/gpu_util.h',
'browser/hang_monitor/hung_plugin_action.cc',
diff --git a/chrome/common/metrics/proto/system_profile.proto b/chrome/common/metrics/proto/system_profile.proto
index 9923af8..56e0dae 100644
--- a/chrome/common/metrics/proto/system_profile.proto
+++ b/chrome/common/metrics/proto/system_profile.proto
@@ -103,7 +103,7 @@ message SystemProfileProto {
optional string driver_date = 4;
// The GPU performance statistics.
- // See http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/gpu/gpu_performance_stats.h?view=markup
+ // See http://src.chromium.org/viewvc/chrome/trunk/src/content/public/common/gpu_performance_stats.h?view=markup
// for details. Currently logged only on Windows.
message PerformanceStatistics {
optional float graphics_score = 1;
diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h
index 7d2f36e..0b600ab 100644
--- a/content/common/gpu/gpu_messages.h
+++ b/content/common/gpu/gpu_messages.h
@@ -89,6 +89,12 @@ IPC_STRUCT_TRAITS_BEGIN(content::DxDiagNode)
IPC_STRUCT_TRAITS_MEMBER(children)
IPC_STRUCT_TRAITS_END()
+IPC_STRUCT_TRAITS_BEGIN(content::GpuPerformanceStats)
+ IPC_STRUCT_TRAITS_MEMBER(graphics)
+ IPC_STRUCT_TRAITS_MEMBER(gaming)
+ IPC_STRUCT_TRAITS_MEMBER(overall)
+IPC_STRUCT_TRAITS_END()
+
IPC_STRUCT_TRAITS_BEGIN(content::GPUInfo)
IPC_STRUCT_TRAITS_MEMBER(finalized)
IPC_STRUCT_TRAITS_MEMBER(initialization_time)
@@ -106,6 +112,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::GPUInfo)
IPC_STRUCT_TRAITS_MEMBER(gl_renderer)
IPC_STRUCT_TRAITS_MEMBER(gl_extensions)
IPC_STRUCT_TRAITS_MEMBER(can_lose_context)
+ IPC_STRUCT_TRAITS_MEMBER(performance_stats)
#if defined(OS_WIN)
IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics)
#endif
diff --git a/content/content_common.gypi b/content/content_common.gypi
index e93daf8..b984fb1 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -51,6 +51,7 @@
'public/common/gpu_feature_type.h',
'public/common/gpu_info.cc',
'public/common/gpu_info.h',
+ 'public/common/gpu_performance_stats.h',
'public/common/main_function_params.h',
'public/common/media_stream_request.cc',
'public/common/media_stream_request.h',
diff --git a/content/gpu/gpu_info_collector_win.cc b/content/gpu/gpu_info_collector_win.cc
index 13645f7..c2e85b4 100644
--- a/content/gpu/gpu_info_collector_win.cc
+++ b/content/gpu/gpu_info_collector_win.cc
@@ -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,67 @@ std::string VersionNumberToString(uint32 version_number) {
return base::IntToString(hi) + "." + base::IntToString(low);
}
+float GetComponentScore(IProvideWinSATAssessmentInfo* subcomponent) {
+ float score;
+ HRESULT hr = subcomponent->get_Score(&score);
+ if (FAILED(hr))
+ return 0.0;
+ return score;
+}
+
+content::GpuPerformanceStats RetrieveGpuPerformanceStats() {
+ HRESULT hr = S_OK;
+ IQueryRecentWinSATAssessment* assessment = NULL;
+ IProvideWinSATResultsInfo* results = NULL;
+ IProvideWinSATAssessmentInfo* subcomponent = NULL;
+ content::GpuPerformanceStats stats;
+
+ hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
+ if (FAILED(hr))
+ goto cleanup;
+
+ hr = CoCreateInstance(__uuidof(CQueryWinSAT),
+ NULL,
+ CLSCTX_INPROC_SERVER,
+ __uuidof(IQueryRecentWinSATAssessment),
+ reinterpret_cast<void**>(&assessment));
+ if (FAILED(hr))
+ goto cleanup;
+
+ hr = assessment->get_Info(&results);
+ if (FAILED(hr))
+ goto cleanup;
+
+ hr = results->get_SystemRating(&stats.overall);
+ if (FAILED(hr))
+ goto cleanup;
+
+ hr = results->GetAssessmentInfo(WINSAT_ASSESSMENT_D3D, &subcomponent);
+ if (FAILED(hr))
+ goto cleanup;
+ stats.gaming = GetComponentScore(subcomponent);
+ subcomponent->Release();
+ subcomponent = NULL;
+
+ hr = results->GetAssessmentInfo(WINSAT_ASSESSMENT_GRAPHICS, &subcomponent);
+ if (FAILED(hr))
+ goto cleanup;
+ stats.graphics = GetComponentScore(subcomponent);
+ subcomponent->Release();
+ subcomponent = NULL;
+
+ cleanup:
+ if (assessment)
+ assessment->Release();
+ if (results)
+ results->Release();
+ if (subcomponent)
+ subcomponent->Release();
+ CoUninitialize();
+
+ return stats;
+}
+
} // namespace anonymous
namespace gpu_info_collector {
@@ -39,6 +101,8 @@ namespace gpu_info_collector {
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);
@@ -88,6 +152,8 @@ bool CollectPreliminaryGraphicsInfo(content::GPUInfo* gpu_info) {
if (!CollectVideoCardInfo(gpu_info))
rt = false;
+ gpu_info->performance_stats = RetrieveGpuPerformanceStats();
+
return rt;
}
diff --git a/content/public/common/gpu_info.h b/content/public/common/gpu_info.h
index cf4b8dc..bb5274e 100644
--- a/content/public/common/gpu_info.h
+++ b/content/public/common/gpu_info.h
@@ -16,6 +16,7 @@
#include "build/build_config.h"
#include "content/common/content_export.h"
#include "content/public/common/dx_diag_node.h"
+#include "content/public/common/gpu_performance_stats.h"
namespace content {
@@ -75,6 +76,9 @@ struct CONTENT_EXPORT GPUInfo {
// semantics are available.
bool can_lose_context;
+ // By default all values are 0.
+ GpuPerformanceStats performance_stats;
+
#if defined(OS_WIN)
// The information returned by the DirectX Diagnostics Tool.
DxDiagNode dx_diagnostics;
diff --git a/content/public/common/gpu_performance_stats.h b/content/public/common/gpu_performance_stats.h
new file mode 100644
index 0000000..5e78c3d6
--- /dev/null
+++ b/content/public/common/gpu_performance_stats.h
@@ -0,0 +1,23 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_COMMON_PERFORMANCE_STATS_H_
+#define CONTENT_PUBLIC_COMMON_PERFORMANCE_STATS_H_
+
+#include "content/common/content_export.h"
+
+namespace content {
+
+struct CONTENT_EXPORT GpuPerformanceStats {
+ GpuPerformanceStats() : graphics(0.f), gaming(0.f), overall(0.f) {}
+
+ float graphics;
+ float gaming;
+ float overall;
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_COMMON_PERFORMANCE_STATS_H_
+