summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorzmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-07 20:42:34 +0000
committerzmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-07 20:42:34 +0000
commitd1f43abcb958e76806007d59f75f2da6078be89e (patch)
treed6fd1b06ddb01518b281d0a8e4448954a8da30be /content
parentb94df0af964b427b29c4efcb6b99cb7f0e1a9ad5 (diff)
downloadchromium_src-d1f43abcb958e76806007d59f75f2da6078be89e.zip
chromium_src-d1f43abcb958e76806007d59f75f2da6078be89e.tar.gz
chromium_src-d1f43abcb958e76806007d59f75f2da6078be89e.tar.bz2
Refactoring to make GpuPerformanceStats part of gpu info collection.
Then expand GpuBlacklist so we could blacklist GPU features based on GpuPerformanceStats. This is Windows only feature. BUG=116350 TEST=waterfall R=vangelis Review URL: https://chromiumcodereview.appspot.com/9616036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125446 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-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
5 files changed, 101 insertions, 0 deletions
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_
+