| 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 | 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 // Virtual contexts crash when switching surfaces, but only on SDK 16, | 86 // Virtual contexts crash when switching surfaces, but only on SDK 16, |
| 86 // so we us full context switching for now. If virtual contexts can | 87 // so we us full context switching for now. If virtual contexts can |
| 87 // avoid some of it's extra surface switches, or Qualcomm gives us | 88 // avoid some of it's extra surface switches, or Qualcomm gives us |
| 88 // a more directed work-around, we can remove this. | 89 // a more directed work-around, we can remove this. |
| 89 int sdk_int = base::android::BuildInfo::GetInstance()->sdk_int(); | 90 int sdk_int = base::android::BuildInfo::GetInstance()->sdk_int(); |
| 90 | 91 |
| 91 // IMG: avoid context switching perf problems, crashes with share groups | 92 // IMG: avoid context switching perf problems, crashes with share groups |
| 92 // Mali-T604: http://crbug.com/154715 | 93 // Mali-T604: http://crbug.com/154715 |
| 93 // QualComm, NVIDIA: Crashes with share groups | 94 // QualComm, NVIDIA: Crashes with share groups |
| 94 if (is_img || is_mali_t604 || is_nexus7 || (is_qualcomm && sdk_int != 16)) { | 95 if (is_hisilicon || is_img || is_mali_t604 || is_nexus7 |
| 96 || (is_qualcomm && sdk_int != 16)) { |
| 95 CommandLine::ForCurrentProcess()->AppendSwitch( | 97 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 96 switches::kEnableVirtualGLContexts); | 98 switches::kEnableVirtualGLContexts); |
| 97 } | 99 } |
| 98 | 100 |
| 99 gfx::DeviceDisplayInfo info; | 101 gfx::DeviceDisplayInfo info; |
| 100 int default_tile_size = 256; | 102 int default_tile_size = 256; |
| 101 | 103 |
| 102 // For very high resolution displays (eg. Nexus 10), set the default | 104 // For very high resolution displays (eg. Nexus 10), set the default |
| 103 // tile size to be 512. This should be removed in favour of a generic | 105 // tile size to be 512. This should be removed in favour of a generic |
| 104 // hueristic that works across all platforms and devices, once that | 106 // hueristic that works across all platforms and devices, once that |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 gpu_info->gl_version_string); | 149 gpu_info->gl_version_string); |
| 148 return true; | 150 return true; |
| 149 } | 151 } |
| 150 | 152 |
| 151 void MergeGPUInfo(content::GPUInfo* basic_gpu_info, | 153 void MergeGPUInfo(content::GPUInfo* basic_gpu_info, |
| 152 const content::GPUInfo& context_gpu_info) { | 154 const content::GPUInfo& context_gpu_info) { |
| 153 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 155 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
| 154 } | 156 } |
| 155 | 157 |
| 156 } // namespace gpu_info_collector | 158 } // namespace gpu_info_collector |
| OLD | NEW |