gallium: pass st_config_options to query_versions
authorMarek Olšák <marek.olsak@amd.com>
Sun, 3 Aug 2014 11:58:20 +0000 (13:58 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 11 Aug 2014 19:53:57 +0000 (21:53 +0200)
So move it from dri_context to dri_screen.
This will be needed for version computations.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/include/state_tracker/st_api.h
src/gallium/state_trackers/dri/dri_context.c
src/gallium/state_trackers/dri/dri_screen.c
src/gallium/state_trackers/dri/dri_screen.h
src/gallium/state_trackers/vega/vg_manager.c
src/mesa/state_tracker/st_manager.c

index 4e563330c4dbc13849310a02c75fe0481ae6ce25..86fdc6988ab3c417f4883a250b6e0c0526442f83 100644 (file)
@@ -490,6 +490,7 @@ struct st_api
     * The format is (major*10+minor).
     */
    void (*query_versions)(struct st_api *stapi, struct st_manager *sm,
+                          struct st_config_options *options,
                           int *gl_core_version,
                           int *gl_compat_version,
                           int *gl_es1_version,
index 827f847ea078971f38fdb05fd204ff99ec7b4382..fe3240ae1fa214c2d4d9b747f41088f589ad4e99 100644 (file)
 #include "pipe/p_context.h"
 #include "state_tracker/st_context.h"
 
-static void
-dri_fill_st_options(struct st_config_options *options,
-                    const struct driOptionCache * optionCache)
-{
-   options->disable_blend_func_extended =
-      driQueryOptionb(optionCache, "disable_blend_func_extended");
-   options->disable_glsl_line_continuations =
-      driQueryOptionb(optionCache, "disable_glsl_line_continuations");
-   options->disable_shader_bit_encoding =
-      driQueryOptionb(optionCache, "disable_shader_bit_encoding");
-   options->force_glsl_extensions_warn =
-      driQueryOptionb(optionCache, "force_glsl_extensions_warn");
-   options->force_glsl_version =
-      driQueryOptioni(optionCache, "force_glsl_version");
-   options->force_s3tc_enable =
-      driQueryOptionb(optionCache, "force_s3tc_enable");
-   options->allow_glsl_extension_directive_midshader =
-      driQueryOptionb(optionCache, "allow_glsl_extension_directive_midshader");
-}
-
 GLboolean
 dri_create_context(gl_api api, const struct gl_config * visual,
                   __DRIcontext * cPriv,
@@ -127,7 +107,7 @@ dri_create_context(gl_api api, const struct gl_config * visual,
    ctx->cPriv = cPriv;
    ctx->sPriv = sPriv;
 
-   dri_fill_st_options(&attribs.options, &screen->optionCache);
+   attribs.options = screen->options;
    dri_fill_st_visual(&attribs.visual, screen, visual);
    ctx->st = stapi->create_context(stapi, &screen->base, &attribs, &ctx_err,
                                   st_share);
index 697ebee0fb136157b46849cfe0fcb2b9cdbb6af9..fdcedcba555be9603ce77acdedcbd0fd23768a6d 100644 (file)
@@ -80,6 +80,26 @@ const __DRIconfigOptionsExtension gallium_config_options = {
 
 #define false 0
 
+static void
+dri_fill_st_options(struct st_config_options *options,
+                    const struct driOptionCache * optionCache)
+{
+   options->disable_blend_func_extended =
+      driQueryOptionb(optionCache, "disable_blend_func_extended");
+   options->disable_glsl_line_continuations =
+      driQueryOptionb(optionCache, "disable_glsl_line_continuations");
+   options->disable_shader_bit_encoding =
+      driQueryOptionb(optionCache, "disable_shader_bit_encoding");
+   options->force_glsl_extensions_warn =
+      driQueryOptionb(optionCache, "force_glsl_extensions_warn");
+   options->force_glsl_version =
+      driQueryOptioni(optionCache, "force_glsl_version");
+   options->force_s3tc_enable =
+      driQueryOptionb(optionCache, "force_s3tc_enable");
+   options->allow_glsl_extension_directive_midshader =
+      driQueryOptionb(optionCache, "allow_glsl_extension_directive_midshader");
+}
+
 static const __DRIconfig **
 dri_fill_in_modes(struct dri_screen *screen)
 {
@@ -439,9 +459,10 @@ dri_init_screen_helper(struct dri_screen *screen,
                        screen->sPriv->myNum,
                        driver_name);
 
+   dri_fill_st_options(&screen->options, &screen->optionCache);
+
    /* Handle force_s3tc_enable. */
-   if (!util_format_s3tc_enabled &&
-       driQueryOptionb(&screen->optionCache, "force_s3tc_enable")) {
+   if (!util_format_s3tc_enabled && screen->options.force_s3tc_enable) {
       /* Ensure libtxc_dxtn has been loaded if available.
        * Forcing S3TC on before calling this would prevent loading
        * the library.
@@ -456,6 +477,7 @@ dri_init_screen_helper(struct dri_screen *screen,
    dri_postprocessing_init(screen);
 
    screen->st_api->query_versions(screen->st_api, &screen->base,
+                                  &screen->options,
                                   &screen->sPriv->max_gl_core_version,
                                   &screen->sPriv->max_gl_compat_version,
                                   &screen->sPriv->max_gl_es1_version,
index 07c989807f39a504b310139ebe410fd6b55a4234..e4a1a39aa219eb68fdf083acdb025bd2839d8be9 100644 (file)
@@ -65,6 +65,8 @@ struct dri_screen
    /** The screen's effective configuration options */
    driOptionCache optionCache;
 
+   struct st_config_options options;
+
    /* Which postprocessing filters are enabled. */
    unsigned pp_enabled[PP_FILTERS];
 
index 2894428a8bc74bf8e8da1bd4217c630c74ea2500..7960b0692c32365da775d87f6c9e0629e5063d3b 100644 (file)
@@ -371,6 +371,7 @@ vg_api_destroy(struct st_api *stapi)
 
 static void
 vg_api_query_versions(struct st_api *stapi, struct st_manager *sm,
+                      struct st_config_options *options,
                       int *gl_core_version,
                       int *gl_compat_version,
                       int *gl_es1_version,
index dd9597be766182e28bf81e2091fb69f27cb58ce0..09854221a5cd4b24e5b05b4c73589bc1a769685e 100644 (file)
@@ -912,6 +912,7 @@ st_manager_add_color_renderbuffer(struct st_context *st,
 
 static void
 st_api_query_versions(struct st_api *stapi, struct st_manager *sm,
+                      struct st_config_options *options,
                       int *gl_core_version,
                       int *gl_compat_version,
                       int *gl_es1_version,