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
3 // found in the LICENSE file.
5 #ifndef GPU_CONFIG_GPU_TEST_CONFIG_H_
6 #define GPU_CONFIG_GPU_TEST_CONFIG_H_
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "gpu/gpu_export.h"
19 class GPU_EXPORT GPUTestConfig
{
27 kOsWin
= kOsWinXP
| kOsWinVista
| kOsWin7
| kOsWin8
,
28 kOsMacLeopard
= 1 << 4,
29 kOsMacSnowLeopard
= 1 << 5,
31 kOsMacMountainLion
= 1 << 7,
32 kOsMacMavericks
= 1 << 8,
33 kOsMacYosemite
= 1 << 9,
34 kOsMac
= kOsMacLeopard
| kOsMacSnowLeopard
| kOsMacLion
|
35 kOsMacMountainLion
| kOsMacMavericks
| kOsMacYosemite
,
37 kOsChromeOS
= 1 << 11,
42 kBuildTypeUnknown
= 0,
43 kBuildTypeRelease
= 1 << 0,
44 kBuildTypeDebug
= 1 << 1,
48 virtual ~GPUTestConfig();
50 void set_os(int32 os
);
51 void set_gpu_device_id(uint32 id
);
52 void set_build_type(int32 build_type
);
54 virtual void AddGPUVendor(uint32 gpu_vendor
);
56 int32
os() const { return os_
; }
57 const std::vector
<uint32
>& gpu_vendor() const { return gpu_vendor_
; }
58 uint32
gpu_device_id() const { return gpu_device_id_
; }
59 int32
build_type() const { return build_type_
; }
61 // Check if the config is valid. For example, if gpu_device_id_ is set, but
62 // gpu_vendor_ is unknown, then it's invalid.
63 virtual bool IsValid() const;
65 // Check if two configs overlap, i.e., if there exists a config that matches
67 bool OverlapsWith(const GPUTestConfig
& config
) const;
69 // Disable validation of GPU vendor and device ids.
70 void DisableGPUInfoValidation();
73 void ClearGPUVendor();
75 // Indicates that the OS has the notion of a numeric GPU vendor and device id
76 // and this data should be validated.
77 bool validate_gpu_info_
;
84 std::vector
<uint32
> gpu_vendor_
;
86 // GPU device id (unique to each vendor).
87 uint32 gpu_device_id_
;
93 class GPU_EXPORT GPUTestBotConfig
: public GPUTestConfig
{
95 GPUTestBotConfig() { }
96 ~GPUTestBotConfig() override
;
98 // This should only be called when no gpu_vendor is added.
99 void AddGPUVendor(uint32 gpu_vendor
) override
;
101 // Return false if gpu_info does not have valid vendor_id and device_id.
102 bool SetGPUInfo(const GPUInfo
& gpu_info
);
104 // Check if the bot config is valid, i.e., if it is one valid test-bot
105 // environment. For example, if a field is unknown, or if OS is not one
106 // fully defined OS, then it's valid.
107 bool IsValid() const override
;
109 // Check if a bot config matches a test config, i.e., the test config is a
110 // superset of the bot config.
111 bool Matches(const GPUTestConfig
& config
) const;
112 bool Matches(const std::string
& config_data
) const;
114 // Setup the config with the current gpu testing environment.
115 // If gpu_info is NULL, collect GPUInfo first.
116 bool LoadCurrentConfig(const GPUInfo
* gpu_info
);
118 // Check if this bot's config matches |config_data| or any of the |configs|.
119 static bool CurrentConfigMatches(const std::string
& config_data
);
120 static bool CurrentConfigMatches(const std::vector
<std::string
>& configs
);
122 // Check if the bot has blacklisted all GPU features.
123 static bool GpuBlacklistedOnBot();
128 #endif // GPU_CONFIG_GPU_TEST_CONFIG_H_