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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Create a short-lived context on the UI thread to collect the GL strings. | 67 // Create a short-lived context on the UI thread to collect the GL strings. |
68 if (!CollectGraphicsInfoGL(gpu_info)) | 68 if (!CollectGraphicsInfoGL(gpu_info)) |
69 return false; | 69 return false; |
70 | 70 |
71 std::string vendor(StringToLowerASCII(gpu_info->gl_vendor)); | 71 std::string vendor(StringToLowerASCII(gpu_info->gl_vendor)); |
72 std::string renderer(StringToLowerASCII(gpu_info->gl_renderer)); | 72 std::string renderer(StringToLowerASCII(gpu_info->gl_renderer)); |
73 bool is_img = vendor.find("imagination") != std::string::npos; | 73 bool is_img = vendor.find("imagination") != std::string::npos; |
74 bool is_arm = vendor.find("arm") != std::string::npos; | 74 bool is_arm = vendor.find("arm") != std::string::npos; |
75 bool is_qualcomm = vendor.find("qualcomm") != std::string::npos; | 75 bool is_qualcomm = vendor.find("qualcomm") != std::string::npos; |
76 bool is_mali_t604 = is_arm && renderer.find("mali-t604") != std::string::npos; | 76 bool is_mali_t604 = is_arm && renderer.find("mali-t604") != std::string::npos; |
77 bool is_hisilicon = vendor.find("hisilicon") != std::string::npos; | 77 bool is_vivante = vendor.find("vivante") != std::string::npos; |
| 78 is_vivante |= vendor.find("hisilicon") != std::string::npos; |
78 | 79 |
79 base::android::BuildInfo* build_info = | 80 base::android::BuildInfo* build_info = |
80 base::android::BuildInfo::GetInstance(); | 81 base::android::BuildInfo::GetInstance(); |
81 std::string model = build_info->model(); | 82 std::string model = build_info->model(); |
82 model = StringToLowerASCII(model); | 83 model = StringToLowerASCII(model); |
83 bool is_nexus7 = model.find("nexus 7") != std::string::npos; | 84 bool is_nexus7 = model.find("nexus 7") != std::string::npos; |
84 bool is_nexus10 = model.find("nexus 10") != std::string::npos; | 85 bool is_nexus10 = model.find("nexus 10") != std::string::npos; |
85 | 86 |
86 // Virtual contexts crash when switching surfaces, but only on SDK 16, | 87 // Virtual contexts crash when switching surfaces, but only on SDK 16, |
87 // so we us full context switching for now. If virtual contexts can | 88 // so we us full context switching for now. If virtual contexts can |
88 // avoid some of it's extra surface switches, or Qualcomm gives us | 89 // avoid some of it's extra surface switches, or Qualcomm gives us |
89 // a more directed work-around, we can remove this. | 90 // a more directed work-around, we can remove this. |
90 int sdk_int = base::android::BuildInfo::GetInstance()->sdk_int(); | 91 int sdk_int = base::android::BuildInfo::GetInstance()->sdk_int(); |
91 | 92 |
92 // IMG: avoid context switching perf problems, crashes with share groups | 93 // IMG: avoid context switching perf problems, crashes with share groups |
93 // Mali-T604: http://crbug.com/154715 | 94 // Mali-T604: http://crbug.com/154715 |
94 // QualComm, NVIDIA: Crashes with share groups | 95 // QualComm, NVIDIA: Crashes with share groups |
95 if (is_hisilicon || is_img || is_mali_t604 || is_nexus7 | 96 if (is_vivante || is_img || is_mali_t604 || is_nexus7 |
96 || (is_qualcomm && sdk_int != 16)) { | 97 || (is_qualcomm && sdk_int != 16)) { |
97 CommandLine::ForCurrentProcess()->AppendSwitch( | 98 CommandLine::ForCurrentProcess()->AppendSwitch( |
98 switches::kEnableVirtualGLContexts); | 99 switches::kEnableVirtualGLContexts); |
99 } | 100 } |
100 | 101 |
101 gfx::DeviceDisplayInfo info; | 102 gfx::DeviceDisplayInfo info; |
102 int default_tile_size = 256; | 103 int default_tile_size = 256; |
103 | 104 |
104 // For very high resolution displays (eg. Nexus 10), set the default | 105 // For very high resolution displays (eg. Nexus 10), set the default |
105 // tile size to be 512. This should be removed in favour of a generic | 106 // tile size to be 512. This should be removed in favour of a generic |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 gpu_info->gl_version_string); | 150 gpu_info->gl_version_string); |
150 return true; | 151 return true; |
151 } | 152 } |
152 | 153 |
153 void MergeGPUInfo(content::GPUInfo* basic_gpu_info, | 154 void MergeGPUInfo(content::GPUInfo* basic_gpu_info, |
154 const content::GPUInfo& context_gpu_info) { | 155 const content::GPUInfo& context_gpu_info) { |
155 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 156 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
156 } | 157 } |
157 | 158 |
158 } // namespace gpu_info_collector | 159 } // namespace gpu_info_collector |
OLD | NEW |