anv: add support for driconf
authorEric Engestrom <eric.engestrom@intel.com>
Wed, 24 Apr 2019 15:42:25 +0000 (16:42 +0100)
committerEric Engestrom <eric.engestrom@intel.com>
Fri, 6 Sep 2019 22:16:05 +0000 (23:16 +0100)
No option is supported yet, this is just the boilerplate.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/anv_device.c
src/intel/vulkan/anv_private.h
src/intel/vulkan/anv_wsi.c
src/intel/vulkan/meson.build

index 3497a01f900fc8d34ee5d8ef571dd17907b7a320..3363c8fa791b45b559e65366cf3dbefa54c69564 100644 (file)
@@ -40,6 +40,7 @@
 #include "util/os_file.h"
 #include "util/u_atomic.h"
 #include "util/u_string.h"
+#include "util/xmlpool.h"
 #include "git_sha1.h"
 #include "vk_util.h"
 #include "common/gen_defines.h"
 
 #include "genxml/gen7_pack.h"
 
+static const char anv_dri_options_xml[] =
+DRI_CONF_BEGIN
+DRI_CONF_END;
+
 /* This is probably far to big but it reflects the max size used for messages
  * in OpenGLs KHR_debug.
  */
@@ -770,6 +775,10 @@ VkResult anv_CreateInstance(
 
    VG(VALGRIND_CREATE_MEMPOOL(instance, 0, false));
 
+   driParseOptionInfo(&instance->available_dri_options, anv_dri_options_xml);
+   driParseConfigFiles(&instance->dri_options, &instance->available_dri_options,
+                       0, "anv", NULL);
+
    *pInstance = anv_instance_to_handle(instance);
 
    return VK_SUCCESS;
@@ -800,6 +809,9 @@ void anv_DestroyInstance(
    glsl_type_singleton_decref();
    _mesa_locale_fini();
 
+   driDestroyOptionCache(&instance->dri_options);
+   driDestroyOptionInfo(&instance->available_dri_options);
+
    vk_free(&instance->alloc, instance);
 }
 
index 26ce4aa6ddf362f791e0de0d156ec72954577eeb..fa40c71839a360aabc9bdd38fc61caa8e4288ae0 100644 (file)
@@ -57,6 +57,7 @@
 #include "util/u_vector.h"
 #include "util/u_math.h"
 #include "util/vma.h"
+#include "util/xmlconfig.h"
 #include "vk_alloc.h"
 #include "vk_debug_report.h"
 
@@ -1009,6 +1010,9 @@ struct anv_instance {
     bool                                        pipeline_cache_enabled;
 
     struct vk_debug_report_instance             debug_report_callbacks;
+
+    struct driOptionCache                       dri_options;
+    struct driOptionCache                       available_dri_options;
 };
 
 VkResult anv_init_wsi(struct anv_physical_device *physical_device);
index ba07bcef8b38ea7f7877c92e70d7822167cac682..9edadb13d2d0e8b9b14b178e1129a1542552f79c 100644 (file)
@@ -50,7 +50,7 @@ anv_init_wsi(struct anv_physical_device *physical_device)
                             anv_wsi_proc_addr,
                             &physical_device->instance->alloc,
                             physical_device->master_fd,
-                            NULL);
+                            &physical_device->instance->dri_options);
    if (result != VK_SUCCESS)
       return result;
 
index 87280d173185f65ebca7e7fee042bdd287cda279..86325beabea57259f51579e8894e3468bb1b599c 100644 (file)
@@ -179,7 +179,7 @@ libanv_common = static_library(
   ],
   include_directories : [
     inc_common, inc_intel, inc_compiler, inc_include,
-    inc_vulkan_wsi,
+    inc_vulkan_wsi, inc_util,
   ],
   c_args : anv_flags,
   dependencies : anv_deps,
@@ -197,7 +197,7 @@ libvulkan_intel = shared_library(
   ],
   dependencies : [
     dep_thread, dep_dl, dep_m, anv_deps, idep_libintel_common,
-    idep_nir, idep_genxml, idep_vulkan_util, idep_mesautil,
+    idep_nir, idep_genxml, idep_vulkan_util, idep_mesautil, idep_xmlconfig,
   ],
   c_args : anv_flags,
   link_args : ['-Wl,--build-id=sha1', ld_args_bsymbolic, ld_args_gc_sections],