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": "vendor ID", "type": "uint32_t"},
{"name": "name", "type": "char", "annotation": "const*"},
{"name": "driver description", "type": "char", "annotation": "const*"},
{"name": "adapter type", "type": "adapter type"},
{"name": "backend type", "type": "backend type"}
]

View File

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

View File

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

View File

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

View File

@ -22,6 +22,7 @@
#include "dawn_native/d3d12/PlatformFunctions.h"
#include <locale>
#include <sstream>
namespace dawn_native { namespace d3d12 {
@ -89,10 +90,26 @@ namespace dawn_native { namespace d3d12 {
: 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(
"Error converting");
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();
return {};

View File

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

View File

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

View File

@ -45,6 +45,16 @@ namespace dawn_native { namespace vulkan {
"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();
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::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::ShaderFloat16Int8, "VK_KHR_shader_float16_int8", VulkanVersion_1_2},
@ -258,6 +259,7 @@ namespace dawn_native { namespace vulkan {
HasDep(DeviceExt::GetPhysicalDeviceProperties2);
break;
case DeviceExt::DriverProperties:
case DeviceExt::ShaderFloat16Int8:
hasDependencies = HasDep(DeviceExt::GetPhysicalDeviceProperties2);
break;

View File

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

View File

@ -280,6 +280,11 @@ namespace dawn_native { namespace vulkan {
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
// 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 {
VkPhysicalDeviceProperties properties;
VkPhysicalDeviceDriverProperties driverProperties;
VkPhysicalDeviceSubgroupSizeControlPropertiesEXT subgroupSizeControlProperties;
std::vector<VkQueueFamilyProperties> queueFamilies;

View File

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