nvk: Hook up driconf for nvk_instance

We will use this in the future to enable present_id + present_wait like
in RADV.

This also enables the common WSI driconf entries for image count, etc
overrides to work by default, fixing some games.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26752>
This commit is contained in:
Joshua Ashton 2023-12-19 09:56:57 +00:00 committed by Marge Bot
parent 2464cd81d3
commit edb5229538
3 changed files with 28 additions and 1 deletions

View file

@ -10,6 +10,7 @@
#include "vulkan/wsi/wsi_common.h"
#include "util/build_id.h"
#include "util/driconf.h"
#include "util/mesa-sha1.h"
VKAPI_ATTR VkResult VKAPI_CALL
@ -61,6 +62,26 @@ nvk_EnumerateInstanceExtensionProperties(const char *pLayerName,
&instance_extensions, pPropertyCount, pProperties);
}
static const driOptionDescription nvk_dri_options[] = {
DRI_CONF_SECTION_PERFORMANCE
DRI_CONF_ADAPTIVE_SYNC(true)
DRI_CONF_VK_X11_OVERRIDE_MIN_IMAGE_COUNT(0)
DRI_CONF_VK_X11_STRICT_IMAGE_COUNT(false)
DRI_CONF_VK_X11_ENSURE_MIN_IMAGE_COUNT(false)
DRI_CONF_VK_KHR_PRESENT_WAIT(false)
DRI_CONF_VK_XWAYLAND_WAIT_READY(true)
DRI_CONF_SECTION_END
};
static void
nvk_init_dri_options(struct nvk_instance *instance)
{
driParseOptionInfo(&instance->available_dri_options, nvk_dri_options, ARRAY_SIZE(nvk_dri_options));
driParseConfigFiles(&instance->dri_options, &instance->available_dri_options, 0, "nvk", NULL, NULL,
instance->vk.app_info.app_name, instance->vk.app_info.app_version,
instance->vk.app_info.engine_name, instance->vk.app_info.engine_version);
}
VKAPI_ATTR VkResult VKAPI_CALL
nvk_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
@ -90,6 +111,8 @@ nvk_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
if (result != VK_SUCCESS)
goto fail_alloc;
nvk_init_dri_options(instance);
instance->vk.physical_devices.try_create_for_drm =
nvk_create_drm_physical_device;
instance->vk.physical_devices.destroy = nvk_physical_device_destroy;

View file

@ -8,10 +8,14 @@
#include "nvk_private.h"
#include "vulkan/runtime/vk_instance.h"
#include "util/xmlconfig.h"
struct nvk_instance {
struct vk_instance vk;
struct driOptionCache dri_options;
struct driOptionCache available_dri_options;
uint8_t driver_build_sha[20];
};

View file

@ -24,7 +24,7 @@ nvk_init_wsi(struct nvk_physical_device *pdev)
result = wsi_device_init(&pdev->wsi_device,
nvk_physical_device_to_handle(pdev),
nvk_wsi_proc_addr, &pdev->vk.instance->alloc,
-1, NULL, &wsi_options);
-1, &nvk_physical_device_instance(pdev)->dri_options, &wsi_options);
if (result != VK_SUCCESS)
return result;