diff options
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/glide/fxddspan.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxddtex.c | 95 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxdrv.h | 46 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxglidew.c | 110 |
4 files changed, 146 insertions, 112 deletions
diff --git a/src/mesa/drivers/glide/fxddspan.c b/src/mesa/drivers/glide/fxddspan.c index 1cb13397bb7..3dfc82b7044 100644 --- a/src/mesa/drivers/glide/fxddspan.c +++ b/src/mesa/drivers/glide/fxddspan.c @@ -122,6 +122,11 @@ void LFB_WRITE_SPAN_MESA(GrBuffer_t dst_buffer, #if defined(FX_GLIDE3) && defined(XF86DRI) +static FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer, + FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format, + FxU32 src_width, FxU32 src_height, FxI32 src_stride, + void *src_data); + FxBool writeRegionClipped(fxMesaContext fxMesa, GrBuffer_t dst_buffer, FxU32 dst_x, FxU32 dst_y, GrLfbSrcFmt_t src_format, FxU32 src_width, FxU32 src_height, FxI32 src_stride, @@ -383,7 +388,7 @@ static void fxDDReadRGBAPixels(const GLcontext *ctx, { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; GLuint i; - GLint bottom=fxMesa->y_delta-1; + GLint bottom=fxMesa->height+fxMesa->y_offset-1; if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxDDReadRGBAPixels(...)\n"); diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index 2c2fca9e5e7..64fc1933578 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -54,6 +54,37 @@ #include "fxdrv.h" +void fxPrintTextureData(tfxTexInfo *ti) +{ + fprintf(stderr, "Texture Data:\n"); + if (ti->tObj) { + fprintf(stderr, "\tName: %d\n", ti->tObj->Name); + fprintf(stderr, "\tBaseLevel: %d\n", ti->tObj->BaseLevel); + fprintf(stderr, "\tSize: %d x %d\n", + ti->tObj->Image[ti->tObj->BaseLevel]->Width, + ti->tObj->Image[ti->tObj->BaseLevel]->Height); + } else + fprintf(stderr, "\tName: UNNAMED\n"); + fprintf(stderr, "\tLast used: %d\n", ti->lastTimeUsed); + fprintf(stderr, "\tTMU: %d\n", ti->whichTMU); + fprintf(stderr, "\t%s\n", (ti->isInTM)?"In TMU":"Not in TMU"); + if (ti->tm[0]) + fprintf(stderr, "\tMem0: %x-%x\n", ti->tm[0]->startAddr, + ti->tm[0]->endAddr); + if (ti->tm[1]) + fprintf(stderr, "\tMem1: %x-%x\n", ti->tm[1]->startAddr, + ti->tm[1]->endAddr); + fprintf(stderr, "\tMipmaps: %d-%d\n", ti->minLevel, ti->maxLevel); + fprintf(stderr, "\tFilters: min %d min %d\n", ti->minFilt, ti->maxFilt); + fprintf(stderr, "\tClamps: s %d t %d\n", ti->sClamp, ti->tClamp); + fprintf(stderr, "\tScales: s %f t %f\n", ti->sScale, ti->tScale); + fprintf(stderr, "\tInt Scales: s %d t %d\n", + ti->int_sScale/0x800000, ti->int_tScale/0x800000); + fprintf(stderr, "\t%s\n", (ti->fixedPalette)?"Fixed palette":"Non fixed palette"); + fprintf(stderr, "\t%s\n", (ti->validated)?"Validated":"Not validated"); +} + + /************************************************************************/ /*************************** Texture Mapping ****************************/ /************************************************************************/ @@ -65,7 +96,7 @@ void fxTexInvalidate(GLcontext *ctx, struct gl_texture_object *tObj) fxTMMoveOutTM(fxMesa,tObj); /* TO DO: SLOW but easy to write */ - ti=(tfxTexInfo *)tObj->DriverData; + ti=fxTMGetTexInfo(tObj); ti->validated=GL_FALSE; fxMesa->new_state|=FX_NEW_TEXTURING; ctx->Driver.RenderStart = fxSetupFXUnits; @@ -83,12 +114,12 @@ static tfxTexInfo *fxAllocTexObjData(fxMesaContext fxMesa) } ti->validated=GL_FALSE; - ti->tmi.isInTM=GL_FALSE; + ti->isInTM=GL_FALSE; - ti->tmi.whichTMU=FX_TMU_NONE; + ti->whichTMU=FX_TMU_NONE; - ti->tmi.tm[FX_TMU0]=NULL; - ti->tmi.tm[FX_TMU1]=NULL; + ti->tm[FX_TMU0]=NULL; + ti->tm[FX_TMU1]=NULL; ti->minFilt=GR_TEXTUREFILTER_POINT_SAMPLED; ti->maxFilt=GR_TEXTUREFILTER_BILINEAR; @@ -105,8 +136,8 @@ static tfxTexInfo *fxAllocTexObjData(fxMesaContext fxMesa) } for(i=0;i<MAX_TEXTURE_LEVELS;i++) { - ti->tmi.mipmapLevel[i].used=GL_FALSE; - ti->tmi.mipmapLevel[i].data=NULL; + ti->mipmapLevel[i].used=GL_FALSE; + ti->mipmapLevel[i].data=NULL; } return ti; @@ -124,13 +155,14 @@ void fxDDTexBind(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj) if(target!=GL_TEXTURE_2D) return; - if(!tObj->DriverData) + if (!tObj->DriverData) { tObj->DriverData=fxAllocTexObjData(fxMesa); + } - ti=(tfxTexInfo *)tObj->DriverData; + ti=fxTMGetTexInfo(tObj); fxMesa->texBindNumber++; - ti->tmi.lastTimeUsed=fxMesa->texBindNumber; + ti->lastTimeUsed=fxMesa->texBindNumber; fxMesa->new_state|=FX_NEW_TEXTURING; ctx->Driver.RenderStart = fxSetupFXUnits; @@ -165,10 +197,10 @@ void fxDDTexParam(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, if(target!=GL_TEXTURE_2D) return; - if(!tObj->DriverData) + if (!tObj->DriverData) tObj->DriverData=fxAllocTexObjData(fxMesa); - ti=(tfxTexInfo *)tObj->DriverData; + ti=fxTMGetTexInfo(tObj); switch(pname) { @@ -289,7 +321,7 @@ void fxDDTexParam(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, void fxDDTexDel(GLcontext *ctx, struct gl_texture_object *tObj) { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - tfxTexInfo *ti=(tfxTexInfo *)tObj->DriverData; + tfxTexInfo *ti=fxTMGetTexInfo(tObj); if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxDDTexDel(%d,%x)\n",tObj->Name,(GLuint)ti); @@ -332,10 +364,10 @@ void fxDDTexPalette(GLcontext *ctx, struct gl_texture_object *tObj) return; } - if(!tObj->DriverData) + if (!tObj->DriverData) tObj->DriverData=fxAllocTexObjData(fxMesa); - ti=(tfxTexInfo *)tObj->DriverData; + ti=fxTMGetTexInfo(tObj); for(i=0;i<tObj->Palette.Size;i++) { r=tObj->Palette.Table[i*4]; @@ -397,13 +429,10 @@ void fxDDTexUseGlbPalette(GLcontext *ctx, GLboolean state) if((ctx->Texture.Unit[0].Current==ctx->Texture.Unit[0].CurrentD[2]) && (ctx->Texture.Unit[0].Current!=NULL)) { struct gl_texture_object *tObj=ctx->Texture.Unit[0].Current; - tfxTexInfo *ti; - if(!tObj->DriverData) + if (!tObj->DriverData) tObj->DriverData=fxAllocTexObjData(fxMesa); - ti=(tfxTexInfo *)tObj->DriverData; - fxTexInvalidate(ctx,tObj); } } @@ -1037,21 +1066,23 @@ void fxDDTexImg(GLcontext *ctx, GLenum target, tfxTexInfo *ti; if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: (%d) fxDDTexImg(...,%d,%x,%d,%d...)\n",tObj->Name, - target,internalFormat,image->Width,image->Height); + fprintf(stderr, + "fxmesa: (%d) fxDDTexImg(...,level=%d,target=%d,format=%x,width=%d,height=%d...)\n", + tObj->Name, level, target, internalFormat, image->Width, + image->Height); } if(target!=GL_TEXTURE_2D) return; - if(!tObj->DriverData) + if (!tObj->DriverData) tObj->DriverData=fxAllocTexObjData(fxMesa); - ti=(tfxTexInfo *)tObj->DriverData; + ti=fxTMGetTexInfo(tObj); if(fxIsTexSupported(target,internalFormat,image)) { GrTextureFormat_t gldformat; - tfxMipMapLevel *mml=&ti->tmi.mipmapLevel[level]; + tfxMipMapLevel *mml=&ti->mipmapLevel[level]; fxTexGetFormat(internalFormat,&gldformat,NULL); @@ -1062,7 +1093,7 @@ void fxDDTexImg(GLcontext *ctx, GLenum target, fxTexBuildImageMap(image,internalFormat,&(mml->data), &(mml->translated)); - if(ti->validated && ti->tmi.isInTM) + if(ti->validated && ti->isInTM) fxTMReloadMipMapLevel(fxMesa,tObj,level); else fxTexInvalidate(ctx,tObj); @@ -1262,18 +1293,20 @@ void fxDDTexSubImg(GLcontext *ctx, GLenum target, tfxMipMapLevel *mml; if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: (%d) fxDDTexSubImg(...,%d,%x,%d,%d...)\n",tObj->Name, - target,internalFormat,image->Width,image->Height); + fprintf(stderr, + "fxmesa: (%d) fxDDTexSubImg(level=%d,target=%d,format=%x,width=%d,height=%d)\n", + tObj->Name, level, target, internalFormat, image->Width, + image->Height); } if(target!=GL_TEXTURE_2D) return; - if(!tObj->DriverData) + if (!tObj->DriverData) return; - ti=(tfxTexInfo *)tObj->DriverData; - mml=&ti->tmi.mipmapLevel[level]; + ti=fxTMGetTexInfo(tObj); + mml=&ti->mipmapLevel[level]; fxTexGetFormat(internalFormat,&gldformat,NULL); @@ -1301,7 +1334,7 @@ void fxDDTexSubImg(GLcontext *ctx, GLenum target, fxTexBuildSubImageMap(image,internalFormat,xoffset,yoffset, width,height,mml->data); - if(ti->validated && ti->tmi.isInTM) + if(ti->validated && ti->isInTM) fxTMReloadSubMipMapLevel(fxMesa,tObj,level,yoffset,height); else fxTexInvalidate(ctx,tObj); diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h index 9064205b3a5..57d35ff63e3 100644 --- a/src/mesa/drivers/glide/fxdrv.h +++ b/src/mesa/drivers/glide/fxdrv.h @@ -263,16 +263,13 @@ typedef struct { typedef void (*tfxRenderVBFunc)(GLcontext *); -typedef struct tfxTMFreeListNode { - struct tfxTMFreeListNode *next; - FxU32 startAddress, endAddress; -} tfxTMFreeNode; - -typedef struct tfxTMAllocListNode { - struct tfxTMAllocListNode *next; - FxU32 startAddress, endAddress; - struct gl_texture_object *tObj; -} tfxTMAllocNode; +/* + Memory range from startAddr to endAddr-1 +*/ +typedef struct MemRange_t { + struct MemRange_t *next; + FxU32 startAddr, endAddr; +} MemRange; typedef struct { GLsizei width, height; @@ -282,19 +279,17 @@ typedef struct { GLboolean translated, used; } tfxMipMapLevel; -typedef struct { - GLuint lastTimeUsed; +typedef struct tfxTexInfo_t { + struct tfxTexInfo *next; + struct gl_texture_object *tObj; + GLuint lastTimeUsed; FxU32 whichTMU; - - tfxTMAllocNode *tm[FX_NUM_TMU]; + GLboolean isInTM; tfxMipMapLevel mipmapLevel[MAX_TEXTURE_LEVELS]; - GLboolean isInTM; -} tfxTMInfo; -typedef struct { - tfxTMInfo tmi; + MemRange *tm[FX_NUM_TMU]; GLint minLevel, maxLevel; GLint baseLevelInternalFormat; @@ -410,7 +405,7 @@ struct tfxMesaVertexBuffer { #define FX_DRIVER_DATA(vb) ((struct tfxMesaVertexBuffer *)((vb)->driver_data)) #define FX_CONTEXT(ctx) ((fxMesaContext)((ctx)->DriverCtx)) -#define FX_TEXTURE_DATA(t) ((tfxTexInfo *) ((t)->Current->DriverData)) +#define FX_TEXTURE_DATA(t) fxTMGetTexInfo((t)->Current) #if defined(XFree86Server) || defined(GLX_DIRECT_RENDERING) #include "tdfx_init.h" @@ -475,9 +470,10 @@ struct tfxMesaContext { GLuint texBindNumber; GLint tmuSrc; GLuint lastUnitsMode; + GLuint texStart[FX_NUM_TMU]; GLuint freeTexMem[FX_NUM_TMU]; - tfxTMFreeNode *tmFree[FX_NUM_TMU]; - tfxTMAllocNode *tmAlloc[FX_NUM_TMU]; + MemRange *tmPool; + MemRange *tmFree[FX_NUM_TMU]; GLenum fogTableMode; GLfloat fogDensity; @@ -526,12 +522,8 @@ struct tfxMesaContext { int clipMinY; int clipMaxY; int needClip; - int numClipRects; -#ifdef FX86DRI - XF86DRIClipRectPtr pClipRects; -#endif - DRI_FX_CONTEXT + DRI_FX_CONTEXT }; typedef void (*tfxSetupFunc)(struct vertex_buffer *, GLuint, GLuint); @@ -573,6 +565,7 @@ extern void fxSetupDDSpanPointers(GLcontext *); extern void fxDDBufferSize(GLcontext *, GLuint *, GLuint *); +extern void fxPrintTextureData(tfxTexInfo *ti); extern void fxDDTexEnv(GLcontext *, GLenum, const GLfloat *); extern void fxDDTexImg(GLcontext *, GLenum, struct gl_texture_object *, GLint, GLint, const struct gl_texture_image *); @@ -622,6 +615,7 @@ extern void fxDDRenderVBIndirectDirect( struct vertex_buffer *VB ); extern void fxDDInitExtensions( GLcontext *ctx ); +#define fxTMGetTexInfo(o) ((tfxTexInfo*)((o)->DriverData)) extern void fxTMInit(fxMesaContext ctx); extern void fxTMClose(fxMesaContext ctx); extern void fxTMMoveInTM(fxMesaContext, struct gl_texture_object *, GLint); diff --git a/src/mesa/drivers/glide/fxglidew.c b/src/mesa/drivers/glide/fxglidew.c index 574136a5cd0..900e84076d4 100644 --- a/src/mesa/drivers/glide/fxglidew.c +++ b/src/mesa/drivers/glide/fxglidew.c @@ -55,7 +55,7 @@ #include <stdlib.h> #include <string.h> -FxI32 grGetInteger(FxU32 pname) +static FxI32 FX_grGetInteger_NoLock(FxU32 pname) { #if !defined(FX_GLIDE3) switch (pname) @@ -103,7 +103,7 @@ FxI32 FX_grGetInteger(FxU32 pname) int result; BEGIN_BOARD_LOCK(); - result=grGetInteger(pname); + result=FX_grGetInteger_NoLock(pname); END_BOARD_LOCK(); return result; } @@ -247,34 +247,37 @@ void FX_grAADrawPoint(GrVertex *a) #if FX_USE_PARGB void FX_setupGrVertexLayout(void) { - grReset(GR_VERTEX_PARAMETER); + BEGIN_BOARD_LOCK(); + grReset(GR_VERTEX_PARAMETER); - grCoordinateSpace(GR_WINDOW_COORDS); - grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PARGB_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE); - grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); - grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); + grCoordinateSpace(GR_WINDOW_COORDS); + grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_PARGB, GR_VERTEX_PARGB_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE); + grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); + grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); + END_BOARD_LOCK(); } #else /* FX_USE_PARGB */ void FX_setupGrVertexLayout(void) { - grReset(GR_VERTEX_PARAMETER); + BEGIN_BOARD_LOCK(); + grReset(GR_VERTEX_PARAMETER); - grCoordinateSpace(GR_WINDOW_COORDS); - grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE); - /* grVertexLayout(GR_PARAM_Z, GR_VERTEX_Z_OFFSET << 2, GR_PARAM_ENABLE); */ - grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); - grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE); - grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); - grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); + grCoordinateSpace(GR_WINDOW_COORDS); + grVertexLayout(GR_PARAM_XY, GR_VERTEX_X_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_RGB, GR_VERTEX_R_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_A, GR_VERTEX_A_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Q, GR_VERTEX_OOW_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Z, GR_VERTEX_OOZ_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_ST0, GR_VERTEX_SOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); + grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE); + grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); + grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); + END_BOARD_LOCK(); } #endif @@ -342,6 +345,34 @@ int FX_grSstQueryHardware(GrHwConfiguration *config) return 1; } +#else + +int FX_grSstScreenWidth() +{ + int i; + BEGIN_BOARD_LOCK(); + i = grSstScreenWidth(); + END_BOARD_LOCK(); + return i; +} + +int FX_grSstScreenHeight() +{ + int i; + BEGIN_BOARD_LOCK(); + i = grSstScreenHeight(); + END_BOARD_LOCK(); + return i; +} + +int FX_grSstQueryHardware(GrHwConfiguration *c) +{ + int i; + BEGIN_BOARD_LOCK(); + i = grSstQueryHardware(c); + END_BOARD_LOCK(); + return i; +} FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd, GrScreenResolution_t screen_resolution, @@ -377,38 +408,9 @@ FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd, return i; } -#else /* FX_GLIDE3 */ - -int FX_grSstScreenWidth() -{ - return grSstScreenWidth(); -} - -int FX_grSstScreenHeight() -{ - return grSstScreenHeight(); -} - -int FX_grSstQueryHardware(GrHwConfiguration *config) -{ - return grSstQueryHardware(config); -} - -FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd, - GrScreenResolution_t screen_resolution, - GrScreenRefresh_t refresh_rate, - GrColorFormat_t color_format, - GrOriginLocation_t origin_location, - int nColBuffers, - int nAuxBuffers) -{ - return grSstWinOpen(hWnd, screen_resolution, refresh_rate, - color_format, origin_location, nColBuffers, nAuxBuffers); -} - -#endif /* FX_GLIDE3 */ +#endif #else /* |