[Mesa-dev] [PATCH 1/2] anv: bail out if using loader interface prior to v3

Emil Velikov emil.l.velikov at gmail.com
Tue Jan 24 14:16:19 UTC 2017


From: Emil Velikov <emil.velikov at collabora.com>

Strictly speaking we could add support for v2 and earlier. At the same
time, those tend to be buggy and as such there's limited testing done.

Cc: Jason Ekstrand <jason at jlekstrand.net>
Cc: Shawn Starr <shawn.starr at rogers.com>
Cc: Chad Versace <chadversary at chromium.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99446
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
Slightly pedantic, yet explicitly mentioned in the spec as a way to
detect/manage older loader versions. Would have saved us a crash, so I'm
wondering if we want it for stable ?

Shawn considering you still have the old libvulkan.so around can you
give this and/or 2/2 a test ?
---
 src/intel/vulkan/anv_device.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index f80a36a940..e7aa81883a 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -36,6 +36,8 @@
 
 #include "genxml/gen7_pack.h"
 
+static uint32_t loader_version;
+
 struct anv_dispatch_table dtable;
 
 static void
@@ -739,6 +741,11 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(
     VkInstance                                  instance,
     const char*                                 pName)
 {
+   if (loader_version < 3u) {
+      fprintf(stderr, "WARNING: ANV supports Loader interface v3 or newer, v%u "
+                      "detected. Update your libvulkan.so.\n", loader_version);
+      return NULL;
+   }
    return anv_GetInstanceProcAddr(instance, pName);
 }
 
@@ -2075,6 +2082,7 @@ vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pSupportedVersion)
     *          vkDestroySurfaceKHR(), and other API which uses VKSurfaceKHR,
     *          because the loader no longer does so.
     */
+   loader_version = *pSupportedVersion;
    *pSupportedVersion = MIN2(*pSupportedVersion, 3u);
    return VK_SUCCESS;
 }
-- 
2.11.0



More information about the mesa-dev mailing list