This attached patch should enable an option for forcing anisotropy
from driconf.
Please comment or push if it's ok.
>From 79e2c7785ab0398eaf7a2ebc70ef980a26b7ca3a Mon Sep 17 00:00:00 2001
From: Carl-Philip Haensch <carli@carli-laptop.(none)>
Date: Thu, 19 May 2011 21:45:55 +0200
Subject: [PATCH] gallium/st: force anisotropy setting in driconf
---
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/include/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
};
/**
diff --git a/src/gallium/state_trackers/dri/common/dri_context.c
b/src/gallium/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 @@
#include "pipe/p_context.h"
#include "state_tracker/st_context.h"
+#include "state_tracker/drm_driver.h"
static void
dri_init_extensions(struct dri_context *ctx)
@@ -86,8 +87,8 @@ dri_create_context(gl_api api, const struct gl_config *
visual,
ctx->lock = screen->drmLock;
driParseConfigFiles(&ctx->optionCache,
- &screen->optionCache, sPriv->myNum, "dri");
-
+ &screen->optionCache, sPriv->myNum,
driver_descriptor.name);
+ screen->global_optionCache = &ctx->optionCache;
dri_fill_st_visual(&attribs.visual, screen, visual);
ctx->st = stapi->create_context(stapi, &screen->base, &attribs, st_share);
if (ctx->st == NULL)
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c
b/src/gallium/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"
PUBLIC const char __driConfigOptions[] =
- 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 = 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
+
+ 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 = 4;
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_anisotropy");
default:
return 0;
}
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.h
b/src/gallium/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;
/* drm */
int fd;
diff --git a/src/mesa/state_tracker/st_atom_sampler.c
b/src/mesa/state_tracker/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,
sampler->border_color);
}
- sampler->max_anisotropy = (msamp->MaxAnisotropy == 1.0 ?
- 0 : (GLuint) msamp->MaxAnisotropy);
+ sampler->max_anisotropy = MAX2((msamp->MaxAnisotropy == 1.0 ?
+ 0 : (GLuint) msamp->MaxAnisotropy),
+ st->min_anisotropy);
/* only care about ARB_shadow, not SGI shadow */
if (msamp->CompareMode == 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;
int force_msaa;
+ float min_anisotropy;
void *winsys_drawable_handle;
/* 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_manager *smapi,
st->invalidate_on_gl_viewport =
smapi->get_param(smapi, ST_MANAGER_BROKEN_INVALIDATE);
-
+ st->force_msaa = 0; // ToDo: Ask driconf for it
+ st->min_anisotropy = (float)smapi->get_param(smapi, ST_GLOBAL_ANISOTROPY);
+
st->iface.destroy = st_context_destroy;
st->iface.notify_invalid_framebuffer =
st_context_notify_invalid_framebuffer;
--
1.7.1
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev