<div dir="ltr"><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br><br></div>Alex, do you need someone to push these for you?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 6, 2017 at 8:09 AM, Alex Smith <span dir="ltr"><<a href="mailto:asmith@feralinteractive.com" target="_blank">asmith@feralinteractive.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">This means it can be reused for other Vulkan drivers. Also fix up a<br>
typo, need to search for '.' in the version string rather than ','.<br>
<br>
</span>v2: Remove unneeded temporary version variable (Emil, Eric)<br>
<span class=""><br>
Signed-off-by: Alex Smith <<a href="mailto:asmith@feralinteractive.com">asmith@feralinteractive.com</a>><br>
---<br>
</span> src/amd/vulkan/radv_device.c | 24 +---------------------<br>
 src/vulkan/Makefile.sources  |  1 +<br>
 src/vulkan/util/vk_util.c    | 49 ++++++++++++++++++++++++++++++<wbr>++++++++++++++<br>
 src/vulkan/util/vk_util.h    |  2 ++<br>
 4 files changed, 53 insertions(+), 23 deletions(-)<br>
<div><div class="h5"> create mode 100644 src/vulkan/util/vk_util.c<br>
<br>
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c<br>
index a812527..5fdb894 100644<br>
--- a/src/amd/vulkan/radv_device.c<br>
+++ b/src/amd/vulkan/radv_device.c<br>
@@ -574,28 +574,6 @@ void radv_<wbr>GetPhysicalDeviceFeatures2KHR(<br>
        return radv_<wbr>GetPhysicalDeviceFeatures(<wbr>physicalDevice, &pFeatures->features);<br>
 }<br>
<br>
-static uint32_t radv_get_driver_version()<br>
-{<br>
-       const char *minor_string = strchr(VERSION, '.');<br>
-       const char *patch_string = minor_string ? strchr(minor_string + 1, ','): NULL;<br>
-       int major = atoi(VERSION);<br>
-       int minor = minor_string ? atoi(minor_string + 1) : 0;<br>
-       int patch = patch_string ? atoi(patch_string + 1) : 0;<br>
-       if (strstr(VERSION, "devel")) {<br>
-               if (patch == 0) {<br>
-                       patch = 99;<br>
-                       if (minor == 0) {<br>
-                               minor = 99;<br>
-                               --major;<br>
-                       } else<br>
-                               --minor;<br>
-               } else<br>
-                       --patch;<br>
-       }<br>
-       uint32_t version = VK_MAKE_VERSION(major, minor, patch);<br>
-       return version;<br>
-}<br>
-<br>
 void radv_<wbr>GetPhysicalDeviceProperties(<br>
        VkPhysicalDevice                            physicalDevice,<br>
        VkPhysicalDeviceProperties*                 pProperties)<br>
@@ -731,7 +709,7 @@ void radv_<wbr>GetPhysicalDeviceProperties(<br>
<br>
        *pProperties = (VkPhysicalDeviceProperties) {<br>
                .apiVersion = VK_MAKE_VERSION(1, 0, 42),<br>
-               .driverVersion = radv_get_driver_version(),<br>
+               .driverVersion = vk_get_driver_version(),<br>
                .vendorID = 0x1002,<br>
                .deviceID = pdevice->rad_info.pci_id,<br>
                .deviceType = pdevice->rad_info.has_<wbr>dedicated_vram ? VK_PHYSICAL_DEVICE_TYPE_<wbr>DISCRETE_GPU : VK_PHYSICAL_DEVICE_TYPE_<wbr>INTEGRATED_GPU,<br>
diff --git a/src/vulkan/Makefile.sources b/src/vulkan/Makefile.sources<br>
index 9962c1b..2cf7218 100644<br>
--- a/src/vulkan/Makefile.sources<br>
+++ b/src/vulkan/Makefile.sources<br>
@@ -17,6 +17,7 @@ VULKAN_WSI_X11_FILES := \<br>
<br>
 VULKAN_UTIL_FILES := \<br>
        util/vk_alloc.h \<br>
+       util/vk_util.c \<br>
        util/vk_util.h<br>
<br>
 VULKAN_UTIL_GENERATED_FILES := \<br>
diff --git a/src/vulkan/util/vk_util.c b/src/vulkan/util/vk_util.c<br>
new file mode 100644<br>
</div></div>index 0000000..769e690<br>
--- /dev/null<br>
+++ b/src/vulkan/util/vk_util.c<br>
@@ -0,0 +1,49 @@<br>
<div><div class="h5">+/*<br>
+ * Copyright © 2016 Red Hat.<br>
+ * Copyright © 2016 Bas Nieuwenhuizen<br>
+ * Copyright © 2017 Intel Corporation<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
+ * IN THE SOFTWARE.<br>
+ */<br>
+<br>
+#include <stdlib.h><br>
+#include <string.h><br>
+#include "vk_util.h"<br>
+<br>
+uint32_t vk_get_driver_version(void)<br>
+{<br>
+   const char *minor_string = strchr(VERSION, '.');<br>
+   const char *patch_string = minor_string ? strchr(minor_string + 1, '.') : NULL;<br>
+   int major = atoi(VERSION);<br>
+   int minor = minor_string ? atoi(minor_string + 1) : 0;<br>
+   int patch = patch_string ? atoi(patch_string + 1) : 0;<br>
+   if (strstr(VERSION, "devel")) {<br>
+      if (patch == 0) {<br>
+         patch = 99;<br>
+         if (minor == 0) {<br>
+            minor = 99;<br>
+            --major;<br>
+         } else<br>
+            --minor;<br>
+      } else<br>
+         --patch;<br>
+   }<br>
</div></div>+   return VK_MAKE_VERSION(major, minor, patch);<br>
<div class="HOEnZb"><div class="h5">+}<br>
diff --git a/src/vulkan/util/vk_util.h b/src/vulkan/util/vk_util.h<br>
index 5ff1f00..2ed601f 100644<br>
--- a/src/vulkan/util/vk_util.h<br>
+++ b/src/vulkan/util/vk_util.h<br>
@@ -197,4 +197,6 @@ __vk_find_struct(void *start, VkStructureType sType)<br>
 #define vk_find_struct_const(__start, __sType) \<br>
    (const void *)__vk_find_struct((void *)(__start), VK_STRUCTURE_TYPE_##__sType)<br>
<br>
+uint32_t vk_get_driver_version(void);<br>
+<br>
 #endif /* VK_UTIL_H */<br>
--<br>
2.9.4<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br></div>