OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_private.h" | 5 #include "content/browser/gpu/gpu_data_manager_impl_private.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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 230 } |
231 } | 231 } |
232 | 232 |
233 if (display_changed || gpu_changed) | 233 if (display_changed || gpu_changed) |
234 manager->HandleGpuSwitch(); | 234 manager->HandleGpuSwitch(); |
235 } | 235 } |
236 #endif // OS_MACOSX | 236 #endif // OS_MACOSX |
237 | 237 |
238 #if defined(OS_ANDROID) | 238 #if defined(OS_ANDROID) |
239 void ApplyAndroidWorkarounds(const gpu::GPUInfo& gpu_info, | 239 void ApplyAndroidWorkarounds(const gpu::GPUInfo& gpu_info, |
240 CommandLine* command_line) { | 240 CommandLine* command_line, |
| 241 std::set<int>* workarounds) { |
241 std::string vendor(StringToLowerASCII(gpu_info.gl_vendor)); | 242 std::string vendor(StringToLowerASCII(gpu_info.gl_vendor)); |
242 std::string renderer(StringToLowerASCII(gpu_info.gl_renderer)); | 243 std::string renderer(StringToLowerASCII(gpu_info.gl_renderer)); |
| 244 std::string version(StringToLowerASCII(gpu_info.gl_version)); |
| 245 |
| 246 if (vendor.find("nvidia") != std::string::npos && |
| 247 version.find("3.1") != std::string::npos) { |
| 248 workarounds->insert(gpu::USE_VIRTUALIZED_GL_CONTEXTS); |
| 249 } |
| 250 |
243 bool is_img = | 251 bool is_img = |
244 gpu_info.gl_vendor.find("Imagination") != std::string::npos; | 252 gpu_info.gl_vendor.find("Imagination") != std::string::npos; |
245 | 253 |
246 gfx::DeviceDisplayInfo info; | 254 gfx::DeviceDisplayInfo info; |
247 int default_tile_size = 256; | 255 int default_tile_size = 256; |
248 | 256 |
249 // TODO(epenner): Now that this is somewhat generic, maybe we can | 257 // TODO(epenner): Now that this is somewhat generic, maybe we can |
250 // unify this for all platforms (http://crbug.com/159524) | 258 // unify this for all platforms (http://crbug.com/159524) |
251 | 259 |
252 bool real_size_supported = true; | 260 bool real_size_supported = true; |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 gpu_driver_bug_list_json, gpu::GpuControlList::kCurrentOsOnly); | 989 gpu_driver_bug_list_json, gpu::GpuControlList::kCurrentOsOnly); |
982 DCHECK(success); | 990 DCHECK(success); |
983 } | 991 } |
984 | 992 |
985 gpu_info_ = gpu_info; | 993 gpu_info_ = gpu_info; |
986 UpdateGpuInfo(gpu_info); | 994 UpdateGpuInfo(gpu_info); |
987 UpdateGpuSwitchingManager(gpu_info); | 995 UpdateGpuSwitchingManager(gpu_info); |
988 UpdatePreliminaryBlacklistedFeatures(); | 996 UpdatePreliminaryBlacklistedFeatures(); |
989 | 997 |
990 #if defined(OS_ANDROID) | 998 #if defined(OS_ANDROID) |
991 ApplyAndroidWorkarounds(gpu_info, CommandLine::ForCurrentProcess()); | 999 ApplyAndroidWorkarounds( |
| 1000 gpu_info, CommandLine::ForCurrentProcess(), &gpu_driver_bugs_); |
992 #endif // OS_ANDROID | 1001 #endif // OS_ANDROID |
993 } | 1002 } |
994 | 1003 |
995 void GpuDataManagerImplPrivate::UpdateBlacklistedFeatures( | 1004 void GpuDataManagerImplPrivate::UpdateBlacklistedFeatures( |
996 const std::set<int>& features) { | 1005 const std::set<int>& features) { |
997 blacklisted_features_ = features; | 1006 blacklisted_features_ = features; |
998 | 1007 |
999 // Force disable using the GPU for these features, even if they would | 1008 // Force disable using the GPU for these features, even if they would |
1000 // otherwise be allowed. | 1009 // otherwise be allowed. |
1001 if (card_blacklisted_) { | 1010 if (card_blacklisted_) { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 | 1153 |
1145 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { | 1154 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { |
1146 gpu_process_accessible_ = false; | 1155 gpu_process_accessible_ = false; |
1147 gpu_info_.finalized = true; | 1156 gpu_info_.finalized = true; |
1148 complete_gpu_info_already_requested_ = true; | 1157 complete_gpu_info_already_requested_ = true; |
1149 // Some observers might be waiting. | 1158 // Some observers might be waiting. |
1150 NotifyGpuInfoUpdate(); | 1159 NotifyGpuInfoUpdate(); |
1151 } | 1160 } |
1152 | 1161 |
1153 } // namespace content | 1162 } // namespace content |
OLD | NEW |