From b2ef7e6d6b697c883efd8debaf3cb0a88bcf043b Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Wed, 13 Oct 2021 16:06:51 -0700 Subject: [PATCH] anv: don't advertise vk conformance on GPUs that aren't conformant This sets the conformance version to 0.0.0.0 for GPUs that have incomplete support for vulkan, so that it's easier to check if vulkan is fully supported by a GPU at runtime for applications/libraries. $ vulkaninfo|grep conf MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete conformanceVersion = 0.0.0.0 Signed-off-by: Clayton Craft Reviewed-by: Ivan Briano Reviewed-by: Jason Ekstrand Part-of: --- src/intel/vulkan/anv_device.c | 29 +++++++++++++++++++++++------ src/intel/vulkan/anv_private.h | 2 ++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index dde2e469e99..db779cac2b6 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -768,6 +768,7 @@ anv_physical_device_try_create(struct anv_instance *instance, goto fail_fd; } + bool is_alpha = true; if (devinfo.is_haswell) { mesa_logw("Haswell Vulkan support is incomplete"); } else if (devinfo.ver == 7 && !devinfo.is_baytrail) { @@ -776,6 +777,7 @@ anv_physical_device_try_create(struct anv_instance *instance, mesa_logw("Bay Trail Vulkan support is incomplete"); } else if (devinfo.ver >= 8 && devinfo.ver <= 12) { /* Gfx8-12 fully supported */ + is_alpha = false; } else { result = vk_errorf(instance, VK_ERROR_INCOMPATIBLE_DRIVER, "Vulkan not yet supported on %s", devinfo.name); @@ -809,6 +811,7 @@ anv_physical_device_try_create(struct anv_instance *instance, snprintf(device->path, ARRAY_SIZE(device->path), "%s", path); device->info = devinfo; + device->is_alpha = is_alpha; device->pci_info.domain = drm_device->businfo.pci->domain; device->pci_info.bus = drm_device->businfo.pci->bus; @@ -2018,12 +2021,26 @@ anv_get_physical_device_properties_1_2(struct anv_physical_device *pdevice, memset(p->driverInfo, 0, sizeof(p->driverInfo)); snprintf(p->driverInfo, VK_MAX_DRIVER_INFO_SIZE_KHR, "Mesa " PACKAGE_VERSION MESA_GIT_SHA1); - p->conformanceVersion = (VkConformanceVersionKHR) { - .major = 1, - .minor = 2, - .subminor = 0, - .patch = 0, - }; + + /* Don't advertise conformance with a particular version if the hardware's + * support is incomplete/alpha. + */ + if (pdevice->is_alpha) { + p->conformanceVersion = (VkConformanceVersionKHR) { + .major = 0, + .minor = 0, + .subminor = 0, + .patch = 0, + }; + } + else { + p->conformanceVersion = (VkConformanceVersionKHR) { + .major = 1, + .minor = 2, + .subminor = 0, + .patch = 0, + }; + } p->denormBehaviorIndependence = VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL_KHR; diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index ef804260f68..d3088fa2cc9 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -880,6 +880,8 @@ struct anv_physical_device { struct brw_compiler * compiler; struct isl_device isl_dev; struct intel_perf_config * perf; + /* True if hardware support is incomplete/alpha */ + bool is_alpha; /* * Number of commands required to implement a performance query begin + * end.