gallium/driconf: Allow the driver to parse the driconf options.
This will give the driver a chance to set a device name separate from the driver name, using info probed during screen creation. All drivers querying driconf in screen creation now have to call parsing on their own, but other drivers get fallback parsing after screen creation. Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12135>
This commit is contained in:
@@ -124,11 +124,17 @@ pipe_loader_load_options(struct pipe_loader_device *dev)
|
||||
|
||||
const driOptionDescription *merged_driconf =
|
||||
merge_driconf(driver_driconf, driver_count, &merged_count);
|
||||
|
||||
driParseOptionInfo(&dev->option_info, merged_driconf, merged_count);
|
||||
free((void *)merged_driconf);
|
||||
}
|
||||
|
||||
void
|
||||
pipe_loader_config_options(struct pipe_loader_device *dev)
|
||||
{
|
||||
if (!dev->option_cache.info) {
|
||||
driParseConfigFiles(&dev->option_cache, &dev->option_info, 0,
|
||||
dev->driver_name, NULL, NULL, 0, NULL, 0);
|
||||
free((void *)merged_driconf);
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
@@ -161,6 +167,7 @@ pipe_loader_create_screen_vk(struct pipe_loader_device *dev, bool sw_vk)
|
||||
|
||||
util_cpu_detect();
|
||||
pipe_loader_load_options(dev);
|
||||
config.options_info = &dev->option_info;
|
||||
config.options = &dev->option_cache;
|
||||
|
||||
return dev->ops->create_screen(dev, &config, sw_vk);
|
||||
|
@@ -765,6 +765,9 @@ crocus_screen_create(int fd, const struct pipe_screen_config *config)
|
||||
if (getenv("INTEL_NO_HW") != NULL)
|
||||
screen->no_hw = true;
|
||||
|
||||
driParseConfigFiles(config->options, config->options_info, 0, "crocus",
|
||||
NULL, NULL, 0, NULL, 0);
|
||||
|
||||
bool bo_reuse = false;
|
||||
int bo_reuse_mode = driQueryOptioni(config->options, "bo_reuse");
|
||||
switch (bo_reuse_mode) {
|
||||
|
@@ -811,6 +811,9 @@ iris_screen_create(int fd, const struct pipe_screen_config *config)
|
||||
if (screen->devinfo.ver < 8 || screen->devinfo.is_cherryview)
|
||||
return NULL;
|
||||
|
||||
driParseConfigFiles(config->options, config->options_info, 0, "iris",
|
||||
NULL, NULL, 0, NULL, 0);
|
||||
|
||||
bool bo_reuse = false;
|
||||
int bo_reuse_mode = driQueryOptioni(config->options, "bo_reuse");
|
||||
switch (bo_reuse_mode) {
|
||||
|
@@ -1399,6 +1399,9 @@ struct pipe_screen *radeonsi_screen_create(int fd, const struct pipe_screen_conf
|
||||
drmVersionPtr version = drmGetVersion(fd);
|
||||
struct radeon_winsys *rw = NULL;
|
||||
|
||||
driParseConfigFiles(config->options, config->options_info, 0, "radeonsi",
|
||||
NULL, NULL, 0, NULL, 0);
|
||||
|
||||
switch (version->version_major) {
|
||||
case 2:
|
||||
rw = radeon_drm_winsys_create(fd, config, radeonsi_screen_create_impl);
|
||||
|
@@ -793,6 +793,9 @@ v3d_screen_create(int fd, const struct pipe_screen_config *config,
|
||||
if (!v3d_get_device_info(screen->fd, &screen->devinfo, &v3d_ioctl))
|
||||
goto fail;
|
||||
|
||||
driParseConfigFiles(config->options, config->options_info, 0, "v3d",
|
||||
NULL, NULL, 0, NULL, 0);
|
||||
|
||||
/* We have to driCheckOption for the simulator mode to not assertion
|
||||
* fail on not having our XML config.
|
||||
*/
|
||||
|
@@ -942,6 +942,9 @@ virgl_create_screen(struct virgl_winsys *vws, const struct pipe_screen_config *c
|
||||
virgl_debug = debug_get_option_virgl_debug();
|
||||
|
||||
if (config && config->options) {
|
||||
driParseConfigFiles(config->options, config->options_info, 0, "virtio_gpu",
|
||||
NULL, NULL, 0, NULL, 0);
|
||||
|
||||
screen->tweak_gles_emulate_bgra =
|
||||
driQueryOptionb(config->options, VIRGL_GLES_EMULATE_BGRA);
|
||||
screen->tweak_gles_apply_bgra_dest_swizzle =
|
||||
|
@@ -1902,9 +1902,12 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
|
||||
slab_create_parent(&screen->transfer_pool, sizeof(struct zink_transfer), 16);
|
||||
|
||||
#if WITH_XMLCONFIG
|
||||
if (config)
|
||||
if (config) {
|
||||
driParseConfigFiles(config->options, config->options_info, 0, "zink",
|
||||
NULL, NULL, 0, NULL, 0);
|
||||
screen->driconf.dual_color_blend_by_location = driQueryOptionb(config->options, "dual_color_blend_by_location");
|
||||
//screen->driconf.inline_uniforms = driQueryOptionb(config->options, "radeonsi_inline_uniforms");
|
||||
}
|
||||
#endif
|
||||
screen->driconf.inline_uniforms = debug_get_bool_option("ZINK_INLINE_UNIFORMS", false);
|
||||
|
||||
|
@@ -59,6 +59,8 @@ const __DRIconfigOptionsExtension gallium_config_options = {
|
||||
void
|
||||
dri_init_options(struct dri_screen *screen)
|
||||
{
|
||||
pipe_loader_config_options(screen->dev);
|
||||
|
||||
struct st_config_options *options = &screen->options;
|
||||
const struct driOptionCache *optionCache = &screen->dev->option_cache;
|
||||
|
||||
|
@@ -611,7 +611,8 @@ struct pipe_screen {
|
||||
* Global configuration options for screen creation.
|
||||
*/
|
||||
struct pipe_screen_config {
|
||||
const struct driOptionCache *options;
|
||||
struct driOptionCache *options;
|
||||
const struct driOptionCache *options_info;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user