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/gpu/gpu_info_collector.h" | 5 #include "content/gpu/gpu_info_collector.h" |
6 | 6 |
7 #include "base/android/build_info.h" | 7 #include "base/android/build_info.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 gpu_info->can_lose_context = false; | 64 gpu_info->can_lose_context = false; |
65 // Create a short-lived context on the UI thread to collect the GL strings. | 65 // Create a short-lived context on the UI thread to collect the GL strings. |
66 if (!CollectGraphicsInfoGL(gpu_info)) | 66 if (!CollectGraphicsInfoGL(gpu_info)) |
67 return false; | 67 return false; |
68 | 68 |
69 std::string vendor(StringToLowerASCII(gpu_info->gl_vendor)); | 69 std::string vendor(StringToLowerASCII(gpu_info->gl_vendor)); |
70 std::string renderer(StringToLowerASCII(gpu_info->gl_renderer)); | 70 std::string renderer(StringToLowerASCII(gpu_info->gl_renderer)); |
71 bool is_img = vendor.find("imagination") != std::string::npos; | 71 bool is_img = vendor.find("imagination") != std::string::npos; |
72 bool is_arm = vendor.find("arm") != std::string::npos; | 72 bool is_arm = vendor.find("arm") != std::string::npos; |
73 bool is_qualcomm = vendor.find("qualcomm") != std::string::npos; | 73 bool is_qualcomm = vendor.find("qualcomm") != std::string::npos; |
74 bool is_nvidia = vendor.find("nvidia") != std::string::npos; | |
75 bool is_mali_t604 = is_arm && renderer.find("mali-t604") != std::string::npos; | 74 bool is_mali_t604 = is_arm && renderer.find("mali-t604") != std::string::npos; |
76 | 75 |
77 bool sdk_17_or_greater = | 76 base::android::BuildInfo* build_info = |
78 base::android::BuildInfo::GetInstance()->sdk_int() >= 17; | 77 base::android::BuildInfo::GetInstance(); |
| 78 std::string model = build_info->model(); |
| 79 model = StringToLowerASCII(model); |
| 80 bool is_nexus7 = model.find("nexus 7") != std::string::npos; |
79 | 81 |
80 // IMG: avoid context switching perf problems, crashes with share groups | 82 // IMG: avoid context switching perf problems, crashes with share groups |
81 // Mali-T604: http://crbug.com/154715 | 83 // Mali-T604: http://crbug.com/154715 |
82 // QualComm, NVIDIA: Crashes with share groups | 84 // QualComm, NVIDIA: Crashes with share groups |
83 if (is_img || is_mali_t604 || is_qualcomm || | 85 if (is_img || is_mali_t604 || is_qualcomm || is_nexus7) { |
84 (is_nvidia && sdk_17_or_greater)) { | |
85 CommandLine::ForCurrentProcess()->AppendSwitch( | 86 CommandLine::ForCurrentProcess()->AppendSwitch( |
86 switches::kEnableVirtualGLContexts); | 87 switches::kEnableVirtualGLContexts); |
87 } | 88 } |
88 | 89 |
89 int default_tile_size = 256; | 90 int default_tile_size = 256; |
90 | 91 |
91 // IMG: Fast async texture uploads only work with non-power-of-two, | 92 // IMG: Fast async texture uploads only work with non-power-of-two, |
92 // but still multiple-of-eight sizes. | 93 // but still multiple-of-eight sizes. |
93 // http://crbug.com/168099 | 94 // http://crbug.com/168099 |
94 if (is_img) | 95 if (is_img) |
(...skipping 22 matching lines...) Expand all Loading... |
117 gpu_info->gl_version_string); | 118 gpu_info->gl_version_string); |
118 return true; | 119 return true; |
119 } | 120 } |
120 | 121 |
121 void MergeGPUInfo(content::GPUInfo* basic_gpu_info, | 122 void MergeGPUInfo(content::GPUInfo* basic_gpu_info, |
122 const content::GPUInfo& context_gpu_info) { | 123 const content::GPUInfo& context_gpu_info) { |
123 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 124 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
124 } | 125 } |
125 | 126 |
126 } // namespace gpu_info_collector | 127 } // namespace gpu_info_collector |
OLD | NEW |