radv: Provide a toggle to avoid warnings about unsupported devices.
authorCharlie Turner <cturner@igalia.com>
Thu, 17 Jun 2021 11:43:27 +0000 (12:43 +0100)
committerMartin Peres <martin.peres@mupuf.org>
Tue, 22 Jun 2021 10:59:43 +0000 (13:59 +0300)
In the CI, we have such devices, and this message is printed many
hundreds of times. This results in a useless spam which makes it
difficult to see real issues.

v2 from Martin:
 - Reword the commit message a bit
 - Add a SoB

Signed-off-by: Martin Peres <martin.peres@mupuf.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Acked-by: Andres Gomez <agomez@igalia.com>
Acked-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11491>

src/amd/vulkan/radv_device.c

index 87687a8..4b8eab2 100644 (file)
@@ -29,6 +29,7 @@
 #include <stdbool.h>
 #include <string.h>
 
+#include "util/debug.h"
 #include "util/disk_cache.h"
 #include "radv_cs.h"
 #include "radv_debug.h"
@@ -520,6 +521,15 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device
    };
 }
 
+static void
+warn_non_conformant_implementation()
+{
+   if (env_var_as_boolean("RADV_IGNORE_CONFORMANCE_WARNING", false))
+      return;
+   fprintf(stderr,
+          "WARNING: radv is not a conformant vulkan implementation, testing use only.\n");
+}
+
 static VkResult
 radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm_device,
                                 struct radv_physical_device **device_out)
@@ -649,8 +659,7 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
 #endif
 
    if (device->rad_info.chip_class < GFX8 || device->rad_info.chip_class > GFX10)
-      fprintf(stderr,
-              "WARNING: radv is not a conformant vulkan implementation, testing use only.\n");
+      warn_non_conformant_implementation();
 
    radv_get_driver_uuid(&device->driver_uuid);
    radv_get_device_uuid(&device->rad_info, &device->device_uuid);