panvk: wire up version-overriding

Not a whole lot of applications supports Vulkan 1.0, so let's wire up
support for MESA_VK_VERSION_OVERRIDE so we can easily override the
version to when testing.

While we're at it, let's switch to VK_MAKE_API_VERSION, as
VK_MAKE_VERSION is deprecated now.

Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28694>
This commit is contained in:
Erik Faye-Lund 2024-04-11 17:02:50 +02:00 committed by Marge Bot
parent 83c40aa3f4
commit 13dffdec60
3 changed files with 13 additions and 2 deletions

View file

@ -42,7 +42,7 @@ static const struct debug_control panvk_debug_options[] = {
VKAPI_ATTR VkResult VKAPI_CALL
panvk_EnumerateInstanceVersion(uint32_t *pApiVersion)
{
*pApiVersion = VK_MAKE_VERSION(1, 0, VK_HEADER_VERSION);
*pApiVersion = panvk_get_vk_version();
return VK_SUCCESS;
}

View file

@ -598,7 +598,7 @@ panvk_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
};
pProperties->properties = (VkPhysicalDeviceProperties){
.apiVersion = VK_MAKE_VERSION(1, 0, VK_HEADER_VERSION),
.apiVersion = panvk_get_vk_version(),
.driverVersion = vk_get_driver_version(),
/* Arm vendor ID. */

View file

@ -12,6 +12,7 @@
#include "vk_physical_device.h"
#include "vk_sync.h"
#include "vk_util.h"
#include "wsi_common.h"
#include "lib/kmod/pan_kmod.h"
@ -57,6 +58,16 @@ to_panvk_physical_device(struct vk_physical_device *phys_dev)
return container_of(phys_dev, struct panvk_physical_device, vk);
}
static inline uint32_t
panvk_get_vk_version()
{
const uint32_t version_override = vk_get_version_override();
if (version_override)
return version_override;
return VK_MAKE_API_VERSION(0, 1, 0, VK_HEADER_VERSION);
}
VkResult panvk_physical_device_init(struct panvk_physical_device *device,
struct panvk_instance *instance,
drmDevicePtr drm_device);