summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/savage
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/savage')
-rw-r--r--src/mesa/drivers/dri/savage/savage_init.h5
-rw-r--r--src/mesa/drivers/dri/savage/savage_xmesa.c38
-rw-r--r--src/mesa/drivers/dri/savage/savagecontext.h7
-rw-r--r--src/mesa/drivers/dri/savage/savagestate.c10
-rw-r--r--src/mesa/drivers/dri/savage/savagetex.c8
5 files changed, 63 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/savage/savage_init.h b/src/mesa/drivers/dri/savage/savage_init.h
index f632c91f073..1454b6b36c8 100644
--- a/src/mesa/drivers/dri/savage/savage_init.h
+++ b/src/mesa/drivers/dri/savage/savage_init.h
@@ -32,6 +32,8 @@
#include "dri_util.h"
#include "mtypes.h"
+#include "xmlconfig.h"
+
typedef struct {
drm_handle_t handle;
drmSize size;
@@ -76,6 +78,9 @@ typedef struct {
drmBufMapPtr bufs;
int use_copy_buf;
unsigned int sarea_priv_offset;
+
+ /* Configuration cache with default values for all contexts */
+ driOptionCache optionCache;
} savageScreenPrivate;
diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c
index c8eb69160f8..5bbc7c5ba1a 100644
--- a/src/mesa/drivers/dri/savage/savage_xmesa.c
+++ b/src/mesa/drivers/dri/savage/savage_xmesa.c
@@ -57,6 +57,22 @@
#include "savagedma.h"
+#include "xmlpool.h"
+
+/* Configuration
+ */
+const char __driConfigOptions[] =
+DRI_CONF_BEGIN
+ DRI_CONF_SECTION_QUALITY
+ DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB)
+ DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
+ DRI_CONF_SECTION_END
+ DRI_CONF_SECTION_PERFORMANCE
+ DRI_CONF_MAX_TEXTURE_UNITS(2,1,2)
+ DRI_CONF_SECTION_END
+DRI_CONF_END;
+static const GLuint __driNConfigOptions = 3;
+
#ifdef USE_NEW_INTERFACE
static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
#endif /* USE_NEW_INTERFACE */
@@ -202,6 +218,10 @@ savageInitDriver(__DRIscreenPrivate *sPriv)
return GL_FALSE;
}
+ /* parse information in __driConfigOptions */
+ driParseOptionInfo (&savageScreen->optionCache,
+ __driConfigOptions, __driNConfigOptions);
+
#if 0
savageDDFastPathInit();
savageDDTrifuncInit();
@@ -217,7 +237,9 @@ savageDestroyScreen(__DRIscreenPrivate *sPriv)
{
savageScreenPrivate *savageScreen = (savageScreenPrivate *)sPriv->private;
-
+ /* free all option information */
+ driDestroyOptionInfo (&savageScreen->optionCache);
+
Xfree(savageScreen);
sPriv->private = NULL;
}
@@ -287,10 +309,24 @@ savageCreateContext( const __GLcontextModes *mesaVis,
}
driContextPriv->driverPrivate = imesa;
+ /* Parse configuration files */
+ driParseConfigFiles (&imesa->optionCache, &savageScreen->optionCache,
+ sPriv->myNum, "savage");
+
+ imesa->texture_depth = driQueryOptioni (&imesa->optionCache,
+ "texture_depth");
+ if (imesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)
+ imesa->texture_depth = ( savageScreen->cpp == 4 ) ?
+ DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16;
+
if (savageScreen->chipset >= S3_SAVAGE4)
ctx->Const.MaxTextureUnits = 2;
else
ctx->Const.MaxTextureUnits = 1;
+ if (driQueryOptioni(&imesa->optionCache, "texture_units") <
+ ctx->Const.MaxTextureUnits)
+ ctx->Const.MaxTextureUnits =
+ driQueryOptioni(&imesa->optionCache, "texture_units");
ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits;
diff --git a/src/mesa/drivers/dri/savage/savagecontext.h b/src/mesa/drivers/dri/savage/savagecontext.h
index 5ea40cea4b6..501b98adc13 100644
--- a/src/mesa/drivers/dri/savage/savagecontext.h
+++ b/src/mesa/drivers/dri/savage/savagecontext.h
@@ -44,6 +44,8 @@ typedef struct savage_texture_object_t *savageTextureObjectPtr;
#include "savagetex.h"
#include "savagedma.h"
+#include "xmlconfig.h"
+
/* Reasons to fallback on all primitives.
*/
#define SAVAGE_FALLBACK_TEXTURE 0x1
@@ -259,6 +261,11 @@ struct savage_context_t {
volatile GLuint *eventTag1;
GLuint shadowCounter;
GLboolean shadowStatus;
+
+ /* Configuration cache
+ */
+ driOptionCache optionCache;
+ int texture_depth;
};
#define SAVAGE_CONTEXT(ctx) ((savageContextPtr)(ctx->DriverCtx))
diff --git a/src/mesa/drivers/dri/savage/savagestate.c b/src/mesa/drivers/dri/savage/savagestate.c
index 04d8f0870cb..f4f22602d8d 100644
--- a/src/mesa/drivers/dri/savage/savagestate.c
+++ b/src/mesa/drivers/dri/savage/savagestate.c
@@ -46,6 +46,8 @@
#include "tnl/tnl.h"
#include "swrast_setup/swrast_setup.h"
+#include "xmlpool.h"
+
static void savageBlendFunc_s4(GLcontext *);
static void savageBlendFunc_s3d(GLcontext *);
@@ -1619,7 +1621,9 @@ static void savageDDInitState_s4( savageContextPtr imesa )
imesa->regs.s4.drawLocalCtrl.ni.flushPdDestWrites= GL_TRUE;
imesa->regs.s4.drawLocalCtrl.ni.zUpdateEn= GL_TRUE;
- imesa->regs.s4.drawCtrl1.ni.ditherEn=GL_TRUE;
+ imesa->regs.s4.drawCtrl1.ni.ditherEn = (
+ driQueryOptioni(&imesa->optionCache, "color_reduction") ==
+ DRI_CONF_COLOR_REDUCTION_DITHER) ? GL_TRUE : GL_FALSE;
imesa->regs.s4.drawCtrl1.ni.cullMode = BCM_None;
imesa->regs.s4.zBufCtrl.ni.stencilRefVal = 0x00;
@@ -1684,7 +1688,9 @@ static void savageDDInitState_s3d( savageContextPtr imesa )
imesa->regs.s3d.drawCtrl.ni.flushPdZbufWrites = GL_TRUE;
imesa->regs.s3d.drawCtrl.ni.flushPdDestWrites = GL_TRUE;
- imesa->regs.s3d.drawCtrl.ni.ditherEn = GL_TRUE;
+ imesa->regs.s3d.drawCtrl.ni.ditherEn = (
+ driQueryOptioni(&imesa->optionCache, "color_reduction") ==
+ DRI_CONF_COLOR_REDUCTION_DITHER) ? GL_TRUE : GL_FALSE;
imesa->regs.s3d.drawCtrl.ni.cullMode = BCM_None;
imesa->LcsCullMode = BCM_None;
diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c
index edb016f1523..ade318cdc9f 100644
--- a/src/mesa/drivers/dri/savage/savagetex.c
+++ b/src/mesa/drivers/dri/savage/savagetex.c
@@ -44,6 +44,8 @@
#include "swrast/swrast.h"
+#include "xmlpool.h"
+
/* Size 1, 2 and 4 images are packed into the last subtile. Each image
* is repeated to fill a 4x4 pixel area. The figure below shows the
* layout of those 4x4 pixel areas in the 8x8 subtile.
@@ -325,8 +327,10 @@ savageChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
- const GLboolean do32bpt = GL_FALSE;
- const GLboolean force16bpt = GL_FALSE;
+ const GLboolean do32bpt =
+ ( imesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_32 );
+ const GLboolean force16bpt =
+ ( imesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FORCE_16 );
const GLboolean isSavage4 = (imesa->savageScreen->chipset >= S3_SAVAGE4);
(void) format;
(void) type;