From 3c2e8267d0b2300963d9a04aa4c46058ef448e49 Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Mon, 15 Apr 2019 00:32:27 +0200 Subject: [PATCH] radv: Add support for driconf. This includes 0 options. The cache parsing is located at a position where we can easily add config filtering by VkApplicationInfo. Reviewed-by: Samuel Pitoiset --- src/amd/vulkan/meson.build | 6 +++--- src/amd/vulkan/radv_device.c | 16 ++++++++++++++++ src/amd/vulkan/radv_private.h | 4 ++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/amd/vulkan/meson.build b/src/amd/vulkan/meson.build index 385b5ada0b9..3d7ad9f55a1 100644 --- a/src/amd/vulkan/meson.build +++ b/src/amd/vulkan/meson.build @@ -130,14 +130,14 @@ endif libvulkan_radeon = shared_library( 'vulkan_radeon', - [libradv_files, radv_entrypoints, radv_extensions_c, amd_vk_format_table_c, sha1_h], + [libradv_files, radv_entrypoints, radv_extensions_c, amd_vk_format_table_c, sha1_h, xmlpool_options_h], include_directories : [ - inc_common, inc_amd, inc_amd_common, inc_compiler, inc_vulkan_util, + inc_common, inc_amd, inc_amd_common, inc_compiler, inc_util, inc_vulkan_util, inc_vulkan_wsi, ], link_with : [ libamd_common, libamdgpu_addrlib, libvulkan_util, libvulkan_wsi, - libmesa_util, + libmesa_util, libxmlconfig ], dependencies : [ dep_llvm, dep_libdrm_amdgpu, dep_thread, dep_elf, dep_dl, dep_m, diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index a31860eabf4..f44b6842c2e 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -49,6 +49,7 @@ #include "util/debug.h" #include "util/mesa-sha1.h" #include "compiler/glsl_types.h" +#include "util/xmlpool.h" static int radv_device_get_cache_uuid(enum radeon_family family, void *uuid) @@ -520,6 +521,17 @@ static int radv_get_instance_extension_index(const char *name) return -1; } +static const char radv_dri_options_xml[] = +DRI_CONF_BEGIN +DRI_CONF_END; + +static void radv_init_dri_options(struct radv_instance *instance) +{ + driParseOptionInfo(&instance->available_dri_options, radv_dri_options_xml); + driParseConfigFiles(&instance->dri_options, + &instance->available_dri_options, + 0, "radv", NULL); +} VkResult radv_CreateInstance( const VkInstanceCreateInfo* pCreateInfo, @@ -587,6 +599,7 @@ VkResult radv_CreateInstance( VG(VALGRIND_CREATE_MEMPOOL(instance, 0, false)); + radv_init_dri_options(instance); radv_handle_per_app_options(instance, pCreateInfo->pApplicationInfo); *pInstance = radv_instance_to_handle(instance); @@ -612,6 +625,9 @@ void radv_DestroyInstance( glsl_type_singleton_decref(); _mesa_locale_fini(); + driDestroyOptionCache(&instance->dri_options); + driDestroyOptionInfo(&instance->available_dri_options); + vk_debug_report_instance_destroy(&instance->debug_report_callbacks); vk_free(&instance->alloc, instance); diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index cd3af7e614d..248a5ec0ac7 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -48,6 +48,7 @@ #include "compiler/shader_enums.h" #include "util/macros.h" #include "util/list.h" +#include "util/xmlconfig.h" #include "main/macros.h" #include "vk_alloc.h" #include "vk_debug_report.h" @@ -339,6 +340,9 @@ struct radv_instance { struct vk_debug_report_instance debug_report_callbacks; struct radv_instance_extension_table enabled_extensions; + + struct driOptionCache dri_options; + struct driOptionCache available_dri_options; }; VkResult radv_init_wsi(struct radv_physical_device *physical_device); -- 2.30.2