Commit e98e16ea by Corentin Wallez Committed by Commit Bot

Update gpu_test_expectations and use angle_gpu_info_util

This is to have the new "OS" for MacOS Sierra. Several types were introduced in angle_config.h to minimize the angle-mods.patch to make it easier to update in the future. BUG=angleproject:2137 Change-Id: I7a98c5cb48d424f83eb39763eba0e51852a9b98f Reviewed-on: https://chromium-review.googlesource.com/636202 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 218ffc49
......@@ -319,10 +319,8 @@ if (build_angle_deqp_tests) {
sources = deqp_gypi.deqp_gpu_test_expectations_sources
sources += [ "//gpu/angle_deqp_tests_main.cc" ]
# Taken from gpu/BUILD.gn
# TODO(jmadill): this should be in a shared location
if (is_linux && !is_chromecast) {
libs = [ "pci" ]
if (!is_android) {
public_deps += ["//third_party/angle:angle_gpu_info_util"]
}
}
......
......@@ -1806,7 +1806,16 @@
'angle_test_support',
'<(angle_path)/util/util.gyp:angle_util',
],
'conditions':
[
['OS!="android"',
{
'dependencies':
[
'<(angle_path)/src/angle.gyp:angle_gpu_info_util',
],
}],
],
'direct_dependent_settings':
{
'include_dirs':
......@@ -1836,35 +1845,15 @@
],
},
},
'conditions':
[
# NOTE(smcgruer): Guarding with use_libpci allows gyp to run successfully
# on systems without libpci, but the test targets will not compile or link.
['OS=="linux" and use_libpci==1',
{
'ldflags':
[
'<!@(<(pkg-config) --libs-only-L --libs-only-other libpci)',
],
'libraries':
[
'<!@(<(pkg-config) --libs-only-l libpci)',
],
}],
['OS=="mac"',
{
'sources':
[
'third_party/gpu_test_expectations/gpu_test_config_mac.h',
'third_party/gpu_test_expectations/gpu_test_config_mac.mm',
],
'link_settings':
{
'libraries':
[
'$(SDKROOT)/System/Library/Frameworks/IOKit.framework',
],
},
}],
],
},
......
......@@ -7,8 +7,8 @@
// Helpers for importing the gpu test expectations package from Chrome.
//
#ifndef GPU_TEST_EXPECTATIONS_ANGLE_CONFIG_H_
#define GPU_TEST_EXPECTATIONS_ANGLE_CONFIG_H_
#ifndef ANGLE_GPU_TEST_EXPECTATIONS_ANGLE_CONFIG_H_
#define ANGLE_GPU_TEST_EXPECTATIONS_ANGLE_CONFIG_H_
#include <stdint.h>
......@@ -20,16 +20,12 @@
#define DCHECK_EQ(A,B) ASSERT((A) == (B))
#define DCHECK_NE(A,B) ASSERT((A) != (B))
#define DCHECK(X) ASSERT(X)
#define DLOG(X) std::cerr
#define LOG(X) std::cerr
#define GPU_EXPORT
typedef int32_t int32;
typedef uint32_t uint32;
typedef int64_t int64;
typedef uint64_t uint64;
// Shim Chromium's base by importing functions in the base namespace.
// Shim Chromium's types by importing symbols in the correct namespaces
namespace base
{
using angle::kWhitespaceASCII;
......@@ -41,7 +37,23 @@ namespace base
using angle::SplitStringAlongWhitespace;
using angle::HexStringToUInt;
using angle::ReadFileToString;
}
using TimeDelta = int;
} // namespace base
namespace gfx
{
class Size
{
public:
int width() const { return 0; }
int height() const { return 0; }
};
} // namespace gfx
struct DxDiagNode
{
};
// TODO(jmadill): other platforms
// clang-format off
......
......@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stdint.h>
#include "gpu_info.h"
namespace {
......@@ -17,10 +19,44 @@ void EnumerateGPUDevice(const gpu::GPUInfo::GPUDevice& device,
enumerator->EndGPUDevice();
}
void EnumerateVideoDecodeAcceleratorSupportedProfile(
const gpu::VideoDecodeAcceleratorSupportedProfile& profile,
gpu::GPUInfo::Enumerator* enumerator) {
enumerator->BeginVideoDecodeAcceleratorSupportedProfile();
enumerator->AddInt("profile", profile.profile);
enumerator->AddInt("maxResolutionWidth", profile.max_resolution.width());
enumerator->AddInt("maxResolutionHeight", profile.max_resolution.height());
enumerator->AddInt("minResolutionWidth", profile.min_resolution.width());
enumerator->AddInt("minResolutionHeight", profile.min_resolution.height());
enumerator->AddBool("encrypted_only", profile.encrypted_only);
enumerator->EndVideoDecodeAcceleratorSupportedProfile();
}
void EnumerateVideoEncodeAcceleratorSupportedProfile(
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->EndVideoEncodeAcceleratorSupportedProfile();
}
} // namespace
namespace gpu {
VideoDecodeAcceleratorCapabilities::VideoDecodeAcceleratorCapabilities()
: flags(0) {}
VideoDecodeAcceleratorCapabilities::VideoDecodeAcceleratorCapabilities(
const VideoDecodeAcceleratorCapabilities& other) = default;
VideoDecodeAcceleratorCapabilities::~VideoDecodeAcceleratorCapabilities() {}
GPUInfo::GPUDevice::GPUDevice()
: vendor_id(0),
device_id(0),
......@@ -32,30 +68,49 @@ GPUInfo::GPUDevice::~GPUDevice() { }
GPUInfo::GPUInfo()
: optimus(false),
amd_switchable(false),
lenovo_dcute(false),
adapter_luid(0),
gl_reset_notification_strategy(0),
can_lose_context(false),
software_rendering(false),
direct_rendering(true),
sandboxed(false),
process_crash_count(0),
in_process_gpu(true),
passthrough_cmd_decoder(false),
basic_info_state(kCollectInfoNone),
context_info_state(kCollectInfoNone),
jpeg_decode_accelerator_supported(false) {
#if defined(OS_WIN)
dx_diagnostics_info_state(kCollectInfoNone),
#endif
jpeg_decode_accelerator_supported(false)
#if defined(USE_X11)
,
system_visual(0),
rgba_visual(0)
#endif
{
}
GPUInfo::GPUInfo(const GPUInfo& other) = default;
GPUInfo::~GPUInfo() { }
const GPUInfo::GPUDevice& GPUInfo::active_gpu() const {
if (gpu.active)
return gpu;
for (const GPUDevice& secondary_gpu : secondary_gpus) {
if (secondary_gpu.active)
return secondary_gpu;
}
DLOG(ERROR) << "No active GPU found, returning primary GPU.\n";
return gpu;
}
void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
struct GPUInfoKnownFields {
base::TimeDelta initialization_time;
bool optimus;
bool amd_switchable;
bool lenovo_dcute;
GPUDevice gpu;
std::vector<GPUDevice> secondary_gpus;
uint64 adapter_luid;
std::string driver_vendor;
std::string driver_version;
std::string driver_date;
......@@ -71,16 +126,30 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
std::string gl_ws_vendor;
std::string gl_ws_version;
std::string gl_ws_extensions;
uint32 gl_reset_notification_strategy;
bool can_lose_context;
uint32_t gl_reset_notification_strategy;
bool software_rendering;
bool direct_rendering;
bool sandboxed;
int process_crash_count;
bool in_process_gpu;
bool passthrough_cmd_decoder;
bool supports_overlays;
bool hdr;
bool can_support_threaded_texture_mailbox;
CollectInfoResult basic_info_state;
CollectInfoResult context_info_state;
#if defined(OS_WIN)
CollectInfoResult dx_diagnostics_info_state;
DxDiagNode dx_diagnostics;
#endif
VideoDecodeAcceleratorCapabilities video_decode_accelerator_capabilities;
VideoEncodeAcceleratorSupportedProfiles
video_encode_accelerator_supported_profiles;
bool jpeg_decode_accelerator_supported;
#if defined(USE_X11)
VisualID system_visual;
VisualID rgba_visual;
#endif
};
// If this assert fails then most likely something below needs to be updated.
......@@ -98,10 +167,10 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
EnumerateGPUDevice(secondary_gpu, enumerator);
enumerator->BeginAuxAttributes();
enumerator->AddTimeDeltaInSecondsF("initializationTime",
initialization_time);
enumerator->AddBool("optimus", optimus);
enumerator->AddBool("amdSwitchable", amd_switchable);
enumerator->AddBool("lenovoDcute", lenovo_dcute);
enumerator->AddInt64("adapterLuid", adapter_luid);
enumerator->AddString("driverVendor", driver_vendor);
enumerator->AddString("driverVersion", driver_version);
enumerator->AddString("driverDate", driver_date);
......@@ -118,18 +187,36 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
enumerator->AddInt(
"glResetNotificationStrategy",
static_cast<int>(gl_reset_notification_strategy));
enumerator->AddBool("can_lose_context", can_lose_context);
// TODO(kbr): add performance_stats.
enumerator->AddBool("softwareRendering", software_rendering);
enumerator->AddBool("directRendering", direct_rendering);
enumerator->AddBool("sandboxed", sandboxed);
enumerator->AddInt("processCrashCount", process_crash_count);
enumerator->AddBool("inProcessGpu", in_process_gpu);
enumerator->AddBool("passthroughCmdDecoder", passthrough_cmd_decoder);
enumerator->AddBool("supportsOverlays", supports_overlays);
enumerator->AddBool("hdr", hdr);
enumerator->AddBool("canSupportThreadedTextureMailbox",
can_support_threaded_texture_mailbox);
enumerator->AddInt("basicInfoState", basic_info_state);
enumerator->AddInt("contextInfoState", context_info_state);
#if defined(OS_WIN)
enumerator->AddInt("DxDiagnosticsInfoState", dx_diagnostics_info_state);
#endif
// TODO(kbr): add dx_diagnostics on Windows.
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)
EnumerateVideoEncodeAcceleratorSupportedProfile(profile, enumerator);
enumerator->AddBool("jpegDecodeAcceleratorSupported",
jpeg_decode_accelerator_supported);
#if defined(USE_X11)
enumerator->AddInt64("systemVisual", system_visual);
enumerator->AddInt64("rgbaVisual", rgba_visual);
#endif
enumerator->EndAuxAttributes();
}
......
......@@ -2,17 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef GPU_CONFIG_GPU_INFO_H_
#define GPU_CONFIG_GPU_INFO_H_
#ifndef ANGLE_GPU_CONFIG_GPU_INFO_H_
#define ANGLE_GPU_CONFIG_GPU_INFO_H_
// Provides access to the GPU information for the system
// on which chrome is currently running.
#include <stdint.h>
#include <string>
#include <vector>
#include "angle_config.h"
#if defined(USE_X11)
typedef unsigned long VisualID;
#endif
namespace gpu {
// Result for the various Collect*Info* functions below.
......@@ -33,32 +39,72 @@ enum VideoCodecProfile {
VIDEO_CODEC_PROFILE_UNKNOWN = -1,
VIDEO_CODEC_PROFILE_MIN = VIDEO_CODEC_PROFILE_UNKNOWN,
H264PROFILE_BASELINE = 0,
H264PROFILE_MAIN = 1,
H264PROFILE_EXTENDED = 2,
H264PROFILE_HIGH = 3,
H264PROFILE_HIGH10PROFILE = 4,
H264PROFILE_HIGH422PROFILE = 5,
H264PROFILE_HIGH444PREDICTIVEPROFILE = 6,
H264PROFILE_SCALABLEBASELINE = 7,
H264PROFILE_SCALABLEHIGH = 8,
H264PROFILE_STEREOHIGH = 9,
H264PROFILE_MULTIVIEWHIGH = 10,
VP8PROFILE_ANY = 11,
VP9PROFILE_ANY = 12,
VIDEO_CODEC_PROFILE_MAX = VP9PROFILE_ANY,
H264PROFILE_MAIN,
H264PROFILE_EXTENDED,
H264PROFILE_HIGH,
H264PROFILE_HIGH10PROFILE,
H264PROFILE_HIGH422PROFILE,
H264PROFILE_HIGH444PREDICTIVEPROFILE,
H264PROFILE_SCALABLEBASELINE,
H264PROFILE_SCALABLEHIGH,
H264PROFILE_STEREOHIGH,
H264PROFILE_MULTIVIEWHIGH,
VP8PROFILE_ANY,
VP9PROFILE_PROFILE0,
VP9PROFILE_PROFILE1,
VP9PROFILE_PROFILE2,
VP9PROFILE_PROFILE3,
HEVCPROFILE_MAIN,
HEVCPROFILE_MAIN10,
HEVCPROFILE_MAIN_STILL_PICTURE,
DOLBYVISION_PROFILE0,
DOLBYVISION_PROFILE4,
DOLBYVISION_PROFILE5,
DOLBYVISION_PROFILE7,
VIDEO_CODEC_PROFILE_MAX = DOLBYVISION_PROFILE7,
};
// Specification of a decoding profile supported by a hardware decoder.
struct GPU_EXPORT VideoDecodeAcceleratorSupportedProfile {
VideoCodecProfile profile;
gfx::Size max_resolution;
gfx::Size min_resolution;
bool encrypted_only;
};
using VideoDecodeAcceleratorSupportedProfiles =
std::vector<VideoDecodeAcceleratorSupportedProfile>;
struct GPU_EXPORT VideoDecodeAcceleratorCapabilities {
VideoDecodeAcceleratorCapabilities();
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 {
VideoCodecProfile profile;
gfx::Size max_resolution;
uint32_t max_framerate_numerator;
uint32_t max_framerate_denominator;
};
using VideoEncodeAcceleratorSupportedProfiles =
std::vector<VideoEncodeAcceleratorSupportedProfile>;
struct GPU_EXPORT GPUInfo {
struct GPU_EXPORT GPUDevice {
GPUDevice();
~GPUDevice();
// The DWORD (uint32) representing the graphics card vendor id.
uint32 vendor_id;
// The DWORD (uint32_t) representing the graphics card vendor id.
uint32_t vendor_id;
// The DWORD (uint32) representing the graphics card device id.
// The DWORD (uint32_t) representing the graphics card device id.
// Device ids are unique to vendor, not to one another.
uint32 device_id;
uint32_t device_id;
// Whether this GPU is the currently used one.
// Currently this field is only supported and meaningful on OS X.
......@@ -73,11 +119,12 @@ struct GPU_EXPORT GPUInfo {
};
GPUInfo();
GPUInfo(const GPUInfo& other);
~GPUInfo();
bool SupportsAccelerated2dCanvas() const {
return !can_lose_context && !software_rendering;
}
// The amount of time taken to get from the process starting to the message
// loop being pumped.
base::TimeDelta initialization_time;
// Computer has NVIDIA Optimus
bool optimus;
......@@ -85,21 +132,14 @@ struct GPU_EXPORT GPUInfo {
// Computer has AMD Dynamic Switchable Graphics
bool amd_switchable;
// Lenovo dCute is installed. http://crbug.com/181665.
bool lenovo_dcute;
// Primary GPU, for exmaple, the discrete GPU in a dual GPU machine.
GPUDevice gpu;
// Secondary GPUs, for example, the integrated GPU in a dual GPU machine.
std::vector<GPUDevice> secondary_gpus;
// On Windows, the unique identifier of the adapter the GPU process uses.
// The default is zero, which makes the browser process create its D3D device
// on the primary adapter. Note that the primary adapter can change at any
// time so it is better to specify a particular LUID. Note that valid LUIDs
// are always non-zero.
uint64 adapter_luid;
// The currently active gpu.
const GPUDevice& active_gpu() const;
// The vendor of the graphics driver currently installed.
std::string driver_vendor;
......@@ -155,11 +195,7 @@ struct GPU_EXPORT GPUInfo {
// GL reset notification strategy as defined by GL_ARB_robustness. 0 if GPU
// reset detection or notification not available.
uint32 gl_reset_notification_strategy;
// The device semantics, i.e. whether the Vista and Windows 7 specific
// semantics are available.
bool can_lose_context;
uint32_t gl_reset_notification_strategy;
bool software_rendering;
......@@ -176,13 +212,41 @@ struct GPU_EXPORT GPUInfo {
// True if the GPU is running in the browser process instead of its own.
bool in_process_gpu;
// True if the GPU process is using the passthrough command decoder.
bool passthrough_cmd_decoder;
// True if the current set of outputs supports overlays.
bool supports_overlays = false;
// True if the current set of outputs supports HDR.
bool hdr = false;
// True only on android when extensions for threaded mailbox sharing are
// present. Threaded mailbox sharing is used on Android only, so this check
// is only implemented on Android.
bool can_support_threaded_texture_mailbox = false;
// The state of whether the basic/context/DxDiagnostics info is collected and
// if the collection fails or not.
CollectInfoResult basic_info_state;
CollectInfoResult context_info_state;
#if defined(OS_WIN)
CollectInfoResult dx_diagnostics_info_state;
// The information returned by the DirectX Diagnostics Tool.
DxDiagNode dx_diagnostics;
#endif
VideoDecodeAcceleratorCapabilities video_decode_accelerator_capabilities;
VideoEncodeAcceleratorSupportedProfiles
video_encode_accelerator_supported_profiles;
bool jpeg_decode_accelerator_supported;
#if defined(USE_X11)
VisualID system_visual;
VisualID rgba_visual;
#endif
// Note: when adding new members, please remember to update EnumerateFields
// in gpu_info.cc.
......@@ -196,10 +260,12 @@ struct GPU_EXPORT GPUInfo {
// 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 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;
......@@ -230,4 +296,4 @@ struct GPU_EXPORT GPUInfo {
} // namespace gpu
#endif // GPU_CONFIG_GPU_INFO_H_
#endif // ANGLE_GPU_CONFIG_GPU_INFO_H_
......@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef GPU_CONFIG_GPU_TEST_CONFIG_H_
#define GPU_CONFIG_GPU_TEST_CONFIG_H_
#ifndef ANGLE_GPU_CONFIG_GPU_TEST_CONFIG_H_
#define ANGLE_GPU_CONFIG_GPU_TEST_CONFIG_H_
#include <stdint.h>
#include <string>
#include <vector>
......@@ -29,13 +31,14 @@ class GPU_EXPORT GPUTestConfig {
kOsMacMavericks = 1 << 8,
kOsMacYosemite = 1 << 9,
kOsMacElCapitan = 1 << 10,
kOsMacSierra = 1 << 11,
kOsMac = kOsMacLeopard | kOsMacSnowLeopard | kOsMacLion |
kOsMacMountainLion | kOsMacMavericks | kOsMacYosemite |
kOsMacElCapitan,
kOsLinux = 1 << 11,
kOsChromeOS = 1 << 12,
kOsAndroid = 1 << 13,
kOsWin10 = 1 << 14,
kOsMacElCapitan | kOsMacSierra,
kOsLinux = 1 << 12,
kOsChromeOS = 1 << 13,
kOsAndroid = 1 << 14,
kOsWin10 = 1 << 15,
kOsWin = kOsWinXP | kOsWinVista | kOsWin7 | kOsWin8 | kOsWin10,
};
......@@ -54,20 +57,21 @@ class GPU_EXPORT GPUTestConfig {
};
GPUTestConfig();
GPUTestConfig(const GPUTestConfig& other);
virtual ~GPUTestConfig();
void set_os(int32 os);
void set_gpu_device_id(uint32 id);
void set_build_type(int32 build_type);
void set_api(int32 api);
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 gpu_vendor);
virtual void AddGPUVendor(uint32_t gpu_vendor);
int32 os() const { return os_; }
const std::vector<uint32>& gpu_vendor() const { return gpu_vendor_; }
uint32 gpu_device_id() const { return gpu_device_id_; }
int32 build_type() const { return build_type_; }
int32 api() const { return api_; }
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.
......@@ -89,19 +93,19 @@ class GPU_EXPORT GPUTestConfig {
private:
// operating system.
int32 os_;
int32_t os_;
// GPU vendor.
std::vector<uint32> gpu_vendor_;
std::vector<uint32_t> gpu_vendor_;
// GPU device id (unique to each vendor).
uint32 gpu_device_id_;
uint32_t gpu_device_id_;
// Release or Debug.
int32 build_type_;
int32_t build_type_;
// Back-end rendering APIs.
int32 api_;
int32_t api_;
};
class GPU_EXPORT GPUTestBotConfig : public GPUTestConfig {
......@@ -110,7 +114,7 @@ class GPU_EXPORT GPUTestBotConfig : public GPUTestConfig {
~GPUTestBotConfig() override;
// This should only be called when no gpu_vendor is added.
void AddGPUVendor(uint32 gpu_vendor) override;
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);
......@@ -132,9 +136,12 @@ class GPU_EXPORT GPUTestBotConfig : public GPUTestConfig {
// 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 // GPU_CONFIG_GPU_TEST_CONFIG_H_
#endif // ANGLE_GPU_CONFIG_GPU_TEST_CONFIG_H_
......@@ -7,8 +7,8 @@
// Helper functions for gpu_test_config that have to be compiled in ObjectiveC++
//
#ifndef GPU_TEST_EXPECTATIONS_GPU_TEST_CONFIG_MAC_H_
#define GPU_TEST_EXPECTATIONS_GPU_TEST_CONFIG_MAC_H_
#ifndef ANGLE_GPU_TEST_EXPECTATIONS_GPU_TEST_CONFIG_MAC_H_
#define ANGLE_GPU_TEST_EXPECTATIONS_GPU_TEST_CONFIG_MAC_H_
#include "gpu_info.h"
......@@ -17,12 +17,11 @@ namespace base {
class SysInfo
{
public:
static void OperatingSystemVersionNumbers(
int32 *major_version, int32 *minor_version, int32 *bugfix_version);
static void OperatingSystemVersionNumbers(int32_t *major_version,
int32_t *minor_version,
int32_t *bugfix_version);
};
} // namespace base
gpu::GPUInfo::GPUDevice GetActiveGPU();
#endif // GPU_TEST_EXPECTATIONS_GPU_TEST_CONFIG_MAC_H_
#endif // ANGLE_GPU_TEST_EXPECTATIONS_GPU_TEST_CONFIG_MAC_H_
......@@ -19,8 +19,9 @@ namespace base {
@end
#endif
void SysInfo::OperatingSystemVersionNumbers(
int32 *major_version, int32 *minor_version, int32 *bugfix_version)
void SysInfo::OperatingSystemVersionNumbers(int32_t *major_version,
int32_t *minor_version,
int32_t *bugfix_version)
{
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8
Gestalt(gestaltSystemVersionMajor, reinterpret_cast<SInt32*>(major_version));
......@@ -35,41 +36,3 @@ void SysInfo::OperatingSystemVersionNumbers(
}
} // namespace base
UInt32 GetEntryProperty(io_registry_entry_t entry, CFStringRef property_name) {
CFTypeRef type = IORegistryEntrySearchCFProperty(entry,
kIOServicePlane,
property_name,
kCFAllocatorDefault,
kIORegistryIterateRecursively | kIORegistryIterateParents);
CFDataRef data = reinterpret_cast<CFDataRef>(type);
if (!data) {
CFRelease(data);
return 0;
}
UInt32 value = 0;
const uint32_t* valuePointer = reinterpret_cast<const uint32_t*>(CFDataGetBytePtr(data));
if (valuePointer != NULL) {
value = *valuePointer;
}
CFRelease(data);
return value;
}
gpu::GPUInfo::GPUDevice GetActiveGPU() {
gpu::GPUInfo::GPUDevice gpu;
// Ignore the fact that CGDisplayIOServicePort is deprecated as Apple
// did not provide a good replacement for it as of 10.10.
// TODO(cwallez) revisit with later systems
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
io_registry_entry_t dsp_port = CGDisplayIOServicePort(kCGDirectMainDisplay);
#pragma clang diagnostic pop
gpu.vendor_id = GetEntryProperty(dsp_port, CFSTR("vendor-id"));
gpu.device_id = GetEntryProperty(dsp_port, CFSTR("device-id"));
return gpu;
}
......@@ -4,8 +4,10 @@
#include "gpu_test_expectations_parser.h"
#include <sstream>
#include <stddef.h>
#include <stdint.h>
#include "angle_config.h"
#include "common/angleutils.h"
namespace base {
......@@ -71,6 +73,7 @@ enum Token {
kConfigMacMavericks,
kConfigMacYosemite,
kConfigMacElCapitan,
kConfigMacSierra,
kConfigMac,
kConfigLinux,
kConfigChromeOS,
......@@ -108,7 +111,7 @@ enum Token {
struct TokenInfo {
const char* name;
int32 flag;
int32_t flag;
};
const TokenInfo kTokenData[] = {
......@@ -125,6 +128,7 @@ const TokenInfo kTokenData[] = {
{"mavericks", GPUTestConfig::kOsMacMavericks},
{"yosemite", GPUTestConfig::kOsMacYosemite},
{"elcapitan", GPUTestConfig::kOsMacElCapitan},
{"sierra", GPUTestConfig::kOsMacSierra},
{"mac", GPUTestConfig::kOsMac},
{"linux", GPUTestConfig::kOsLinux},
{"chromeos", GPUTestConfig::kOsChromeOS},
......@@ -182,7 +186,7 @@ Token ParseToken(const std::string& word) {
if (base::StartsWithASCII(word, "0x", false))
return kConfigGPUDeviceID;
for (int32 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);
}
......@@ -207,10 +211,10 @@ bool NamesMatching(const std::string& ref, const std::string& test_name) {
GPUTestExpectationsParser::GPUTestExpectationsParser() {
// Some sanity check.
static_assert(static_cast<unsigned int>(kNumberOfExactMatchTokens) ==
sizeof(kTokenData) / sizeof(kTokenData[0]), "sanity check");
static_assert(static_cast<unsigned int>(kNumberOfErrors) ==
sizeof(kErrorMessage) / sizeof(kErrorMessage[0]), "sanity check");
DCHECK_EQ(static_cast<unsigned int>(kNumberOfExactMatchTokens),
sizeof(kTokenData) / sizeof(kTokenData[0]));
DCHECK_EQ(static_cast<unsigned int>(kNumberOfErrors),
sizeof(kErrorMessage) / sizeof(kErrorMessage[0]));
}
GPUTestExpectationsParser::~GPUTestExpectationsParser() {
......@@ -248,7 +252,7 @@ bool GPUTestExpectationsParser::LoadTestExpectationsFromFile(
return LoadTestExpectations(data);
}
int32 GPUTestExpectationsParser::GetTestExpectation(
int32_t GPUTestExpectationsParser::GetTestExpectation(
const std::string& test_name,
const GPUTestBotConfig& bot_config) const {
for (size_t i = 0; i < entries_.size(); ++i) {
......@@ -287,6 +291,7 @@ bool GPUTestExpectationsParser::ParseConfig(
case kConfigMacMavericks:
case kConfigMacYosemite:
case kConfigMacElCapitan:
case kConfigMacSierra:
case kConfigMac:
case kConfigLinux:
case kConfigChromeOS:
......@@ -322,7 +327,7 @@ bool GPUTestExpectationsParser::ParseLine(
std::vector<std::string> tokens = base::SplitString(
line_data, base::kWhitespaceASCII, base::KEEP_WHITESPACE,
base::SPLIT_WANT_NONEMPTY);
int32 stage = kLineParserBegin;
int32_t stage = kLineParserBegin;
GPUTestExpectationEntry entry;
entry.line_number = line_number;
GPUTestConfig& config = entry.test_config;
......@@ -346,6 +351,7 @@ bool GPUTestExpectationsParser::ParseLine(
case kConfigMacMavericks:
case kConfigMacYosemite:
case kConfigMacElCapitan:
case kConfigMacSierra:
case kConfigMac:
case kConfigLinux:
case kConfigChromeOS:
......@@ -430,7 +436,7 @@ bool GPUTestExpectationsParser::ParseLine(
stage++;
break;
default:
UNREACHABLE();
DCHECK(false);
break;
}
}
......@@ -450,8 +456,9 @@ bool GPUTestExpectationsParser::ParseLine(
return false;
}
bool GPUTestExpectationsParser::UpdateTestConfig(
GPUTestConfig* config, int32 token, size_t line_number) {
bool GPUTestExpectationsParser::UpdateTestConfig(GPUTestConfig* config,
int32_t token,
size_t line_number) {
DCHECK(config);
switch (token) {
case kConfigWinXP:
......@@ -467,6 +474,7 @@ bool GPUTestExpectationsParser::UpdateTestConfig(
case kConfigMacMavericks:
case kConfigMacYosemite:
case kConfigMacElCapitan:
case kConfigMacSierra:
case kConfigMac:
case kConfigLinux:
case kConfigChromeOS:
......@@ -483,8 +491,7 @@ bool GPUTestExpectationsParser::UpdateTestConfig(
case kConfigIntel:
case kConfigVMWare:
{
uint32 gpu_vendor =
static_cast<uint32>(kTokenData[token].flag);
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(
......@@ -519,7 +526,7 @@ bool GPUTestExpectationsParser::UpdateTestConfig(
config->set_api(config->api() | kTokenData[token].flag);
break;
default:
UNREACHABLE();
DCHECK(false);
break;
}
return true;
......@@ -530,7 +537,7 @@ bool GPUTestExpectationsParser::UpdateTestConfig(
const std::string& gpu_device_id,
size_t line_number) {
DCHECK(config);
uint32 device_id = 0;
uint32_t device_id = 0;
if (config->gpu_device_id() != 0 ||
!base::HexStringToUInt(gpu_device_id, &device_id) ||
device_id == 0) {
......@@ -560,18 +567,17 @@ bool GPUTestExpectationsParser::DetectConflictsBetweenEntries() {
void GPUTestExpectationsParser::PushErrorMessage(
const std::string& message, size_t line_number) {
std::ostringstream stream;
stream << "Line " << line_number << " : " << message;
error_messages_.push_back(stream.str());
error_messages_.push_back("Line " + ToString(line_number) +
" : " + message.c_str());
}
void GPUTestExpectationsParser::PushErrorMessage(
const std::string& message,
size_t entry1_line_number,
size_t entry2_line_number) {
std::ostringstream stream;
stream << "Line " << entry1_line_number << " and " << entry2_line_number << " : " << message;
error_messages_.push_back(stream.str());
error_messages_.push_back("Line " + ToString(entry1_line_number) +
" and " + ToString(entry2_line_number) +
" : " + message.c_str());
}
GPUTestExpectationsParser:: GPUTestExpectationEntry::GPUTestExpectationEntry()
......
......@@ -2,8 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef GPU_CONFIG_GPU_TEST_EXPECTATIONS_PARSER_H_
#define GPU_CONFIG_GPU_TEST_EXPECTATIONS_PARSER_H_
#ifndef ANGLE_GPU_CONFIG_GPU_TEST_EXPECTATIONS_PARSER_H_
#define ANGLE_GPU_CONFIG_GPU_TEST_EXPECTATIONS_PARSER_H_
#include <stddef.h>
#include <stdint.h>
#include <string>
#include <vector>
......@@ -36,8 +39,8 @@ class GPU_EXPORT GPUTestExpectationsParser {
const std::vector<std::string>& GetErrorMessages() const;
// Get the test expectation of a given test on a given bot.
int32 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.
......@@ -49,7 +52,7 @@ class GPU_EXPORT GPUTestExpectationsParser {
std::string test_name;
GPUTestConfig test_config;
int32 test_expectation;
int32_t test_expectation;
size_t line_number;
};
......@@ -58,8 +61,9 @@ class GPU_EXPORT GPUTestExpectationsParser {
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 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,
......@@ -82,5 +86,5 @@ class GPU_EXPORT GPUTestExpectationsParser {
} // namespace gpu
#endif // GPU_CONFIG_GPU_TEST_EXPECTATIONS_PARSER_H_
#endif // ANGLE_GPU_CONFIG_GPU_TEST_EXPECTATIONS_PARSER_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