[Mesa-dev] [PATCH] anv: Set driver version to Mesa version

Alex Smith asmith at feralinteractive.com
Mon Jun 5 14:48:45 UTC 2017


As already done by RADV, this code is lifted straight from there.

Signed-off-by: Alex Smith <asmith at feralinteractive.com>
---
 src/intel/vulkan/anv_device.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index aacd07f..8090eea 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -754,6 +754,28 @@ void anv_GetPhysicalDeviceFeatures2KHR(
    }
 }
 
+static uint32_t anv_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 anv_GetPhysicalDeviceProperties(
     VkPhysicalDevice                            physicalDevice,
     VkPhysicalDeviceProperties*                 pProperties)
@@ -886,7 +908,7 @@ void anv_GetPhysicalDeviceProperties(
 
    *pProperties = (VkPhysicalDeviceProperties) {
       .apiVersion = VK_MAKE_VERSION(1, 0, 42),
-      .driverVersion = 1,
+      .driverVersion = anv_get_driver_version(),
       .vendorID = 0x8086,
       .deviceID = pdevice->chipset_id,
       .deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU,
-- 
2.9.4



More information about the mesa-dev mailing list