Commit 0449a902 by Jonah Ryan-Davis Committed by Commit Bot

Move gpu_test_expectations from third_party into ANGLE.

1. Copy the code from src/tests/third_party/gpu_test_expectations to src/test/test_expectations, rename .cc files to .cpp. Put these in a new static library and update dEQP to link against it in src/tests/BUILD.gn. 2. Merge the code in angle_config.h into the rest of the expectations parser, this code was added so that the rest of the parser would compile in ANGLE's tree with minimal modification. Still need to follow up with the third step to close the issue. Bug: angleproject:2677 Change-Id: Icf09b4eeed83a6d09b1964ad2adcfa85cabb4b63 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1536312 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 4ae2c12f
......@@ -659,26 +659,34 @@ if (build_angle_deqp_tests && !is_fuchsia) {
}
}
config("angle_deqp_gtest_support_config") {
include_dirs = [ "third_party/gpu_test_expectations" ]
config("angle_deqp_test_expectations_config") {
include_dirs = [ "${angle_root}:angle_common" ]
}
angle_static_library("angle_deqp_test_expectations") {
public_configs += [ ":angle_deqp_test_expectations_config" ]
public_deps = [
"${angle_root}:angle_common",
"${angle_root}:angle_util",
]
sources = deqp_test_expectations_sources
if (is_mac) {
sources += deqp_test_expectations_sources_mac
libs = [ "Cocoa.framework" ]
}
}
angle_source_set("angle_deqp_gtest_support") {
testonly = true
public_deps = [
":angle_deqp_test_expectations",
":angle_deqp_tests_main",
"${angle_root}:angle_common",
"${angle_root}:angle_util",
]
public_configs += [ ":angle_deqp_gtest_support_config" ]
sources = deqp_gpu_test_expectations_sources
if (is_mac) {
sources += deqp_gpu_test_expectations_sources_mac
libs = [ "Cocoa.framework" ]
}
libs = []
if (!is_android) {
public_deps += [ "${angle_root}:angle_gpu_info_util" ]
......
......@@ -1143,15 +1143,15 @@ deqp_libtester_sources_android = [
"$_deqp_path/framework/platform/android/tcuAndroidInternals.cpp",
"$_deqp_path/framework/platform/android/tcuAndroidInternals.hpp",
]
deqp_gpu_test_expectations_sources = [
"third_party/gpu_test_expectations/gpu_info.cc",
"third_party/gpu_test_expectations/gpu_info.h",
"third_party/gpu_test_expectations/gpu_test_config.cc",
"third_party/gpu_test_expectations/gpu_test_config.h",
"third_party/gpu_test_expectations/gpu_test_expectations_parser.cc",
"third_party/gpu_test_expectations/gpu_test_expectations_parser.h",
deqp_test_expectations_sources = [
"test_expectations/gpu_info.cpp",
"test_expectations/gpu_info.h",
"test_expectations/gpu_test_config.cpp",
"test_expectations/gpu_test_config.h",
"test_expectations/gpu_test_expectations_parser.cpp",
"test_expectations/gpu_test_expectations_parser.h",
]
deqp_gpu_test_expectations_sources_mac = [
"third_party/gpu_test_expectations/gpu_test_config_mac.mm",
"third_party/gpu_test_expectations/gpu_test_config_mac.h",
deqp_test_expectations_sources_mac = [
"test_expectations/gpu_test_config_mac.mm",
"test_expectations/gpu_test_config_mac.h",
]
......@@ -19,8 +19,8 @@
#include "common/debug.h"
#include "common/platform.h"
#include "common/string_utils.h"
#include "gpu_test_expectations_parser.h"
#include "platform/Platform.h"
#include "tests/test_expectations/gpu_test_expectations_parser.h"
#include "util/system_utils.h"
namespace
......
......@@ -6,10 +6,11 @@
#include "gpu_info.h"
namespace {
namespace
{
void EnumerateGPUDevice(const gpu::GPUInfo::GPUDevice& device,
gpu::GPUInfo::Enumerator* enumerator) {
void EnumerateGPUDevice(const gpu::GPUInfo::GPUDevice &device, gpu::GPUInfo::Enumerator *enumerator)
{
enumerator->BeginGPUDevice();
enumerator->AddInt("vendorId", device.vendor_id);
enumerator->AddInt("deviceId", device.device_id);
......@@ -19,14 +20,14 @@ void EnumerateGPUDevice(const gpu::GPUInfo::GPUDevice& device,
enumerator->AddString("driverVendor", device.driver_vendor);
enumerator->AddString("driverVersion", device.driver_version);
enumerator->AddString("driverDate", device.driver_date);
enumerator->AddInt("cudaComputeCapabilityMajor",
device.cuda_compute_capability_major);
enumerator->AddInt("cudaComputeCapabilityMajor", device.cuda_compute_capability_major);
enumerator->EndGPUDevice();
}
void EnumerateVideoDecodeAcceleratorSupportedProfile(
const gpu::VideoDecodeAcceleratorSupportedProfile& profile,
gpu::GPUInfo::Enumerator* enumerator) {
const gpu::VideoDecodeAcceleratorSupportedProfile &profile,
gpu::GPUInfo::Enumerator *enumerator)
{
enumerator->BeginVideoDecodeAcceleratorSupportedProfile();
enumerator->AddInt("profile", profile.profile);
enumerator->AddInt("maxResolutionWidth", profile.max_resolution.width());
......@@ -38,21 +39,22 @@ void EnumerateVideoDecodeAcceleratorSupportedProfile(
}
void EnumerateVideoEncodeAcceleratorSupportedProfile(
const gpu::VideoEncodeAcceleratorSupportedProfile& profile,
gpu::GPUInfo::Enumerator* enumerator) {
const gpu::VideoEncodeAcceleratorSupportedProfile &profile,
gpu::GPUInfo::Enumerator *enumerator)
{
enumerator->BeginVideoEncodeAcceleratorSupportedProfile();
enumerator->AddInt("profile", profile.profile);
enumerator->AddInt("maxResolutionWidth", profile.max_resolution.width());
enumerator->AddInt("maxResolutionHeight", profile.max_resolution.height());
enumerator->AddInt("maxFramerateNumerator", profile.max_framerate_numerator);
enumerator->AddInt("maxFramerateDenominator",
profile.max_framerate_denominator);
enumerator->AddInt("maxFramerateDenominator", profile.max_framerate_denominator);
enumerator->EndVideoEncodeAcceleratorSupportedProfile();
}
const char* ImageDecodeAcceleratorTypeToString(
gpu::ImageDecodeAcceleratorType type) {
switch (type) {
const char *ImageDecodeAcceleratorTypeToString(gpu::ImageDecodeAcceleratorType type)
{
switch (type)
{
case gpu::ImageDecodeAcceleratorType::kJpeg:
return "JPEG";
case gpu::ImageDecodeAcceleratorType::kUnknown:
......@@ -60,9 +62,11 @@ const char* ImageDecodeAcceleratorTypeToString(
}
}
const char* ImageDecodeAcceleratorSubsamplingToString(
gpu::ImageDecodeAcceleratorSubsampling subsampling) {
switch (subsampling) {
const char *ImageDecodeAcceleratorSubsamplingToString(
gpu::ImageDecodeAcceleratorSubsampling subsampling)
{
switch (subsampling)
{
case gpu::ImageDecodeAcceleratorSubsampling::k420:
return "4:2:0";
case gpu::ImageDecodeAcceleratorSubsampling::k422:
......@@ -71,44 +75,42 @@ const char* ImageDecodeAcceleratorSubsamplingToString(
}
void EnumerateImageDecodeAcceleratorSupportedProfile(
const gpu::ImageDecodeAcceleratorSupportedProfile& profile,
gpu::GPUInfo::Enumerator* enumerator) {
const gpu::ImageDecodeAcceleratorSupportedProfile &profile,
gpu::GPUInfo::Enumerator *enumerator)
{
enumerator->BeginImageDecodeAcceleratorSupportedProfile();
enumerator->AddString("imageType",
ImageDecodeAcceleratorTypeToString(profile.image_type));
enumerator->AddString("minEncodedDimensions",
profile.min_encoded_dimensions.ToString());
enumerator->AddString("maxEncodedDimensions",
profile.max_encoded_dimensions.ToString());
enumerator->AddString("imageType", ImageDecodeAcceleratorTypeToString(profile.image_type));
enumerator->AddString("minEncodedDimensions", profile.min_encoded_dimensions.ToString());
enumerator->AddString("maxEncodedDimensions", profile.max_encoded_dimensions.ToString());
std::string subsamplings;
for (size_t i = 0; i < profile.subsamplings.size(); i++) {
for (size_t i = 0; i < profile.subsamplings.size(); i++)
{
if (i > 0)
subsamplings += ", ";
subsamplings +=
ImageDecodeAcceleratorSubsamplingToString(profile.subsamplings[i]);
subsamplings += ImageDecodeAcceleratorSubsamplingToString(profile.subsamplings[i]);
}
enumerator->AddString("subsamplings", subsamplings);
enumerator->EndImageDecodeAcceleratorSupportedProfile();
}
#if defined(OS_WIN)
void EnumerateOverlayCapability(const gpu::OverlayCapability& cap,
gpu::GPUInfo::Enumerator* enumerator) {
void EnumerateOverlayCapability(const gpu::OverlayCapability &cap,
gpu::GPUInfo::Enumerator *enumerator)
{
std::string key_string = "overlayCap";
key_string += OverlayFormatToString(cap.format);
enumerator->BeginOverlayCapability();
enumerator->AddString(key_string.c_str(),
cap.is_scaling_supported ? "SCALING" : "DIRECT");
enumerator->AddString(key_string.c_str(), cap.is_scaling_supported ? "SCALING" : "DIRECT");
enumerator->EndOverlayCapability();
}
void EnumerateDx12VulkanVersionInfo(const gpu::Dx12VulkanVersionInfo& info,
gpu::GPUInfo::Enumerator* enumerator) {
void EnumerateDx12VulkanVersionInfo(const gpu::Dx12VulkanVersionInfo &info,
gpu::GPUInfo::Enumerator *enumerator)
{
enumerator->BeginDx12VulkanVersionInfo();
enumerator->AddBool("supportsDx12", info.supports_dx12);
enumerator->AddBool("supportsVulkan", info.supports_vulkan);
enumerator->AddInt("dx12FeatureLevel",
static_cast<int>(info.d3d12_feature_level));
enumerator->AddInt("dx12FeatureLevel", static_cast<int>(info.d3d12_feature_level));
enumerator->AddInt("vulkanVersion", static_cast<int>(info.vulkan_version));
enumerator->EndDx12VulkanVersionInfo();
}
......@@ -116,11 +118,14 @@ void EnumerateDx12VulkanVersionInfo(const gpu::Dx12VulkanVersionInfo& info,
} // namespace
namespace gpu {
namespace gpu
{
#if defined(OS_WIN)
const char* OverlayFormatToString(OverlayFormat format) {
switch (format) {
const char *OverlayFormatToString(OverlayFormat format)
{
switch (format)
{
case OverlayFormat::kBGRA:
return "BGRA";
case OverlayFormat::kYUY2:
......@@ -130,56 +135,50 @@ const char* OverlayFormatToString(OverlayFormat format) {
}
}
bool OverlayCapability::operator==(const OverlayCapability& other) const {
return format == other.format &&
is_scaling_supported == other.is_scaling_supported;
bool OverlayCapability::operator==(const OverlayCapability &other) const
{
return format == other.format && is_scaling_supported == other.is_scaling_supported;
}
#endif
VideoDecodeAcceleratorCapabilities::VideoDecodeAcceleratorCapabilities()
: flags(0) {}
VideoDecodeAcceleratorCapabilities::VideoDecodeAcceleratorCapabilities() : flags(0) {}
VideoDecodeAcceleratorCapabilities::VideoDecodeAcceleratorCapabilities(
const VideoDecodeAcceleratorCapabilities& other) = default;
const VideoDecodeAcceleratorCapabilities &other) = default;
VideoDecodeAcceleratorCapabilities::~VideoDecodeAcceleratorCapabilities() =
default;
VideoDecodeAcceleratorCapabilities::~VideoDecodeAcceleratorCapabilities() = default;
ImageDecodeAcceleratorSupportedProfile::ImageDecodeAcceleratorSupportedProfile()
: image_type(ImageDecodeAcceleratorType::kUnknown) {}
: image_type(ImageDecodeAcceleratorType::kUnknown)
{}
ImageDecodeAcceleratorSupportedProfile::ImageDecodeAcceleratorSupportedProfile(
const ImageDecodeAcceleratorSupportedProfile& other) = default;
const ImageDecodeAcceleratorSupportedProfile &other) = default;
ImageDecodeAcceleratorSupportedProfile::ImageDecodeAcceleratorSupportedProfile(
ImageDecodeAcceleratorSupportedProfile&& other) = default;
ImageDecodeAcceleratorSupportedProfile &&other) = default;
ImageDecodeAcceleratorSupportedProfile::
~ImageDecodeAcceleratorSupportedProfile() = default;
ImageDecodeAcceleratorSupportedProfile::~ImageDecodeAcceleratorSupportedProfile() = default;
ImageDecodeAcceleratorSupportedProfile& ImageDecodeAcceleratorSupportedProfile::
operator=(const ImageDecodeAcceleratorSupportedProfile& other) = default;
ImageDecodeAcceleratorSupportedProfile &ImageDecodeAcceleratorSupportedProfile::operator=(
const ImageDecodeAcceleratorSupportedProfile &other) = default;
ImageDecodeAcceleratorSupportedProfile& ImageDecodeAcceleratorSupportedProfile::
operator=(ImageDecodeAcceleratorSupportedProfile&& other) = default;
ImageDecodeAcceleratorSupportedProfile &ImageDecodeAcceleratorSupportedProfile::operator=(
ImageDecodeAcceleratorSupportedProfile &&other) = default;
GPUInfo::GPUDevice::GPUDevice()
: vendor_id(0),
device_id(0),
active(false),
cuda_compute_capability_major(0) {}
: vendor_id(0), device_id(0), active(false), cuda_compute_capability_major(0)
{}
GPUInfo::GPUDevice::GPUDevice(const GPUInfo::GPUDevice& other) = default;
GPUInfo::GPUDevice::GPUDevice(const GPUInfo::GPUDevice &other) = default;
GPUInfo::GPUDevice::GPUDevice(GPUInfo::GPUDevice&& other) noexcept = default;
GPUInfo::GPUDevice::GPUDevice(GPUInfo::GPUDevice &&other) noexcept = default;
GPUInfo::GPUDevice::~GPUDevice() noexcept = default;
GPUInfo::GPUDevice& GPUInfo::GPUDevice::operator=(
const GPUInfo::GPUDevice& other) = default;
GPUInfo::GPUDevice &GPUInfo::GPUDevice::operator=(const GPUInfo::GPUDevice &other) = default;
GPUInfo::GPUDevice& GPUInfo::GPUDevice::operator=(
GPUInfo::GPUDevice&& other) noexcept = default;
GPUInfo::GPUDevice &GPUInfo::GPUDevice::operator=(GPUInfo::GPUDevice &&other) noexcept = default;
GPUInfo::GPUInfo()
: optimus(false),
......@@ -195,22 +194,24 @@ GPUInfo::GPUInfo()
system_visual(0),
rgba_visual(0),
#endif
oop_rasterization_supported(false) {
}
oop_rasterization_supported(false)
{}
GPUInfo::GPUInfo(const GPUInfo& other) = default;
GPUInfo::GPUInfo(const GPUInfo &other) = default;
GPUInfo::~GPUInfo() = default;
GPUInfo::GPUDevice& GPUInfo::active_gpu() {
return const_cast<GPUInfo::GPUDevice&>(
const_cast<const GPUInfo&>(*this).active_gpu());
GPUInfo::GPUDevice &GPUInfo::active_gpu()
{
return const_cast<GPUInfo::GPUDevice &>(const_cast<const GPUInfo &>(*this).active_gpu());
}
const GPUInfo::GPUDevice& GPUInfo::active_gpu() const {
const GPUInfo::GPUDevice &GPUInfo::active_gpu() const
{
if (gpu.active || secondary_gpus.empty())
return gpu;
for (const auto& secondary_gpu : secondary_gpus) {
for (const auto &secondary_gpu : secondary_gpus)
{
if (secondary_gpu.active)
return secondary_gpu;
}
......@@ -218,12 +219,15 @@ const GPUInfo::GPUDevice& GPUInfo::active_gpu() const {
return gpu;
}
bool GPUInfo::IsInitialized() const {
bool GPUInfo::IsInitialized() const
{
return gpu.vendor_id != 0 || !gl_vendor.empty();
}
void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
struct GPUInfoKnownFields {
void GPUInfo::EnumerateFields(Enumerator *enumerator) const
{
struct GPUInfoKnownFields
{
base::TimeDelta initialization_time;
bool optimus;
bool amd_switchable;
......@@ -257,12 +261,10 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
#endif
VideoDecodeAcceleratorCapabilities video_decode_accelerator_capabilities;
VideoEncodeAcceleratorSupportedProfiles
video_encode_accelerator_supported_profiles;
VideoEncodeAcceleratorSupportedProfiles video_encode_accelerator_supported_profiles;
bool jpeg_decode_accelerator_supported;
ImageDecodeAcceleratorSupportedProfiles
image_decode_accelerator_supported_profiles;
ImageDecodeAcceleratorSupportedProfiles image_decode_accelerator_supported_profiles;
#if defined(USE_X11)
VisualID system_visual;
......@@ -275,20 +277,18 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
// If this assert fails then most likely something below needs to be updated.
// Note that this assert is only approximate. If a new field is added to
// GPUInfo which fits within the current padding then it will not be caught.
static_assert(
sizeof(GPUInfo) == sizeof(GPUInfoKnownFields),
static_assert(sizeof(GPUInfo) == sizeof(GPUInfoKnownFields),
"fields have changed in GPUInfo, GPUInfoKnownFields must be updated");
// Required fields (according to DevTools protocol) first.
enumerator->AddString("machineModelName", machine_model_name);
enumerator->AddString("machineModelVersion", machine_model_version);
EnumerateGPUDevice(gpu, enumerator);
for (const auto& secondary_gpu : secondary_gpus)
for (const auto &secondary_gpu : secondary_gpus)
EnumerateGPUDevice(secondary_gpu, enumerator);
enumerator->BeginAuxAttributes();
enumerator->AddTimeDeltaInSecondsF("initializationTime",
initialization_time);
enumerator->AddTimeDeltaInSecondsF("initializationTime", initialization_time);
enumerator->AddBool("optimus", optimus);
enumerator->AddBool("amdSwitchable", amd_switchable);
enumerator->AddString("pixelShaderVersion", pixel_shader_version);
......@@ -301,8 +301,7 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
enumerator->AddString("glWsVendor", gl_ws_vendor);
enumerator->AddString("glWsVersion", gl_ws_version);
enumerator->AddString("glWsExtensions", gl_ws_extensions);
enumerator->AddInt(
"glResetNotificationStrategy",
enumerator->AddInt("glResetNotificationStrategy",
static_cast<int>(gl_reset_notification_strategy));
// TODO(kbr): add performance_stats.
enumerator->AddBool("softwareRendering", software_rendering);
......@@ -310,26 +309,22 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
enumerator->AddBool("sandboxed", sandboxed);
enumerator->AddBool("inProcessGpu", in_process_gpu);
enumerator->AddBool("passthroughCmdDecoder", passthrough_cmd_decoder);
enumerator->AddBool("canSupportThreadedTextureMailbox",
can_support_threaded_texture_mailbox);
enumerator->AddBool("canSupportThreadedTextureMailbox", can_support_threaded_texture_mailbox);
// TODO(kbr): add dx_diagnostics on Windows.
#if defined(OS_WIN)
enumerator->AddBool("directComposition", direct_composition);
enumerator->AddBool("supportsOverlays", supports_overlays);
for (const auto& cap : overlay_capabilities)
for (const auto &cap : overlay_capabilities)
EnumerateOverlayCapability(cap, enumerator);
EnumerateDx12VulkanVersionInfo(dx12_vulkan_version_info, enumerator);
#endif
enumerator->AddInt("videoDecodeAcceleratorFlags",
video_decode_accelerator_capabilities.flags);
for (const auto& profile :
video_decode_accelerator_capabilities.supported_profiles)
enumerator->AddInt("videoDecodeAcceleratorFlags", video_decode_accelerator_capabilities.flags);
for (const auto &profile : video_decode_accelerator_capabilities.supported_profiles)
EnumerateVideoDecodeAcceleratorSupportedProfile(profile, enumerator);
for (const auto& profile : video_encode_accelerator_supported_profiles)
for (const auto &profile : video_encode_accelerator_supported_profiles)
EnumerateVideoEncodeAcceleratorSupportedProfile(profile, enumerator);
enumerator->AddBool("jpegDecodeAcceleratorSupported",
jpeg_decode_accelerator_supported);
for (const auto& profile : image_decode_accelerator_supported_profiles)
enumerator->AddBool("jpegDecodeAcceleratorSupported", jpeg_decode_accelerator_supported);
for (const auto &profile : image_decode_accelerator_supported_profiles)
EnumerateImageDecodeAcceleratorSupportedProfile(profile, enumerator);
#if defined(USE_X11)
enumerator->AddInt64("systemVisual", system_visual);
......
......@@ -13,17 +13,19 @@
#include <string>
#include <vector>
#include "angle_config.h"
#include "gpu_test_config.h"
#if defined(USE_X11)
typedef unsigned long VisualID;
#endif
namespace gpu {
namespace gpu
{
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class GpuSeriesType {
enum class GpuSeriesType
{
kUnknown = 0,
// Intel 6th gen
kIntelSandyBridge = 1,
......@@ -45,7 +47,8 @@ enum class GpuSeriesType {
};
// Video profile. This *must* match media::VideoCodecProfile.
enum VideoCodecProfile {
enum VideoCodecProfile
{
VIDEO_CODEC_PROFILE_UNKNOWN = -1,
VIDEO_CODEC_PROFILE_MIN = VIDEO_CODEC_PROFILE_UNKNOWN,
H264PROFILE_BASELINE = 0,
......@@ -79,59 +82,60 @@ enum VideoCodecProfile {
};
// Specification of a decoding profile supported by a hardware decoder.
struct GPU_EXPORT VideoDecodeAcceleratorSupportedProfile {
struct GPU_EXPORT VideoDecodeAcceleratorSupportedProfile
{
VideoCodecProfile profile;
gfx::Size max_resolution;
gfx::Size min_resolution;
bool encrypted_only;
};
using VideoDecodeAcceleratorSupportedProfiles =
std::vector<VideoDecodeAcceleratorSupportedProfile>;
using VideoDecodeAcceleratorSupportedProfiles = std::vector<VideoDecodeAcceleratorSupportedProfile>;
struct GPU_EXPORT VideoDecodeAcceleratorCapabilities {
struct GPU_EXPORT VideoDecodeAcceleratorCapabilities
{
VideoDecodeAcceleratorCapabilities();
VideoDecodeAcceleratorCapabilities(
const VideoDecodeAcceleratorCapabilities& other);
VideoDecodeAcceleratorCapabilities(const VideoDecodeAcceleratorCapabilities &other);
~VideoDecodeAcceleratorCapabilities();
VideoDecodeAcceleratorSupportedProfiles supported_profiles;
uint32_t flags;
};
// Specification of an encoding profile supported by a hardware encoder.
struct GPU_EXPORT VideoEncodeAcceleratorSupportedProfile {
struct GPU_EXPORT VideoEncodeAcceleratorSupportedProfile
{
VideoCodecProfile profile;
gfx::Size max_resolution;
uint32_t max_framerate_numerator;
uint32_t max_framerate_denominator;
};
using VideoEncodeAcceleratorSupportedProfiles =
std::vector<VideoEncodeAcceleratorSupportedProfile>;
using VideoEncodeAcceleratorSupportedProfiles = std::vector<VideoEncodeAcceleratorSupportedProfile>;
enum class ImageDecodeAcceleratorType {
enum class ImageDecodeAcceleratorType
{
kJpeg = 0,
kUnknown = 1,
kMaxValue = kUnknown,
};
enum class ImageDecodeAcceleratorSubsampling {
enum class ImageDecodeAcceleratorSubsampling
{
k420 = 0,
k422 = 1,
kMaxValue = k422,
};
// Specification of an image decoding profile supported by a hardware decoder.
struct GPU_EXPORT ImageDecodeAcceleratorSupportedProfile {
struct GPU_EXPORT ImageDecodeAcceleratorSupportedProfile
{
ImageDecodeAcceleratorSupportedProfile();
ImageDecodeAcceleratorSupportedProfile(
const ImageDecodeAcceleratorSupportedProfile& other);
ImageDecodeAcceleratorSupportedProfile(
ImageDecodeAcceleratorSupportedProfile&& other);
ImageDecodeAcceleratorSupportedProfile(const ImageDecodeAcceleratorSupportedProfile &other);
ImageDecodeAcceleratorSupportedProfile(ImageDecodeAcceleratorSupportedProfile &&other);
~ImageDecodeAcceleratorSupportedProfile();
ImageDecodeAcceleratorSupportedProfile& operator=(
const ImageDecodeAcceleratorSupportedProfile& other);
ImageDecodeAcceleratorSupportedProfile& operator=(
ImageDecodeAcceleratorSupportedProfile&& other);
ImageDecodeAcceleratorSupportedProfile &operator=(
const ImageDecodeAcceleratorSupportedProfile &other);
ImageDecodeAcceleratorSupportedProfile &operator=(
ImageDecodeAcceleratorSupportedProfile &&other);
// Fields common to all image types.
// Type of image to which this profile applies, e.g., JPEG.
......@@ -144,25 +148,32 @@ struct GPU_EXPORT ImageDecodeAcceleratorSupportedProfile {
// The supported chroma subsampling formats, e.g. 4:2:0.
std::vector<ImageDecodeAcceleratorSubsampling> subsamplings;
};
using ImageDecodeAcceleratorSupportedProfiles =
std::vector<ImageDecodeAcceleratorSupportedProfile>;
using ImageDecodeAcceleratorSupportedProfiles = std::vector<ImageDecodeAcceleratorSupportedProfile>;
#if defined(OS_WIN)
// Common overlay formats that we're interested in. Must match the OverlayFormat
// enum in //tools/metrics/histograms/enums.xml. Mapped to corresponding DXGI
// formats in DirectCompositionSurfaceWin.
enum class OverlayFormat { kBGRA = 0, kYUY2 = 1, kNV12 = 2, kMaxValue = kNV12 };
enum class OverlayFormat
{
kBGRA = 0,
kYUY2 = 1,
kNV12 = 2,
kMaxValue = kNV12
};
GPU_EXPORT const char* OverlayFormatToString(OverlayFormat format);
GPU_EXPORT const char *OverlayFormatToString(OverlayFormat format);
struct GPU_EXPORT OverlayCapability {
struct GPU_EXPORT OverlayCapability
{
OverlayFormat format;
bool is_scaling_supported;
bool operator==(const OverlayCapability& other) const;
bool operator==(const OverlayCapability &other) const;
};
using OverlayCapabilities = std::vector<OverlayCapability>;
struct GPU_EXPORT Dx12VulkanVersionInfo {
struct GPU_EXPORT Dx12VulkanVersionInfo
{
bool IsEmpty() const { return !d3d12_feature_level && !vulkan_version; }
// True if the GPU driver supports DX12.
......@@ -179,14 +190,16 @@ struct GPU_EXPORT Dx12VulkanVersionInfo {
};
#endif
struct GPU_EXPORT GPUInfo {
struct GPU_EXPORT GPUDevice {
struct GPU_EXPORT GPUInfo
{
struct GPU_EXPORT GPUDevice
{
GPUDevice();
GPUDevice(const GPUDevice& other);
GPUDevice(GPUDevice&& other) noexcept;
GPUDevice(const GPUDevice &other);
GPUDevice(GPUDevice &&other) noexcept;
~GPUDevice() noexcept;
GPUDevice& operator=(const GPUDevice& other);
GPUDevice& operator=(GPUDevice&& other) noexcept;
GPUDevice &operator=(const GPUDevice &other);
GPUDevice &operator=(GPUDevice &&other) noexcept;
// The DWORD (uint32_t) representing the graphics card vendor id.
uint32_t vendor_id;
......@@ -216,12 +229,12 @@ struct GPU_EXPORT GPUInfo {
};
GPUInfo();
GPUInfo(const GPUInfo& other);
GPUInfo(const GPUInfo &other);
~GPUInfo();
// The currently active gpu.
GPUDevice& active_gpu();
const GPUDevice& active_gpu() const;
GPUDevice &active_gpu();
const GPUDevice &active_gpu() const;
bool IsInitialized() const;
......@@ -324,12 +337,10 @@ struct GPU_EXPORT GPUInfo {
#endif
VideoDecodeAcceleratorCapabilities video_decode_accelerator_capabilities;
VideoEncodeAcceleratorSupportedProfiles
video_encode_accelerator_supported_profiles;
VideoEncodeAcceleratorSupportedProfiles video_encode_accelerator_supported_profiles;
bool jpeg_decode_accelerator_supported;
ImageDecodeAcceleratorSupportedProfiles
image_decode_accelerator_supported_profiles;
ImageDecodeAcceleratorSupportedProfiles image_decode_accelerator_supported_profiles;
#if defined(USE_X11)
VisualID system_visual;
......@@ -345,18 +356,18 @@ struct GPU_EXPORT GPUInfo {
// enumerate the values in this structure without having to embed
// references to its specific member variables. This simplifies the
// addition of new fields to this type.
class Enumerator {
class Enumerator
{
public:
// The following methods apply to the "current" object. Initially this
// is the root object, but calls to BeginGPUDevice/EndGPUDevice and
// BeginAuxAttributes/EndAuxAttributes change the object to which these
// calls should apply.
virtual void AddInt64(const char* name, int64_t value) = 0;
virtual void AddInt(const char* name, int value) = 0;
virtual void AddString(const char* name, const std::string& value) = 0;
virtual void AddBool(const char* name, bool value) = 0;
virtual void AddTimeDeltaInSecondsF(const char* name,
const base::TimeDelta& value) = 0;
virtual void AddInt64(const char *name, int64_t value) = 0;
virtual void AddInt(const char *name, int value) = 0;
virtual void AddString(const char *name, const std::string &value) = 0;
virtual void AddBool(const char *name, bool value) = 0;
virtual void AddTimeDeltaInSecondsF(const char *name, const base::TimeDelta &value) = 0;
// Markers indicating that a GPUDevice is being described.
virtual void BeginGPUDevice() = 0;
......@@ -393,7 +404,7 @@ struct GPU_EXPORT GPUInfo {
};
// Outputs the fields in this structure to the provided enumerator.
void EnumerateFields(Enumerator* enumerator) const;
void EnumerateFields(Enumerator *enumerator) const;
};
} // namespace gpu
......
......@@ -11,34 +11,38 @@
#include "gpu_test_expectations_parser.h"
#if defined(OS_MACOSX)
#include "gpu_test_config_mac.h"
# include "gpu_test_config_mac.h"
#endif
#if !defined(OS_ANDROID)
#include "gpu_info_util/SystemInfo.h"
# include "gpu_info_util/SystemInfo.h"
#endif
#if defined(OS_WIN)
namespace base {
namespace {
namespace base
{
namespace
{
// Disable the deprecated function warning for GetVersionEx
#pragma warning(disable: 4996)
# pragma warning(disable : 4996)
class SysInfo
{
public:
static void OperatingSystemVersionNumbers(
int32_t *major_version, int32_t *minor_version, int32_t *bugfix_version);
static void OperatingSystemVersionNumbers(int32_t *major_version,
int32_t *minor_version,
int32_t *bugfix_version);
};
// static
void SysInfo::OperatingSystemVersionNumbers(
int32_t *major_version, int32_t *minor_version, int32_t *bugfix_version)
void SysInfo::OperatingSystemVersionNumbers(int32_t *major_version,
int32_t *minor_version,
int32_t *bugfix_version)
{
OSVERSIONINFOEX version_info = { sizeof version_info };
::GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&version_info));
OSVERSIONINFOEX version_info = {sizeof version_info};
::GetVersionEx(reinterpret_cast<OSVERSIONINFO *>(&version_info));
*major_version = version_info.dwMajorVersion;
*minor_version = version_info.dwMinorVersion;
*bugfix_version = version_info.dwBuildNumber;
......@@ -49,11 +53,14 @@ void SysInfo::OperatingSystemVersionNumbers(
#endif // defined(OS_WIN)
namespace gpu {
namespace gpu
{
namespace {
namespace
{
GPUTestConfig::OS GetCurrentOS() {
GPUTestConfig::OS GetCurrentOS()
{
#if defined(OS_CHROMEOS)
return GPUTestConfig::kOsChromeOS;
#elif defined(OS_LINUX) || defined(OS_OPENBSD)
......@@ -62,8 +69,7 @@ GPUTestConfig::OS GetCurrentOS() {
int32_t major_version = 0;
int32_t minor_version = 0;
int32_t bugfix_version = 0;
base::SysInfo::OperatingSystemVersionNumbers(
&major_version, &minor_version, &bugfix_version);
base::SysInfo::OperatingSystemVersionNumbers(&major_version, &minor_version, &bugfix_version);
if (major_version == 5)
return GPUTestConfig::kOsWinXP;
if (major_version == 6 && minor_version == 0)
......@@ -79,8 +85,10 @@ GPUTestConfig::OS GetCurrentOS() {
int32_t minor_version = 0;
int32_t bugfix_version = 0;
angle::GetOperatingSystemVersionNumbers(&major_version, &minor_version, &bugfix_version);
if (major_version == 10) {
switch (minor_version) {
if (major_version == 10)
{
switch (minor_version)
{
case 5:
return GPUTestConfig::kOsMacLeopard;
case 6:
......@@ -112,66 +120,75 @@ GPUTestConfig::OS GetCurrentOS() {
}
#if !defined(OS_ANDROID)
bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) {
bool CollectBasicGraphicsInfo(GPUInfo *gpu_info)
{
angle::SystemInfo info;
if (!angle::GetSystemInfo(&info)) {
if (!angle::GetSystemInfo(&info))
{
return false;
}
const angle::GPUDeviceInfo& gpu = info.gpus[info.primaryGPUIndex];
const angle::GPUDeviceInfo &gpu = info.gpus[info.primaryGPUIndex];
gpu_info->gpu.vendor_id = gpu.vendorId;
gpu_info->gpu.device_id = gpu.deviceId;
gpu_info->gpu.active = true;
return true;
}
#else
bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) {
bool CollectBasicGraphicsInfo(GPUInfo *gpu_info)
{
gpu_info->gpu.vendor_id = 0;
gpu_info->gpu.device_id = 0;
gpu_info->gpu.active = true;
return false;
}
#endif // defined(OS_ANDROID)
} // namespace anonymous
} // namespace
GPUTestConfig::GPUTestConfig()
: validate_gpu_info_(true),
os_(kOsUnknown),
gpu_device_id_(0),
build_type_(kBuildTypeUnknown),
api_(kAPIUnknown) {}
api_(kAPIUnknown)
{}
GPUTestConfig::GPUTestConfig(const GPUTestConfig& other) = default;
GPUTestConfig::GPUTestConfig(const GPUTestConfig &other) = default;
GPUTestConfig::~GPUTestConfig() = default;
void GPUTestConfig::set_os(int32_t os) {
DCHECK_EQ(0, os & ~(kOsAndroid | kOsWin | kOsMac | kOsLinux | kOsChromeOS |
kOsFuchsia));
void GPUTestConfig::set_os(int32_t os)
{
DCHECK_EQ(0, os & ~(kOsAndroid | kOsWin | kOsMac | kOsLinux | kOsChromeOS | kOsFuchsia));
os_ = os;
}
void GPUTestConfig::AddGPUVendor(uint32_t gpu_vendor) {
void GPUTestConfig::AddGPUVendor(uint32_t gpu_vendor)
{
DCHECK_NE(0u, gpu_vendor);
for (size_t i = 0; i < gpu_vendor_.size(); ++i)
DCHECK_NE(gpu_vendor_[i], gpu_vendor);
gpu_vendor_.push_back(gpu_vendor);
}
void GPUTestConfig::set_gpu_device_id(uint32_t id) {
void GPUTestConfig::set_gpu_device_id(uint32_t id)
{
gpu_device_id_ = id;
}
void GPUTestConfig::set_build_type(int32_t build_type) {
void GPUTestConfig::set_build_type(int32_t build_type)
{
DCHECK_EQ(0, build_type & ~(kBuildTypeRelease | kBuildTypeDebug));
build_type_ = build_type;
}
void GPUTestConfig::set_api(int32_t api) {
void GPUTestConfig::set_api(int32_t api)
{
DCHECK_EQ(0, api & ~(kAPID3D9 | kAPID3D11 | kAPIGLDesktop | kAPIGLES | kAPIVulkan));
api_ = api;
}
bool GPUTestConfig::IsValid() const {
bool GPUTestConfig::IsValid() const
{
if (!validate_gpu_info_)
return true;
if (gpu_device_id_ != 0 && (gpu_vendor_.size() != 1 || gpu_vendor_[0] == 0))
......@@ -179,17 +196,21 @@ bool GPUTestConfig::IsValid() const {
return true;
}
bool GPUTestConfig::OverlapsWith(const GPUTestConfig& config) const {
bool GPUTestConfig::OverlapsWith(const GPUTestConfig &config) const
{
DCHECK(IsValid());
DCHECK(config.IsValid());
if (config.os_ != kOsUnknown && os_ != kOsUnknown &&
(os_ & config.os_) == 0)
if (config.os_ != kOsUnknown && os_ != kOsUnknown && (os_ & config.os_) == 0)
return false;
if (config.gpu_vendor_.size() > 0 && gpu_vendor_.size() > 0) {
if (config.gpu_vendor_.size() > 0 && gpu_vendor_.size() > 0)
{
bool shared = false;
for (size_t i = 0; i < config.gpu_vendor_.size() && !shared; ++i) {
for (size_t j = 0; j < gpu_vendor_.size(); ++j) {
if (config.gpu_vendor_[i] == gpu_vendor_[j]) {
for (size_t i = 0; i < config.gpu_vendor_.size() && !shared; ++i)
{
for (size_t j = 0; j < gpu_vendor_.size(); ++j)
{
if (config.gpu_vendor_[i] == gpu_vendor_[j])
{
shared = true;
break;
}
......@@ -201,8 +222,7 @@ bool GPUTestConfig::OverlapsWith(const GPUTestConfig& config) const {
if (config.gpu_device_id_ != 0 && gpu_device_id_ != 0 &&
gpu_device_id_ != config.gpu_device_id_)
return false;
if (config.build_type_ != kBuildTypeUnknown &&
build_type_ != kBuildTypeUnknown &&
if (config.build_type_ != kBuildTypeUnknown && build_type_ != kBuildTypeUnknown &&
(build_type_ & config.build_type_) == 0)
return false;
if (config.api() != kAPIUnknown && api_ != kAPIUnknown && api_ != config.api_)
......@@ -210,22 +230,26 @@ bool GPUTestConfig::OverlapsWith(const GPUTestConfig& config) const {
return true;
}
void GPUTestConfig::DisableGPUInfoValidation() {
void GPUTestConfig::DisableGPUInfoValidation()
{
validate_gpu_info_ = false;
}
void GPUTestConfig::ClearGPUVendor() {
void GPUTestConfig::ClearGPUVendor()
{
gpu_vendor_.clear();
}
GPUTestBotConfig::~GPUTestBotConfig() = default;
void GPUTestBotConfig::AddGPUVendor(uint32_t gpu_vendor) {
void GPUTestBotConfig::AddGPUVendor(uint32_t gpu_vendor)
{
DCHECK_EQ(0u, GPUTestConfig::gpu_vendor().size());
GPUTestConfig::AddGPUVendor(gpu_vendor);
}
bool GPUTestBotConfig::SetGPUInfo(const GPUInfo& gpu_info) {
bool GPUTestBotConfig::SetGPUInfo(const GPUInfo &gpu_info)
{
DCHECK(validate_gpu_info_);
if (gpu_info.gpu.device_id == 0 || gpu_info.gpu.vendor_id == 0)
return false;
......@@ -235,8 +259,10 @@ bool GPUTestBotConfig::SetGPUInfo(const GPUInfo& gpu_info) {
return true;
}
bool GPUTestBotConfig::IsValid() const {
switch (os()) {
bool GPUTestBotConfig::IsValid() const
{
switch (os())
{
case kOsWinXP:
case kOsWinVista:
case kOsWin7:
......@@ -260,13 +286,15 @@ bool GPUTestBotConfig::IsValid() const {
default:
return false;
}
if (validate_gpu_info_) {
if (validate_gpu_info_)
{
if (gpu_vendor().size() != 1 || gpu_vendor()[0] == 0)
return false;
if (gpu_device_id() == 0)
return false;
}
switch (build_type()) {
switch (build_type())
{
case kBuildTypeRelease:
case kBuildTypeDebug:
break;
......@@ -276,15 +304,19 @@ bool GPUTestBotConfig::IsValid() const {
return true;
}
bool GPUTestBotConfig::Matches(const GPUTestConfig& config) const {
bool GPUTestBotConfig::Matches(const GPUTestConfig &config) const
{
DCHECK(IsValid());
DCHECK(config.IsValid());
if (config.os() != kOsUnknown && (os() & config.os()) == 0)
return false;
if (config.gpu_vendor().size() > 0) {
if (config.gpu_vendor().size() > 0)
{
bool contained = false;
for (size_t i = 0; i < config.gpu_vendor().size(); ++i) {
if (!gpu_vendor().empty() && config.gpu_vendor()[i] == gpu_vendor()[0]) {
for (size_t i = 0; i < config.gpu_vendor().size(); ++i)
{
if (!gpu_vendor().empty() && config.gpu_vendor()[i] == gpu_vendor()[0])
{
contained = true;
break;
}
......@@ -292,18 +324,17 @@ bool GPUTestBotConfig::Matches(const GPUTestConfig& config) const {
if (!contained)
return false;
}
if (config.gpu_device_id() != 0 &&
gpu_device_id() != config.gpu_device_id())
if (config.gpu_device_id() != 0 && gpu_device_id() != config.gpu_device_id())
return false;
if (config.build_type() != kBuildTypeUnknown &&
(build_type() & config.build_type()) == 0)
if (config.build_type() != kBuildTypeUnknown && (build_type() & config.build_type()) == 0)
return false;
if (config.api() != 0 && (api() & config.api()) == 0)
return false;
return true;
}
bool GPUTestBotConfig::Matches(const std::string& config_data) const {
bool GPUTestBotConfig::Matches(const std::string &config_data) const
{
GPUTestExpectationsParser parser;
GPUTestConfig config;
......@@ -312,22 +343,30 @@ bool GPUTestBotConfig::Matches(const std::string& config_data) const {
return Matches(config);
}
bool GPUTestBotConfig::LoadCurrentConfig(const GPUInfo* gpu_info) {
bool GPUTestBotConfig::LoadCurrentConfig(const GPUInfo *gpu_info)
{
bool rt;
if (!gpu_info) {
if (!gpu_info)
{
GPUInfo my_gpu_info;
if (!CollectBasicGraphicsInfo(&my_gpu_info)) {
if (!CollectBasicGraphicsInfo(&my_gpu_info))
{
LOG(ERROR) << "Fail to identify GPU\n";
DisableGPUInfoValidation();
rt = true;
} else {
}
else
{
rt = SetGPUInfo(my_gpu_info);
}
} else {
}
else
{
rt = SetGPUInfo(*gpu_info);
}
set_os(GetCurrentOS());
if (os() == kOsUnknown) {
if (os() == kOsUnknown)
{
LOG(ERROR) << "Unknown OS\n";
rt = false;
}
......@@ -340,7 +379,8 @@ bool GPUTestBotConfig::LoadCurrentConfig(const GPUInfo* gpu_info) {
}
// static
bool GPUTestBotConfig::CurrentConfigMatches(const std::string& config_data) {
bool GPUTestBotConfig::CurrentConfigMatches(const std::string &config_data)
{
GPUTestBotConfig my_config;
if (!my_config.LoadCurrentConfig(nullptr))
return false;
......@@ -348,12 +388,13 @@ bool GPUTestBotConfig::CurrentConfigMatches(const std::string& config_data) {
}
// static
bool GPUTestBotConfig::CurrentConfigMatches(
const std::vector<std::string>& configs) {
bool GPUTestBotConfig::CurrentConfigMatches(const std::vector<std::string> &configs)
{
GPUTestBotConfig my_config;
if (!my_config.LoadCurrentConfig(nullptr))
return false;
for (size_t i = 0 ; i < configs.size(); ++i) {
for (size_t i = 0; i < configs.size(); ++i)
{
if (my_config.Matches(configs[i]))
return true;
}
......@@ -361,7 +402,8 @@ bool GPUTestBotConfig::CurrentConfigMatches(
}
// static
bool GPUTestBotConfig::GpuBlacklistedOnBot() {
bool GPUTestBotConfig::GpuBlacklistedOnBot()
{
return false;
}
......
//
// Copyright 2015 The ANGLE Project Authors. All rights reserved.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// angle_config.h:
// Helpers for importing the gpu test expectations package from Chrome.
//
#ifndef ANGLE_GPU_TEST_EXPECTATIONS_ANGLE_CONFIG_H_
#define ANGLE_GPU_TEST_EXPECTATIONS_ANGLE_CONFIG_H_
#ifndef ANGLE_GPU_CONFIG_GPU_TEST_CONFIG_H_
#define ANGLE_GPU_CONFIG_GPU_TEST_CONFIG_H_
#include <stdint.h>
#include <iostream>
#include <string>
#include <vector>
#include "common/debug.h"
#include "common/string_utils.h"
......@@ -73,4 +69,145 @@ struct DxDiagNode
#endif
// clang-format on
#endif
namespace gpu
{
struct GPUInfo;
class GPU_EXPORT GPUTestConfig
{
public:
enum OS
{
kOsUnknown = 0,
kOsWinXP = 1 << 0,
kOsWinVista = 1 << 1,
kOsWin7 = 1 << 2,
kOsWin8 = 1 << 3,
kOsMacLeopard = 1 << 4,
kOsMacSnowLeopard = 1 << 5,
kOsMacLion = 1 << 6,
kOsMacMountainLion = 1 << 7,
kOsMacMavericks = 1 << 8,
kOsMacYosemite = 1 << 9,
kOsMacElCapitan = 1 << 10,
kOsMacSierra = 1 << 11,
kOsMacHighSierra = 1 << 12,
kOsMacMojave = 1 << 13,
kOsMac = kOsMacLeopard | kOsMacSnowLeopard | kOsMacLion | kOsMacMountainLion |
kOsMacMavericks | kOsMacYosemite | kOsMacElCapitan | kOsMacSierra |
kOsMacHighSierra | kOsMacMojave,
kOsLinux = 1 << 14,
kOsChromeOS = 1 << 15,
kOsAndroid = 1 << 16,
kOsWin10 = 1 << 17,
kOsWin = kOsWinXP | kOsWinVista | kOsWin7 | kOsWin8 | kOsWin10,
kOsFuchsia = 1 << 18,
};
enum BuildType
{
kBuildTypeUnknown = 0,
kBuildTypeRelease = 1 << 0,
kBuildTypeDebug = 1 << 1,
};
enum API
{
kAPIUnknown = 0,
kAPID3D9 = 1 << 0,
kAPID3D11 = 1 << 1,
kAPIGLDesktop = 1 << 2,
kAPIGLES = 1 << 3,
kAPIVulkan = 1 << 4,
};
GPUTestConfig();
GPUTestConfig(const GPUTestConfig &other);
virtual ~GPUTestConfig();
void set_os(int32_t os);
void set_gpu_device_id(uint32_t id);
void set_build_type(int32_t build_type);
void set_api(int32_t api);
virtual void AddGPUVendor(uint32_t gpu_vendor);
int32_t os() const { return os_; }
const std::vector<uint32_t> &gpu_vendor() const { return gpu_vendor_; }
uint32_t gpu_device_id() const { return gpu_device_id_; }
int32_t build_type() const { return build_type_; }
int32_t api() const { return api_; }
// Check if the config is valid. For example, if gpu_device_id_ is set, but
// gpu_vendor_ is unknown, then it's invalid.
virtual bool IsValid() const;
// Check if two configs overlap, i.e., if there exists a config that matches
// both configs.
bool OverlapsWith(const GPUTestConfig &config) const;
// Disable validation of GPU vendor and device ids.
void DisableGPUInfoValidation();
protected:
void ClearGPUVendor();
// Indicates that the OS has the notion of a numeric GPU vendor and device id
// and this data should be validated.
bool validate_gpu_info_;
private:
// operating system.
int32_t os_;
// GPU vendor.
std::vector<uint32_t> gpu_vendor_;
// GPU device id (unique to each vendor).
uint32_t gpu_device_id_;
// Release or Debug.
int32_t build_type_;
// Back-end rendering APIs.
int32_t api_;
};
class GPU_EXPORT GPUTestBotConfig : public GPUTestConfig
{
public:
GPUTestBotConfig() = default;
~GPUTestBotConfig() override;
// This should only be called when no gpu_vendor is added.
void AddGPUVendor(uint32_t gpu_vendor) override;
// Return false if gpu_info does not have valid vendor_id and device_id.
bool SetGPUInfo(const GPUInfo &gpu_info);
// Check if the bot config is valid, i.e., if it is one valid test-bot
// environment. For example, if a field is unknown, or if OS is not one
// fully defined OS, then it's valid.
bool IsValid() const override;
// Check if a bot config matches a test config, i.e., the test config is a
// superset of the bot config.
bool Matches(const GPUTestConfig &config) const;
bool Matches(const std::string &config_data) const;
// Setup the config with the current gpu testing environment.
// If gpu_info is nullptr, collect GPUInfo first.
bool LoadCurrentConfig(const GPUInfo *gpu_info);
// Check if this bot's config matches |config_data| or any of the |configs|.
static bool CurrentConfigMatches(const std::string &config_data);
static bool CurrentConfigMatches(const std::vector<std::string> &configs);
// Check if the bot has blacklisted all GPU features.
static bool GpuBlacklistedOnBot();
};
} // namespace gpu
#endif // ANGLE_GPU_CONFIG_GPU_TEST_CONFIG_H_
......@@ -7,36 +7,39 @@
#include <stddef.h>
#include <stdint.h>
#include "angle_config.h"
#include "common/angleutils.h"
namespace base {
namespace base
{
namespace {
namespace
{
bool StartsWithASCII(const std::string& str,
const std::string& search,
bool case_sensitive) {
bool StartsWithASCII(const std::string &str, const std::string &search, bool case_sensitive)
{
ASSERT(!case_sensitive);
return str.compare(0, search.length(), search) == 0;
}
template <class Char> inline Char ToLowerASCII(Char c) {
template <class Char>
inline Char ToLowerASCII(Char c)
{
return (c >= 'A' && c <= 'Z') ? (c + ('a' - 'A')) : c;
}
template<typename Iter>
static inline bool DoLowerCaseEqualsASCII(Iter a_begin,
Iter a_end,
const char* b) {
for (Iter it = a_begin; it != a_end; ++it, ++b) {
template <typename Iter>
static inline bool DoLowerCaseEqualsASCII(Iter a_begin, Iter a_end, const char *b)
{
for (Iter it = a_begin; it != a_end; ++it, ++b)
{
if (!*b || base::ToLowerASCII(*it) != *b)
return false;
}
return *b == 0;
}
bool LowerCaseEqualsASCII(const std::string& a, const char* b) {
bool LowerCaseEqualsASCII(const std::string &a, const char *b)
{
return DoLowerCaseEqualsASCII(a.begin(), a.end(), b);
}
......@@ -44,11 +47,14 @@ bool LowerCaseEqualsASCII(const std::string& a, const char* b) {
} // namespace base
namespace gpu {
namespace gpu
{
namespace {
namespace
{
enum LineParserStage {
enum LineParserStage
{
kLineParserBegin = 0,
kLineParserBugID,
kLineParserConfigs,
......@@ -58,7 +64,8 @@ enum LineParserStage {
kLineParserExpectations,
};
enum Token {
enum Token
{
// os
kConfigWinXP = 0,
kConfigWinVista,
......@@ -112,8 +119,9 @@ enum Token {
kTokenWord,
};
struct TokenInfo {
const char* name;
struct TokenInfo
{
const char *name;
int32_t flag;
};
......@@ -158,7 +166,8 @@ const TokenInfo kTokenData[] = {
{"=", 0},
};
enum ErrorType {
enum ErrorType
{
kErrorFileIO = 0,
kErrorIllegalEntry,
kErrorInvalidEntry,
......@@ -173,7 +182,7 @@ enum ErrorType {
kNumberOfErrors,
};
const char* kErrorMessage[] = {
const char *kErrorMessage[] = {
"file IO failed",
"entry with wrong format",
"entry invalid, likely wrong modifiers combination",
......@@ -186,13 +195,15 @@ const char* kErrorMessage[] = {
"two entries' configs overlap",
};
Token ParseToken(const std::string& word) {
Token ParseToken(const std::string &word)
{
if (base::StartsWithASCII(word, "//", false))
return kTokenComment;
if (base::StartsWithASCII(word, "0x", false))
return kConfigGPUDeviceID;
for (int32_t i = 0; i < kNumberOfExactMatchTokens; ++i) {
for (int32_t i = 0; i < kNumberOfExactMatchTokens; ++i)
{
if (base::LowerCaseEqualsASCII(word, kTokenData[i].name))
return static_cast<Token>(i);
}
......@@ -200,22 +211,24 @@ Token ParseToken(const std::string& word) {
}
// reference name can have the last character as *.
bool NamesMatching(const std::string& ref, const std::string& test_name) {
bool NamesMatching(const std::string &ref, const std::string &test_name)
{
size_t len = ref.length();
if (len == 0)
return false;
if (ref[len - 1] == '*') {
if (test_name.length() > len -1 &&
ref.compare(0, len - 1, test_name, 0, len - 1) == 0)
if (ref[len - 1] == '*')
{
if (test_name.length() > len - 1 && ref.compare(0, len - 1, test_name, 0, len - 1) == 0)
return true;
return false;
}
return (ref == test_name);
}
} // namespace anonymous
} // namespace
GPUTestExpectationsParser::GPUTestExpectationsParser() {
GPUTestExpectationsParser::GPUTestExpectationsParser()
{
// Some sanity check.
DCHECK_EQ(static_cast<unsigned int>(kNumberOfExactMatchTokens),
sizeof(kTokenData) / sizeof(kTokenData[0]));
......@@ -225,18 +238,21 @@ GPUTestExpectationsParser::GPUTestExpectationsParser() {
GPUTestExpectationsParser::~GPUTestExpectationsParser() = default;
bool GPUTestExpectationsParser::LoadTestExpectations(const std::string& data) {
bool GPUTestExpectationsParser::LoadTestExpectations(const std::string &data)
{
entries_.clear();
error_messages_.clear();
std::vector<std::string> lines = base::SplitString(
data, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
std::vector<std::string> lines =
base::SplitString(data, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
bool rt = true;
for (size_t i = 0; i < lines.size(); ++i) {
for (size_t i = 0; i < lines.size(); ++i)
{
if (!ParseLine(lines[i], i + 1))
rt = false;
}
if (DetectConflictsBetweenEntries()) {
if (DetectConflictsBetweenEntries())
{
entries_.clear();
rt = false;
}
......@@ -244,23 +260,25 @@ bool GPUTestExpectationsParser::LoadTestExpectations(const std::string& data) {
return rt;
}
bool GPUTestExpectationsParser::LoadTestExpectationsFromFile(
const std::string& path) {
bool GPUTestExpectationsParser::LoadTestExpectationsFromFile(const std::string &path)
{
entries_.clear();
error_messages_.clear();
std::string data;
if (!base::ReadFileToString(path, &data)) {
if (!base::ReadFileToString(path, &data))
{
error_messages_.push_back(kErrorMessage[kErrorFileIO]);
return false;
}
return LoadTestExpectations(data);
}
int32_t GPUTestExpectationsParser::GetTestExpectation(
const std::string& test_name,
const GPUTestBotConfig& bot_config) const {
for (size_t i = 0; i < entries_.size(); ++i) {
int32_t GPUTestExpectationsParser::GetTestExpectation(const std::string &test_name,
const GPUTestBotConfig &bot_config) const
{
for (size_t i = 0; i < entries_.size(); ++i)
{
if (NamesMatching(entries_[i].test_name, test_name) &&
bot_config.Matches(entries_[i].test_config))
return entries_[i].test_expectation;
......@@ -268,21 +286,22 @@ int32_t GPUTestExpectationsParser::GetTestExpectation(
return kGpuTestPass;
}
const std::vector<std::string>&
GPUTestExpectationsParser::GetErrorMessages() const {
const std::vector<std::string> &GPUTestExpectationsParser::GetErrorMessages() const
{
return error_messages_;
}
bool GPUTestExpectationsParser::ParseConfig(
const std::string& config_data, GPUTestConfig* config) {
bool GPUTestExpectationsParser::ParseConfig(const std::string &config_data, GPUTestConfig *config)
{
DCHECK(config);
std::vector<std::string> tokens = base::SplitString(
config_data, base::kWhitespaceASCII, base::KEEP_WHITESPACE,
base::SPLIT_WANT_NONEMPTY);
config_data, base::kWhitespaceASCII, base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
for (size_t i = 0; i < tokens.size(); ++i) {
for (size_t i = 0; i < tokens.size(); ++i)
{
Token token = ParseToken(tokens[i]);
switch (token) {
switch (token)
{
case kConfigWinXP:
case kConfigWinVista:
case kConfigWin7:
......@@ -315,10 +334,13 @@ bool GPUTestExpectationsParser::ParseConfig(
case kConfigGLES:
case kConfigVulkan:
case kConfigGPUDeviceID:
if (token == kConfigGPUDeviceID) {
if (token == kConfigGPUDeviceID)
{
if (!UpdateTestConfig(config, tokens[i], 0))
return false;
} else {
}
else
{
if (!UpdateTestConfig(config, token, 0))
return false;
}
......@@ -330,19 +352,20 @@ bool GPUTestExpectationsParser::ParseConfig(
return true;
}
bool GPUTestExpectationsParser::ParseLine(
const std::string& line_data, size_t line_number) {
bool GPUTestExpectationsParser::ParseLine(const std::string &line_data, size_t line_number)
{
std::vector<std::string> tokens = base::SplitString(
line_data, base::kWhitespaceASCII, base::KEEP_WHITESPACE,
base::SPLIT_WANT_NONEMPTY);
line_data, base::kWhitespaceASCII, base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
int32_t stage = kLineParserBegin;
GPUTestExpectationEntry entry;
entry.line_number = line_number;
GPUTestConfig& config = entry.test_config;
GPUTestConfig &config = entry.test_config;
bool comments_encountered = false;
for (size_t i = 0; i < tokens.size() && !comments_encountered; ++i) {
for (size_t i = 0; i < tokens.size() && !comments_encountered; ++i)
{
Token token = ParseToken(tokens[i]);
switch (token) {
switch (token)
{
case kTokenComment:
comments_encountered = true;
break;
......@@ -379,15 +402,18 @@ bool GPUTestExpectationsParser::ParseLine(
case kConfigVulkan:
case kConfigGPUDeviceID:
// MODIFIERS, could be in any order, need at least one.
if (stage != kLineParserConfigs && stage != kLineParserBugID) {
PushErrorMessage(kErrorMessage[kErrorIllegalEntry],
line_number);
if (stage != kLineParserConfigs && stage != kLineParserBugID)
{
PushErrorMessage(kErrorMessage[kErrorIllegalEntry], line_number);
return false;
}
if (token == kConfigGPUDeviceID) {
if (token == kConfigGPUDeviceID)
{
if (!UpdateTestConfig(&config, tokens[i], line_number))
return false;
} else {
}
else
{
if (!UpdateTestConfig(&config, token, line_number))
return false;
}
......@@ -396,31 +422,35 @@ bool GPUTestExpectationsParser::ParseLine(
break;
case kSeparatorColon:
// :
if (stage != kLineParserConfigs) {
PushErrorMessage(kErrorMessage[kErrorIllegalEntry],
line_number);
if (stage != kLineParserConfigs)
{
PushErrorMessage(kErrorMessage[kErrorIllegalEntry], line_number);
return false;
}
stage++;
break;
case kSeparatorEqual:
// =
if (stage != kLineParserTestName) {
PushErrorMessage(kErrorMessage[kErrorIllegalEntry],
line_number);
if (stage != kLineParserTestName)
{
PushErrorMessage(kErrorMessage[kErrorIllegalEntry], line_number);
return false;
}
stage++;
break;
case kTokenWord:
// BUG_ID or TEST_NAME
if (stage == kLineParserBegin) {
if (stage == kLineParserBegin)
{
// Bug ID is not used for anything; ignore it.
} else if (stage == kLineParserColon) {
}
else if (stage == kLineParserColon)
{
entry.test_name = tokens[i];
} else {
PushErrorMessage(kErrorMessage[kErrorIllegalEntry],
line_number);
}
else
{
PushErrorMessage(kErrorMessage[kErrorIllegalEntry], line_number);
return false;
}
stage++;
......@@ -431,18 +461,18 @@ bool GPUTestExpectationsParser::ParseLine(
case kExpectationTimeout:
case kExpectationSkip:
// TEST_EXPECTATIONS
if (stage != kLineParserEqual && stage != kLineParserExpectations) {
PushErrorMessage(kErrorMessage[kErrorIllegalEntry],
line_number);
if (stage != kLineParserEqual && stage != kLineParserExpectations)
{
PushErrorMessage(kErrorMessage[kErrorIllegalEntry], line_number);
return false;
}
if ((kTokenData[token].flag & entry.test_expectation) != 0) {
if ((kTokenData[token].flag & entry.test_expectation) != 0)
{
PushErrorMessage(kErrorMessage[kErrorEntryWithExpectationConflicts],
line_number);
return false;
}
entry.test_expectation =
(kTokenData[token].flag | entry.test_expectation);
entry.test_expectation = (kTokenData[token].flag | entry.test_expectation);
if (stage == kLineParserEqual)
stage++;
break;
......@@ -451,12 +481,15 @@ bool GPUTestExpectationsParser::ParseLine(
break;
}
}
if (stage == kLineParserBegin) {
if (stage == kLineParserBegin)
{
// The whole line is empty or all comments
return true;
}
if (stage == kLineParserExpectations) {
if (!config.IsValid()) {
if (stage == kLineParserExpectations)
{
if (!config.IsValid())
{
PushErrorMessage(kErrorMessage[kErrorInvalidEntry], line_number);
return false;
}
......@@ -467,11 +500,13 @@ bool GPUTestExpectationsParser::ParseLine(
return false;
}
bool GPUTestExpectationsParser::UpdateTestConfig(GPUTestConfig* config,
bool GPUTestExpectationsParser::UpdateTestConfig(GPUTestConfig *config,
int32_t token,
size_t line_number) {
size_t line_number)
{
DCHECK(config);
switch (token) {
switch (token)
{
case kConfigWinXP:
case kConfigWinVista:
case kConfigWin7:
......@@ -492,9 +527,9 @@ bool GPUTestExpectationsParser::UpdateTestConfig(GPUTestConfig* config,
case kConfigLinux:
case kConfigChromeOS:
case kConfigAndroid:
if ((config->os() & kTokenData[token].flag) != 0) {
PushErrorMessage(kErrorMessage[kErrorEntryWithOsConflicts],
line_number);
if ((config->os() & kTokenData[token].flag) != 0)
{
PushErrorMessage(kErrorMessage[kErrorEntryWithOsConflicts], line_number);
return false;
}
config->set_os(config->os() | kTokenData[token].flag);
......@@ -505,11 +540,11 @@ bool GPUTestExpectationsParser::UpdateTestConfig(GPUTestConfig* config,
case kConfigVMWare:
{
uint32_t gpu_vendor = static_cast<uint32_t>(kTokenData[token].flag);
for (size_t i = 0; i < config->gpu_vendor().size(); ++i) {
if (config->gpu_vendor()[i] == gpu_vendor) {
PushErrorMessage(
kErrorMessage[kErrorEntryWithGpuVendorConflicts],
line_number);
for (size_t i = 0; i < config->gpu_vendor().size(); ++i)
{
if (config->gpu_vendor()[i] == gpu_vendor)
{
PushErrorMessage(kErrorMessage[kErrorEntryWithGpuVendorConflicts], line_number);
return false;
}
}
......@@ -518,23 +553,21 @@ bool GPUTestExpectationsParser::UpdateTestConfig(GPUTestConfig* config,
break;
case kConfigRelease:
case kConfigDebug:
if ((config->build_type() & kTokenData[token].flag) != 0) {
PushErrorMessage(
kErrorMessage[kErrorEntryWithBuildTypeConflicts],
line_number);
if ((config->build_type() & kTokenData[token].flag) != 0)
{
PushErrorMessage(kErrorMessage[kErrorEntryWithBuildTypeConflicts], line_number);
return false;
}
config->set_build_type(
config->build_type() | kTokenData[token].flag);
config->set_build_type(config->build_type() | kTokenData[token].flag);
break;
case kConfigD3D9:
case kConfigD3D11:
case kConfigGLDesktop:
case kConfigGLES:
case kConfigVulkan:
if ((config->api() & kTokenData[token].flag) != 0) {
PushErrorMessage(kErrorMessage[kErrorEntryWithAPIConflicts],
line_number);
if ((config->api() & kTokenData[token].flag) != 0)
{
PushErrorMessage(kErrorMessage[kErrorEntryWithAPIConflicts], line_number);
return false;
}
config->set_api(config->api() | kTokenData[token].flag);
......@@ -546,31 +579,33 @@ bool GPUTestExpectationsParser::UpdateTestConfig(GPUTestConfig* config,
return true;
}
bool GPUTestExpectationsParser::UpdateTestConfig(
GPUTestConfig* config,
const std::string& gpu_device_id,
size_t line_number) {
bool GPUTestExpectationsParser::UpdateTestConfig(GPUTestConfig *config,
const std::string &gpu_device_id,
size_t line_number)
{
DCHECK(config);
uint32_t device_id = 0;
if (config->gpu_device_id() != 0 ||
!base::HexStringToUInt(gpu_device_id, &device_id) ||
device_id == 0) {
PushErrorMessage(kErrorMessage[kErrorEntryWithGpuDeviceIdConflicts],
line_number);
if (config->gpu_device_id() != 0 || !base::HexStringToUInt(gpu_device_id, &device_id) ||
device_id == 0)
{
PushErrorMessage(kErrorMessage[kErrorEntryWithGpuDeviceIdConflicts], line_number);
return false;
}
config->set_gpu_device_id(device_id);
return true;
}
bool GPUTestExpectationsParser::DetectConflictsBetweenEntries() {
bool GPUTestExpectationsParser::DetectConflictsBetweenEntries()
{
bool rt = false;
for (size_t i = 0; i < entries_.size(); ++i) {
for (size_t j = i + 1; j < entries_.size(); ++j) {
for (size_t i = 0; i < entries_.size(); ++i)
{
for (size_t j = i + 1; j < entries_.size(); ++j)
{
if (entries_[i].test_name == entries_[j].test_name &&
entries_[i].test_config.OverlapsWith(entries_[j].test_config)) {
PushErrorMessage(kErrorMessage[kErrorEntriesOverlap],
entries_[i].line_number,
entries_[i].test_config.OverlapsWith(entries_[j].test_config))
{
PushErrorMessage(kErrorMessage[kErrorEntriesOverlap], entries_[i].line_number,
entries_[j].line_number);
rt = true;
}
......@@ -579,25 +614,21 @@ bool GPUTestExpectationsParser::DetectConflictsBetweenEntries() {
return rt;
}
void GPUTestExpectationsParser::PushErrorMessage(
const std::string& message, size_t line_number) {
error_messages_.push_back("Line " + ToString(line_number) +
" : " + message.c_str());
void GPUTestExpectationsParser::PushErrorMessage(const std::string &message, size_t line_number)
{
error_messages_.push_back("Line " + ToString(line_number) + " : " + message.c_str());
}
void GPUTestExpectationsParser::PushErrorMessage(
const std::string& message,
void GPUTestExpectationsParser::PushErrorMessage(const std::string &message,
size_t entry1_line_number,
size_t entry2_line_number) {
error_messages_.push_back("Line " + ToString(entry1_line_number) +
" and " + ToString(entry2_line_number) +
" : " + message.c_str());
size_t entry2_line_number)
{
error_messages_.push_back("Line " + ToString(entry1_line_number) + " and " +
ToString(entry2_line_number) + " : " + message.c_str());
}
GPUTestExpectationsParser:: GPUTestExpectationEntry::GPUTestExpectationEntry()
: test_expectation(0),
line_number(0) {
}
GPUTestExpectationsParser::GPUTestExpectationEntry::GPUTestExpectationEntry()
: test_expectation(0), line_number(0)
{}
} // namespace gpu
......@@ -11,14 +11,16 @@
#include <string>
#include <vector>
#include "angle_config.h"
#include "gpu_test_config.h"
namespace gpu {
namespace gpu
{
class GPU_EXPORT GPUTestExpectationsParser {
class GPU_EXPORT GPUTestExpectationsParser
{
public:
enum GPUTestExpectation {
enum GPUTestExpectation
{
kGpuTestPass = 1 << 0,
kGpuTestFail = 1 << 1,
kGpuTestFlaky = 1 << 2,
......@@ -32,22 +34,23 @@ class GPU_EXPORT GPUTestExpectationsParser {
// Parse the text expectations, and if no error is encountered,
// save all the entries. Otherwise, generate error messages.
// Return true if parsing succeeds.
bool LoadTestExpectations(const std::string& data);
bool LoadTestExpectationsFromFile(const std::string& path);
bool LoadTestExpectations(const std::string &data);
bool LoadTestExpectationsFromFile(const std::string &path);
// Query error messages from the last LoadTestExpectations() call.
const std::vector<std::string>& GetErrorMessages() const;
const std::vector<std::string> &GetErrorMessages() const;
// Get the test expectation of a given test on a given bot.
int32_t GetTestExpectation(const std::string& test_name,
const GPUTestBotConfig& bot_config) const;
int32_t GetTestExpectation(const std::string &test_name,
const GPUTestBotConfig &bot_config) const;
// Parse a list of config modifiers. If we have a valid entry with no
// conflicts, | config | stores it, and the function returns true.
bool ParseConfig(const std::string& config_data, GPUTestConfig* config);
bool ParseConfig(const std::string &config_data, GPUTestConfig *config);
private:
struct GPUTestExpectationEntry {
struct GPUTestExpectationEntry
{
GPUTestExpectationEntry();
std::string test_name;
......@@ -58,16 +61,14 @@ class GPU_EXPORT GPUTestExpectationsParser {
// Parse a line of text. If we have a valid entry, save it; otherwise,
// generate error messages.
bool ParseLine(const std::string& line_data, size_t line_number);
bool ParseLine(const std::string &line_data, size_t line_number);
// Update OS/GPUVendor/BuildType modifiers. May generate an error message.
bool UpdateTestConfig(GPUTestConfig* config,
int32_t token,
size_t line_number);
bool UpdateTestConfig(GPUTestConfig *config, int32_t token, size_t line_number);
// Update GPUDeviceID modifier. May generate an error message.
bool UpdateTestConfig(GPUTestConfig* config,
const std::string & gpu_device_id,
bool UpdateTestConfig(GPUTestConfig *config,
const std::string &gpu_device_id,
size_t line_number);
// Check if two entries' config overlap with each other. May generate an
......@@ -75,8 +76,8 @@ class GPU_EXPORT GPUTestExpectationsParser {
bool DetectConflictsBetweenEntries();
// Save an error message, which can be queried later.
void PushErrorMessage(const std::string& message, size_t line_number);
void PushErrorMessage(const std::string& message,
void PushErrorMessage(const std::string &message, size_t line_number);
void PushErrorMessage(const std::string &message,
size_t entry1_line_number,
size_t entry2_line_number);
......@@ -87,4 +88,3 @@ class GPU_EXPORT GPUTestExpectationsParser {
} // namespace gpu
#endif // ANGLE_GPU_CONFIG_GPU_TEST_EXPECTATIONS_PARSER_H_
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ANGLE_GPU_CONFIG_GPU_TEST_CONFIG_H_
#define ANGLE_GPU_CONFIG_GPU_TEST_CONFIG_H_
#include <stdint.h>
#include <string>
#include <vector>
#include "angle_config.h"
namespace gpu {
struct GPUInfo;
class GPU_EXPORT GPUTestConfig {
public:
enum OS {
kOsUnknown = 0,
kOsWinXP = 1 << 0,
kOsWinVista = 1 << 1,
kOsWin7 = 1 << 2,
kOsWin8 = 1 << 3,
kOsMacLeopard = 1 << 4,
kOsMacSnowLeopard = 1 << 5,
kOsMacLion = 1 << 6,
kOsMacMountainLion = 1 << 7,
kOsMacMavericks = 1 << 8,
kOsMacYosemite = 1 << 9,
kOsMacElCapitan = 1 << 10,
kOsMacSierra = 1 << 11,
kOsMacHighSierra = 1 << 12,
kOsMacMojave = 1 << 13,
kOsMac = kOsMacLeopard | kOsMacSnowLeopard | kOsMacLion |
kOsMacMountainLion | kOsMacMavericks | kOsMacYosemite |
kOsMacElCapitan | kOsMacSierra | kOsMacHighSierra | kOsMacMojave,
kOsLinux = 1 << 14,
kOsChromeOS = 1 << 15,
kOsAndroid = 1 << 16,
kOsWin10 = 1 << 17,
kOsWin = kOsWinXP | kOsWinVista | kOsWin7 | kOsWin8 | kOsWin10,
kOsFuchsia = 1 << 18,
};
enum BuildType {
kBuildTypeUnknown = 0,
kBuildTypeRelease = 1 << 0,
kBuildTypeDebug = 1 << 1,
};
enum API {
kAPIUnknown = 0,
kAPID3D9 = 1 << 0,
kAPID3D11 = 1 << 1,
kAPIGLDesktop = 1 << 2,
kAPIGLES = 1 << 3,
kAPIVulkan = 1 << 4,
};
GPUTestConfig();
GPUTestConfig(const GPUTestConfig& other);
virtual ~GPUTestConfig();
void set_os(int32_t os);
void set_gpu_device_id(uint32_t id);
void set_build_type(int32_t build_type);
void set_api(int32_t api);
virtual void AddGPUVendor(uint32_t gpu_vendor);
int32_t os() const { return os_; }
const std::vector<uint32_t>& gpu_vendor() const { return gpu_vendor_; }
uint32_t gpu_device_id() const { return gpu_device_id_; }
int32_t build_type() const { return build_type_; }
int32_t api() const { return api_; }
// Check if the config is valid. For example, if gpu_device_id_ is set, but
// gpu_vendor_ is unknown, then it's invalid.
virtual bool IsValid() const;
// Check if two configs overlap, i.e., if there exists a config that matches
// both configs.
bool OverlapsWith(const GPUTestConfig& config) const;
// Disable validation of GPU vendor and device ids.
void DisableGPUInfoValidation();
protected:
void ClearGPUVendor();
// Indicates that the OS has the notion of a numeric GPU vendor and device id
// and this data should be validated.
bool validate_gpu_info_;
private:
// operating system.
int32_t os_;
// GPU vendor.
std::vector<uint32_t> gpu_vendor_;
// GPU device id (unique to each vendor).
uint32_t gpu_device_id_;
// Release or Debug.
int32_t build_type_;
// Back-end rendering APIs.
int32_t api_;
};
class GPU_EXPORT GPUTestBotConfig : public GPUTestConfig {
public:
GPUTestBotConfig() = default;
~GPUTestBotConfig() override;
// This should only be called when no gpu_vendor is added.
void AddGPUVendor(uint32_t gpu_vendor) override;
// Return false if gpu_info does not have valid vendor_id and device_id.
bool SetGPUInfo(const GPUInfo& gpu_info);
// Check if the bot config is valid, i.e., if it is one valid test-bot
// environment. For example, if a field is unknown, or if OS is not one
// fully defined OS, then it's valid.
bool IsValid() const override;
// Check if a bot config matches a test config, i.e., the test config is a
// superset of the bot config.
bool Matches(const GPUTestConfig& config) const;
bool Matches(const std::string& config_data) const;
// Setup the config with the current gpu testing environment.
// If gpu_info is nullptr, collect GPUInfo first.
bool LoadCurrentConfig(const GPUInfo* gpu_info);
// Check if this bot's config matches |config_data| or any of the |configs|.
static bool CurrentConfigMatches(const std::string& config_data);
static bool CurrentConfigMatches(const std::vector<std::string>& configs);
// Check if the bot has blacklisted all GPU features.
static bool GpuBlacklistedOnBot();
};
} // namespace gpu
#endif // ANGLE_GPU_CONFIG_GPU_TEST_CONFIG_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment