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:
Emma Anholt
2021-07-30 14:47:33 -07:00
committed by Rob Clark
parent fdf9ebf317
commit b080aa9466
9 changed files with 33 additions and 5 deletions

View File

@@ -124,11 +124,17 @@ pipe_loader_load_options(struct pipe_loader_device *dev)
const driOptionDescription *merged_driconf = const driOptionDescription *merged_driconf =
merge_driconf(driver_driconf, driver_count, &merged_count); merge_driconf(driver_driconf, driver_count, &merged_count);
driParseOptionInfo(&dev->option_info, merged_driconf, 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, driParseConfigFiles(&dev->option_cache, &dev->option_info, 0,
dev->driver_name, NULL, NULL, 0, NULL, 0); dev->driver_name, NULL, NULL, 0, NULL, 0);
free((void *)merged_driconf); }
} }
char * char *
@@ -161,6 +167,7 @@ pipe_loader_create_screen_vk(struct pipe_loader_device *dev, bool sw_vk)
util_cpu_detect(); util_cpu_detect();
pipe_loader_load_options(dev); pipe_loader_load_options(dev);
config.options_info = &dev->option_info;
config.options = &dev->option_cache; config.options = &dev->option_cache;
return dev->ops->create_screen(dev, &config, sw_vk); return dev->ops->create_screen(dev, &config, sw_vk);

View File

@@ -765,6 +765,9 @@ crocus_screen_create(int fd, const struct pipe_screen_config *config)
if (getenv("INTEL_NO_HW") != NULL) if (getenv("INTEL_NO_HW") != NULL)
screen->no_hw = true; screen->no_hw = true;
driParseConfigFiles(config->options, config->options_info, 0, "crocus",
NULL, NULL, 0, NULL, 0);
bool bo_reuse = false; bool bo_reuse = false;
int bo_reuse_mode = driQueryOptioni(config->options, "bo_reuse"); int bo_reuse_mode = driQueryOptioni(config->options, "bo_reuse");
switch (bo_reuse_mode) { switch (bo_reuse_mode) {

View File

@@ -811,6 +811,9 @@ iris_screen_create(int fd, const struct pipe_screen_config *config)
if (screen->devinfo.ver < 8 || screen->devinfo.is_cherryview) if (screen->devinfo.ver < 8 || screen->devinfo.is_cherryview)
return NULL; return NULL;
driParseConfigFiles(config->options, config->options_info, 0, "iris",
NULL, NULL, 0, NULL, 0);
bool bo_reuse = false; bool bo_reuse = false;
int bo_reuse_mode = driQueryOptioni(config->options, "bo_reuse"); int bo_reuse_mode = driQueryOptioni(config->options, "bo_reuse");
switch (bo_reuse_mode) { switch (bo_reuse_mode) {

View File

@@ -1399,6 +1399,9 @@ struct pipe_screen *radeonsi_screen_create(int fd, const struct pipe_screen_conf
drmVersionPtr version = drmGetVersion(fd); drmVersionPtr version = drmGetVersion(fd);
struct radeon_winsys *rw = NULL; struct radeon_winsys *rw = NULL;
driParseConfigFiles(config->options, config->options_info, 0, "radeonsi",
NULL, NULL, 0, NULL, 0);
switch (version->version_major) { switch (version->version_major) {
case 2: case 2:
rw = radeon_drm_winsys_create(fd, config, radeonsi_screen_create_impl); rw = radeon_drm_winsys_create(fd, config, radeonsi_screen_create_impl);

View File

@@ -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)) if (!v3d_get_device_info(screen->fd, &screen->devinfo, &v3d_ioctl))
goto fail; 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 /* We have to driCheckOption for the simulator mode to not assertion
* fail on not having our XML config. * fail on not having our XML config.
*/ */

View File

@@ -942,6 +942,9 @@ virgl_create_screen(struct virgl_winsys *vws, const struct pipe_screen_config *c
virgl_debug = debug_get_option_virgl_debug(); virgl_debug = debug_get_option_virgl_debug();
if (config && config->options) { if (config && config->options) {
driParseConfigFiles(config->options, config->options_info, 0, "virtio_gpu",
NULL, NULL, 0, NULL, 0);
screen->tweak_gles_emulate_bgra = screen->tweak_gles_emulate_bgra =
driQueryOptionb(config->options, VIRGL_GLES_EMULATE_BGRA); driQueryOptionb(config->options, VIRGL_GLES_EMULATE_BGRA);
screen->tweak_gles_apply_bgra_dest_swizzle = screen->tweak_gles_apply_bgra_dest_swizzle =

View File

@@ -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); slab_create_parent(&screen->transfer_pool, sizeof(struct zink_transfer), 16);
#if WITH_XMLCONFIG #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.dual_color_blend_by_location = driQueryOptionb(config->options, "dual_color_blend_by_location");
//screen->driconf.inline_uniforms = driQueryOptionb(config->options, "radeonsi_inline_uniforms"); //screen->driconf.inline_uniforms = driQueryOptionb(config->options, "radeonsi_inline_uniforms");
}
#endif #endif
screen->driconf.inline_uniforms = debug_get_bool_option("ZINK_INLINE_UNIFORMS", false); screen->driconf.inline_uniforms = debug_get_bool_option("ZINK_INLINE_UNIFORMS", false);

View File

@@ -59,6 +59,8 @@ const __DRIconfigOptionsExtension gallium_config_options = {
void void
dri_init_options(struct dri_screen *screen) dri_init_options(struct dri_screen *screen)
{ {
pipe_loader_config_options(screen->dev);
struct st_config_options *options = &screen->options; struct st_config_options *options = &screen->options;
const struct driOptionCache *optionCache = &screen->dev->option_cache; const struct driOptionCache *optionCache = &screen->dev->option_cache;

View File

@@ -611,7 +611,8 @@ struct pipe_screen {
* Global configuration options for screen creation. * Global configuration options for screen creation.
*/ */
struct pipe_screen_config { struct pipe_screen_config {
const struct driOptionCache *options; struct driOptionCache *options;
const struct driOptionCache *options_info;
}; };