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

Side by Side Diff: gpu/config/gpu_info_collector_mac.mm

Issue 194303002: Blacklist GLX indirect rendering (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gpu/config/gpu_info_collector_android.cc ('k') | gpu/config/gpu_info_collector_ozone.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "gpu/config/gpu_info_collector.h" 5 #include "gpu/config/gpu_info_collector.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 gpu_info->secondary_gpus.push_back(gpu_list[i]); 150 gpu_info->secondary_gpus.push_back(gpu_list[i]);
151 } 151 }
152 } 152 }
153 break; 153 break;
154 } 154 }
155 return (gpu_info->gpu.vendor_id && gpu_info->gpu.device_id); 155 return (gpu_info->gpu.vendor_id && gpu_info->gpu.device_id);
156 } 156 }
157 157
158 } // namespace anonymous 158 } // namespace anonymous
159 159
160 bool CollectContextGraphicsInfo(GPUInfo* gpu_info) { 160 CollectInfoResult CollectContextGraphicsInfo(GPUInfo* gpu_info) {
161 DCHECK(gpu_info); 161 DCHECK(gpu_info);
162 162
163 TRACE_EVENT0("gpu", "gpu_info_collector::CollectGraphicsInfo"); 163 TRACE_EVENT0("gpu", "gpu_info_collector::CollectGraphicsInfo");
164 164
165 gpu_info->can_lose_context = 165 gpu_info->can_lose_context =
166 (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); 166 (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2);
167 gpu_info->finalized = true; 167 gpu_info->finalized = true;
168 return CollectGraphicsInfoGL(gpu_info); 168 return CollectGraphicsInfoGL(gpu_info);
169 } 169 }
170 170
171 GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id) { 171 GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id) {
172 DCHECK(vendor_id && device_id); 172 DCHECK(vendor_id && device_id);
173 *vendor_id = 0; 173 *vendor_id = 0;
174 *device_id = 0; 174 *device_id = 0;
175 175
176 GPUInfo gpu_info; 176 GPUInfo gpu_info;
177 if (CollectPCIVideoCardInfo(&gpu_info)) { 177 if (CollectPCIVideoCardInfo(&gpu_info)) {
178 *vendor_id = gpu_info.gpu.vendor_id; 178 *vendor_id = gpu_info.gpu.vendor_id;
179 *device_id = gpu_info.gpu.device_id; 179 *device_id = gpu_info.gpu.device_id;
180 return kGpuIDSuccess; 180 return kGpuIDSuccess;
181 } 181 }
182 return kGpuIDFailure; 182 return kGpuIDFailure;
183 } 183 }
184 184
185 bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) { 185 CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info) {
186 DCHECK(gpu_info); 186 DCHECK(gpu_info);
187 187
188 std::string model_name; 188 std::string model_name;
189 int32 model_major = 0, model_minor = 0; 189 int32 model_major = 0, model_minor = 0;
190 base::mac::ParseModelIdentifier(base::mac::GetModelIdentifier(), 190 base::mac::ParseModelIdentifier(base::mac::GetModelIdentifier(),
191 &model_name, &model_major, &model_minor); 191 &model_name, &model_major, &model_minor);
192 base::ReplaceChars(model_name, " ", "_", &gpu_info->machine_model); 192 base::ReplaceChars(model_name, " ", "_", &gpu_info->machine_model);
193 gpu_info->machine_model += " " + base::IntToString(model_major) + 193 gpu_info->machine_model += " " + base::IntToString(model_major) +
194 "." + base::IntToString(model_minor); 194 "." + base::IntToString(model_minor);
195 195
196 return CollectPCIVideoCardInfo(gpu_info); 196 bool result = CollectPCIVideoCardInfo(gpu_info);
197 return result ? kCollectInfoSuccess : kCollectInfoNonFatalFailure;
197 } 198 }
198 199
199 bool CollectDriverInfoGL(GPUInfo* gpu_info) { 200 CollectInfoResult CollectDriverInfoGL(GPUInfo* gpu_info) {
200 DCHECK(gpu_info); 201 DCHECK(gpu_info);
201 202
202 // Extract the OpenGL driver version string from the GL_VERSION string. 203 // Extract the OpenGL driver version string from the GL_VERSION string.
203 // Mac OpenGL drivers have the driver version 204 // Mac OpenGL drivers have the driver version
204 // at the end of the gl version string preceded by a dash. 205 // at the end of the gl version string preceded by a dash.
205 // Use some jiggery-pokery to turn that utf8 string into a std::wstring. 206 // Use some jiggery-pokery to turn that utf8 string into a std::wstring.
206 std::string gl_version_string = gpu_info->gl_version_string; 207 std::string gl_version_string = gpu_info->gl_version_string;
207 size_t pos = gl_version_string.find_last_of('-'); 208 size_t pos = gl_version_string.find_last_of('-');
208 if (pos == std::string::npos) 209 if (pos == std::string::npos)
209 return false; 210 return kCollectInfoNonFatalFailure;
210 gpu_info->driver_version = gl_version_string.substr(pos + 1); 211 gpu_info->driver_version = gl_version_string.substr(pos + 1);
211 return true; 212 return kCollectInfoSuccess;
212 } 213 }
213 214
214 void MergeGPUInfo(GPUInfo* basic_gpu_info, 215 void MergeGPUInfo(GPUInfo* basic_gpu_info,
215 const GPUInfo& context_gpu_info) { 216 const GPUInfo& context_gpu_info) {
216 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); 217 MergeGPUInfoGL(basic_gpu_info, context_gpu_info);
217 } 218 }
218 219
219 } // namespace gpu 220 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/config/gpu_info_collector_android.cc ('k') | gpu/config/gpu_info_collector_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698