diff options
author | Nicolai Hähnle <[email protected]> | 2017-06-28 17:50:19 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2017-08-02 09:50:57 +0200 |
commit | e794f8bf8bdb7cd0820251b46a9387ea5a7316da (patch) | |
tree | cda2f6ab2301d409ce404f13ab5b4bfcbe3588a9 /src/gallium/state_trackers | |
parent | 678dadf1237a3fb492ee2d8daa32d0205dea59ba (diff) |
gallium: move loading of drirc to pipe-loader
v2: rebase compile fix: addition of mesa_no_error
Reviewed-by: Marek Olšák <[email protected]> (v1)
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/dri/dri2.c | 18 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/dri_context.c | 5 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/dri_screen.c | 41 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/dri_screen.h | 10 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/drisw.c | 2 |
5 files changed, 21 insertions, 55 deletions
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c index ab85cc2452e..0f71adc7689 100644 --- a/src/gallium/state_trackers/dri/dri2.c +++ b/src/gallium/state_trackers/dri/dri2.c @@ -1941,10 +1941,10 @@ dri2GalliumConfigQueryb(__DRIscreen *sPriv, const char *var, { struct dri_screen *screen = dri_screen(sPriv); - if (!driCheckOption(&screen->optionCache, var, DRI_BOOL)) + if (!driCheckOption(&screen->dev->option_cache, var, DRI_BOOL)) return dri2ConfigQueryExtension.configQueryb(sPriv, var, val); - *val = driQueryOptionb(&screen->optionCache, var); + *val = driQueryOptionb(&screen->dev->option_cache, var); return 0; } @@ -1957,11 +1957,11 @@ dri2GalliumConfigQueryi(__DRIscreen *sPriv, const char *var, int *val) { struct dri_screen *screen = dri_screen(sPriv); - if (!driCheckOption(&screen->optionCache, var, DRI_INT) && - !driCheckOption(&screen->optionCache, var, DRI_ENUM)) + if (!driCheckOption(&screen->dev->option_cache, var, DRI_INT) && + !driCheckOption(&screen->dev->option_cache, var, DRI_ENUM)) return dri2ConfigQueryExtension.configQueryi(sPriv, var, val); - *val = driQueryOptioni(&screen->optionCache, var); + *val = driQueryOptioni(&screen->dev->option_cache, var); return 0; } @@ -1974,10 +1974,10 @@ dri2GalliumConfigQueryf(__DRIscreen *sPriv, const char *var, float *val) { struct dri_screen *screen = dri_screen(sPriv); - if (!driCheckOption(&screen->optionCache, var, DRI_FLOAT)) + if (!driCheckOption(&screen->dev->option_cache, var, DRI_FLOAT)) return dri2ConfigQueryExtension.configQueryf(sPriv, var, val); - *val = driQueryOptionf(&screen->optionCache, var); + *val = driQueryOptionf(&screen->dev->option_cache, var); return 0; } @@ -2059,7 +2059,7 @@ dri2_init_screen(__DRIscreen * sPriv) struct pipe_screen_config config = {}; config.flags = - dri_init_options_get_screen_flags(screen, screen->dev->driver_name); + dri_init_options_get_screen_flags(screen); pscreen = pipe_loader_create_screen(screen->dev, &config); } @@ -2154,7 +2154,7 @@ dri_kms_init_screen(__DRIscreen * sPriv) struct pipe_screen_config config = {}; - config.flags = dri_init_options_get_screen_flags(screen, "swrast"); + config.flags = dri_init_options_get_screen_flags(screen); if (pipe_loader_sw_probe_kms(&screen->dev, fd)) pscreen = pipe_loader_create_screen(screen->dev, &config); diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c index 8c3797e4285..8b9323faa4f 100644 --- a/src/gallium/state_trackers/dri/dri_context.c +++ b/src/gallium/state_trackers/dri/dri_context.c @@ -37,6 +37,7 @@ #include "state_tracker/drm_driver.h" #include "pipe/p_context.h" +#include "pipe-loader/pipe_loader.h" #include "state_tracker/st_context.h" GLboolean @@ -124,7 +125,7 @@ dri_create_context(gl_api api, const struct gl_config * visual, ctx->cPriv = cPriv; ctx->sPriv = sPriv; - if (driQueryOptionb(&screen->optionCache, "mesa_no_error")) + if (driQueryOptionb(&screen->dev->option_cache, "mesa_no_error")) attribs.flags |= ST_CONTEXT_FLAG_NO_ERROR; attribs.options = screen->options; @@ -167,7 +168,7 @@ dri_create_context(gl_api api, const struct gl_config * visual, /* Do this last. */ if (ctx->st->start_thread && - driQueryOptionb(&screen->optionCache, "mesa_glthread")) { + driQueryOptionb(&screen->dev->option_cache, "mesa_glthread")) { if (backgroundCallable && backgroundCallable->base.version >= 2 && backgroundCallable->isThreadSafe) { diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c index 79d7282b511..1fa0347d644 100644 --- a/src/gallium/state_trackers/dri/dri_screen.c +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -59,7 +59,7 @@ static void dri_fill_st_options(struct dri_screen *screen) { struct st_config_options *options = &screen->options; - const struct driOptionCache *optionCache = &screen->optionCache; + const struct driOptionCache *optionCache = &screen->dev->option_cache; options->disable_blend_func_extended = driQueryOptionb(optionCache, "disable_blend_func_extended"); @@ -156,7 +156,7 @@ dri_fill_in_modes(struct dri_screen *screen) GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML }; - if (driQueryOptionb(&screen->optionCache, "always_have_depth_buffer")) { + if (driQueryOptionb(&screen->dev->option_cache, "always_have_depth_buffer")) { /* all visuals will have a depth buffer */ depth_buffer_factor = 0; } @@ -416,28 +416,6 @@ dri_get_param(struct st_manager *smapi, } } -static void -dri_destroy_option_cache(struct dri_screen * screen) -{ - int i; - - if (screen->optionCache.info) { - for (i = 0; i < (1 << screen->optionCache.tableSize); ++i) { - free(screen->optionCache.info[i].name); - free(screen->optionCache.info[i].ranges); - } - free(screen->optionCache.info); - } - - free(screen->optionCache.values); - - /* Default values are copied to screen->optionCache->values in - * initOptionCache. The info field, however, is a pointer copy, so don't free - * that twice. - */ - free(screen->optionCacheDefaults.values); -} - void dri_destroy_screen_helper(struct dri_screen * screen) { @@ -450,7 +428,6 @@ dri_destroy_screen_helper(struct dri_screen * screen) if (screen->base.screen) screen->base.screen->destroy(screen->base.screen); - dri_destroy_option_cache(screen); mtx_destroy(&screen->opencl_func_mutex); } @@ -474,7 +451,7 @@ dri_postprocessing_init(struct dri_screen *screen) unsigned i; for (i = 0; i < PP_FILTERS; i++) { - screen->pp_enabled[i] = driQueryOptioni(&screen->optionCache, + screen->pp_enabled[i] = driQueryOptioni(&screen->dev->option_cache, pp_filters[i].name); } } @@ -499,19 +476,15 @@ dri_set_background_context(struct st_context_iface *st, } unsigned -dri_init_options_get_screen_flags(struct dri_screen *screen, - const char* driver_name) +dri_init_options_get_screen_flags(struct dri_screen *screen) { unsigned flags = 0; - driParseOptionInfo(&screen->optionCacheDefaults, gallium_config_options.xml); - driParseConfigFiles(&screen->optionCache, - &screen->optionCacheDefaults, - screen->sPriv->myNum, - driver_name); + pipe_loader_load_options(screen->dev); + dri_fill_st_options(screen); - if (driQueryOptionb(&screen->optionCache, + if (driQueryOptionb(&screen->dev->option_cache, "glsl_correct_derivatives_after_discard")) flags |= PIPE_SCREEN_ENABLE_CORRECT_TGSI_DERIVATIVES_AFTER_KILL; diff --git a/src/gallium/state_trackers/dri/dri_screen.h b/src/gallium/state_trackers/dri/dri_screen.h index 383e762393e..b8b27c30222 100644 --- a/src/gallium/state_trackers/dri/dri_screen.h +++ b/src/gallium/state_trackers/dri/dri_screen.h @@ -33,7 +33,6 @@ #define DRI_SCREEN_H #include "dri_util.h" -#include "util/xmlconfig.h" #include "pipe/p_compiler.h" #include "pipe/p_context.h" @@ -61,12 +60,6 @@ struct dri_screen boolean throttling_enabled; int default_throttle_frames; - /** Configuration cache with default values for all contexts */ - driOptionCache optionCacheDefaults; - - /** The screen's effective configuration options */ - driOptionCache optionCache; - struct st_config_options options; /* Which postprocessing filters are enabled. */ @@ -138,8 +131,7 @@ dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen, const struct gl_config *mode); unsigned -dri_init_options_get_screen_flags(struct dri_screen *screen, - const char* driver_name); +dri_init_options_get_screen_flags(struct dri_screen *screen); const __DRIconfig ** dri_init_screen_helper(struct dri_screen *screen, diff --git a/src/gallium/state_trackers/dri/drisw.c b/src/gallium/state_trackers/dri/drisw.c index 10d1c8d1e4d..d064bb0d4a3 100644 --- a/src/gallium/state_trackers/dri/drisw.c +++ b/src/gallium/state_trackers/dri/drisw.c @@ -402,7 +402,7 @@ drisw_init_screen(__DRIscreen * sPriv) struct pipe_screen_config config; - config.flags = dri_init_options_get_screen_flags(screen, "swrast"); + config.flags = dri_init_options_get_screen_flags(screen); if (pipe_loader_sw_probe_dri(&screen->dev, &drisw_lf)) pscreen = pipe_loader_create_screen(screen->dev, &config); |