dawn.json: Expose the driver version in the adapter.

And use it to print the driver version at the start of
dawn_end2end_tests. This will help when figuring out issues
happening on CQ but not necessarily locally.

Bug: None

Change-Id: Ibdb9ab8cab53cc1e1cf8a807da53edeca616bed9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/29602
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2020-10-14 13:33:15 +00:00 committed by Commit Bot service account
parent cac0442277
commit 73b70229af
13 changed files with 55 additions and 1 deletions

View File

@ -21,6 +21,7 @@
{"name": "device ID", "type": "uint32_t"}, {"name": "device ID", "type": "uint32_t"},
{"name": "vendor ID", "type": "uint32_t"}, {"name": "vendor ID", "type": "uint32_t"},
{"name": "name", "type": "char", "annotation": "const*"}, {"name": "name", "type": "char", "annotation": "const*"},
{"name": "driver description", "type": "char", "annotation": "const*"},
{"name": "adapter type", "type": "adapter type"}, {"name": "adapter type", "type": "adapter type"},
{"name": "backend type", "type": "backend type"} {"name": "backend type", "type": "backend type"}
] ]

View File

@ -30,6 +30,10 @@ namespace dawn_native {
return mAdapterType; return mAdapterType;
} }
const std::string& AdapterBase::GetDriverDescription() const {
return mDriverDescription;
}
const PCIInfo& AdapterBase::GetPCIInfo() const { const PCIInfo& AdapterBase::GetPCIInfo() const {
return mPCIInfo; return mPCIInfo;
} }

View File

@ -34,6 +34,7 @@ namespace dawn_native {
wgpu::BackendType GetBackendType() const; wgpu::BackendType GetBackendType() const;
wgpu::AdapterType GetAdapterType() const; wgpu::AdapterType GetAdapterType() const;
const std::string& GetDriverDescription() const;
const PCIInfo& GetPCIInfo() const; const PCIInfo& GetPCIInfo() const;
InstanceBase* GetInstance() const; InstanceBase* GetInstance() const;
@ -47,6 +48,7 @@ namespace dawn_native {
protected: protected:
PCIInfo mPCIInfo = {}; PCIInfo mPCIInfo = {};
wgpu::AdapterType mAdapterType = wgpu::AdapterType::Unknown; wgpu::AdapterType mAdapterType = wgpu::AdapterType::Unknown;
std::string mDriverDescription;
ExtensionsSet mSupportedExtensions; ExtensionsSet mSupportedExtensions;
private: private:

View File

@ -48,6 +48,7 @@ namespace dawn_native {
void Adapter::GetProperties(wgpu::AdapterProperties* properties) const { void Adapter::GetProperties(wgpu::AdapterProperties* properties) const {
properties->backendType = mImpl->GetBackendType(); properties->backendType = mImpl->GetBackendType();
properties->adapterType = mImpl->GetAdapterType(); properties->adapterType = mImpl->GetAdapterType();
properties->driverDescription = mImpl->GetDriverDescription().c_str();
properties->deviceID = mImpl->GetPCIInfo().deviceId; properties->deviceID = mImpl->GetPCIInfo().deviceId;
properties->vendorID = mImpl->GetPCIInfo().vendorId; properties->vendorID = mImpl->GetPCIInfo().vendorId;
properties->name = mImpl->GetPCIInfo().name.c_str(); properties->name = mImpl->GetPCIInfo().name.c_str();

View File

@ -22,6 +22,7 @@
#include "dawn_native/d3d12/PlatformFunctions.h" #include "dawn_native/d3d12/PlatformFunctions.h"
#include <locale> #include <locale>
#include <sstream>
namespace dawn_native { namespace d3d12 { namespace dawn_native { namespace d3d12 {
@ -89,10 +90,26 @@ namespace dawn_native { namespace d3d12 {
: wgpu::AdapterType::DiscreteGPU; : wgpu::AdapterType::DiscreteGPU;
} }
// Get the adapter's name as a UTF8 string.
std::wstring_convert<DeletableFacet<std::codecvt<wchar_t, char, std::mbstate_t>>> converter( std::wstring_convert<DeletableFacet<std::codecvt<wchar_t, char, std::mbstate_t>>> converter(
"Error converting"); "Error converting");
mPCIInfo.name = converter.to_bytes(adapterDesc.Description); mPCIInfo.name = converter.to_bytes(adapterDesc.Description);
// Convert the adapter's D3D12 driver version to a readable string like "24.21.13.9793".
LARGE_INTEGER umdVersion;
if (mHardwareAdapter->CheckInterfaceSupport(__uuidof(IDXGIDevice), &umdVersion) !=
DXGI_ERROR_UNSUPPORTED) {
uint64_t encodedVersion = umdVersion.QuadPart;
std::ostringstream o;
o << "D3D12 driver version ";
o << ((encodedVersion >> 48) & 0xFFFF) << ".";
o << ((encodedVersion >> 32) & 0xFFFF) << ".";
o << ((encodedVersion >> 16) & 0xFFFF) << ".";
o << (encodedVersion & 0xFFFF);
mDriverDescription = o.str();
}
InitializeSupportedExtensions(); InitializeSupportedExtensions();
return {}; return {};

View File

@ -187,16 +187,22 @@ namespace dawn_native { namespace metal {
#if defined(DAWN_PLATFORM_IOS) #if defined(DAWN_PLATFORM_IOS)
mAdapterType = wgpu::AdapterType::IntegratedGPU; mAdapterType = wgpu::AdapterType::IntegratedGPU;
const char* systemName = "macOS";
#elif defined(DAWN_PLATFORM_MACOS) #elif defined(DAWN_PLATFORM_MACOS)
if ([device isLowPower]) { if ([device isLowPower]) {
mAdapterType = wgpu::AdapterType::IntegratedGPU; mAdapterType = wgpu::AdapterType::IntegratedGPU;
} else { } else {
mAdapterType = wgpu::AdapterType::DiscreteGPU; mAdapterType = wgpu::AdapterType::DiscreteGPU;
} }
const char* systemName = "iOS";
#else #else
# error "Unsupported Apple platform." # error "Unsupported Apple platform."
#endif #endif
NSString* osVersion = [[NSProcessInfo processInfo] operatingSystemVersionString];
mDriverDescription =
"Metal driver on " + std::string(systemName) + [osVersion UTF8String];
InitializeSupportedExtensions(); InitializeSupportedExtensions();
} }

View File

@ -170,6 +170,9 @@ namespace dawn_native { namespace opengl {
const char* vendor = reinterpret_cast<const char*>(mFunctions.GetString(GL_VENDOR)); const char* vendor = reinterpret_cast<const char*>(mFunctions.GetString(GL_VENDOR));
mPCIInfo.vendorId = GetVendorIdFromVendors(vendor); mPCIInfo.vendorId = GetVendorIdFromVendors(vendor);
mDriverDescription = std::string("OpenGL version ") +
reinterpret_cast<const char*>(mFunctions.GetString(GL_VERSION));
InitializeSupportedExtensions(); InitializeSupportedExtensions();
return {}; return {};

View File

@ -45,6 +45,16 @@ namespace dawn_native { namespace vulkan {
"viewport flipY"); "viewport flipY");
} }
if (mDeviceInfo.HasExt(DeviceExt::DriverProperties)) {
mDriverDescription = mDeviceInfo.driverProperties.driverName;
if (mDeviceInfo.driverProperties.driverInfo[0] != '\0') {
mDriverDescription += std::string(": ") + mDeviceInfo.driverProperties.driverInfo;
}
} else {
mDriverDescription =
"Vulkan driver version: " + std::to_string(mDeviceInfo.properties.driverVersion);
}
InitializeSupportedExtensions(); InitializeSupportedExtensions();
mPCIInfo.deviceId = mDeviceInfo.properties.deviceID; mPCIInfo.deviceId = mDeviceInfo.properties.deviceID;

View File

@ -151,6 +151,7 @@ namespace dawn_native { namespace vulkan {
{DeviceExt::_16BitStorage, "VK_KHR_16bit_storage", VulkanVersion_1_1}, {DeviceExt::_16BitStorage, "VK_KHR_16bit_storage", VulkanVersion_1_1},
{DeviceExt::SamplerYCbCrConversion, "VK_KHR_sampler_ycbcr_conversion", VulkanVersion_1_1}, {DeviceExt::SamplerYCbCrConversion, "VK_KHR_sampler_ycbcr_conversion", VulkanVersion_1_1},
{DeviceExt::DriverProperties, "VK_KHR_driver_properties", VulkanVersion_1_2},
{DeviceExt::ImageFormatList, "VK_KHR_image_format_list", VulkanVersion_1_2}, {DeviceExt::ImageFormatList, "VK_KHR_image_format_list", VulkanVersion_1_2},
{DeviceExt::ShaderFloat16Int8, "VK_KHR_shader_float16_int8", VulkanVersion_1_2}, {DeviceExt::ShaderFloat16Int8, "VK_KHR_shader_float16_int8", VulkanVersion_1_2},
@ -258,6 +259,7 @@ namespace dawn_native { namespace vulkan {
HasDep(DeviceExt::GetPhysicalDeviceProperties2); HasDep(DeviceExt::GetPhysicalDeviceProperties2);
break; break;
case DeviceExt::DriverProperties:
case DeviceExt::ShaderFloat16Int8: case DeviceExt::ShaderFloat16Int8:
hasDependencies = HasDep(DeviceExt::GetPhysicalDeviceProperties2); hasDependencies = HasDep(DeviceExt::GetPhysicalDeviceProperties2);
break; break;

View File

@ -87,6 +87,7 @@ namespace dawn_native { namespace vulkan {
SamplerYCbCrConversion, SamplerYCbCrConversion,
// Promoted to 1.2 // Promoted to 1.2
DriverProperties,
ImageFormatList, ImageFormatList,
ShaderFloat16Int8, ShaderFloat16Int8,

View File

@ -280,6 +280,11 @@ namespace dawn_native { namespace vulkan {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES_EXT); VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES_EXT);
} }
if (info.extensions.Has(DeviceExt::DriverProperties)) {
propertiesChain.Add(&info.driverProperties,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES);
}
// If we have DeviceExt::GetPhysicalDeviceProperties2, use features2 and properties2 so // If we have DeviceExt::GetPhysicalDeviceProperties2, use features2 and properties2 so
// that features no covered by VkPhysicalDevice{Features,Properties} can be queried. // that features no covered by VkPhysicalDevice{Features,Properties} can be queried.
// //

View File

@ -62,6 +62,7 @@ namespace dawn_native { namespace vulkan {
struct VulkanDeviceInfo : VulkanDeviceKnobs { struct VulkanDeviceInfo : VulkanDeviceKnobs {
VkPhysicalDeviceProperties properties; VkPhysicalDeviceProperties properties;
VkPhysicalDeviceDriverProperties driverProperties;
VkPhysicalDeviceSubgroupSizeControlPropertiesEXT subgroupSizeControlProperties; VkPhysicalDeviceSubgroupSizeControlPropertiesEXT subgroupSizeControlProperties;
std::vector<VkQueueFamilyProperties> queueFamilies; std::vector<VkQueueFamilyProperties> queueFamilies;

View File

@ -434,7 +434,8 @@ void DawnTestEnvironment::PrintTestConfigurationAndAdapterInfo() const {
// Preparing for outputting hex numbers // Preparing for outputting hex numbers
log << std::showbase << std::hex << std::setfill('0') << std::setw(4) log << std::showbase << std::hex << std::setfill('0') << std::setw(4)
<< " - \"" << properties.adapterName << "\"\n" << " - \"" << properties.adapterName << "\" - \"" << properties.driverDescription
<< "\"\n"
<< " type: " << AdapterTypeName(properties.adapterType) << " type: " << AdapterTypeName(properties.adapterType)
<< ", backend: " << ParamName(properties.backendType) << "\n" << ", backend: " << ParamName(properties.backendType) << "\n"
<< " vendorId: 0x" << vendorId.str() << ", deviceId: 0x" << deviceId.str() << " vendorId: 0x" << vendorId.str() << ", deviceId: 0x" << deviceId.str()