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

Side by Side Diff: gpu/config/gpu_dx_diagnostics_win.cc

Issue 15745014: Move GPU device/driver info related code from content to gpu. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 7 years, 7 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 | « gpu/config/gpu_driver_bug_workaround_type.h ('k') | gpu/config/gpu_feature_type.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Functions to enumerate the Dx Diagnostic Tool hierarchy and build up 5 // Functions to enumerate the Dx Diagnostic Tool hierarchy and build up
6 // a tree of nodes with name / value properties. 6 // a tree of nodes with name / value properties.
7 7
8 #define INITGUID 8 #define INITGUID
9 #include <dxdiag.h> 9 #include <dxdiag.h>
10 #include <windows.h> 10 #include <windows.h>
11 11
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "base/win/scoped_com_initializer.h" 14 #include "base/win/scoped_com_initializer.h"
15 #include "content/gpu/gpu_info_collector.h" 15 #include "gpu/config/gpu_info_collector.h"
16 16
17 // Functions in this file depend on functions exported from dxguid.dll. 17 // Functions in this file depend on functions exported from dxguid.dll.
18 #pragma comment(lib, "dxguid.lib") 18 #pragma comment(lib, "dxguid.lib")
19 19
20 namespace gpu {
21
20 namespace { 22 namespace {
21 23
22 // Traverses the IDxDiagContainer tree and populates a tree of DxDiagNode 24 // Traverses the IDxDiagContainer tree and populates a tree of DxDiagNode
23 // structures that contains property name / value pairs and subtrees of DirectX 25 // structures that contains property name / value pairs and subtrees of DirectX
24 // diagnostic information. 26 // diagnostic information.
25 void RecurseDiagnosticTree(content::DxDiagNode* output, 27 void RecurseDiagnosticTree(DxDiagNode* output,
26 IDxDiagContainer* container, 28 IDxDiagContainer* container,
27 int depth) { 29 int depth) {
28 HRESULT hr; 30 HRESULT hr;
29 31
30 VARIANT variant; 32 VARIANT variant;
31 VariantInit(&variant); 33 VariantInit(&variant);
32 34
33 DWORD prop_count; 35 DWORD prop_count;
34 hr = container->GetNumberOfProps(&prop_count); 36 hr = container->GetNumberOfProps(&prop_count);
35 if (SUCCEEDED(hr)) { 37 if (SUCCEEDED(hr)) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 DWORD child_count; 71 DWORD child_count;
70 hr = container->GetNumberOfChildContainers(&child_count); 72 hr = container->GetNumberOfChildContainers(&child_count);
71 if (SUCCEEDED(hr)) { 73 if (SUCCEEDED(hr)) {
72 for (DWORD i = 0; i < child_count; i++) { 74 for (DWORD i = 0; i < child_count; i++) {
73 WCHAR child_name16[256]; 75 WCHAR child_name16[256];
74 hr = container->EnumChildContainerNames(i, 76 hr = container->EnumChildContainerNames(i,
75 child_name16, 77 child_name16,
76 arraysize(child_name16)); 78 arraysize(child_name16));
77 if (SUCCEEDED(hr)) { 79 if (SUCCEEDED(hr)) {
78 std::string child_name8 = WideToUTF8(child_name16); 80 std::string child_name8 = WideToUTF8(child_name16);
79 content::DxDiagNode* output_child = 81 DxDiagNode* output_child = &output->children[child_name8];
80 &output->children[child_name8];
81 82
82 IDxDiagContainer* child_container = NULL; 83 IDxDiagContainer* child_container = NULL;
83 hr = container->GetChildContainer(child_name16, &child_container); 84 hr = container->GetChildContainer(child_name16, &child_container);
84 if (SUCCEEDED(hr)) { 85 if (SUCCEEDED(hr)) {
85 RecurseDiagnosticTree(output_child, child_container, depth - 1); 86 RecurseDiagnosticTree(output_child, child_container, depth - 1);
86 87
87 child_container->Release(); 88 child_container->Release();
88 } 89 }
89 } 90 }
90 } 91 }
91 } 92 }
92 } 93 }
93 } 94 }
94 } // namespace anonymous 95 } // namespace anonymous
95 96
96 namespace gpu_info_collector { 97 bool GetDxDiagnostics(DxDiagNode* output) {
97
98 bool GetDxDiagnostics(content::DxDiagNode* output) {
99 HRESULT hr; 98 HRESULT hr;
100 bool success = false; 99 bool success = false;
101 base::win::ScopedCOMInitializer com_initializer; 100 base::win::ScopedCOMInitializer com_initializer;
102 101
103 IDxDiagProvider* provider = NULL; 102 IDxDiagProvider* provider = NULL;
104 hr = CoCreateInstance(CLSID_DxDiagProvider, 103 hr = CoCreateInstance(CLSID_DxDiagProvider,
105 NULL, 104 NULL,
106 CLSCTX_INPROC_SERVER, 105 CLSCTX_INPROC_SERVER,
107 IID_IDxDiagProvider, 106 IID_IDxDiagProvider,
108 reinterpret_cast<void**>(&provider)); 107 reinterpret_cast<void**>(&provider));
(...skipping 20 matching lines...) Expand all
129 } 128 }
130 129
131 root->Release(); 130 root->Release();
132 } 131 }
133 } 132 }
134 provider->Release(); 133 provider->Release();
135 } 134 }
136 135
137 return success; 136 return success;
138 } 137 }
139 } // namespace gpu_info_collector 138 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/config/gpu_driver_bug_workaround_type.h ('k') | gpu/config/gpu_feature_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698