[PATCH] gallium/st: force anisotropy setting in driconf

Carl-Philip Haensch (none) carli at carli-laptop.
Thu May 19 12:45:55 PDT 2011


---
 src/gallium/include/state_tracker/st_api.h         |    6 ++++-
 .../state_trackers/dri/common/dri_context.c        |    5 ++-
 src/gallium/state_trackers/dri/common/dri_screen.c |   25 ++++++++++++-----=
--
 src/gallium/state_trackers/dri/common/dri_screen.h |    2 +-
 src/mesa/state_tracker/st_atom_sampler.c           |    5 ++-
 src/mesa/state_tracker/st_context.h                |    1 +
 src/mesa/state_tracker/st_manager.c                |    4 ++-
 7 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/includ=
e/state_tracker/st_api.h
index d4973a1..b6e8262 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -136,7 +136,11 @@ enum st_manager_param {
     * For the mesa state tracker that means that it needs to invalidate
     * the framebuffer in glViewport itself.
     */
-   ST_MANAGER_BROKEN_INVALIDATE
+   ST_MANAGER_BROKEN_INVALIDATE,
+   /**
+    * This parameter represents the global forced anisotropy.
+    */
+   ST_GLOBAL_ANISOTROPY
 };
=20
 /**
diff --git a/src/gallium/state_trackers/dri/common/dri_context.c b/src/galli=
um/state_trackers/dri/common/dri_context.c
index e23c1bc..73ac43b 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -37,6 +37,7 @@
=20
 #include "pipe/p_context.h"
 #include "state_tracker/st_context.h"
+#include "state_tracker/drm_driver.h"
=20
 static void
 dri_init_extensions(struct dri_context *ctx)
@@ -86,8 +87,8 @@ dri_create_context(gl_api api, const struct gl_config * vi=
sual,
    ctx->lock =3D screen->drmLock;
=20
    driParseConfigFiles(&ctx->optionCache,
-=09=09       &screen->optionCache, sPriv->myNum, "dri");
-
+=09=09       &screen->optionCache, sPriv->myNum, driver_descriptor.name);
+   screen->global_optionCache =3D &ctx->optionCache;
    dri_fill_st_visual(&attribs.visual, screen, visual);
    ctx->st =3D stapi->create_context(stapi, &screen->base, &attribs, st_sha=
re);
    if (ctx->st =3D=3D NULL)
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/galliu=
m/state_trackers/dri/common/dri_screen.c
index 5931df9..46f9984 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -42,15 +42,20 @@
 #include "util/u_debug.h"
=20
 PUBLIC const char __driConfigOptions[] =3D
-   DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE
-   DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
-   DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
-   DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY
-/* DRI_CONF_FORCE_S3TC_ENABLE(false) */
-   DRI_CONF_ALLOW_LARGE_TEXTURES(1)
-   DRI_CONF_SECTION_END DRI_CONF_END;
-
-static const uint __driNConfigOptions =3D 3;
+   DRI_CONF_BEGIN
+      DRI_CONF_SECTION_PERFORMANCE
+         DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
+         DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
+      DRI_CONF_SECTION_END
+  =20
+      DRI_CONF_SECTION_QUALITY
+         /*DRI_CONF_FORCE_S3TC_ENABLE(false)*/
+         DRI_CONF_ALLOW_LARGE_TEXTURES(1)
+         DRI_CONF_DEF_MAX_ANISOTROPY(1.0, "1.0,2.0,4.0,8.0,16.0")
+      DRI_CONF_SECTION_END
+   DRI_CONF_END;
+
+static const uint __driNConfigOptions =3D 4;
=20
 static const __DRIconfig **
 dri_fill_in_modes(struct dri_screen *screen,
@@ -321,6 +326,8 @@ dri_get_param(struct st_manager *smapi,
    switch(param) {
    case ST_MANAGER_BROKEN_INVALIDATE:
       return screen->broken_invalidate;
+   case ST_GLOBAL_ANISOTROPY:
+      return (int)driQueryOptionf(screen->global_optionCache, "def_max_anis=
otropy");
    default:
       return 0;
    }
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.h b/src/galliu=
m/state_trackers/dri/common/dri_screen.h
index 8cb0a10..cf1b1fc 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.h
+++ b/src/gallium/state_trackers/dri/common/dri_screen.h
@@ -58,7 +58,7 @@ struct dri_screen
    /**
     * Configuration cache with default values for all contexts
     */
-   driOptionCache optionCache;
+   driOptionCache optionCache, *global_optionCache;
=20
    /* drm */
    int fd;
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_track=
er/st_atom_sampler.c
index 06024ad..0dba553 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -177,8 +177,9 @@ static void convert_sampler(struct st_context *st,
 =09=09=09  sampler->border_color);
     }
=20
-    sampler->max_anisotropy =3D (msamp->MaxAnisotropy =3D=3D 1.0 ?
-=09=09=09       0 : (GLuint) msamp->MaxAnisotropy);
+    sampler->max_anisotropy =3D MAX2((msamp->MaxAnisotropy =3D=3D 1.0 ?
+=09=09=09       0 : (GLuint) msamp->MaxAnisotropy),
+=09=09=09       st->min_anisotropy);
=20
     /* only care about ARB_shadow, not SGI shadow */
     if (msamp->CompareMode =3D=3D GL_COMPARE_R_TO_TEXTURE) {
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st=
_context.h
index c6fc318..4d1aba6 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -187,6 +187,7 @@ struct st_context
    struct cso_context *cso_context;
=20
    int force_msaa;
+   float min_anisotropy;
    void *winsys_drawable_handle;
=20
    /* User vertex buffers. */
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st=
_manager.c
index a68544d..4d677a4 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -694,7 +694,9 @@ st_api_create_context(struct st_api *stapi, struct st_ma=
nager *smapi,
=20
    st->invalidate_on_gl_viewport =3D
       smapi->get_param(smapi, ST_MANAGER_BROKEN_INVALIDATE);
-
+   st->force_msaa =3D 0; // ToDo: Ask driconf for it
+   st->min_anisotropy =3D (float)smapi->get_param(smapi, ST_GLOBAL_ANISOTRO=
PY);
+  =20
    st->iface.destroy =3D st_context_destroy;
    st->iface.notify_invalid_framebuffer =3D
       st_context_notify_invalid_framebuffer;
--=20
1.7.1


--=_6x3jsy9c7rg5--


More information about the mesa-dev mailing list