radv: Add support for driconf.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sun, 14 Apr 2019 22:32:27 +0000 (00:32 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tue, 23 Apr 2019 23:49:39 +0000 (23:49 +0000)
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 <samuel.pitoiset@gmail.com>
src/amd/vulkan/meson.build
src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_private.h

index 385b5ada0b9f2d718b349194b1f14dcd2a2398cc..3d7ad9f55a1050d9403e5663d2d994c98bbeda94 100644 (file)
@@ -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,
index a31860eabf4bab55efcc6cc36586295ebfe50fc0..f44b6842c2ec9259c32676ec8e2447b5990bd7b4 100644 (file)
@@ -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);
index cd3af7e614dfffb1819198953fca4fbf490b671f..248a5ec0ac7ce38d105ce9c8b297b51522aa6c15 100644 (file)
@@ -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);