diff options
Diffstat (limited to 'src/mesa/drivers/dri')
22 files changed, 190 insertions, 116 deletions
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 20faf0fda45..3edeb03f99b 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -131,9 +131,8 @@ static void __driGarbageCollectDrawables(void *drawHash) __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private; dpy = pdp->driScreenPriv->display; if (! (*dri_interface->windowExists)(dpy, draw)) { - /* Destroy the local drawable data in the hash table, if the - drawable no longer exists in the Xserver */ - drmHashDelete(drawHash, draw); + /* Destroy the local drawable data, if the drawable no + longer exists in the Xserver */ (*pdraw->destroyDrawable)(dpy, pdraw->private); _mesa_free(pdraw); } @@ -664,6 +663,7 @@ static void driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate) (*psp->DriverAPI.DestroyBuffer)(pdp); if ((*dri_interface->windowExists)(dpy, pdp->draw)) (void)(*dri_interface->destroyDrawable)(dpy, scrn, pdp->draw); + drmHashDelete(psp->drawHash, pdp->draw); if (pdp->pClipRects) { _mesa_free(pdp->pClipRects); pdp->pClipRects = NULL; diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index a5e907e7261..b9b38f39cd6 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -54,6 +54,7 @@ #include <GL/gl.h> #include "drm.h" #include "drm_sarea.h" +#include "xf86drm.h" #include "GL/internal/glcore.h" #include "GL/internal/dri_interface.h" diff --git a/src/mesa/drivers/dri/common/glcontextmodes.c b/src/mesa/drivers/dri/common/glcontextmodes.c index 4bff387ae0a..5e9e352f2c6 100644 --- a/src/mesa/drivers/dri/common/glcontextmodes.c +++ b/src/mesa/drivers/dri/common/glcontextmodes.c @@ -157,8 +157,8 @@ _gl_copy_visual_to_context_mode( __GLcontextModes * mode, mode->greenMask = config->greenMask; mode->blueMask = config->blueMask; mode->alphaMask = config->alphaMask; - mode->rgbBits = config->bufferSize; - mode->indexBits = config->bufferSize; + mode->rgbBits = mode->rgbMode ? config->bufferSize : 0; + mode->indexBits = mode->colorIndexMode ? config->bufferSize : 0; mode->accumRedBits = config->accumRedSize; mode->accumGreenBits = config->accumGreenSize; diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index ce14f8050e4..b69252d2ac3 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -157,9 +157,9 @@ static GLuint get_result_vector( struct i915_fragment_program *p, switch (inst->DstReg.File) { case PROGRAM_OUTPUT: switch (inst->DstReg.Index) { - case 0: + case FRAG_OUTPUT_COLR: return UREG(REG_TYPE_OC, 0); - case 1: + case FRAG_OUTPUT_DEPR: p->depth_written = 1; return UREG(REG_TYPE_OD, 0); default: diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index c6c598cc3b8..17cdd60b125 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -198,11 +198,19 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) r128Screen->depthPitch = r128DRIPriv->depthPitch; r128Screen->spanOffset = r128DRIPriv->spanOffset; - r128Screen->texOffset[R128_LOCAL_TEX_HEAP] = r128DRIPriv->textureOffset; - r128Screen->texSize[R128_LOCAL_TEX_HEAP] = r128DRIPriv->textureSize; - r128Screen->logTexGranularity[R128_LOCAL_TEX_HEAP] = r128DRIPriv->log2TexGran; + if ( r128DRIPriv->textureSize == 0 ) { + r128Screen->texOffset[R128_LOCAL_TEX_HEAP] = + r128DRIPriv->agpTexOffset + R128_AGP_TEX_OFFSET; + r128Screen->texSize[R128_LOCAL_TEX_HEAP] = r128DRIPriv->agpTexMapSize; + r128Screen->logTexGranularity[R128_LOCAL_TEX_HEAP] = + r128DRIPriv->log2AGPTexGran; + } else { + r128Screen->texOffset[R128_LOCAL_TEX_HEAP] = r128DRIPriv->textureOffset; + r128Screen->texSize[R128_LOCAL_TEX_HEAP] = r128DRIPriv->textureSize; + r128Screen->logTexGranularity[R128_LOCAL_TEX_HEAP] = r128DRIPriv->log2TexGran; + } - if ( r128Screen->IsPCI ) { + if ( !r128Screen->agpTextures.map || r128DRIPriv->textureSize == 0 ) { r128Screen->numTexHeaps = R128_NR_TEX_HEAPS - 1; r128Screen->texOffset[R128_AGP_TEX_HEAP] = 0; r128Screen->texSize[R128_AGP_TEX_HEAP] = 0; diff --git a/src/mesa/drivers/dri/r200/r200_screen.c b/src/mesa/drivers/dri/r200/r200_screen.c index 78aa962fa70..08e4a3548da 100644 --- a/src/mesa/drivers/dri/r200/r200_screen.c +++ b/src/mesa/drivers/dri/r200/r200_screen.c @@ -445,13 +445,20 @@ r200CreateScreen( __DRIscreenPrivate *sPriv ) screen->depthOffset = dri_priv->depthOffset; screen->depthPitch = dri_priv->depthPitch; - screen->texOffset[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureOffset - + screen->fbLocation; - screen->texSize[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureSize; - screen->logTexGranularity[RADEON_LOCAL_TEX_HEAP] = - dri_priv->log2TexGran; + if ( dri_priv->textureSize == 0 ) { + screen->texOffset[RADEON_LOCAL_TEX_HEAP] = screen->gart_texture_offset; + screen->texSize[RADEON_GART_TEX_HEAP] = dri_priv->gartTexMapSize; + screen->logTexGranularity[RADEON_GART_TEX_HEAP] = + dri_priv->log2GARTTexGran; + } else { + screen->texOffset[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureOffset + + screen->fbLocation; + screen->texSize[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureSize; + screen->logTexGranularity[RADEON_LOCAL_TEX_HEAP] = + dri_priv->log2TexGran; + } - if ( !screen->gartTextures.map ) { + if ( !screen->gartTextures.map || dri_priv->textureSize == 0 ) { screen->numTexHeaps = RADEON_NR_TEX_HEAPS - 1; screen->texOffset[RADEON_GART_TEX_HEAP] = 0; screen->texSize[RADEON_GART_TEX_HEAP] = 0; diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c index 9d5a2f2924a..94b4978fa3e 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c @@ -219,6 +219,8 @@ void r200ChooseVertexState( GLcontext *ctx ) { r200ContextPtr rmesa = R200_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); + GLuint vte; + GLuint vap; /* We must ensure that we don't do _tnl_need_projected_coords while in a * rasterization fallback. As this function will be called again when we @@ -227,8 +229,8 @@ void r200ChooseVertexState( GLcontext *ctx ) if (rmesa->Fallback != 0) return; - GLuint vte = rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL]; - GLuint vap = rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL]; + vte = rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL]; + vap = rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL]; /* HW perspective divide is a win, but tiny vertex formats are a * bigger one. diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 327a398d4d7..d3c22fda16d 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -626,12 +626,13 @@ void r300EmitWait(r300ContextPtr rmesa, GLuint flags) void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset) { - if (RADEON_DEBUG & DEBUG_VERTS) - fprintf(stderr, "%s: nr=%d, ofs=0x%08x\n", __func__, nr, offset); int sz = 1 + (nr >> 1) * 3 + (nr & 1) * 2; int i; LOCAL_VARS + if (RADEON_DEBUG & DEBUG_VERTS) + fprintf(stderr, "%s: nr=%d, ofs=0x%08x\n", __func__, nr, offset); + start_packet3(RADEON_CP_PACKET3_3D_LOAD_VBPNTR, sz-1); e32(nr); for(i=0;i+1<nr;i+=2){ diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index f43b50e34df..8750ff60ca9 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -277,9 +277,9 @@ static void free_temp(struct r300_fragment_program *rp, pfs_reg_t r) static pfs_reg_t emit_param4fv(struct r300_fragment_program *rp, GLfloat *values) { pfs_reg_t r = pfs_default_reg; - r.type = REG_TYPE_CONST; int pidx; + r.type = REG_TYPE_CONST; pidx = rp->param_nr++; r.index = rp->const_nr++; if (pidx >= PFS_NUM_CONST_REGS || r.index >= PFS_NUM_CONST_REGS) { @@ -626,6 +626,7 @@ static void emit_arith(struct r300_fragment_program *rp, int op, int argc; int vop, sop; int i; + int str; if (!dest.valid || !src0.valid || !src1.valid || !src2.valid) { ERROR("invalid register. dest/src0/src1/src2 valid = %d/%d/%d/%d\n", @@ -657,7 +658,6 @@ static void emit_arith(struct r300_fragment_program *rp, int op, return; } - int str; for (i=0;i<3;i++) { if (i<argc) { hwsrc = t_hw_src(rp, src[i]); diff --git a/src/mesa/drivers/dri/r300/radeon_screen.c b/src/mesa/drivers/dri/r300/radeon_screen.c index ea15e872877..663bc973b00 100644 --- a/src/mesa/drivers/dri/r300/radeon_screen.c +++ b/src/mesa/drivers/dri/r300/radeon_screen.c @@ -562,13 +562,20 @@ static radeonScreenPtr radeonCreateScreen(__DRIscreenPrivate * sPriv) screen->depthOffset = dri_priv->depthOffset; screen->depthPitch = dri_priv->depthPitch; - screen->texOffset[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureOffset - + screen->fbLocation; - screen->texSize[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureSize; - screen->logTexGranularity[RADEON_LOCAL_TEX_HEAP] = - dri_priv->log2TexGran; + if ( dri_priv->textureSize == 0 ) { + screen->texOffset[RADEON_LOCAL_TEX_HEAP] = screen->gart_texture_offset; + screen->texSize[RADEON_GART_TEX_HEAP] = dri_priv->gartTexMapSize; + screen->logTexGranularity[RADEON_GART_TEX_HEAP] = + dri_priv->log2GARTTexGran; + } else { + screen->texOffset[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureOffset + + screen->fbLocation; + screen->texSize[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureSize; + screen->logTexGranularity[RADEON_LOCAL_TEX_HEAP] = + dri_priv->log2TexGran; + } - if (!screen->gartTextures.map) { + if (!screen->gartTextures.map || dri_priv->textureSize == 0) { screen->numTexHeaps = RADEON_NR_TEX_HEAPS - 1; screen->texOffset[RADEON_GART_TEX_HEAP] = 0; screen->texSize[RADEON_GART_TEX_HEAP] = 0; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index b3a768c2851..80710294c48 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -375,13 +375,20 @@ radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->depthHasSurface = ((sPriv->ddxMajor > 4) && (screen->chipset & RADEON_CHIPSET_TCL)); - screen->texOffset[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureOffset - + screen->fbLocation; - screen->texSize[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureSize; - screen->logTexGranularity[RADEON_LOCAL_TEX_HEAP] = - dri_priv->log2TexGran; + if ( dri_priv->textureSize == 0 ) { + screen->texOffset[RADEON_LOCAL_TEX_HEAP] = screen->gart_texture_offset; + screen->texSize[RADEON_LOCAL_TEX_HEAP] = dri_priv->gartTexMapSize; + screen->logTexGranularity[RADEON_LOCAL_TEX_HEAP] = + dri_priv->log2GARTTexGran; + } else { + screen->texOffset[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureOffset + + screen->fbLocation; + screen->texSize[RADEON_LOCAL_TEX_HEAP] = dri_priv->textureSize; + screen->logTexGranularity[RADEON_LOCAL_TEX_HEAP] = + dri_priv->log2TexGran; + } - if ( !screen->gartTextures.map + if ( !screen->gartTextures.map || dri_priv->textureSize == 0 || getenv( "RADEON_GARTTEXTURING_FORCE_DISABLE" ) ) { screen->numTexHeaps = RADEON_NR_TEX_HEAPS - 1; screen->texOffset[RADEON_GART_TEX_HEAP] = 0; diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c index f126e4982d3..924d4028d51 100644 --- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c @@ -385,7 +385,7 @@ static __inline void radeonDmaPrimitive( radeonContextPtr rmesa, GLenum prim ) assert(rmesa->dma.current.ptr == rmesa->dma.current.start); } -#define LOCAL_VARS radeonContextPtr rmesa = RADEON_CONTEXT(ctx); (void)rmesa +#define LOCAL_VARS radeonContextPtr rmesa = RADEON_CONTEXT(ctx) #define INIT( prim ) radeonDmaPrimitive( rmesa, prim ) #define FLUSH() RADEON_NEWPRIM( rmesa ) #define GET_CURRENT_VB_MAX_VERTS() \ diff --git a/src/mesa/drivers/dri/s3v/s3v_tritmp.h b/src/mesa/drivers/dri/s3v/s3v_tritmp.h index b2136fcb384..16318f4c402 100644 --- a/src/mesa/drivers/dri/s3v/s3v_tritmp.h +++ b/src/mesa/drivers/dri/s3v/s3v_tritmp.h @@ -17,7 +17,8 @@ int start02, end01; \ int ystart, y01y12; \ int i, tmp, tmp2, tmp3; \ - GLfloat ydiff, fy[3]; \ + GLfloat ydiff, fy[3] +#define LINE_VERT_VARS_VOIDS \ (void) v; (void) vvv; (void) x; (void) y; (void) z; (void) idx; \ (void) dx01; (void) dy01; (void) delt02; (void) deltzy; \ (void) zstart; (void) start02; (void) ystart; (void) y01y12; \ @@ -26,7 +27,8 @@ #define LINE_FLAT_VARS \ int arstart, gbstart; \ int deltarx, deltgbx, deltary, deltgby; \ - GLubyte *(col)[3]; \ + GLubyte *(col)[3] +#define LINE_FLAT_VARS_VOIDS \ (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \ (void) deltary; (void) deltgby; (void) col @@ -34,7 +36,8 @@ int arstart, gbstart; \ int deltary, deltgby; \ int ctmp, ctmp2, ctmp3, ctmp4; \ - GLubyte *(col)[3]; \ + GLubyte *(col)[3] +#define LINE_GOURAUD_VARS_VOIDS \ (void) arstart; (void) gbstart; (void) deltary; (void) deltgby; \ (void) ctmp; (void) ctmp2; (void) ctmp3; (void) ctmp4; (void) col @@ -207,7 +210,8 @@ do { \ int start02, end01, end12; \ int ystart, y01y12; \ int i, tmp, lr; \ - GLfloat ydiff, fy[3]; \ + GLfloat ydiff, fy[3] +#define VERT_VARS_VOIDS \ (void) v; (void) x; (void) y; (void) z; (void) idx; (void) dx01; \ (void) dy01; (void) dx02; (void) dy02; (void) dx12; (void) dy12; \ (void) delt01; (void) delt02; (void) delt12; (void) deltzx; \ @@ -219,7 +223,8 @@ do { \ int arstart, gbstart; \ int deltarx, deltgbx, deltary, deltgby; \ int ctmp, ctmp2, ctmp3, ctmp4; \ - GLubyte *(col)[3]; \ + GLubyte *(col)[3] +#define GOURAUD_VARS_VOIDS \ (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \ (void) deltary; (void) deltgby; (void) ctmp; (void) ctmp2; \ (void) ctmp3; (void) ctmp4; (void) col @@ -227,7 +232,8 @@ do { \ #define FLAT_VARS \ int arstart, gbstart; \ int deltarx, deltgbx, deltary, deltgby; \ - GLubyte *(col)[3]; \ + GLubyte *(col)[3] +#define FLAT_VARS_VOIDS \ (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \ (void) deltary; (void) deltgby; (void) col @@ -245,7 +251,8 @@ do { \ int rbaseu, rbasev; \ int dstart, ustart, wstart, vstart; \ static int stmp = 0; \ - s3vTextureObjectPtr t; \ + s3vTextureObjectPtr t +#define TEX_VARS_VOIDS \ (void) u0; (void) u1; (void) u2; (void) ru0; (void) ru1; (void) ru2; \ (void) v0; (void) v1; (void) v2; (void) rv0; (void) rv1; (void) rv2; \ (void) w0; (void) w1; (void) w2; (void) rw0; (void) rw1; (void) rw2; \ @@ -620,6 +627,12 @@ static void TAG(s3v_line)( s3vContextPtr vmesa, GLfloat cull; (void) cull; #endif + LINE_VERT_VARS_VOIDS; +#if (IND & S3V_RAST_FLAT_BIT) + LINE_FLAT_VARS_VOIDS; +#else + LINE_GOURAUD_VARS_VOIDS; +#endif DEBUG(("*** s3v_line: ")); #if (IND & S3V_RAST_CULL_BIT) @@ -684,6 +697,15 @@ static void TAG(s3v_triangle)( s3vContextPtr vmesa, #if (IND & S3V_RAST_CULL_BIT) GLfloat cull; #endif + VERT_VARS_VOIDS; +#if (IND & S3v_RAST_FLAT_BIT) + FLAT_VARS_VOIDS; +#else + GOURAUD_VARS_VOIDS; +#endif +#if (IND & S3V_RAST_TEX_BIT) + TEX_VARS_VOIDS; +#endif DEBUG(("*** s3v_triangle: ")); #if (IND & S3V_RAST_CULL_BIT) @@ -774,6 +796,15 @@ static void TAG(s3v_quad)( s3vContextPtr vmesa, #if (IND & S3V_RAST_CULL_BIT) GLfloat cull; #endif + VERT_VARS_VOIDS; +#if (IND & S3v_RAST_FLAT_BIT) + FLAT_VARS_VOIDS; +#else + GOURAUD_VARS_VOIDS; +#endif +#if (IND & S3V_RAST_TEX_BIT) + TEX_VARS_VOIDS; +#endif DEBUG(("*** s3v_quad: ")); #if (IND & S3V_RAST_CULL_BIT) diff --git a/src/mesa/drivers/dri/savage/savageioctl.c b/src/mesa/drivers/dri/savage/savageioctl.c index 30d008e1be8..f759034e4af 100644 --- a/src/mesa/drivers/dri/savage/savageioctl.c +++ b/src/mesa/drivers/dri/savage/savageioctl.c @@ -632,18 +632,18 @@ void savageFlushCmdBuf( savageContextPtr imesa, GLboolean discard ) static void savageDDFlush( GLcontext *ctx ) { + savageContextPtr imesa = SAVAGE_CONTEXT(ctx); if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG) fprintf (stderr, "%s\n", __FUNCTION__); - savageContextPtr imesa = SAVAGE_CONTEXT(ctx); savageFlushVertices (imesa); savageFlushCmdBuf(imesa, GL_FALSE); } static void savageDDFinish( GLcontext *ctx ) { + savageContextPtr imesa = SAVAGE_CONTEXT(ctx); if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG) fprintf (stderr, "%s\n", __FUNCTION__); - savageContextPtr imesa = SAVAGE_CONTEXT(ctx); savageFlushVertices (imesa); savageFlushCmdBuf(imesa, GL_FALSE); WAIT_IDLE_EMPTY(imesa); diff --git a/src/mesa/drivers/dri/savage/savagerender.c b/src/mesa/drivers/dri/savage/savagerender.c index 9eda9a591e0..514434c4271 100644 --- a/src/mesa/drivers/dri/savage/savagerender.c +++ b/src/mesa/drivers/dri/savage/savagerender.c @@ -246,57 +246,59 @@ static GLboolean run_texnorm_stage( GLcontext *ctx, return GL_TRUE; for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) { - if (!ctx->Texture.Unit[i]._ReallyEnabled || - VB->TexCoordPtr[i]->size == 4) - /* Never try to normalize homogenous tex coords! */ - continue; - - GLuint reallyEnabled = ctx->Texture.Unit[i]._ReallyEnabled; - struct gl_texture_object *texObj = ctx->Texture.Unit[i]._Current; - GLboolean normalizeS = (texObj->WrapS == GL_REPEAT); - GLboolean normalizeT = (reallyEnabled & TEXTURE_2D_BIT) && - (texObj->WrapT == GL_REPEAT); - GLfloat *in = (GLfloat *)VB->TexCoordPtr[i]->data; - GLint instride = VB->TexCoordPtr[i]->stride; - GLfloat (*out)[4] = store->texcoord[i].data; - GLint j; - - if (normalizeS && normalizeT) { - /* take first texcoords as rough estimate of mean value */ - GLfloat correctionS = -floor(in[0]+0.5); - GLfloat correctionT = -floor(in[1]+0.5); - for (j = 0; j < VB->Count; ++j) { - out[j][0] = in[0] + correctionS; - out[j][1] = in[1] + correctionT; - in = (GLfloat *)((GLubyte *)in + instride); - } - } else if (normalizeS) { - /* take first texcoords as rough estimate of mean value */ - GLfloat correctionS = -floor(in[0]+0.5); - if (reallyEnabled & TEXTURE_2D_BIT) { - for (j = 0; j < VB->Count; ++j) { - out[j][0] = in[0] + correctionS; - out[j][1] = in[1]; - in = (GLfloat *)((GLubyte *)in + instride); - } - } else { - for (j = 0; j < VB->Count; ++j) { - out[j][0] = in[0] + correctionS; - in = (GLfloat *)((GLubyte *)in + instride); - } - } - } else if (normalizeT) { - /* take first texcoords as rough estimate of mean value */ - GLfloat correctionT = -floor(in[1]+0.5); - for (j = 0; j < VB->Count; ++j) { - out[j][0] = in[0]; - out[j][1] = in[1] + correctionT; - in = (GLfloat *)((GLubyte *)in + instride); - } + const GLbitfield reallyEnabled = ctx->Texture.Unit[i]._ReallyEnabled; + if (reallyEnabled) { + const struct gl_texture_object *texObj = ctx->Texture.Unit[i]._Current; + const GLboolean normalizeS = (texObj->WrapS == GL_REPEAT); + const GLboolean normalizeT = (reallyEnabled & TEXTURE_2D_BIT) && + (texObj->WrapT == GL_REPEAT); + const GLfloat *in = (GLfloat *)VB->TexCoordPtr[i]->data; + const GLint instride = VB->TexCoordPtr[i]->stride; + GLfloat (*out)[4] = store->texcoord[i].data; + GLint j; + + if (!ctx->Texture.Unit[i]._ReallyEnabled || + VB->TexCoordPtr[i]->size == 4) + /* Never try to normalize homogenous tex coords! */ + continue; + + if (normalizeS && normalizeT) { + /* take first texcoords as rough estimate of mean value */ + GLfloat correctionS = -floor(in[0]+0.5); + GLfloat correctionT = -floor(in[1]+0.5); + for (j = 0; j < VB->Count; ++j) { + out[j][0] = in[0] + correctionS; + out[j][1] = in[1] + correctionT; + in = (GLfloat *)((GLubyte *)in + instride); + } + } else if (normalizeS) { + /* take first texcoords as rough estimate of mean value */ + GLfloat correctionS = -floor(in[0]+0.5); + if (reallyEnabled & TEXTURE_2D_BIT) { + for (j = 0; j < VB->Count; ++j) { + out[j][0] = in[0] + correctionS; + out[j][1] = in[1]; + in = (GLfloat *)((GLubyte *)in + instride); + } + } else { + for (j = 0; j < VB->Count; ++j) { + out[j][0] = in[0] + correctionS; + in = (GLfloat *)((GLubyte *)in + instride); + } + } + } else if (normalizeT) { + /* take first texcoords as rough estimate of mean value */ + GLfloat correctionT = -floor(in[1]+0.5); + for (j = 0; j < VB->Count; ++j) { + out[j][0] = in[0]; + out[j][1] = in[1] + correctionT; + in = (GLfloat *)((GLubyte *)in + instride); + } + } + + if (normalizeS || normalizeT) + VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i] = &store->texcoord[i]; } - - if (normalizeS || normalizeT) - VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i] = &store->texcoord[i]; } return GL_TRUE; diff --git a/src/mesa/drivers/dri/sis/sis_clear.c b/src/mesa/drivers/dri/sis/sis_clear.c index ef4b561ca58..7b68aadc7e2 100644 --- a/src/mesa/drivers/dri/sis/sis_clear.c +++ b/src/mesa/drivers/dri/sis/sis_clear.c @@ -78,7 +78,7 @@ sisUpdateZStencilPattern( sisContextPtr smesa, GLclampd z, GLint stencil ) switch (smesa->zFormat) { case SiS_ZFORMAT_Z16: - zPattern = FLOAT_TO_USHORT(z); + CLAMPED_FLOAT_TO_USHORT(zPattern, z); zPattern |= zPattern << 16; break; case SiS_ZFORMAT_S8Z24: diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index c23e8428e4c..cc6afda1fc4 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -206,6 +206,7 @@ sisCreateBuffer( __DRIscreenPrivate *driScrnPriv, GLboolean isPixmap ) { sisScreenPtr screen = (sisScreenPtr) driScrnPriv->private; + struct gl_framebuffer *fb; if (isPixmap) return GL_FALSE; /* not implemented */ @@ -218,7 +219,7 @@ sisCreateBuffer( __DRIscreenPrivate *driScrnPriv, mesaVis->accumRedBits > 0, mesaVis->alphaBits > 0 ); /* XXX */ #else - struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); + fb = _mesa_create_framebuffer(mesaVis); /* XXX double-check the Offset/Pitch parameters! */ { diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index d347dcafc3d..4c18eba9b85 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -561,13 +561,14 @@ viaCreateContext(const __GLcontextModes *visual, (*dri_interface->getUST)( &vmesa->swap_ust ); - vmesa->regMMIOBase = (GLuint *)((GLuint)viaScreen->reg); - vmesa->pnGEMode = (GLuint *)((GLuint)viaScreen->reg + 0x4); - vmesa->regEngineStatus = (GLuint *)((GLuint)viaScreen->reg + 0x400); - vmesa->regTranSet = (GLuint *)((GLuint)viaScreen->reg + 0x43C); - vmesa->regTranSpace = (GLuint *)((GLuint)viaScreen->reg + 0x440); + vmesa->regMMIOBase = (GLuint *)((unsigned long)viaScreen->reg); + vmesa->pnGEMode = (GLuint *)((unsigned long)viaScreen->reg + 0x4); + vmesa->regEngineStatus = (GLuint *)((unsigned long)viaScreen->reg + 0x400); + vmesa->regTranSet = (GLuint *)((unsigned long)viaScreen->reg + 0x43C); + vmesa->regTranSpace = (GLuint *)((unsigned long)viaScreen->reg + 0x440); vmesa->agpBase = viaScreen->agpBase; + return GL_TRUE; } @@ -683,9 +684,9 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv, __DRIdrawablePrivate *driReadPriv) { if (VIA_DEBUG & DEBUG_DRI) { - fprintf(stderr, "driContextPriv = %08x\n", (GLuint)driContextPriv); - fprintf(stderr, "driDrawPriv = %08x\n", (GLuint)driDrawPriv); - fprintf(stderr, "driReadPriv = %08x\n", (GLuint)driReadPriv); + fprintf(stderr, "driContextPriv = %016lx\n", (unsigned long)driContextPriv); + fprintf(stderr, "driDrawPriv = %016lx\n", (unsigned long)driDrawPriv); + fprintf(stderr, "driReadPriv = %016lx\n", (unsigned long)driReadPriv); } if (driContextPriv) { diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h index 8f5548deb71..e51ec48afb1 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.h +++ b/src/mesa/drivers/dri/unichrome/via_context.h @@ -85,8 +85,8 @@ typedef void (*via_point_func)(struct via_context *, viaVertex *); struct via_buffer { drm_handle_t handle; drmSize size; - GLuint offset; - GLuint index; + unsigned long offset; + unsigned long index; GLuint pitch; GLuint bpp; char *map; @@ -102,8 +102,8 @@ struct via_buffer { struct via_tex_buffer { struct via_tex_buffer *next, *prev; struct via_texture_image *image; - GLuint index; - GLuint offset; + unsigned long index; + unsigned long offset; GLuint size; GLuint memType; unsigned char *bufAddr; @@ -298,7 +298,7 @@ struct via_context { volatile GLuint* regEngineStatus; volatile GLuint* regTranSet; volatile GLuint* regTranSpace; - GLuint* agpBase; + GLuint agpBase; GLuint drawType; GLuint nDoneFirstFlip; diff --git a/src/mesa/drivers/dri/unichrome/via_fb.c b/src/mesa/drivers/dri/unichrome/via_fb.c index 60ad0cf4ed1..faa6690732c 100644 --- a/src/mesa/drivers/dri/unichrome/via_fb.c +++ b/src/mesa/drivers/dri/unichrome/via_fb.c @@ -142,12 +142,12 @@ via_alloc_texture(struct via_context *vmesa, t->index = fb.index; if (t->memType == VIA_MEM_AGP) { - t->bufAddr = (GLubyte *)((GLuint)vmesa->viaScreen->agpLinearStart + + t->bufAddr = (GLubyte *)((unsigned long)vmesa->viaScreen->agpLinearStart + fb.offset); - t->texBase = (GLuint)vmesa->agpBase + fb.offset; + t->texBase = vmesa->agpBase + fb.offset; } else { - t->bufAddr = (GLubyte *)(fb.offset + (GLuint)vmesa->driScreen->pFB); + t->bufAddr = (GLubyte *)((unsigned long)vmesa->driScreen->pFB + fb.offset); t->texBase = fb.offset; } diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index c1997d4b433..267eeffc8b5 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -167,8 +167,14 @@ viaInitDriver(__DRIscreenPrivate *sPriv) sPriv->private = NULL; __driUtilMessage("viaInitDriver: drmMap agp failed"); return GL_FALSE; - } - viaScreen->agpBase = (GLuint *)gDRIPriv->agp.handle; + } + + /* + * FIXME: This is an invalid assumption that works until handle is + * changed to mean something else than the 32-bit physical AGP address. + */ + + viaScreen->agpBase = gDRIPriv->agp.handle; } else viaScreen->agpLinearStart = 0; diff --git a/src/mesa/drivers/dri/unichrome/via_screen.h b/src/mesa/drivers/dri/unichrome/via_screen.h index 8239960a632..84aa5aef88e 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.h +++ b/src/mesa/drivers/dri/unichrome/via_screen.h @@ -59,7 +59,7 @@ typedef struct { drmAddress reg; drmAddress agpLinearStart; - GLuint* agpBase; + GLuint agpBase; __DRIscreenPrivate *driScrnPriv; drmBufMapPtr bufs; |