diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 133a375139c..f7fd867fea7 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -606,8 +606,7 @@ radv_handle_per_app_options(struct radv_instance *instance,
instance->debug_flags |= RADV_DEBUG_NO_DYNAMIC_BOUNDS;
}
-static const char radv_dri_options_xml[] =
-DRI_CONF_BEGIN
+static const driOptionDescription radv_dri_options[] = {
DRI_CONF_SECTION_PERFORMANCE
DRI_CONF_ADAPTIVE_SYNC("true")
DRI_CONF_VK_X11_OVERRIDE_MIN_IMAGE_COUNT(0)
@@ -623,11 +622,11 @@ DRI_CONF_BEGIN
DRI_CONF_OVERRIDE_VRAM_SIZE()
DRI_CONF_VK_WSI_FORCE_BGRA8_UNORM_FIRST("false")
DRI_CONF_SECTION_END
-DRI_CONF_END;
+};
static void radv_init_dri_options(struct radv_instance *instance)
{
- driParseOptionInfo(&instance->available_dri_options, radv_dri_options_xml);
+ driParseOptionInfo(&instance->available_dri_options, radv_dri_options, ARRAY_SIZE(radv_dri_options));
driParseConfigFiles(&instance->dri_options,
&instance->available_dri_options,
0, "radv", NULL,
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.c b/src/gallium/auxiliary/pipe-loader/pipe_loader.c
index 0629d2fd80b..29b4993257b 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.c
@@ -51,9 +51,9 @@ static int (*backends[])(struct pipe_loader_device **, int) = {
&pipe_loader_sw_probe
};
-const char gallium_driinfo_xml[] =
+const driOptionDescription gallium_driconf[] = {
#include "driinfo_gallium.h"
-;
+};
int
pipe_loader_probe(struct pipe_loader_device **devs, int ndev)
@@ -85,45 +85,62 @@ pipe_loader_base_release(struct pipe_loader_device **dev)
*dev = NULL;
}
+static driOptionDescription *
+merge_driconf(const driOptionDescription *driver_driconf, unsigned driver_count,
+ unsigned *merged_count)
+{
+ unsigned gallium_count = ARRAY_SIZE(gallium_driconf);
+ driOptionDescription *merged = malloc((driver_count + gallium_count) *
+ sizeof(*merged));
+ if (!merged) {
+ *merged_count = 0;
+ return NULL;
+ }
+
+ memcpy(merged, gallium_driconf, sizeof(*merged) * gallium_count);
+ memcpy(&merged[gallium_count], driver_driconf, sizeof(*merged) * driver_count);
+
+ *merged_count = driver_count + gallium_count;
+ return merged;
+}
+
void
pipe_loader_load_options(struct pipe_loader_device *dev)
{
if (dev->option_info.info)
return;
- const char *driver_xml = dev->ops->get_driconf_xml(dev);
+ unsigned driver_count, merged_count;
+ const driOptionDescription *driver_driconf =
+ dev->ops->get_driconf(dev, &driver_count);
- char *xml_options;
- int ret = asprintf(&xml_options, "%s%s%s%s",
- DRI_CONF_BEGIN,
- gallium_driinfo_xml,
- driver_xml ? driver_xml : "",
- DRI_CONF_END);
- if (ret >= 0) {
- driParseOptionInfo(&dev->option_info, xml_options);
- driParseConfigFiles(&dev->option_cache, &dev->option_info, 0,
- dev->driver_name, NULL, NULL, 0, NULL, 0);
- free(xml_options);
- }
+ const driOptionDescription *merged_driconf =
+ merge_driconf(driver_driconf, driver_count, &merged_count);
+
+ driParseOptionInfo(&dev->option_info, merged_driconf, merged_count);
+ driParseConfigFiles(&dev->option_cache, &dev->option_info, 0,
+ dev->driver_name, NULL, NULL, 0, NULL, 0);
}
char *
pipe_loader_get_driinfo_xml(const char *driver_name)
{
+ unsigned driver_count = 0;
+ const driOptionDescription *driver_driconf = NULL;
+
#ifdef HAVE_LIBDRM
- char *driver_xml = pipe_loader_drm_get_driinfo_xml(driver_name);
-#else
- char *driver_xml = NULL;
+ driver_driconf = pipe_loader_drm_get_driconf_by_name(driver_name,
+ &driver_count);
#endif
- char *xml;
- int ret = asprintf(&xml, "%s%s%s%s",
- DRI_CONF_BEGIN,
- gallium_driinfo_xml,
- driver_xml ? driver_xml : "",
- DRI_CONF_END);
- if (ret < 0)
- xml = NULL;
+ unsigned merged_count;
+ const driOptionDescription *merged_driconf =
+ merge_driconf(driver_driconf, driver_count, &merged_count);
+ free((void *)driver_driconf);
+
+ char *xml = driGetOptionsXml(merged_driconf, merged_count);
+
+ free((void *)merged_driconf);
return xml;
}
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.h b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
index b57df804e56..ab89ed6f6a8 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.h
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
@@ -199,14 +199,12 @@ bool
pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd);
/**
- * Get the driinfo XML used for the DRM driver of the given name, if any.
+ * Get the dri options used for the DRM driver of the given name, if any.
*
- * The returned string is heap-allocated.
+ * The returned array is heap-allocated.
*/
-char *
-pipe_loader_drm_get_driinfo_xml(const char *driver_name);
-
-extern const char gallium_driinfo_xml[];
+const struct driOptionDescription *
+pipe_loader_drm_get_driconf_by_name(const char *driver_name, unsigned *count);
#ifdef __cplusplus
}
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
index 6cfb25d99d8..92bc82149ad 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
@@ -46,6 +46,7 @@
#include "util/u_memory.h"
#include "util/u_dl.h"
#include "util/u_debug.h"
+#include "util/xmlconfig.h"
#define DRM_RENDER_NODE_DEV_NAME_FORMAT "%s/renderD%d"
#define DRM_RENDER_NODE_MAX_NODES 63
@@ -241,15 +242,13 @@ pipe_loader_drm_release(struct pipe_loader_device **dev)
pipe_loader_base_release(dev);
}
-static const char *
-pipe_loader_drm_get_driconf_xml(struct pipe_loader_device *dev)
+static const struct driOptionDescription *
+pipe_loader_drm_get_driconf(struct pipe_loader_device *dev, unsigned *count)
{
struct pipe_loader_drm_device *ddev = pipe_loader_drm_device(dev);
- if (!ddev->dd->driconf_xml)
- return NULL;
-
- return *ddev->dd->driconf_xml;
+ *count = ddev->dd->driconf_count;
+ return ddev->dd->driconf;
}
static struct pipe_screen *
@@ -261,24 +260,30 @@ pipe_loader_drm_create_screen(struct pipe_loader_device *dev,
return ddev->dd->create_screen(ddev->fd, config);
}
-char *
-pipe_loader_drm_get_driinfo_xml(const char *driver_name)
+const struct driOptionDescription *
+pipe_loader_drm_get_driconf_by_name(const char *driver_name, unsigned *count)
{
- char *xml = NULL;
+ driOptionDescription *driconf = NULL;
struct util_dl_library *lib = NULL;
const struct drm_driver_descriptor *dd =
get_driver_descriptor(driver_name, &lib);
- if (dd && dd->driconf_xml && *dd->driconf_xml)
- xml = strdup(*dd->driconf_xml);
-
+ if (!dd) {
+ *count = 0;
+ } else {
+ *count = dd->driconf_count;
+ size_t size = sizeof(*driconf) * *count;
+ driconf = malloc(size);
+ memcpy(driconf, dd->driconf, size);
+ }
if (lib)
util_dl_close(lib);
- return xml;
+
+ return driconf;
}
static const struct pipe_loader_ops pipe_loader_drm_ops = {
.create_screen = pipe_loader_drm_create_screen,
- .get_driconf_xml = pipe_loader_drm_get_driconf_xml,
+ .get_driconf = pipe_loader_drm_get_driconf,
.release = pipe_loader_drm_release
};
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h b/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h
index 01b7c54425f..7f87cacd929 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h
@@ -34,7 +34,8 @@ struct pipe_loader_ops {
struct pipe_screen *(*create_screen)(struct pipe_loader_device *dev,
const struct pipe_screen_config *config);
- const char *(*get_driconf_xml)(struct pipe_loader_device *dev);
+ const struct driOptionDescription *(*get_driconf)(struct pipe_loader_device *dev,
+ unsigned *count);
void (*release)(struct pipe_loader_device **dev);
};
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
index b3932c7464c..6c7144777dc 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
@@ -294,9 +294,10 @@ pipe_loader_sw_release(struct pipe_loader_device **dev)
pipe_loader_base_release(dev);
}
-static const char *
-pipe_loader_sw_get_driconf_xml(struct pipe_loader_device *dev)
+static const struct driOptionDescription *
+pipe_loader_sw_get_driconf(struct pipe_loader_device *dev, unsigned *count)
{
+ *count = 0;
return NULL;
}
@@ -316,6 +317,6 @@ pipe_loader_sw_create_screen(struct pipe_loader_device *dev,
static const struct pipe_loader_ops pipe_loader_sw_ops = {
.create_screen = pipe_loader_sw_create_screen,
- .get_driconf_xml = pipe_loader_sw_get_driconf_xml,
+ .get_driconf = pipe_loader_sw_get_driconf,
.release = pipe_loader_sw_release
};
diff --git a/src/gallium/auxiliary/target-helpers/drm_helper.h b/src/gallium/auxiliary/target-helpers/drm_helper.h
index 8e1bd970b68..c0cf2d341f6 100644
--- a/src/gallium/auxiliary/target-helpers/drm_helper.h
+++ b/src/gallium/auxiliary/target-helpers/drm_helper.h
@@ -10,10 +10,11 @@
/**
* Instantiate a drm_driver_descriptor struct.
*/
-#define DEFINE_DRM_DRIVER_DESCRIPTOR(descriptor_name, driver, driconf, func) \
+#define DEFINE_DRM_DRIVER_DESCRIPTOR(descriptor_name, driver, _driconf, _driconf_count, func) \
const struct drm_driver_descriptor descriptor_name = { \
.driver_name = #driver, \
- .driconf_xml = driconf, \
+ .driconf = _driconf, \
+ .driconf_count = _driconf_count, \
.create_screen = func, \
};
@@ -32,17 +33,17 @@ const struct drm_driver_descriptor descriptor_name = { \
#ifdef PIPE_LOADER_DYNAMIC
-#define DRM_DRIVER_DESCRIPTOR(driver, driconf) \
- PUBLIC DEFINE_DRM_DRIVER_DESCRIPTOR(driver_descriptor, driver, driconf, pipe_##driver##_create_screen)
+#define DRM_DRIVER_DESCRIPTOR(driver, driconf, driconf_count) \
+ PUBLIC DEFINE_DRM_DRIVER_DESCRIPTOR(driver_descriptor, driver, driconf, driconf_count, pipe_##driver##_create_screen)
#define DRM_DRIVER_DESCRIPTOR_STUB(driver)
-#define DRM_DRIVER_DESCRIPTOR_ALIAS(driver, alias, driconf)
+#define DRM_DRIVER_DESCRIPTOR_ALIAS(driver, alias, driconf, driconf_count)
#else
-#define DRM_DRIVER_DESCRIPTOR(driver, driconf) \
- DEFINE_DRM_DRIVER_DESCRIPTOR(driver##_driver_descriptor, driver, driconf, pipe_##driver##_create_screen)
+#define DRM_DRIVER_DESCRIPTOR(driver, driconf, driconf_count) \
+ DEFINE_DRM_DRIVER_DESCRIPTOR(driver##_driver_descriptor, driver, driconf, driconf_count, pipe_##driver##_create_screen)
#define DRM_DRIVER_DESCRIPTOR_STUB(driver) \
static struct pipe_screen * \
@@ -51,10 +52,11 @@ const struct drm_driver_descriptor descriptor_name = { \
fprintf(stderr, #driver ": driver missing\n"); \
return NULL; \
} \
- DRM_DRIVER_DESCRIPTOR(driver, NULL)
+ DRM_DRIVER_DESCRIPTOR(driver, NULL, 0)
-#define DRM_DRIVER_DESCRIPTOR_ALIAS(driver, alias, driconf) \
- DEFINE_DRM_DRIVER_DESCRIPTOR(alias##_driver_descriptor, alias, driconf, pipe_##driver##_create_screen)
+#define DRM_DRIVER_DESCRIPTOR_ALIAS(driver, alias, driconf, driconf_count) \
+ DEFINE_DRM_DRIVER_DESCRIPTOR(alias##_driver_descriptor, alias, driconf, \
+ driconf_count, pipe_##driver##_create_screen)
#endif
@@ -75,7 +77,7 @@ pipe_i915_create_screen(int fd, const struct pipe_screen_config *config)
screen = i915_screen_create(iws);
return screen ? debug_screen_wrap(screen) : NULL;
}
-DRM_DRIVER_DESCRIPTOR(i915, NULL)
+DRM_DRIVER_DESCRIPTOR(i915, NULL, 0)
#else
DRM_DRIVER_DESCRIPTOR_STUB(i915)
#endif
@@ -92,10 +94,10 @@ pipe_iris_create_screen(int fd, const struct pipe_screen_config *config)
return screen ? debug_screen_wrap(screen) : NULL;
}
-const char *iris_driconf_xml =
+const driOptionDescription iris_driconf[] = {
#include "iris/driinfo_iris.h"
- ;
-DRM_DRIVER_DESCRIPTOR(iris, &iris_driconf_xml)
+};
+DRM_DRIVER_DESCRIPTOR(iris, iris_driconf, ARRAY_SIZE(iris_driconf))
#else
DRM_DRIVER_DESCRIPTOR_STUB(iris)
@@ -112,16 +114,16 @@ pipe_nouveau_create_screen(int fd, const struct pipe_screen_config *config)
screen = nouveau_drm_screen_create(fd);
return screen ? debug_screen_wrap(screen) : NULL;
}
-DRM_DRIVER_DESCRIPTOR(nouveau, NULL)
+DRM_DRIVER_DESCRIPTOR(nouveau, NULL, 0)
#else
DRM_DRIVER_DESCRIPTOR_STUB(nouveau)
#endif
#if defined(GALLIUM_VC4) || defined(GALLIUM_V3D)
- const char *v3d_driconf_xml =
+const driOptionDescription v3d_driconf[] = {
#include "v3d/driinfo_v3d.h"
- ;
+};
#endif
#ifdef GALLIUM_KMSRO
@@ -136,9 +138,9 @@ pipe_kmsro_create_screen(int fd, const struct pipe_screen_config *config)
return screen ? debug_screen_wrap(screen) : NULL;
}
#if defined(GALLIUM_VC4) || defined(GALLIUM_V3D)
-DRM_DRIVER_DESCRIPTOR(kmsro, &v3d_driconf_xml)
+DRM_DRIVER_DESCRIPTOR(kmsro, v3d_driconf, ARRAY_SIZE(v3d_driconf))
#else
-DRM_DRIVER_DESCRIPTOR(kmsro, NULL)
+DRM_DRIVER_DESCRIPTOR(kmsro, NULL, 0)
#endif
#else
@@ -158,7 +160,7 @@ pipe_r300_create_screen(int fd, const struct pipe_screen_config *config)
rw = radeon_drm_winsys_create(fd, config, r300_screen_create);
return rw ? debug_screen_wrap(rw->screen) : NULL;
}
-DRM_DRIVER_DESCRIPTOR(r300, NULL)
+DRM_DRIVER_DESCRIPTOR(r300, NULL, 0)
#else
DRM_DRIVER_DESCRIPTOR_STUB(r300)
@@ -177,7 +179,7 @@ pipe_r600_create_screen(int fd, const struct pipe_screen_config *config)
rw = radeon_drm_winsys_create(fd, config, r600_screen_create);
return rw ? debug_screen_wrap(rw->screen) : NULL;
}
-DRM_DRIVER_DESCRIPTOR(r600, NULL)
+DRM_DRIVER_DESCRIPTOR(r600, NULL, 0)
#else
DRM_DRIVER_DESCRIPTOR_STUB(r600)
@@ -194,10 +196,10 @@ pipe_radeonsi_create_screen(int fd, const struct pipe_screen_config *config)
return screen ? debug_screen_wrap(screen) : NULL;
}
-const char *radeonsi_driconf_xml =
+const driOptionDescription radeonsi_driconf[] = {
#include "radeonsi/driinfo_radeonsi.h"
- ;
-DRM_DRIVER_DESCRIPTOR(radeonsi, &radeonsi_driconf_xml)
+};
+DRM_DRIVER_DESCRIPTOR(radeonsi, radeonsi_driconf, ARRAY_SIZE(radeonsi_driconf))
#else
DRM_DRIVER_DESCRIPTOR_STUB(radeonsi)
@@ -220,7 +222,7 @@ pipe_vmwgfx_create_screen(int fd, const struct pipe_screen_config *config)
screen = svga_screen_create(sws);
return screen ? debug_screen_wrap(screen) : NULL;
}
-DRM_DRIVER_DESCRIPTOR(vmwgfx, NULL)
+DRM_DRIVER_DESCRIPTOR(vmwgfx, NULL, 0)
#else
DRM_DRIVER_DESCRIPTOR_STUB(vmwgfx)
@@ -237,11 +239,11 @@ pipe_msm_create_screen(int fd, const struct pipe_screen_config *config)
screen = fd_drm_screen_create(fd, NULL);
return screen ? debug_screen_wrap(screen) : NULL;
}
-DRM_DRIVER_DESCRIPTOR(msm, NULL)
+DRM_DRIVER_DESCRIPTOR(msm, NULL, 0)
#else
DRM_DRIVER_DESCRIPTOR_STUB(msm)
#endif
-DRM_DRIVER_DESCRIPTOR_ALIAS(msm, kgsl, NULL)
+DRM_DRIVER_DESCRIPTOR_ALIAS(msm, kgsl, NULL, 0)
#ifdef GALLIUM_VIRGL
#include "virgl/drm/virgl_drm_public.h"
@@ -256,10 +258,10 @@ pipe_virtio_gpu_create_screen(int fd, const struct pipe_screen_config *config)
return screen ? debug_screen_wrap(screen) : NULL;
}
-const char *virgl_driconf_xml =
+const driOptionDescription virgl_driconf[] = {
#include "virgl/virgl_driinfo.h.in"
- ;
-DRM_DRIVER_DESCRIPTOR(virtio_gpu, &virgl_driconf_xml)
+};
+DRM_DRIVER_DESCRIPTOR(virtio_gpu, virgl_driconf, ARRAY_SIZE(virgl_driconf))
#else
DRM_DRIVER_DESCRIPTOR_STUB(virtio_gpu)
@@ -276,7 +278,7 @@ pipe_vc4_create_screen(int fd, const struct pipe_screen_config *config)
screen = vc4_drm_screen_create(fd, config);
return screen ? debug_screen_wrap(screen) : NULL;
}
-DRM_DRIVER_DESCRIPTOR(vc4, &v3d_driconf_xml)
+DRM_DRIVER_DESCRIPTOR(vc4, v3d_driconf, ARRAY_SIZE(v3d_driconf))
#else
DRM_DRIVER_DESCRIPTOR_STUB(vc4)
#endif
@@ -293,7 +295,7 @@ pipe_v3d_create_screen(int fd, const struct pipe_screen_config *config)
return screen ? debug_screen_wrap(screen) : NULL;
}
-DRM_DRIVER_DESCRIPTOR(v3d, &v3d_driconf_xml)
+DRM_DRIVER_DESCRIPTOR(v3d, v3d_driconf, ARRAY_SIZE(v3d_driconf))
#else
DRM_DRIVER_DESCRIPTOR_STUB(v3d)
@@ -310,7 +312,7 @@ pipe_panfrost_create_screen(int fd, const struct pipe_screen_config *config)
screen = panfrost_drm_screen_create(fd);
return screen ? debug_screen_wrap(screen) : NULL;
}
-DRM_DRIVER_DESCRIPTOR(panfrost, NULL)
+DRM_DRIVER_DESCRIPTOR(panfrost, NULL, 0)
#else
DRM_DRIVER_DESCRIPTOR_STUB(panfrost)
@@ -327,7 +329,7 @@ pipe_etnaviv_create_screen(int fd, const struct pipe_screen_config *config)
screen = etna_drm_screen_create(fd);
return screen ? debug_screen_wrap(screen) : NULL;
}
-DRM_DRIVER_DESCRIPTOR(etnaviv, NULL)
+DRM_DRIVER_DESCRIPTOR(etnaviv, NULL, 0)
#else
DRM_DRIVER_DESCRIPTOR_STUB(etnaviv)
@@ -345,7 +347,7 @@ pipe_tegra_create_screen(int fd, const struct pipe_screen_config *config)
return screen ? debug_screen_wrap(screen) : NULL;
}
-DRM_DRIVER_DESCRIPTOR(tegra, NULL)
+DRM_DRIVER_DESCRIPTOR(tegra, NULL, 0)
#else
DRM_DRIVER_DESCRIPTOR_STUB(tegra)
@@ -362,7 +364,7 @@ pipe_lima_create_screen(int fd, const struct pipe_screen_config *config)
screen = lima_drm_screen_create(fd);
return screen ? debug_screen_wrap(screen) : NULL;
}
-DRM_DRIVER_DESCRIPTOR(lima, NULL)
+DRM_DRIVER_DESCRIPTOR(lima, NULL, 0)
#else
DRM_DRIVER_DESCRIPTOR_STUB(lima)
@@ -378,7 +380,7 @@ pipe_zink_create_screen(int fd, const struct pipe_screen_config *config)
screen = zink_drm_create_screen(fd);
return screen ? debug_screen_wrap(screen) : NULL;
}
-DRM_DRIVER_DESCRIPTOR(zink, NULL)
+DRM_DRIVER_DESCRIPTOR(zink, NULL, 0)
#else
DRM_DRIVER_DESCRIPTOR_STUB(zink)
diff --git a/src/gallium/drivers/iris/driinfo_iris.h b/src/gallium/drivers/iris/driinfo_iris.h
index 361d8de03b1..5a9e430573f 100644
--- a/src/gallium/drivers/iris/driinfo_iris.h
+++ b/src/gallium/drivers/iris/driinfo_iris.h
@@ -7,5 +7,5 @@ DRI_CONF_SECTION_DEBUG
DRI_CONF_SECTION_END
DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_OPT_E(bo_reuse, 1, 0, 1, "Buffer object reuse", "")
+ DRI_CONF_OPT_E(bo_reuse, 1, 0, 1, "Buffer object reuse",)
DRI_CONF_SECTION_END
diff --git a/src/gallium/frontends/dri/dri_screen.c b/src/gallium/frontends/dri/dri_screen.c
index bcdd96bde3f..f476333d295 100644
--- a/src/gallium/frontends/dri/dri_screen.c
+++ b/src/gallium/frontends/dri/dri_screen.c
@@ -51,7 +51,6 @@
const __DRIconfigOptionsExtension gallium_config_options = {
.base = { __DRI_CONFIG_OPTIONS, 2 },
- .xml = gallium_driinfo_xml,
.getXml = pipe_loader_get_driinfo_xml
};
diff --git a/src/gallium/include/frontend/drm_driver.h b/src/gallium/include/frontend/drm_driver.h
index 10a9cf007e7..f1824128e3a 100644
--- a/src/gallium/include/frontend/drm_driver.h
+++ b/src/gallium/include/frontend/drm_driver.h
@@ -19,11 +19,13 @@ struct drm_driver_descriptor
const char *driver_name;
/**
- * Pointer to the XML string fragment describing driver-specific driconf
- * options. Use DRI_CONF_* macros to create the string, do not wrap in
- * DRI_CONF_BEGIN/END.
+ * Optional pointer to the array of driOptionDescription describing
+ * driver-specific driconf options.
*/
- const char **driconf_xml;
+ const struct driOptionDescription *driconf;
+
+ /* Number of entries in the driconf array. */
+ unsigned driconf_count;
/**
* Create a pipe srcreen.
diff --git a/src/gallium/targets/d3dadapter9/drm.c b/src/gallium/targets/d3dadapter9/drm.c
index fa6d7352241..b1962f74200 100644
--- a/src/gallium/targets/d3dadapter9/drm.c
+++ b/src/gallium/targets/d3dadapter9/drm.c
@@ -47,8 +47,7 @@
#define DBG_CHANNEL DBG_ADAPTER
-const char __driConfigOptionsNine[] =
-DRI_CONF_BEGIN
+const driOptionDescription __driConfigOptionsNine[] = {
DRI_CONF_SECTION_PERFORMANCE
DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_1)
DRI_CONF_SECTION_END
@@ -62,7 +61,7 @@ DRI_CONF_BEGIN
DRI_CONF_NINE_DYNAMICTEXTUREWORKAROUND("false")
DRI_CONF_NINE_SHADERINLINECONSTANTS("false")
DRI_CONF_SECTION_END
-DRI_CONF_END;
+};
struct fallback_card_config {
const char *name;
@@ -249,7 +248,8 @@ drm_create_adapter( int fd,
ctx->base.throttling_value = 2;
ctx->base.throttling = ctx->base.throttling_value > 0;
- driParseOptionInfo(&defaultInitOptions, __driConfigOptionsNine);
+ driParseOptionInfo(&defaultInitOptions, __driConfigOptionsNine,
+ ARRAY_SIZE(__driConfigOptionsNine));
driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0,
"nine", NULL, NULL, 0, NULL, 0);
if (driCheckOption(&userInitOptions, "throttle_value", DRI_INT)) {
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 58e1c8fa24b..3e31c166441 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -49,8 +49,7 @@
#include "genxml/gen7_pack.h"
-static const char anv_dri_options_xml[] =
-DRI_CONF_BEGIN
+static const driOptionDescription anv_dri_options[] = {
DRI_CONF_SECTION_PERFORMANCE
DRI_CONF_VK_X11_OVERRIDE_MIN_IMAGE_COUNT(0)
DRI_CONF_VK_X11_STRICT_IMAGE_COUNT("false")
@@ -60,7 +59,7 @@ DRI_CONF_BEGIN
DRI_CONF_ALWAYS_FLUSH_CACHE("false")
DRI_CONF_VK_WSI_FORCE_BGRA8_UNORM_FIRST("false")
DRI_CONF_SECTION_END
-DRI_CONF_END;
+};
/* This is probably far to big but it reflects the max size used for messages
* in OpenGLs KHR_debug.
@@ -768,7 +767,8 @@ VkResult anv_CreateInstance(
VG(VALGRIND_CREATE_MEMPOOL(instance, 0, false));
- driParseOptionInfo(&instance->available_dri_options, anv_dri_options_xml);
+ driParseOptionInfo(&instance->available_dri_options, anv_dri_options,
+ ARRAY_SIZE(anv_dri_options));
driParseConfigFiles(&instance->dri_options, &instance->available_dri_options,
0, "anv", NULL,
instance->app_info.app_name,
diff --git a/src/loader/loader.c b/src/loader/loader.c
index 38395c8b768..f619333a21a 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -178,13 +178,12 @@ loader_open_render_node(const char *name)
}
#ifdef USE_DRICONF
-static const char __driConfigOptionsLoader[] =
-DRI_CONF_BEGIN
+static const driOptionDescription __driConfigOptionsLoader[] = {
DRI_CONF_SECTION_INITIALIZATION
DRI_CONF_DEVICE_ID_PATH_TAG()
DRI_CONF_DRI_DRIVER()
DRI_CONF_SECTION_END
-DRI_CONF_END;
+};
static char *loader_get_dri_config_driver(int fd)
{
@@ -193,7 +192,8 @@ static char *loader_get_dri_config_driver(int fd)
char *dri_driver = NULL;
char *kernel_driver = loader_get_kernel_driver_name(fd);
- driParseOptionInfo(&defaultInitOptions, __driConfigOptionsLoader);
+ driParseOptionInfo(&defaultInitOptions, __driConfigOptionsLoader,
+ ARRAY_SIZE(__driConfigOptionsLoader));
driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0,
"loader", kernel_driver, NULL, 0, NULL, 0);
if (driCheckOption(&userInitOptions, "dri_driver", DRI_STRING)) {
@@ -215,7 +215,8 @@ static char *loader_get_dri_config_device_id(void)
driOptionCache userInitOptions;
char *prime = NULL;
- driParseOptionInfo(&defaultInitOptions, __driConfigOptionsLoader);
+ driParseOptionInfo(&defaultInitOptions, __driConfigOptionsLoader,
+ ARRAY_SIZE(__driConfigOptionsLoader));
driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0,
"loader", NULL, NULL, 0, NULL, 0);
if (driCheckOption(&userInitOptions, "device_id", DRI_STRING))
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index ffc4bbd1103..35d61572d76 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -51,12 +51,11 @@
#include "main/errors.h"
#include "main/macros.h"
-const char __dri2ConfigOptions[] =
- DRI_CONF_BEGIN
+driOptionDescription __dri2ConfigOptions[] = {
DRI_CONF_SECTION_PERFORMANCE
DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_1)
DRI_CONF_SECTION_END
- DRI_CONF_END;
+};
/*****************************************************************/
/** \name Screen handling functions */
@@ -148,7 +147,8 @@ driCreateNewScreen2(int scrn, int fd,
psp->myNum = scrn;
/* Option parsing before ->InitScreen(), as some options apply there. */
- driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions);
+ driParseOptionInfo(&psp->optionInfo,
+ __dri2ConfigOptions, ARRAY_SIZE(__dri2ConfigOptions));
driParseConfigFiles(&psp->optionCache, &psp->optionInfo, psp->myNum,
"dri2", NULL, NULL, 0, NULL, 0);
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index 9eac6ada2d6..45b339265a4 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -43,11 +43,7 @@
#include "util/driconf.h"
#include "util/u_memory.h"
-static const __DRIconfigOptionsExtension i915_config_options = {
- .base = { __DRI_CONFIG_OPTIONS, 1 },
- .xml =
-
-DRI_CONF_BEGIN
+static const driOptionDescription i915_driconf[] = {
DRI_CONF_SECTION_PERFORMANCE
/* Options correspond to DRI_CONF_BO_REUSE_DISABLED,
* DRI_CONF_BO_REUSE_ALL
@@ -75,7 +71,18 @@ DRI_CONF_BEGIN
DRI_CONF_OPT_B(shader_precompile, "true", "Perform code generation at shader link time.")
DRI_CONF_SECTION_END
-DRI_CONF_END
+};
+
+static char *
+i915_driconf_get_xml(const char *driver_name)
+{
+ return driGetOptionsXml(i915_driconf, ARRAY_SIZE(i915_driconf));
+}
+
+static const __DRIconfigOptionsExtension i915_config_options = {
+ .base = { __DRI_CONFIG_OPTIONS, 2 },
+ .xml = NULL,
+ .getXml = i915_driconf_get_xml,
};
#include "intel_batchbuffer.h"
@@ -1155,7 +1162,8 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
return false;
}
/* parse information in __driConfigOptions */
- driParseOptionInfo(&intelScreen->optionCache, i915_config_options.xml);
+ driParseOptionInfo(&intelScreen->optionCache, i915_driconf,
+ ARRAY_SIZE(i915_driconf));
intelScreen->driScrnPriv = psp;
psp->driverPrivate = (void *) intelScreen;
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 8e91f5340d6..8e556d20835 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -49,10 +49,7 @@
#include "common/gen_defines.h"
-static const __DRIconfigOptionsExtension brw_config_options = {
- .base = { __DRI_CONFIG_OPTIONS, 1 },
- .xml =
-DRI_CONF_BEGIN
+static const driOptionDescription brw_driconf[] = {
DRI_CONF_SECTION_PERFORMANCE
/* Options correspond to DRI_CONF_BO_REUSE_DISABLED,
* DRI_CONF_BO_REUSE_ALL
@@ -100,7 +97,18 @@ DRI_CONF_BEGIN
DRI_CONF_ALLOW_RGB565_CONFIGS("true")
DRI_CONF_ALLOW_FP16_CONFIGS("false")
DRI_CONF_SECTION_END
-DRI_CONF_END
+};
+
+static char *
+brw_driconf_get_xml(const char *driver_name)
+{
+ return driGetOptionsXml(brw_driconf, ARRAY_SIZE(brw_driconf));
+}
+
+static const __DRIconfigOptionsExtension brw_config_options = {
+ .base = { __DRI_CONFIG_OPTIONS, 2 },
+ .xml = NULL,
+ .getXml = brw_driconf_get_xml,
};
#include "intel_batchbuffer.h"
@@ -2538,7 +2546,7 @@ __DRIconfig **intelInitScreen2(__DRIscreen *dri_screen)
driOptionCache options;
memset(&options, 0, sizeof(options));
- driParseOptionInfo(&options, brw_config_options.xml);
+ driParseOptionInfo(&options, brw_driconf, ARRAY_SIZE(brw_driconf));
driParseConfigFiles(&screen->optionCache, &options, dri_screen->myNum,
"i965", NULL, NULL, 0, NULL, 0);
driDestroyOptionCache(&options);
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index d421cfe280f..e4c8c322ece 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -91,10 +91,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"Initial maximum value for anisotropic texture filtering")
#if defined(RADEON_R100) /* R100 */
-static const __DRIconfigOptionsExtension radeon_config_options = {
- .base = { __DRI_CONFIG_OPTIONS, 1 },
- .xml =
-DRI_CONF_BEGIN
+static const driOptionDescription radeon_driconf[] = {
DRI_CONF_SECTION_PERFORMANCE
DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN)
DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
@@ -110,15 +107,10 @@ DRI_CONF_BEGIN
DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
DRI_CONF_SECTION_END
-DRI_CONF_END
};
#elif defined(RADEON_R200)
-
-static const __DRIconfigOptionsExtension radeon_config_options = {
- .base = { __DRI_CONFIG_OPTIONS, 1 },
- .xml =
-DRI_CONF_BEGIN
+static const driOptionDescription radeon_driconf[] = {
DRI_CONF_SECTION_PERFORMANCE
DRI_CONF_TCL_MODE(DRI_CONF_TCL_CODEGEN)
DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
@@ -136,10 +128,21 @@ DRI_CONF_BEGIN
DRI_CONF_OPT_F(texture_blend_quality, 1.0, 0.0, 1.0,
"Texture filtering quality vs. speed, AKA “brilinear” texture filtering")
DRI_CONF_SECTION_END
-DRI_CONF_END
};
#endif
+static char *
+radeon_driconf_get_xml(const char *driver_name)
+{
+ return driGetOptionsXml(radeon_driconf, ARRAY_SIZE(radeon_driconf));
+}
+
+static const __DRIconfigOptionsExtension radeon_config_options = {
+ .base = { __DRI_CONFIG_OPTIONS, 2 },
+ .xml = NULL,
+ .getXml = radeon_driconf_get_xml,
+};
+
static int
radeonGetParam(__DRIscreen *sPriv, int param, void *value)
{
@@ -578,7 +581,8 @@ radeonCreateScreen2(__DRIscreen *sPriv)
radeon_init_debug();
/* parse information in __driConfigOptions */
- driParseOptionInfo (&screen->optionCache, radeon_config_options.xml);
+ driParseOptionInfo (&screen->optionCache, radeon_driconf,
+ ARRAY_SIZE(radeon_driconf));
screen->chip_flags = 0;
diff --git a/src/util/driconf.h b/src/util/driconf.h
index 9bdb2894ab8..b8c60310ecb 100644
--- a/src/util/driconf.h
+++ b/src/util/driconf.h
@@ -33,119 +33,95 @@
#ifndef __DRICONF_H
#define __DRICONF_H
+#include "xmlconfig.h"
+
/*
* generic macros
*/
-/** \brief Begin __driConfigOptions */
-#define DRI_CONF_BEGIN \
-"" \
-"" \
-" " \
-" " \
-" " \
-" " \
-" " \
-" " \
-" " \
-"]>" \
-"\n"
-
-/** \brief End __driConfigOptions */
-#define DRI_CONF_END \
-"\n"
-
-/** \brief Begin a section of related options */
-#define DRI_CONF_SECTION_BEGIN \
-"\n"
-
-/** \brief End a section of related options */
-#define DRI_CONF_SECTION_END \
-"\n"
-
-/** \brief Begin an option definition */
-#define DRI_CONF_OPT_BEGIN(name,type,def) \
-"\n"
+#define DRI_CONF_OPT_END },
/** \brief A verbal description (empty version) */
-#define DRI_CONF_DESC(text) \
-"\n"
-
-/** \brief Begining of a verbal description */
-#define DRI_CONF_DESC_BEGIN(text) \
-"\n"
-
-/** \brief End a description */
-#define DRI_CONF_DESC_END \
-"\n"
+#define DRI_CONF_DESC(text) .desc = text,
/** \brief A verbal description of an enum value */
-#define DRI_CONF_ENUM(value,text) \
-"\n"
+#define DRI_CONF_ENUM(_value,text) { .value = _value, .desc = text },
-#define DRI_CONF(sections) \
- DRI_CONF_BEGIN \
- sections \
- DRI_CONF_END
+#define DRI_CONF_RANGE_I(min, max) \
+ .range = { \
+ .start = { ._int = min }, \
+ .end = { ._int = max }, \
+ } \
-#define DRI_CONF_SECTION(desc, options) \
- DRI_CONF_SECTION_BEGIN \
- DRI_CONF_DESC(desc) \
- options \
- DRI_CONF_SECTION_END
+#define DRI_CONF_RANGE_F(min, max) \
+ .range = { \
+ .start = { ._float = min }, \
+ .end = { ._float = max }, \
+ } \
/**
* \brief A boolean option definition, with the default value passed in as a
* string
*/
-#define DRI_CONF_OPT_B(name, def, desc) \
- "