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 #ifndef GPU_CONFIG_GPU_TEST_CONFIG_H_ | 5 #ifndef GPU_CONFIG_GPU_TEST_CONFIG_H_ |
6 #define GPU_CONFIG_GPU_TEST_CONFIG_H_ | 6 #define GPU_CONFIG_GPU_TEST_CONFIG_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 #include <vector> | 11 #include <vector> |
10 | 12 |
11 #include "base/basictypes.h" | |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "gpu/gpu_export.h" | 14 #include "gpu/gpu_export.h" |
14 | 15 |
15 namespace gpu { | 16 namespace gpu { |
16 | 17 |
17 struct GPUInfo; | 18 struct GPUInfo; |
18 | 19 |
19 class GPU_EXPORT GPUTestConfig { | 20 class GPU_EXPORT GPUTestConfig { |
20 public: | 21 public: |
21 enum OS { | 22 enum OS { |
(...skipping 29 matching lines...) Expand all Loading... |
51 kAPIUnknown = 0, | 52 kAPIUnknown = 0, |
52 kAPID3D9 = 1 << 0, | 53 kAPID3D9 = 1 << 0, |
53 kAPID3D11 = 1 << 1, | 54 kAPID3D11 = 1 << 1, |
54 kAPIGLDesktop = 1 << 2, | 55 kAPIGLDesktop = 1 << 2, |
55 kAPIGLES = 1 << 3, | 56 kAPIGLES = 1 << 3, |
56 }; | 57 }; |
57 | 58 |
58 GPUTestConfig(); | 59 GPUTestConfig(); |
59 virtual ~GPUTestConfig(); | 60 virtual ~GPUTestConfig(); |
60 | 61 |
61 void set_os(int32 os); | 62 void set_os(int32_t os); |
62 void set_gpu_device_id(uint32 id); | 63 void set_gpu_device_id(uint32_t id); |
63 void set_build_type(int32 build_type); | 64 void set_build_type(int32_t build_type); |
64 void set_api(int32 api); | 65 void set_api(int32_t api); |
65 | 66 |
66 virtual void AddGPUVendor(uint32 gpu_vendor); | 67 virtual void AddGPUVendor(uint32_t gpu_vendor); |
67 | 68 |
68 int32 os() const { return os_; } | 69 int32_t os() const { return os_; } |
69 const std::vector<uint32>& gpu_vendor() const { return gpu_vendor_; } | 70 const std::vector<uint32_t>& gpu_vendor() const { return gpu_vendor_; } |
70 uint32 gpu_device_id() const { return gpu_device_id_; } | 71 uint32_t gpu_device_id() const { return gpu_device_id_; } |
71 int32 build_type() const { return build_type_; } | 72 int32_t build_type() const { return build_type_; } |
72 int32 api() const { return api_; } | 73 int32_t api() const { return api_; } |
73 | 74 |
74 // Check if the config is valid. For example, if gpu_device_id_ is set, but | 75 // Check if the config is valid. For example, if gpu_device_id_ is set, but |
75 // gpu_vendor_ is unknown, then it's invalid. | 76 // gpu_vendor_ is unknown, then it's invalid. |
76 virtual bool IsValid() const; | 77 virtual bool IsValid() const; |
77 | 78 |
78 // Check if two configs overlap, i.e., if there exists a config that matches | 79 // Check if two configs overlap, i.e., if there exists a config that matches |
79 // both configs. | 80 // both configs. |
80 bool OverlapsWith(const GPUTestConfig& config) const; | 81 bool OverlapsWith(const GPUTestConfig& config) const; |
81 | 82 |
82 // Disable validation of GPU vendor and device ids. | 83 // Disable validation of GPU vendor and device ids. |
83 void DisableGPUInfoValidation(); | 84 void DisableGPUInfoValidation(); |
84 | 85 |
85 protected: | 86 protected: |
86 void ClearGPUVendor(); | 87 void ClearGPUVendor(); |
87 | 88 |
88 // Indicates that the OS has the notion of a numeric GPU vendor and device id | 89 // Indicates that the OS has the notion of a numeric GPU vendor and device id |
89 // and this data should be validated. | 90 // and this data should be validated. |
90 bool validate_gpu_info_; | 91 bool validate_gpu_info_; |
91 | 92 |
92 private: | 93 private: |
93 // operating system. | 94 // operating system. |
94 int32 os_; | 95 int32_t os_; |
95 | 96 |
96 // GPU vendor. | 97 // GPU vendor. |
97 std::vector<uint32> gpu_vendor_; | 98 std::vector<uint32_t> gpu_vendor_; |
98 | 99 |
99 // GPU device id (unique to each vendor). | 100 // GPU device id (unique to each vendor). |
100 uint32 gpu_device_id_; | 101 uint32_t gpu_device_id_; |
101 | 102 |
102 // Release or Debug. | 103 // Release or Debug. |
103 int32 build_type_; | 104 int32_t build_type_; |
104 | 105 |
105 // Back-end rendering APIs. | 106 // Back-end rendering APIs. |
106 int32 api_; | 107 int32_t api_; |
107 }; | 108 }; |
108 | 109 |
109 class GPU_EXPORT GPUTestBotConfig : public GPUTestConfig { | 110 class GPU_EXPORT GPUTestBotConfig : public GPUTestConfig { |
110 public: | 111 public: |
111 GPUTestBotConfig() { } | 112 GPUTestBotConfig() { } |
112 ~GPUTestBotConfig() override; | 113 ~GPUTestBotConfig() override; |
113 | 114 |
114 // This should only be called when no gpu_vendor is added. | 115 // This should only be called when no gpu_vendor is added. |
115 void AddGPUVendor(uint32 gpu_vendor) override; | 116 void AddGPUVendor(uint32_t gpu_vendor) override; |
116 | 117 |
117 // Return false if gpu_info does not have valid vendor_id and device_id. | 118 // Return false if gpu_info does not have valid vendor_id and device_id. |
118 bool SetGPUInfo(const GPUInfo& gpu_info); | 119 bool SetGPUInfo(const GPUInfo& gpu_info); |
119 | 120 |
120 // Check if the bot config is valid, i.e., if it is one valid test-bot | 121 // Check if the bot config is valid, i.e., if it is one valid test-bot |
121 // environment. For example, if a field is unknown, or if OS is not one | 122 // environment. For example, if a field is unknown, or if OS is not one |
122 // fully defined OS, then it's valid. | 123 // fully defined OS, then it's valid. |
123 bool IsValid() const override; | 124 bool IsValid() const override; |
124 | 125 |
125 // Check if a bot config matches a test config, i.e., the test config is a | 126 // Check if a bot config matches a test config, i.e., the test config is a |
(...skipping 10 matching lines...) Expand all Loading... |
136 static bool CurrentConfigMatches(const std::vector<std::string>& configs); | 137 static bool CurrentConfigMatches(const std::vector<std::string>& configs); |
137 | 138 |
138 // Check if the bot has blacklisted all GPU features. | 139 // Check if the bot has blacklisted all GPU features. |
139 static bool GpuBlacklistedOnBot(); | 140 static bool GpuBlacklistedOnBot(); |
140 }; | 141 }; |
141 | 142 |
142 } // namespace gpu | 143 } // namespace gpu |
143 | 144 |
144 #endif // GPU_CONFIG_GPU_TEST_CONFIG_H_ | 145 #endif // GPU_CONFIG_GPU_TEST_CONFIG_H_ |
145 | 146 |
OLD | NEW |