[Mesa-dev] [PATCH 2/2] radv: Set driver version to mesa version;

Vedran Miletić vedran at miletic.net
Tue Mar 14 23:28:20 UTC 2017


14.03.2017 u 23:08, Bas Nieuwenhuizen je napisao/la:
> I couldn't really find an encoding in the spec. I'm not sure it
> prescribes VK_MAKE_VERSION format, but vulkan.gpuinfo.org interprets
> it that way by default. vulkaninfo gives the raw number, so we could
> alternatively do something like 17001000, but that doesn't show
> up right on vulkan.gpuinfo.org again. Looking at that site, the -pro
> driver also uses VK_MAKE_VERSION, so keeping consistency is probably
> best.
>
> Signed-off-by: Bas Nieuwenhuizen <basni at google.com>
> ---
>  src/amd/vulkan/radv_device.c | 24 +++++++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
> index 09ae4c9faab..d1fd58d77b9 100644
> --- a/src/amd/vulkan/radv_device.c
> +++ b/src/amd/vulkan/radv_device.c
> @@ -477,6 +477,28 @@ void radv_GetPhysicalDeviceFeatures2KHR(
>  	return radv_GetPhysicalDeviceFeatures(physicalDevice, &pFeatures->features);
>  }
>
> +static uint32_t radv_get_driver_version()
> +{
> +	const char *minor_string = strchr(VERSION, '.');
> +	const char *patch_string = minor_string ? strchr(minor_string + 1, ','): NULL;
> +	int major = atoi(VERSION);
> +	int minor = minor_string ? atoi(minor_string + 1) : 0;
> +	int patch = patch_string ? atoi(patch_string + 1) : 0;
> +	if (strstr(VERSION, "devel")) {
> +		if (patch == 0) {
> +			patch = 99;
> +			if (minor == 0) {
> +				minor = 99;
> +				--major;
> +			} else
> +				--minor;
> +		} else
> +			--patch;
> +	}
> +	uint32_t version = VK_MAKE_VERSION(major, minor, patch);
> +	return version;
> +}
> +
>  void radv_GetPhysicalDeviceProperties(
>  	VkPhysicalDevice                            physicalDevice,
>  	VkPhysicalDeviceProperties*                 pProperties)
> @@ -598,7 +620,7 @@ void radv_GetPhysicalDeviceProperties(
>
>  	*pProperties = (VkPhysicalDeviceProperties) {
>  		.apiVersion = VK_MAKE_VERSION(1, 0, 42),
> -		.driverVersion = 1,
> +		.driverVersion = radv_get_driver_version(),
>  		.vendorID = 0x1002,
>  		.deviceID = pdevice->rad_info.pci_id,
>  		.deviceType = VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU,
>

Works with Dota 2, Talos and Doom over Wine. Mesa version appears nicely 
in Doom. This patch and the previous one is

Tested-by: Vedran Miletić <vedran at miletic.net>

-- 
Vedran Miletić
vedran.miletic.net


More information about the mesa-dev mailing list