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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 base::SplitString(sub_string, '.', &pieces); | 38 base::SplitString(sub_string, '.', &pieces); |
39 if (pieces.size() < 2) | 39 if (pieces.size() < 2) |
40 return "0"; | 40 return "0"; |
41 return pieces[0] + "." + pieces[1]; | 41 return pieces[0] + "." + pieces[1]; |
42 } | 42 } |
43 | 43 |
44 } | 44 } |
45 | 45 |
46 namespace gpu_info_collector { | 46 namespace gpu_info_collector { |
47 | 47 |
48 bool CollectContextGraphicsInfo(content::GPUInfo* gpu_info) { | 48 bool CollectGraphicsInfo(content::GPUInfo* gpu_info) { |
49 // can_lose_context must be false to enable accelerated Canvas2D | 49 // can_lose_context must be false to enable accelerated Canvas2D |
50 gpu_info->can_lose_context = false; | 50 gpu_info->can_lose_context = false; |
51 gpu_info->finalized = true; | 51 gpu_info->finalized = true; |
52 return CollectGraphicsInfoGL(gpu_info); | 52 return CollectGraphicsInfoGL(gpu_info); |
53 } | 53 } |
54 | 54 |
55 bool CollectBasicGraphicsInfo(content::GPUInfo* gpu_info) { | 55 bool CollectPreliminaryGraphicsInfo(content::GPUInfo* gpu_info) { |
56 gpu_info->can_lose_context = false; | 56 gpu_info->can_lose_context = false; |
57 // Create a short-lived context on the UI thread to collect the GL strings. | 57 // Create a short-lived context on the UI thread to collect the GL strings. |
58 if (!CollectGraphicsInfoGL(gpu_info)) | 58 if (!CollectGraphicsInfoGL(gpu_info)) |
59 return false; | 59 return false; |
60 | 60 |
61 std::string vendor(StringToLowerASCII(gpu_info->gl_vendor)); | 61 std::string vendor(StringToLowerASCII(gpu_info->gl_vendor)); |
62 std::string renderer(StringToLowerASCII(gpu_info->gl_renderer)); | 62 std::string renderer(StringToLowerASCII(gpu_info->gl_renderer)); |
63 bool is_img = vendor.find("imagination") != std::string::npos; | 63 bool is_img = vendor.find("imagination") != std::string::npos; |
64 bool is_arm = vendor.find("arm") != std::string::npos; | 64 bool is_arm = vendor.find("arm") != std::string::npos; |
65 bool is_mali_t604 = is_arm && renderer.find("mali-t604") != std::string::npos; | 65 bool is_mali_t604 = is_arm && renderer.find("mali-t604") != std::string::npos; |
66 | 66 |
67 // IMG: avoid context switching perf problems, crashes with share groups | 67 // IMG: avoid context switching perf problems, crashes with share groups |
68 // Mali-T604: http://crbug.com/154715 | 68 // Mali-T604: http://crbug.com/154715 |
69 if (is_img || is_mali_t604) { | 69 if (is_img || is_mali_t604) { |
70 CommandLine::ForCurrentProcess()->AppendSwitch( | 70 CommandLine::ForCurrentProcess()->AppendSwitch( |
71 switches::kEnableVirtualGLContexts); | 71 switches::kEnableVirtualGLContexts); |
72 } | 72 } |
73 return true; | 73 return true; |
74 } | 74 } |
75 | 75 |
| 76 bool CollectVideoCardInfo(content::GPUInfo* gpu_info) { |
| 77 return true; |
| 78 } |
| 79 |
76 bool CollectDriverInfoGL(content::GPUInfo* gpu_info) { | 80 bool CollectDriverInfoGL(content::GPUInfo* gpu_info) { |
77 gpu_info->driver_version = GetDriverVersionFromString( | 81 gpu_info->driver_version = GetDriverVersionFromString( |
78 gpu_info->gl_version_string); | 82 gpu_info->gl_version_string); |
79 return true; | 83 return true; |
80 } | 84 } |
81 | 85 |
82 void MergeGPUInfo(content::GPUInfo* basic_gpu_info, | |
83 const content::GPUInfo& context_gpu_info) { | |
84 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | |
85 } | |
86 | |
87 } // namespace gpu_info_collector | 86 } // namespace gpu_info_collector |
OLD | NEW |