nvk: Require an environment variable for poorly tested hardware
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Wed, 26 Jul 2023 14:31:34 +0000 (09:31 -0500)
committerMarge Bot <emma+marge@anholt.net>
Fri, 4 Aug 2023 21:32:06 +0000 (21:32 +0000)
We really only know that Turing and Ampere work right now.  Maxwell has
recieved some testing but still can't survive a CTS run.  Other hardware
is even less well tested.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

src/nouveau/vulkan/nvk_physical_device.c

index 0f2993f..a9a446a 100644 (file)
@@ -31,6 +31,7 @@
 #include "clc597.h"
 #include "clc5c0.h"
 #include "clc597.h"
+#include "clc997.h"
 
 VKAPI_ATTR void VKAPI_CALL
 nvk_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
@@ -643,6 +644,15 @@ nvk_create_drm_physical_device(struct vk_instance *_instance,
    if (info.cls_eng3d < KEPLER_A)
       return VK_ERROR_INCOMPATIBLE_DRIVER;
 
+   if ((info.cls_eng3d < TURING_A || info.cls_eng3d > ADA_A) &&
+       !debug_get_bool_option("NVK_I_WANT_A_BROKEN_VULKAN_DRIVER", false)) {
+      return vk_errorf(instance, VK_ERROR_INCOMPATIBLE_DRIVER,
+                       "WARNING: NVK is not well-tested on %s, pass "
+                       "NVK_I_WANT_A_BROKEN_VULKAN_DRIVER=1 "
+                       "if you know what you're doing.",
+                       info.device_name);
+   }
+
    if (!(drm_device->available_nodes & (1 << DRM_NODE_RENDER))) {
       return vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
                        "NVK requires a render node");