OLD | NEW |
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 "content/browser/gpu/gpu_data_manager_impl.h" | 5 #include "content/browser/gpu/gpu_data_manager_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
12 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "base/version.h" | 14 #include "base/version.h" |
15 #include "content/browser/gpu/gpu_process_host.h" | 15 #include "content/browser/gpu/gpu_process_host.h" |
16 #include "content/common/gpu/gpu_messages.h" | 16 #include "content/common/gpu/gpu_messages.h" |
17 #include "content/gpu/gpu_info_collector.h" | 17 #include "content/gpu/gpu_info_collector.h" |
18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/browser/gpu_data_manager_observer.h" | 19 #include "content/public/browser/gpu_data_manager_observer.h" |
20 #include "content/public/common/content_client.h" | 20 #include "content/public/common/content_client.h" |
21 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
22 #include "ui/base/ui_base_switches.h" | 22 #include "ui/base/ui_base_switches.h" |
23 #include "ui/gl/gl_implementation.h" | 23 #include "ui/gl/gl_implementation.h" |
24 #include "ui/gl/gl_switches.h" | 24 #include "ui/gl/gl_switches.h" |
25 #include "webkit/plugins/plugin_switches.h" | 25 #include "webkit/plugins/plugin_switches.h" |
26 | 26 |
| 27 #if defined(OS_WIN) |
| 28 #include "base/win/windows_version.h" |
| 29 #endif |
| 30 |
27 using content::BrowserThread; | 31 using content::BrowserThread; |
28 using content::GpuDataManagerObserver; | 32 using content::GpuDataManagerObserver; |
29 using content::GpuFeatureType; | 33 using content::GpuFeatureType; |
30 | 34 |
31 // static | 35 // static |
32 content::GpuDataManager* content::GpuDataManager::GetInstance() { | 36 content::GpuDataManager* content::GpuDataManager::GetInstance() { |
33 return GpuDataManagerImpl::GetInstance(); | 37 return GpuDataManagerImpl::GetInstance(); |
34 } | 38 } |
35 | 39 |
36 // static | 40 // static |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 base::StringPrintf("0x%04x", gpu_info_.gpu.vendor_id)); | 239 base::StringPrintf("0x%04x", gpu_info_.gpu.vendor_id)); |
236 command_line->AppendSwitchASCII(switches::kGpuDeviceID, | 240 command_line->AppendSwitchASCII(switches::kGpuDeviceID, |
237 base::StringPrintf("0x%04x", gpu_info_.gpu.device_id)); | 241 base::StringPrintf("0x%04x", gpu_info_.gpu.device_id)); |
238 command_line->AppendSwitchASCII(switches::kGpuDriverVendor, | 242 command_line->AppendSwitchASCII(switches::kGpuDriverVendor, |
239 gpu_info_.driver_vendor); | 243 gpu_info_.driver_vendor); |
240 command_line->AppendSwitchASCII(switches::kGpuDriverVersion, | 244 command_line->AppendSwitchASCII(switches::kGpuDriverVersion, |
241 gpu_info_.driver_version); | 245 gpu_info_.driver_version); |
242 } | 246 } |
243 } | 247 } |
244 | 248 |
| 249 #if defined(OS_WIN) |
| 250 bool GpuDataManagerImpl::IsUsingAcceleratedSurface() { |
| 251 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
| 252 return false; |
| 253 |
| 254 base::AutoLock auto_lock(gpu_info_lock_); |
| 255 if (gpu_info_.amd_switchable) |
| 256 return false; |
| 257 if (software_rendering_) |
| 258 return false; |
| 259 uint32 flags = GetGpuFeatureType(); |
| 260 if (flags & content::GPU_FEATURE_TYPE_TEXTURE_SHARING) |
| 261 return false; |
| 262 |
| 263 return true; |
| 264 } |
| 265 #endif |
| 266 |
245 void GpuDataManagerImpl::AppendPluginCommandLine( | 267 void GpuDataManagerImpl::AppendPluginCommandLine( |
246 CommandLine* command_line) { | 268 CommandLine* command_line) { |
247 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 269 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
248 DCHECK(command_line); | 270 DCHECK(command_line); |
249 | 271 |
250 #if defined(OS_MACOSX) | 272 #if defined(OS_MACOSX) |
251 uint32 flags = GetGpuFeatureType(); | 273 uint32 flags = GetGpuFeatureType(); |
252 // TODO(jbauman): Add proper blacklist support for core animation plugins so | 274 // TODO(jbauman): Add proper blacklist support for core animation plugins so |
253 // special-casing this video card won't be necessary. See | 275 // special-casing this video card won't be necessary. See |
254 // http://crbug.com/134015 | 276 // http://crbug.com/134015 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 345 |
324 void GpuDataManagerImpl::BlacklistCard() { | 346 void GpuDataManagerImpl::BlacklistCard() { |
325 card_blacklisted_ = true; | 347 card_blacklisted_ = true; |
326 | 348 |
327 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL; | 349 gpu_feature_type_ = content::GPU_FEATURE_TYPE_ALL; |
328 | 350 |
329 EnableSoftwareRenderingIfNecessary(); | 351 EnableSoftwareRenderingIfNecessary(); |
330 NotifyGpuInfoUpdate(); | 352 NotifyGpuInfoUpdate(); |
331 } | 353 } |
332 | 354 |
OLD | NEW |