summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2005-01-28 12:25:00 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2005-01-28 12:25:00 +0000
commite742e95cf9df472f1b9aa98a263e3236c7bf008e (patch)
tree39f7912c5e36feb8a89556d8c8d26f38732286fd
parenta2b9062a09dea142926f18a1a474a2aec88c9324 (diff)
Remove a bunch of unused variables, debug code.
Fix some hard-to-justify code in TexImage and TexSubImage calls.
-rw-r--r--src/mesa/drivers/dri/unichrome/via_common.h1
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.c23
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.h11
-rw-r--r--src/mesa/drivers/dri/unichrome/via_fb.c14
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.c9
-rw-r--r--src/mesa/drivers/dri/unichrome/via_state.c21
-rw-r--r--src/mesa/drivers/dri/unichrome/via_tex.c39
-rw-r--r--src/mesa/drivers/dri/unichrome/via_tex.h8
-rw-r--r--src/mesa/drivers/dri/unichrome/via_texmem.c29
-rw-r--r--src/mesa/drivers/dri/unichrome/via_texstate.c9
10 files changed, 31 insertions, 133 deletions
diff --git a/src/mesa/drivers/dri/unichrome/via_common.h b/src/mesa/drivers/dri/unichrome/via_common.h
index cd608c5722..c18df87c9c 100644
--- a/src/mesa/drivers/dri/unichrome/via_common.h
+++ b/src/mesa/drivers/dri/unichrome/via_common.h
@@ -172,7 +172,6 @@ typedef struct _drm_via_sarea {
unsigned int nbox;
drm_clip_rect_t boxes[VIA_NR_SAREA_CLIPRECTS];
drm_via_tex_region_t texList[VIA_NR_TEX_REGIONS + 1];
- int texAge; /* last time texture was uploaded */
int ctxOwner; /* last context to upload state */
int vertexPrim;
diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c
index 5c442e0829..9da1302946 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.c
+++ b/src/mesa/drivers/dri/unichrome/via_context.c
@@ -209,7 +209,6 @@ calculate_buffer_parameters( viaContextPtr vmesa )
(void) memset( & vmesa->depth, 0, sizeof( vmesa->depth ) );
}
- /*=* John Sheng [2003.5.31] flip *=*/
if( vmesa->viaScreen->width == vmesa->driDrawable->w &&
vmesa->viaScreen->height == vmesa->driDrawable->h ) {
vmesa->doPageFlip = vmesa->allowPageFlip;
@@ -336,7 +335,6 @@ viaCreateContext(const __GLcontextModes *mesaVis,
if (!vmesa) {
return GL_FALSE;
}
- if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
/* Parse configuration files.
*/
@@ -466,7 +464,6 @@ viaCreateContext(const __GLcontextModes *mesaVis,
vmesa->viaScreen = viaScreen;
vmesa->driScreen = sPriv;
vmesa->sarea = saPriv;
- vmesa->glBuffer = NULL;
vmesa->texHeap = mmInit(0, viaScreen->textureSize);
vmesa->renderIndex = ~0;
@@ -527,9 +524,6 @@ viaCreateContext(const __GLcontextModes *mesaVis,
if (getenv("VIA_NO_RAST"))
FALLBACK(vmesa, VIA_FALLBACK_USER_DISABLE, 1);
- if (getenv("VIA_CONFORM"))
- vmesa->strictConformance = 1;
-
/* I don't understand why this isn't working:
*/
vmesa->vblank_flags =
@@ -560,9 +554,6 @@ viaCreateContext(const __GLcontextModes *mesaVis,
fprintf(stderr, "regEngineStatus = %x\n", *vmesa->regEngineStatus);
}
-
-
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
return GL_TRUE;
}
@@ -572,7 +563,6 @@ viaDestroyContext(__DRIcontextPrivate *driContextPriv)
GET_CURRENT_CONTEXT(ctx);
viaContextPtr vmesa = (viaContextPtr)driContextPriv->driverPrivate;
viaContextPtr current = ctx ? VIA_CONTEXT(ctx) : NULL;
- if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
assert(vmesa); /* should never be null */
/* check if we're deleting the currently bound context */
@@ -582,7 +572,6 @@ viaDestroyContext(__DRIcontextPrivate *driContextPriv)
}
if (vmesa) {
- /*=* John Sheng [2003.5.31] agp tex *=*/
WAIT_IDLE(vmesa);
if (vmesa->doPageFlip) {
LOCK_HARDWARE(vmesa);
@@ -593,8 +582,6 @@ viaDestroyContext(__DRIcontextPrivate *driContextPriv)
UNLOCK_HARDWARE(vmesa);
}
- if(VIA_DEBUG) fprintf(stderr, "agpFullCount = %d\n", vmesa->agpFullCount);
-
_swsetup_DestroyContext(vmesa->glCtx);
_tnl_DestroyContext(vmesa->glCtx);
_ac_DestroyContext(vmesa->glCtx);
@@ -604,8 +591,6 @@ viaDestroyContext(__DRIcontextPrivate *driContextPriv)
_mesa_destroy_context(vmesa->glCtx);
FREE(vmesa);
}
-
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}
@@ -666,8 +651,6 @@ void viaXMesaWindowMoved(viaContextPtr vmesa)
GLboolean
viaUnbindContext(__DRIcontextPrivate *driContextPriv)
{
- if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
return GL_TRUE;
}
@@ -676,8 +659,6 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv,
__DRIdrawablePrivate *driDrawPriv,
__DRIdrawablePrivate *driReadPriv)
{
- if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-
if (VIA_DEBUG) {
fprintf(stderr, "driContextPriv = %08x\n", (GLuint)driContextPriv);
fprintf(stderr, "driDrawPriv = %08x\n", (GLuint)driDrawPriv);
@@ -714,7 +695,6 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv,
_mesa_make_current(0,0);
}
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
return GL_TRUE;
}
@@ -749,7 +729,7 @@ void
viaSwapBuffers(__DRIdrawablePrivate *drawablePrivate)
{
__DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *)drawablePrivate;
- if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
+
if (dPriv && dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
viaContextPtr vmesa;
GLcontext *ctx;
@@ -771,5 +751,4 @@ viaSwapBuffers(__DRIdrawablePrivate *drawablePrivate)
else {
_mesa_problem(NULL, "viaSwapBuffers: drawable has no context!\n");
}
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}
diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h
index 2c1639c2c2..9b181c787f 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.h
+++ b/src/mesa/drivers/dri/unichrome/via_context.h
@@ -126,8 +126,6 @@ struct via_context_t {
GLubyte *dma;
viaRegion tex;
- GLuint isAGP;
-
/* Textures
*/
viaTextureObjectPtr CurrentTexObj[2];
@@ -211,7 +209,6 @@ struct via_context_t {
GLuint regHTXnTBLRCb_0;
GLuint regHTXnTBLRAa_0;
GLuint regHTXnTBLRFog_0;
- /*=* John Sheng [2003.7.18] texture combine *=*/
GLuint regHTXnTBLRCa_0;
GLuint regHTXnTBLRCc_0;
GLuint regHTXnTBLRCbias_0;
@@ -248,8 +245,6 @@ struct via_context_t {
/* DRI stuff
*/
- GLuint needClip;
- GLframebuffer *glBuffer;
GLboolean doPageFlip;
viaBuffer *drawBuffer;
@@ -264,11 +259,6 @@ struct via_context_t {
GLuint numClipRects; /* cliprects for that buffer */
drm_clip_rect_t *pClipRects;
- int lastSwap;
- int texAge;
- int ctxAge;
- int dirtyAge;
-
GLboolean scissor;
drm_clip_rect_t drawRect;
drm_clip_rect_t scissorRect;
@@ -293,7 +283,6 @@ struct via_context_t {
GLuint nDoneFirstFlip;
GLuint agpFullCount;
- GLboolean strictConformance;
GLboolean clearTexCache;
/* Configuration cache
diff --git a/src/mesa/drivers/dri/unichrome/via_fb.c b/src/mesa/drivers/dri/unichrome/via_fb.c
index b590e833b6..ff3d15d669 100644
--- a/src/mesa/drivers/dri/unichrome/via_fb.c
+++ b/src/mesa/drivers/dri/unichrome/via_fb.c
@@ -68,7 +68,6 @@ via_alloc_dma_buffer(viaContextPtr vmesa)
{
drm_via_dma_init_t init;
- if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
vmesa->dma = (GLubyte *) malloc(VIA_DMA_BUFSIZ);
/*
@@ -83,8 +82,6 @@ via_alloc_dma_buffer(viaContextPtr vmesa)
fprintf(stderr, "unichrome_dri.so: Using AGP.\n");
else
fprintf(stderr, "unichrome_dri.so: Using PCI.\n");
-
- fprintf(stderr, "%s - out\n", __FUNCTION__);
}
return ((vmesa->dma) ? GL_TRUE : GL_FALSE);
@@ -102,7 +99,7 @@ GLboolean
via_alloc_texture(viaContextPtr vmesa, viaTextureObjectPtr t)
{
drm_via_mem_t fb;
- if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
+
fb.context = vmesa->hHWContext;
fb.size = t->texMem.size;
fb.type = VIDEO;
@@ -120,15 +117,14 @@ via_alloc_texture(viaContextPtr vmesa, viaTextureObjectPtr t)
if (VIA_DEBUG) fprintf(stderr, "texture index = %d\n", (GLuint)fb.index);
t->bufAddr = (unsigned char *)(fb.offset + (GLuint)vmesa->driScreen->pFB);
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
return GL_TRUE;
}
-/*=* John Sheng [2003.5.31] agp tex *=*/
+
GLboolean
via_alloc_texture_agp(viaContextPtr vmesa, viaTextureObjectPtr t)
{
drm_via_mem_t fb;
- if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
+
fb.context = vmesa->hHWContext;
fb.size = t->texMem.size;
fb.type = AGP;
@@ -146,9 +142,8 @@ via_alloc_texture_agp(viaContextPtr vmesa, viaTextureObjectPtr t)
if (VIA_DEBUG) fprintf(stderr, "texture agp index = %d\n", (GLuint)fb.index);
t->bufAddr = (unsigned char *)((GLuint)vmesa->viaScreen->agpLinearStart + fb.offset);
- /*=* John Sheng [2003.5.31] agp tex *=*/
+
t->inAGP = GL_TRUE;
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
return GL_TRUE;
}
@@ -170,7 +165,6 @@ via_free_texture(viaContextPtr vmesa, viaTextureObjectPtr t)
fb.context = vmesa->hHWContext;
fb.index = t->texMem.index;
- /*=* John Sheng [2003.5.31] agp tex *=*/
if(t->inAGP)
fb.type = AGP;
else
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c
index 7ced8fe50f..dfd544e923 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.c
+++ b/src/mesa/drivers/dri/unichrome/via_screen.c
@@ -88,7 +88,6 @@ viaInitDriver(__DRIscreenPrivate *sPriv)
{
viaScreenPrivate *viaScreen;
VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv;
- if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
/* Allocate the private area */
@@ -190,9 +189,6 @@ viaInitDriver(__DRIscreenPrivate *sPriv)
}
}
-
-
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
return GL_TRUE;
}
@@ -201,11 +197,11 @@ viaDestroyScreen(__DRIscreenPrivate *sPriv)
{
viaScreenPrivate *viaScreen = (viaScreenPrivate *)sPriv->private;
VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv;
- if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
+
drmUnmap(viaScreen->reg, gDRIPriv->regs.size);
if (gDRIPriv->agp.size)
drmUnmap(viaScreen->agpLinearStart, gDRIPriv->agp.size);
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
+
FREE(viaScreen);
sPriv->private = NULL;
}
@@ -231,7 +227,6 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
mesaVis->accumRedBits > 0,
GL_FALSE /* s/w alpha planes */);
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
return (driDrawPriv->driverPrivate != NULL);
#endif
return GL_FALSE;
diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c
index 2bf1905784..e1dd78dfb6 100644
--- a/src/mesa/drivers/dri/unichrome/via_state.c
+++ b/src/mesa/drivers/dri/unichrome/via_state.c
@@ -86,8 +86,6 @@ void viaEmitState(viaContextPtr vmesa)
GLuint j = 0;
RING_VARS;
- if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
-
viaCheckDma(vmesa, 0x110);
BEGIN_RING(5);
@@ -232,7 +230,6 @@ void viaEmitState(viaContextPtr vmesa)
GLuint numLevels = t->lastLevel - t->firstLevel + 1;
if (VIA_DEBUG) {
fprintf(stderr, "texture0 enabled\n");
- fprintf(stderr, "texture level %d\n", t->actualLevel);
}
if (numLevels == 8) {
BEGIN_RING(27);
@@ -335,6 +332,8 @@ void viaEmitState(viaContextPtr vmesa)
OUT_RING( (HC_SubA_HTXnCLODu << 24) | vmesa->regHTXnCLOD_0 );
ADVANCE_RING();
+ /* KW: This test never succeeds:
+ */
if (t->regTexFM == HC_HTXnFM_Index8) {
struct gl_color_table *table = &texObj->Palette;
GLfloat *tableF = (GLfloat *)table->Table;
@@ -358,7 +357,6 @@ void viaEmitState(viaContextPtr vmesa)
int texunit = (texUnit0->Enabled ? 1 : 0);
if (VIA_DEBUG) {
fprintf(stderr, "texture1 enabled\n");
- fprintf(stderr, "texture level %d\n", t->actualLevel);
}
if (numLevels == 8) {
BEGIN_RING(27);
@@ -459,6 +457,8 @@ void viaEmitState(viaContextPtr vmesa)
OUT_RING( (HC_SubA_HTXnCLODu << 24) | vmesa->regHTXnCLOD_1 );
ADVANCE_RING();
+ /* KW: This test never succeeds:
+ */
if (t->regTexFM == HC_HTXnFM_Index8) {
struct gl_color_table *table = &texObj->Palette;
GLfloat *tableF = (GLfloat *)table->Table;
@@ -521,8 +521,6 @@ void viaEmitState(viaContextPtr vmesa)
ADVANCE_RING();
}
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
-
vmesa->newEmitState = 0;
}
@@ -889,12 +887,9 @@ static GLboolean viaChooseTextureState(GLcontext *ctx)
viaContextPtr vmesa = VIA_CONTEXT(ctx);
struct gl_texture_unit *texUnit0 = &ctx->Texture.Unit[0];
struct gl_texture_unit *texUnit1 = &ctx->Texture.Unit[1];
- /*=* John Sheng [2003.7.18] texture combine *=*/
- if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
if (texUnit0->_ReallyEnabled || texUnit1->_ReallyEnabled) {
if (VIA_DEBUG) {
- fprintf(stderr, "Texture._ReallyEnabled - in\n");
fprintf(stderr, "texUnit0->_ReallyEnabled = %x\n",texUnit0->_ReallyEnabled);
}
@@ -993,7 +988,6 @@ static GLboolean viaChooseTextureState(GLcontext *ctx)
else {
vmesa->regEnable &= (~(HC_HenTXMP_MASK | HC_HenTXCH_MASK | HC_HenTXPP_MASK));
}
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
return GL_TRUE;
}
@@ -1007,7 +1001,6 @@ static void viaChooseColorState(GLcontext *ctx)
/* The HW's blending equation is:
* (Ca * FCa + Cbias + Cb * FCb) << Cshift
*/
- if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
if (ctx->Color.BlendEnabled) {
vmesa->regEnable |= HC_HenABL_MASK;
@@ -1290,8 +1283,6 @@ static void viaChooseColorState(GLcontext *ctx)
vmesa->regEnable |= HC_HenAW_MASK;
else
vmesa->regEnable &= ~HC_HenAW_MASK;
-
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}
static void viaChooseFogState(GLcontext *ctx)
@@ -1379,7 +1370,6 @@ static void viaChoosePolygonState(GLcontext *ctx)
static void viaChooseStencilState(GLcontext *ctx)
{
viaContextPtr vmesa = VIA_CONTEXT(ctx);
- if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
if (ctx->Stencil.Enabled) {
GLuint temp;
@@ -1459,7 +1449,6 @@ static void viaChooseStencilState(GLcontext *ctx)
else {
vmesa->regEnable &= ~HC_HenST_MASK;
}
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}
@@ -1468,7 +1457,6 @@ static void viaChooseTriangle(GLcontext *ctx)
{
viaContextPtr vmesa = VIA_CONTEXT(ctx);
if (VIA_DEBUG) {
- fprintf(stderr, "%s - in\n", __FUNCTION__);
fprintf(stderr, "GL_CULL_FACE = %x\n", GL_CULL_FACE);
fprintf(stderr, "ctx->Polygon.CullFlag = %x\n", ctx->Polygon.CullFlag);
fprintf(stderr, "GL_FRONT = %x\n", GL_FRONT);
@@ -1494,7 +1482,6 @@ static void viaChooseTriangle(GLcontext *ctx)
return;
}
}
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}
void viaValidateState( GLcontext *ctx )
diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c
index 8bcbe0f15d..ebd33b8e52 100644
--- a/src/mesa/drivers/dri/unichrome/via_tex.c
+++ b/src/mesa/drivers/dri/unichrome/via_tex.c
@@ -54,7 +54,6 @@ viaTextureObjectPtr viaAllocTextureObject(struct gl_texture_object *texObj)
*/
t->bufAddr = NULL;
t->dirtyImages = ~0;
- t->actualLevel = 0;
t->globj = texObj;
make_empty_list(t);
@@ -71,14 +70,12 @@ static void viaTexImage1D(GLcontext *ctx, GLenum target, GLint level,
struct gl_texture_image *texImage)
{
viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData;
- if (VIA_DEBUG) fprintf(stderr, "viaTexImage1D - in\n");
+
if (t) {
- if (level == 0) {
+ if (level == 0) { /* KW: this test is bogus??? */
viaSwapOutTexObj(VIA_CONTEXT(ctx), t);
- t->actualLevel = 0;
}
- else
- t->actualLevel++;
+ t->dirtyImages |= (1<<level);
}
else {
t = viaAllocTextureObject(texObj);
@@ -91,7 +88,6 @@ static void viaTexImage1D(GLcontext *ctx, GLenum target, GLint level,
_mesa_store_teximage1d(ctx, target, level, internalFormat,
width, border, format, type,
pixels, packing, texObj, texImage);
- if (VIA_DEBUG) fprintf(stderr, "viaTexImage1D - out\n");
}
@@ -110,7 +106,7 @@ static void viaTexSubImage1D(GLcontext *ctx,
viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData;
if (t) {
- viaSwapOutTexObj(VIA_CONTEXT(ctx), t);
+ t->dirtyImages |= (1<<level);
}
_mesa_store_texsubimage1d(ctx, target, level, xoffset, width,
format, type, pixels, packing, texObj,
@@ -128,14 +124,12 @@ static void viaTexImage2D(GLcontext *ctx, GLenum target, GLint level,
struct gl_texture_image *texImage)
{
viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData;
- if (VIA_DEBUG) fprintf(stderr, "viaTexImage2D - in\n");
+
if (t) {
- if (level == 0) {
+ if (level == 0) { /* KW: This test is bogus??? */
viaSwapOutTexObj(VIA_CONTEXT(ctx), t);
- t->actualLevel = 0;
}
- else
- t->actualLevel++;
+ t->dirtyImages |= (1<<level);
}
else {
t = viaAllocTextureObject(texObj);
@@ -148,7 +142,6 @@ static void viaTexImage2D(GLcontext *ctx, GLenum target, GLint level,
_mesa_store_teximage2d(ctx, target, level, internalFormat,
width, height, border, format, type,
pixels, packing, texObj, texImage);
- if (VIA_DEBUG) fprintf(stderr, "viaTexImage2D - out\n");
}
static void viaTexSubImage2D(GLcontext *ctx,
@@ -167,7 +160,7 @@ static void viaTexSubImage2D(GLcontext *ctx,
viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData;
if (t) {
- viaSwapOutTexObj(VIA_CONTEXT(ctx), t);
+ t->dirtyImages |= (1<<level);
}
_mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
height, format, type, pixels, packing, texObj,
@@ -181,27 +174,27 @@ static void viaTexSubImage2D(GLcontext *ctx,
static void viaBindTexture(GLcontext *ctx, GLenum target,
struct gl_texture_object *texObj)
{
- if (VIA_DEBUG) fprintf(stderr, "viaBindTexture - in\n");
- if (target == GL_TEXTURE_2D) {
+ if (target == GL_TEXTURE_2D ||
+ target == GL_TEXTURE_1D)
+ {
viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData;
if (!t) {
t = viaAllocTextureObject(texObj);
if (!t) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "viaBindTexture");
- return;
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "viaBindTexture");
+ return;
}
texObj->DriverData = t;
}
}
- if (VIA_DEBUG) fprintf(stderr, "viaBindTexture - out\n");
}
static void viaDeleteTexture(GLcontext *ctx, struct gl_texture_object *texObj)
{
viaTextureObjectPtr t = (viaTextureObjectPtr)texObj->DriverData;
- if (VIA_DEBUG) fprintf(stderr, "viaDeleteTexture - in\n");
+
if (t) {
viaContextPtr vmesa = VIA_CONTEXT(ctx);
if (vmesa) {
@@ -212,7 +205,6 @@ static void viaDeleteTexture(GLcontext *ctx, struct gl_texture_object *texObj)
}
texObj->DriverData = 0;
}
- if (VIA_DEBUG) fprintf(stderr, "viaDeleteTexture - out\n");
/* Free mipmap images and the texture object itself */
_mesa_delete_texture_object(ctx, texObj);
@@ -381,7 +373,6 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat,
void viaInitTextureFuncs(struct dd_function_table * functions)
{
- if (VIA_DEBUG) fprintf(stderr, "viaInitTextureFuncs - in\n");
functions->ChooseTextureFormat = viaChooseTexFormat;
functions->TexImage1D = viaTexImage1D;
functions->TexImage2D = viaTexImage2D;
@@ -393,8 +384,6 @@ void viaInitTextureFuncs(struct dd_function_table * functions)
functions->DeleteTexture = viaDeleteTexture;
functions->UpdateTexturePalette = 0;
functions->IsTextureResident = viaIsTextureResident;
-
- if (VIA_DEBUG) fprintf(stderr, "viaInitTextureFuncs - out\n");
}
void viaInitTextures(GLcontext *ctx)
diff --git a/src/mesa/drivers/dri/unichrome/via_tex.h b/src/mesa/drivers/dri/unichrome/via_tex.h
index 603d18a1e9..a428e65fc8 100644
--- a/src/mesa/drivers/dri/unichrome/via_tex.h
+++ b/src/mesa/drivers/dri/unichrome/via_tex.h
@@ -37,8 +37,6 @@
struct via_texture_object_t {
struct via_texture_object_t *next, *prev;
-
- GLuint age;
struct gl_texture_object *globj;
int texelBytes;
@@ -52,10 +50,6 @@ struct via_texture_object_t {
unsigned char* bufAddr;
GLuint inAGP;
- GLuint needClearCache;
- GLuint actualLevel;
-
- GLuint maxLevel;
GLuint dirtyImages;
struct {
@@ -65,8 +59,6 @@ struct via_texture_object_t {
int internalFormat;
} image[VIA_TEX_MAXLEVELS];
- GLuint dirty;
-
GLuint regTexFM;
GLuint regTexWidthLog2[2];
GLuint regTexHeightLog2[2];
diff --git a/src/mesa/drivers/dri/unichrome/via_texmem.c b/src/mesa/drivers/dri/unichrome/via_texmem.c
index 825ef09f33..f6bd0ed87a 100644
--- a/src/mesa/drivers/dri/unichrome/via_texmem.c
+++ b/src/mesa/drivers/dri/unichrome/via_texmem.c
@@ -39,11 +39,10 @@
#include "via_state.h"
#include "via_ioctl.h"
#include "via_fb.h"
-/*=* John Sheng [2003.5.31] agp tex *=*/
+
void viaDestroyTexObj(viaContextPtr vmesa, viaTextureObjectPtr t)
{
- if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
if (!t)
return;
@@ -52,9 +51,6 @@ void viaDestroyTexObj(viaContextPtr vmesa, viaTextureObjectPtr t)
*/
if (t->bufAddr) {
via_free_texture(vmesa, t);
-
- if (vmesa && t->age > vmesa->dirtyAge)
- vmesa->dirtyAge = t->age;
}
if (t->globj)
@@ -72,22 +68,16 @@ void viaDestroyTexObj(viaContextPtr vmesa, viaTextureObjectPtr t)
remove_from_list(t);
free(t);
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}
void viaSwapOutTexObj(viaContextPtr vmesa, viaTextureObjectPtr t)
{
- if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
if (t->bufAddr) {
via_free_texture(vmesa, t);
-
- if (t->age > vmesa->dirtyAge)
- vmesa->dirtyAge = t->age;
}
t->dirtyImages = ~0;
move_to_tail(&(vmesa->SwappedOut), t);
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}
@@ -108,7 +98,6 @@ static void viaUploadTexLevel(viaTextureObjectPtr t, int level)
const struct gl_texture_image *image = t->image[level].image;
int i, j;
if (VIA_DEBUG) {
- fprintf(stderr, "%s - in\n", __FUNCTION__);
fprintf(stderr, "width = %d, height = %d \n", image->Width, image->Height);
}
switch (t->image[level].internalFormat) {
@@ -279,7 +268,6 @@ static void viaUploadTexLevel(viaTextureObjectPtr t, int level)
if (VIA_DEBUG) fprintf(stderr, "Not supported texture format %s\n",
_mesa_lookup_enum_by_nr(image->Format));
}
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}
void viaPrintLocalLRU(viaContextPtr vmesa)
@@ -307,7 +295,6 @@ void viaPrintLocalLRU(viaContextPtr vmesa)
void viaUpdateTexLRU(viaContextPtr vmesa, viaTextureObjectPtr t)
{
- vmesa->texAge = ++vmesa->sarea->texAge;
move_to_head(&(vmesa->TexObjList), t);
}
@@ -317,15 +304,12 @@ void viaUpdateTexLRU(viaContextPtr vmesa, viaTextureObjectPtr t)
void viaUploadTexImages(viaContextPtr vmesa, viaTextureObjectPtr t)
{
int i, j;
- int numLevels;
- if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
+
LOCK_HARDWARE(vmesa);
j = 0;
if (!t->bufAddr) {
while (1) {
-
- /*=* John Sheng [2003.5.31] agp tex *=*/
if (via_alloc_texture_agp(vmesa, t))
break;
if (via_alloc_texture(vmesa, t))
@@ -349,8 +333,6 @@ void viaUploadTexImages(viaContextPtr vmesa, viaTextureObjectPtr t)
viaSwapOutTexObj(vmesa, vmesa->TexObjList.prev);
}
- /*=* John Sheng [2003.5.31] agp tex *=*/
- /*t->bufAddr = (char *)((GLuint)vmesa->driScreen->pFB + t->texMem.offset);*/
if (t == vmesa->CurrentTexObj[0])
VIA_FLUSH_DMA(vmesa);
@@ -363,15 +345,12 @@ void viaUploadTexImages(viaContextPtr vmesa, viaTextureObjectPtr t)
j++;
}
- numLevels = t->lastLevel - t->firstLevel + 1;
-
- for (i = 0; i < numLevels; i++)
+ for (i = t->firstLevel; i <= t->lastLevel; i++)
if (t->dirtyImages & (1 << i))
- viaUploadTexLevel(t, i);
+ viaUploadTexLevel(t, i - t->firstLevel);
t->dirtyImages = 0;
vmesa->clearTexCache = 1;
UNLOCK_HARDWARE(vmesa);
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}
diff --git a/src/mesa/drivers/dri/unichrome/via_texstate.c b/src/mesa/drivers/dri/unichrome/via_texstate.c
index d16fbd912a..1d5a5ec5a2 100644
--- a/src/mesa/drivers/dri/unichrome/via_texstate.c
+++ b/src/mesa/drivers/dri/unichrome/via_texstate.c
@@ -170,7 +170,7 @@ static void viaSetTexImages(viaContextPtr vmesa,
GLuint basH = 0;
GLuint widthExp = 0;
GLuint heightExp = 0;
- if (VIA_DEBUG) fprintf(stderr, "%s - in\n", __FUNCTION__);
+
switch (baseImage->TexFormat->MesaFormat) {
case MESA_FORMAT_ARGB8888:
/* KW: I'm not sure what the thinking behind this test was, but
@@ -207,7 +207,6 @@ static void viaSetTexImages(viaContextPtr vmesa,
case MESA_FORMAT_AL88:
texFormat = HC_HTXnFM_AL88;
break;
- /*=* John Sheng [2003.7.18] texenv *=*/
case MESA_FORMAT_A8:
texFormat = HC_HTXnFM_A8;
break;
@@ -271,8 +270,6 @@ static void viaSetTexImages(viaContextPtr vmesa,
}
t->totalSize = (*texSize)[log2Height][log2Width];
t->texMem.size = t->totalSize;
- t->maxLevel = i - 1;
-/* t->dirty = VIA_UPLOAD_TEX0 | VIA_UPLOAD_TEX1; */
if (VIA_DEBUG) {
fprintf(stderr, "log2Width = %d\n", log2Width);
@@ -280,7 +277,6 @@ static void viaSetTexImages(viaContextPtr vmesa,
fprintf(stderr, "log2Pitch = %d\n", log2Pitch);
fprintf(stderr, "bytePerTexel = %d\n", baseImage->TexFormat->TexelBytes);
fprintf(stderr, "total size = %d\n", t->totalSize);
- fprintf(stderr, "actual level = %d\n", t->actualLevel);
fprintf(stderr, "numlevel = %d\n", numLevels);
}
@@ -313,11 +309,11 @@ static void viaSetTexImages(viaContextPtr vmesa,
else
mipmapSize = (*texSize)[h][w];
- /*=* John Sheng [2003.5.31] agp tex *=*/
if (t->inAGP)
texBase = (GLuint)vmesa->agpBase + t->texMem.offset + t->image[i].offset;
else
texBase = t->texMem.offset + t->image[i].offset;
+
if (VIA_DEBUG) {
fprintf(stderr, "texmem offset = %x\n", t->texMem.offset);
fprintf(stderr, "mipmap%d addr = %x\n", i, t->image[i].offset);
@@ -365,7 +361,6 @@ static void viaSetTexImages(viaContextPtr vmesa,
t->regTexHeightLog2[l] = ((l + HC_SubA_HTXnL0_5HE) << 24 | heightExp);
}
}
- if (VIA_DEBUG) fprintf(stderr, "%s - out\n", __FUNCTION__);
}