diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-08 01:30:46 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-08 01:30:46 +0000 |
commit | 5c6ddd0fb21889b6aaa65e075f5ad574a04d9aab (patch) | |
tree | c2148a29cfe6360cfd174e55077815f3a99aff0e /chrome/common | |
parent | c4bd23d31da3e295baa43c048590d72f9c019d9a (diff) | |
download | chromium_src-5c6ddd0fb21889b6aaa65e075f5ad574a04d9aab.zip chromium_src-5c6ddd0fb21889b6aaa65e075f5ad574a04d9aab.tar.gz chromium_src-5c6ddd0fb21889b6aaa65e075f5ad574a04d9aab.tar.bz2 |
Added DirectX Diagnostics information to about:gpu on Windows.
This includes the name of the GPU hardware and the driver version and release date and some other information that might potentially also be valuable in the GPU stats.
TEST=try
BUG=none
Review URL: http://codereview.chromium.org/3547020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61904 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/dx_diag_node.h | 19 | ||||
-rw-r--r-- | chrome/common/gpu_info.cc | 10 | ||||
-rw-r--r-- | chrome/common/gpu_info.h | 14 | ||||
-rw-r--r-- | chrome/common/gpu_messages.cc | 35 | ||||
-rw-r--r-- | chrome/common/gpu_param_traits.h | 9 |
5 files changed, 87 insertions, 0 deletions
diff --git a/chrome/common/dx_diag_node.h b/chrome/common/dx_diag_node.h new file mode 100644 index 0000000..9f20d92 --- /dev/null +++ b/chrome/common/dx_diag_node.h @@ -0,0 +1,19 @@ +// Copyright (c) 2010 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. +// +// A tree of name value pairs that report contain DirectX diagnostic +// information. + +#ifndef CHROME_COMMON_DX_DIAG_NODE_H_ +#define CHROME_COMMON_DX_DIAG_NODE_H_ + +#include <map> +#include <string> + +struct DxDiagNode { + std::map<std::string, std::string> values; + std::map<std::string, DxDiagNode> children; +}; + +#endif // CHROME_COMMON_DX_DIAG_NODE_H_ diff --git a/chrome/common/gpu_info.cc b/chrome/common/gpu_info.cc index 9f16bdb..667c375 100644 --- a/chrome/common/gpu_info.cc +++ b/chrome/common/gpu_info.cc @@ -60,3 +60,13 @@ void GPUInfo::SetGraphicsInfo(uint32 vendor_id, uint32 device_id, can_lose_context_ = can_lose_context; initialized_ = true; } + +#if defined(OS_WIN) +const DxDiagNode& GPUInfo::dx_diagnostics() const { + return dx_diagnostics_; +} + +void GPUInfo::SetDxDiagnostics(const DxDiagNode& dx_diagnostics) { + dx_diagnostics_ = dx_diagnostics; +} +#endif diff --git a/chrome/common/gpu_info.h b/chrome/common/gpu_info.h index 2f8f9da..50728db 100644 --- a/chrome/common/gpu_info.h +++ b/chrome/common/gpu_info.h @@ -12,6 +12,8 @@ #include <string> #include "base/basictypes.h" +#include "build/build_config.h" +#include "chrome/common/dx_diag_node.h" class GPUInfo { public: @@ -60,6 +62,14 @@ class GPUInfo { uint32 vertex_shader_version, uint32 gl_version, bool can_lose_context); + +#if defined(OS_WIN) + // The information returned by the DirectX Diagnostics Tool. + const DxDiagNode& dx_diagnostics() const; + + void SetDxDiagnostics(const DxDiagNode& dx_diagnostics); +#endif + private: bool initialized_; uint32 vendor_id_; @@ -69,6 +79,10 @@ class GPUInfo { uint32 vertex_shader_version_; uint32 gl_version_; bool can_lose_context_; + +#if defined(OS_WIN) + DxDiagNode dx_diagnostics_; +#endif }; #endif // CHROME_COMMON_GPU_INFO_H__ diff --git a/chrome/common/gpu_messages.cc b/chrome/common/gpu_messages.cc index 34f051c..893f8c9 100644 --- a/chrome/common/gpu_messages.cc +++ b/chrome/common/gpu_messages.cc @@ -5,6 +5,7 @@ #include "chrome/common/gpu_messages.h" #include "chrome/common/gpu_info.h" +#include "chrome/common/dx_diag_node.h" #include "gfx/rect.h" #include "gfx/size.h" #include "ipc/ipc_channel_handle.h" @@ -85,6 +86,10 @@ void ParamTraits<GPUInfo> ::Write(Message* m, const param_type& p) { m->WriteUInt32(p.vertex_shader_version()); m->WriteUInt32(p.gl_version()); m->WriteBool(p.can_lose_context()); + +#if defined(OS_WIN) + ParamTraits<DxDiagNode> ::Write(m, p.dx_diagnostics()); +#endif } bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) { @@ -109,6 +114,13 @@ bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) { vertex_shader_version, gl_version, can_lose_context); + +#if defined(OS_WIN) + DxDiagNode dx_diagnostics; + ret = ret && ParamTraits<DxDiagNode> ::Read(m, iter, &dx_diagnostics); + p->SetDxDiagnostics(dx_diagnostics); +#endif + return ret; } @@ -120,6 +132,29 @@ void ParamTraits<GPUInfo> ::Log(const param_type& p, std::string* l) { p.can_lose_context())); } +void ParamTraits<DxDiagNode> ::Write(Message* m, const param_type& p) { + ParamTraits<std::map<std::string, std::string> >::Write(m, p.values); + ParamTraits<std::map<std::string, DxDiagNode> >::Write(m, p.children); +} + +bool ParamTraits<DxDiagNode> ::Read(const Message* m, + void** iter, + param_type* p) { + bool ret = ParamTraits<std::map<std::string, std::string> >::Read( + m, + iter, + &p->values); + ret = ret && ParamTraits<std::map<std::string, DxDiagNode> >::Read( + m, + iter, + &p->children); + return ret; +} + +void ParamTraits<DxDiagNode> ::Log(const param_type& p, std::string* l) { + l->append("<DxDiagNode>"); +} + void ParamTraits<gpu::CommandBuffer::State> ::Write(Message* m, const param_type& p) { m->WriteInt(p.num_entries); diff --git a/chrome/common/gpu_param_traits.h b/chrome/common/gpu_param_traits.h index d8ca851..f2c4e02 100644 --- a/chrome/common/gpu_param_traits.h +++ b/chrome/common/gpu_param_traits.h @@ -9,6 +9,7 @@ #include "base/basictypes.h" #include "base/process.h" #include "chrome/common/common_param_traits.h" +#include "chrome/common/dx_diag_node.h" #include "chrome/common/gpu_info.h" #include "chrome/common/gpu_native_window_handle.h" #include "gfx/native_widget_types.h" @@ -52,6 +53,14 @@ struct ParamTraits<GPUInfo> { }; template <> +struct ParamTraits<DxDiagNode> { + typedef DxDiagNode param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> struct ParamTraits<gpu::CommandBuffer::State> { typedef gpu::CommandBuffer::State param_type; static void Write(Message* m, const param_type& p); |