diff options
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/util/u_format_s3tc.c | 12 | ||||
-rw-r--r-- | src/gallium/include/state_tracker/st_api.h | 1 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/common/dri_context.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/common/dri_screen.c | 19 | ||||
-rw-r--r-- | src/gallium/state_trackers/osmesa/osmesa.c | 1 |
5 files changed, 23 insertions, 12 deletions
diff --git a/src/gallium/auxiliary/util/u_format_s3tc.c b/src/gallium/auxiliary/util/u_format_s3tc.c index fd628157b60..11b46020bc3 100644 --- a/src/gallium/auxiliary/util/u_format_s3tc.c +++ b/src/gallium/auxiliary/util/u_format_s3tc.c @@ -111,7 +111,6 @@ util_format_s3tc_init(void) util_dl_proc fetch_2d_texel_rgba_dxt3; util_dl_proc fetch_2d_texel_rgba_dxt5; util_dl_proc tx_compress_dxtn; - char *force_s3tc_enable; if (!first_time) return; @@ -122,15 +121,8 @@ util_format_s3tc_init(void) library = util_dl_open(DXTN_LIBNAME); if (!library) { - if ((force_s3tc_enable = getenv("force_s3tc_enable")) && - !strcmp(force_s3tc_enable, "true")) { - debug_printf("couldn't open " DXTN_LIBNAME ", enabling DXTn due to " - "force_s3tc_enable=true environment variable\n"); - util_format_s3tc_enabled = TRUE; - } else { - debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn " - "compression/decompression unavailable\n"); - } + debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn " + "compression/decompression unavailable\n"); return; } diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h index fd6d04c4a3d..2c178b6951d 100644 --- a/src/gallium/include/state_tracker/st_api.h +++ b/src/gallium/include/state_tracker/st_api.h @@ -242,6 +242,7 @@ struct st_config_options boolean force_glsl_extensions_warn; boolean disable_glsl_line_continuations; boolean disable_blend_func_extended; + boolean force_s3tc_enable; }; /** diff --git a/src/gallium/state_trackers/dri/common/dri_context.c b/src/gallium/state_trackers/dri/common/dri_context.c index 5794e487158..ab80fc75bd4 100644 --- a/src/gallium/state_trackers/dri/common/dri_context.c +++ b/src/gallium/state_trackers/dri/common/dri_context.c @@ -58,6 +58,8 @@ static void dri_fill_st_options(struct st_config_options *options, driQueryOptionb(optionCache, "disable_glsl_line_continuations"); options->disable_blend_func_extended = driQueryOptionb(optionCache, "disable_blend_func_extended"); + options->force_s3tc_enable = + driQueryOptionb(optionCache, "force_s3tc_enable"); } GLboolean diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c index c8aed63f1d3..ca17742eb5b 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.c +++ b/src/gallium/state_trackers/dri/common/dri_screen.c @@ -41,6 +41,7 @@ #include "state_tracker/drm_driver.h" #include "util/u_debug.h" +#include "util/u_format_s3tc.h" #define MSAA_VISUAL_MAX_SAMPLES 32 @@ -54,7 +55,7 @@ PUBLIC const char __driConfigOptions[] = DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY -/* DRI_CONF_FORCE_S3TC_ENABLE("false") */ + DRI_CONF_FORCE_S3TC_ENABLE("false") DRI_CONF_PP_CELSHADE(0) DRI_CONF_PP_NORED(0) DRI_CONF_PP_NOGREEN(0) @@ -76,7 +77,7 @@ PUBLIC const char __driConfigOptions[] = #define false 0 -static const uint __driNConfigOptions = 12; +static const uint __driNConfigOptions = 13; static const __DRIconfig ** dri_fill_in_modes(struct dri_screen *screen) @@ -416,6 +417,20 @@ dri_init_screen_helper(struct dri_screen *screen, screen->sPriv->myNum, driver_descriptor.name); + /* Handle force_s3tc_enable. */ + if (!util_format_s3tc_enabled && + driQueryOptionb(&screen->optionCache, "force_s3tc_enable")) { + /* Ensure libtxc_dxtn has been loaded if available. + * Forcing S3TC on before calling this would prevent loading + * the library. + * This is just a precaution, the driver should have called it + * already. + */ + util_format_s3tc_init(); + + util_format_s3tc_enabled = TRUE; + } + return dri_fill_in_modes(screen); } diff --git a/src/gallium/state_trackers/osmesa/osmesa.c b/src/gallium/state_trackers/osmesa/osmesa.c index 5908316dc81..594372bd725 100644 --- a/src/gallium/state_trackers/osmesa/osmesa.c +++ b/src/gallium/state_trackers/osmesa/osmesa.c @@ -545,6 +545,7 @@ OSMesaCreateContextExt(GLenum format, GLint depthBits, GLint stencilBits, attribs.options.force_glsl_extensions_warn = FALSE; attribs.options.disable_blend_func_extended = FALSE; attribs.options.disable_glsl_line_continuations = FALSE; + attribs.options.force_s3tc_enable = FALSE; osmesa_init_st_visual(&attribs.visual, PIPE_FORMAT_R8G8B8A8_UNORM, |