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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 gpu_info->can_lose_context = false; | 66 gpu_info->can_lose_context = false; |
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_hisilicon = vendor.find("hisilicon") != std::string::npos; |
76 bool is_mali_t604 = is_arm && renderer.find("mali-t604") != std::string::npos; | 77 bool is_mali_t604 = is_arm && renderer.find("mali-t604") != std::string::npos; |
77 | 78 |
78 base::android::BuildInfo* build_info = | 79 base::android::BuildInfo* build_info = |
79 base::android::BuildInfo::GetInstance(); | 80 base::android::BuildInfo::GetInstance(); |
80 std::string model = build_info->model(); | 81 std::string model = build_info->model(); |
81 model = StringToLowerASCII(model); | 82 model = StringToLowerASCII(model); |
82 bool is_nexus7 = model.find("nexus 7") != std::string::npos; | 83 bool is_nexus7 = model.find("nexus 7") != std::string::npos; |
83 bool is_nexus10 = model.find("nexus 10") != std::string::npos; | 84 bool is_nexus10 = model.find("nexus 10") != std::string::npos; |
84 | 85 |
85 // IMG: avoid context switching perf problems, crashes with share groups | 86 // IMG: avoid context switching perf problems, crashes with share groups |
86 // Mali-T604: http://crbug.com/154715 | 87 // Mali-T604: http://crbug.com/154715 |
87 // QualComm, NVIDIA: Crashes with share groups | 88 // QualComm, NVIDIA: Crashes with share groups |
88 if (is_img || is_mali_t604 || is_qualcomm || is_nexus7) { | 89 if (is_img || is_mali_t604 || is_qualcomm || is_nexus7 || is_hisilicon) { |
89 CommandLine::ForCurrentProcess()->AppendSwitch( | 90 CommandLine::ForCurrentProcess()->AppendSwitch( |
90 switches::kEnableVirtualGLContexts); | 91 switches::kEnableVirtualGLContexts); |
91 } | 92 } |
92 | 93 |
93 gfx::DeviceDisplayInfo info; | 94 gfx::DeviceDisplayInfo info; |
94 int default_tile_size = 256; | 95 int default_tile_size = 256; |
95 | 96 |
96 // For very high resolution displays (eg. Nexus 10), set the default | 97 // For very high resolution displays (eg. Nexus 10), set the default |
97 // tile size to be 512. This should be removed in favour of a generic | 98 // tile size to be 512. This should be removed in favour of a generic |
98 // hueristic that works across all platforms and devices, once that | 99 // hueristic that works across all platforms and devices, once that |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 gpu_info->gl_version_string); | 142 gpu_info->gl_version_string); |
142 return true; | 143 return true; |
143 } | 144 } |
144 | 145 |
145 void MergeGPUInfo(content::GPUInfo* basic_gpu_info, | 146 void MergeGPUInfo(content::GPUInfo* basic_gpu_info, |
146 const content::GPUInfo& context_gpu_info) { | 147 const content::GPUInfo& context_gpu_info) { |
147 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 148 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
148 } | 149 } |
149 | 150 |
150 } // namespace gpu_info_collector | 151 } // namespace gpu_info_collector |
OLD | NEW |