diff options
Diffstat (limited to 'src/mesa/drivers/glide/fxglidew.c')
-rw-r--r-- | src/mesa/drivers/glide/fxglidew.c | 461 |
1 files changed, 251 insertions, 210 deletions
diff --git a/src/mesa/drivers/glide/fxglidew.c b/src/mesa/drivers/glide/fxglidew.c index 400f1fbafc6..89f6e5f8e6f 100644 --- a/src/mesa/drivers/glide/fxglidew.c +++ b/src/mesa/drivers/glide/fxglidew.c @@ -41,7 +41,7 @@ * See fxapi.h for more revision/author details. */ - + #ifdef HAVE_CONFIG_H #include "conf.h" #endif @@ -54,280 +54,319 @@ #include <stdlib.h> #include <string.h> -FxI32 FX_grGetInteger_NoLock(FxU32 pname) +FxI32 +FX_grGetInteger_NoLock(FxU32 pname) { #if !defined(FX_GLIDE3) - switch (pname) - { - case FX_FOG_TABLE_ENTRIES: - return GR_FOG_TABLE_SIZE; - case FX_GLIDE_STATE_SIZE: - return sizeof(GrState); - case FX_LFB_PIXEL_PIPE: - return FXFALSE; - case FX_PENDING_BUFFERSWAPS: - return grBufferNumPending(); - case FX_TEXTURE_ALIGN: - /* This is a guess from reading the glide3 docs */ - return 8; - default: - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"Wrong parameter in FX_grGetInteger!\n"); - } - return -1; - } + switch (pname) { + case FX_FOG_TABLE_ENTRIES: + return GR_FOG_TABLE_SIZE; + case FX_GLIDE_STATE_SIZE: + return sizeof(GrState); + case FX_LFB_PIXEL_PIPE: + return FXFALSE; + case FX_PENDING_BUFFERSWAPS: + return grBufferNumPending(); + case FX_TEXTURE_ALIGN: + /* This is a guess from reading the glide3 docs */ + return 8; + default: + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "Wrong parameter in FX_grGetInteger!\n"); + } + return -1; + } #else - FxU32 grname; - FxI32 result; - - switch (pname) - { - case FX_FOG_TABLE_ENTRIES: - case FX_GLIDE_STATE_SIZE: - case FX_LFB_PIXEL_PIPE: - case FX_PENDING_BUFFERSWAPS: - case FX_TEXTURE_ALIGN: - grname = pname; - break; - default: - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"Wrong parameter in FX_grGetInteger!\n"); - } - return -1; - } - - grGet(grname,4,&result); - return result; + FxU32 grname; + FxI32 result; + + switch (pname) { + case FX_FOG_TABLE_ENTRIES: + case FX_GLIDE_STATE_SIZE: + case FX_LFB_PIXEL_PIPE: + case FX_PENDING_BUFFERSWAPS: + case FX_TEXTURE_ALIGN: + grname = pname; + break; + default: + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "Wrong parameter in FX_grGetInteger!\n"); + } + return -1; + } + + grGet(grname, 4, &result); + return result; #endif } -FxI32 FX_grGetInteger(FxU32 pname) +FxI32 +FX_grGetInteger(FxU32 pname) { - int result; + int result; - BEGIN_BOARD_LOCK(); - result=FX_grGetInteger_NoLock(pname); - END_BOARD_LOCK(); - return result; + BEGIN_BOARD_LOCK(); + result = FX_grGetInteger_NoLock(pname); + END_BOARD_LOCK(); + return result; } -FxBool FX_grLfbLock(GrLock_t type, GrBuffer_t buffer, - GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, - FxBool pixelPipeline, GrLfbInfo_t *info ) { - FxBool result; +FxBool +FX_grLfbLock(GrLock_t type, GrBuffer_t buffer, + GrLfbWriteMode_t writeMode, GrOriginLocation_t origin, + FxBool pixelPipeline, GrLfbInfo_t * info) +{ + FxBool result; - BEGIN_BOARD_LOCK(); - result=grLfbLock(type, buffer, writeMode, origin, pixelPipeline, info); - END_BOARD_LOCK(); - return result; + BEGIN_BOARD_LOCK(); + result = grLfbLock(type, buffer, writeMode, origin, pixelPipeline, info); + END_BOARD_LOCK(); + return result; } -FxU32 FX_grTexTextureMemRequired(FxU32 evenOdd, GrTexInfo *info) { - FxU32 result; +FxU32 +FX_grTexTextureMemRequired(FxU32 evenOdd, GrTexInfo * info) +{ + FxU32 result; - BEGIN_BOARD_LOCK(); - result=grTexTextureMemRequired(evenOdd, info); - END_BOARD_LOCK(); - return result; + BEGIN_BOARD_LOCK(); + result = grTexTextureMemRequired(evenOdd, info); + END_BOARD_LOCK(); + return result; } -FxU32 FX_grTexMinAddress(GrChipID_t tmu) { - FxU32 result; +FxU32 +FX_grTexMinAddress(GrChipID_t tmu) +{ + FxU32 result; - BEGIN_BOARD_LOCK(); - result=grTexMinAddress(tmu); - END_BOARD_LOCK(); - return result; + BEGIN_BOARD_LOCK(); + result = grTexMinAddress(tmu); + END_BOARD_LOCK(); + return result; } -extern FxU32 FX_grTexMaxAddress(GrChipID_t tmu) { - FxU32 result; +extern FxU32 +FX_grTexMaxAddress(GrChipID_t tmu) +{ + FxU32 result; - BEGIN_BOARD_LOCK(); - result=grTexMaxAddress(tmu); - END_BOARD_LOCK(); - return result; + BEGIN_BOARD_LOCK(); + result = grTexMaxAddress(tmu); + END_BOARD_LOCK(); + return result; } -FxBool FX_grSstControl(FxU32 code) +FxBool +FX_grSstControl(FxU32 code) { #if defined(FX_GLIDE3) - /* The glide 3 sources call for grEnable/grDisable to be called in exchange - * for grSstControl. */ - switch(code) { - case GR_CONTROL_ACTIVATE: + /* The glide 3 sources call for grEnable/grDisable to be called in exchange + * for grSstControl. */ + switch (code) { + case GR_CONTROL_ACTIVATE: grEnable(GR_PASSTHRU); break; - case GR_CONTROL_DEACTIVATE: + case GR_CONTROL_DEACTIVATE: grDisable(GR_PASSTHRU); break; - } - /* Appearently GR_CONTROL_RESIZE can be ignored. */ - return 1; /* OK? */ + } + /* Appearently GR_CONTROL_RESIZE can be ignored. */ + return 1; /* OK? */ #else - FxU32 result; - BEGIN_BOARD_LOCK(); - result = grSstControl(code); - END_BOARD_LOCK(); - return result; + FxU32 result; + BEGIN_BOARD_LOCK(); + result = grSstControl(code); + END_BOARD_LOCK(); + return result; #endif } #if defined(FX_GLIDE3) -void FX_grGammaCorrectionValue(float val) +void +FX_grGammaCorrectionValue(float val) { - (void)val; + (void) val; /* ToDo */ } -int FX_getFogTableSize(void) +int +FX_getFogTableSize(void) { int result; BEGIN_BOARD_LOCK(); - grGet(GR_FOG_TABLE_ENTRIES,sizeof(int),(void*)&result); + grGet(GR_FOG_TABLE_ENTRIES, sizeof(int), (void *) &result); END_BOARD_LOCK(); - return result; + return result; } -int FX_getGrStateSize(void) +int +FX_getGrStateSize(void) { int result; BEGIN_BOARD_LOCK(); - grGet(GR_GLIDE_STATE_SIZE,sizeof(int),(void*)&result); + grGet(GR_GLIDE_STATE_SIZE, sizeof(int), (void *) &result); END_BOARD_LOCK(); return result; - + } -int FX_grSstScreenWidth() +int +FX_grSstScreenWidth() { FxI32 result[4]; BEGIN_BOARD_LOCK(); - grGet(GR_VIEWPORT,sizeof(FxI32)*4,result); + grGet(GR_VIEWPORT, sizeof(FxI32) * 4, result); END_BOARD_LOCK(); - + return result[2]; } -int FX_grSstScreenHeight() +int +FX_grSstScreenHeight() { FxI32 result[4]; BEGIN_BOARD_LOCK(); - grGet(GR_VIEWPORT,sizeof(FxI32)*4,result); + grGet(GR_VIEWPORT, sizeof(FxI32) * 4, result); END_BOARD_LOCK(); - + return result[3]; } -void FX_grGlideGetVersion(char *buf) +void +FX_grGlideGetVersion(char *buf) { - BEGIN_BOARD_LOCK(); - strcpy(buf,grGetString(GR_VERSION)); - END_BOARD_LOCK(); + BEGIN_BOARD_LOCK(); + strcpy(buf, grGetString(GR_VERSION)); + END_BOARD_LOCK(); } -void FX_grSstPerfStats(GrSstPerfStats_t *st) +void +FX_grSstPerfStats(GrSstPerfStats_t * st) { - FxI32 n; - grGet(GR_STATS_PIXELS_IN, 4, &n); st->pixelsIn = n; - grGet(GR_STATS_PIXELS_CHROMA_FAIL, 4, &n); st->chromaFail = n; - grGet(GR_STATS_PIXELS_DEPTHFUNC_FAIL, 4, &n); st->zFuncFail = n; - grGet(GR_STATS_PIXELS_AFUNC_FAIL, 4, &n); st->aFuncFail = n; - grGet(GR_STATS_PIXELS_OUT, 4, &n); st->pixelsOut = n; + FxI32 n; + grGet(GR_STATS_PIXELS_IN, 4, &n); + st->pixelsIn = n; + grGet(GR_STATS_PIXELS_CHROMA_FAIL, 4, &n); + st->chromaFail = n; + grGet(GR_STATS_PIXELS_DEPTHFUNC_FAIL, 4, &n); + st->zFuncFail = n; + grGet(GR_STATS_PIXELS_AFUNC_FAIL, 4, &n); + st->aFuncFail = n; + grGet(GR_STATS_PIXELS_OUT, 4, &n); + st->pixelsOut = n; } -void FX_grAADrawLine(GrVertex *a,GrVertex *b) +void +FX_grAADrawLine(GrVertex * a, GrVertex * b) { /* ToDo */ BEGIN_CLIP_LOOP(); - grDrawLine(a,b); + grDrawLine(a, b); END_CLIP_LOOP(); } -void FX_grAADrawPoint(GrVertex *a) +void +FX_grAADrawPoint(GrVertex * a) { - BEGIN_CLIP_LOOP(); - grDrawPoint(a); - END_CLIP_LOOP(); + BEGIN_CLIP_LOOP(); + grDrawPoint(a); + END_CLIP_LOOP(); } -void FX_grDrawPolygonVertexList(int n, GrVertex *verts) +void +FX_grDrawPolygonVertexList(int n, GrVertex * verts) { - BEGIN_CLIP_LOOP(); - grDrawVertexArrayContiguous(GR_POLYGON, n, verts, sizeof(GrVertex)); - END_CLIP_LOOP(); + BEGIN_CLIP_LOOP(); + grDrawVertexArrayContiguous(GR_POLYGON, n, verts, sizeof(GrVertex)); + END_CLIP_LOOP(); } -void FX_setupGrVertexLayout(void) +void +FX_setupGrVertexLayout(void) { - 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_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(); + 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_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(); } -void FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask) +void +FX_grHints_NoLock(GrHint_t hintType, FxU32 hintMask) { - switch(hintType) { - case GR_HINT_STWHINT: - { - if (hintMask & GR_STWHINT_W_DIFF_TMU0) - grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_ENABLE); - else - grVertexLayout(GR_PARAM_Q0,GR_VERTEX_OOW_TMU0_OFFSET << 2, GR_PARAM_DISABLE); - - if (hintMask & GR_STWHINT_ST_DIFF_TMU1) - grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE); - else - grVertexLayout(GR_PARAM_ST1,GR_VERTEX_SOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); - - if (hintMask & GR_STWHINT_W_DIFF_TMU1) - grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_ENABLE); - else - grVertexLayout(GR_PARAM_Q1,GR_VERTEX_OOW_TMU1_OFFSET << 2, GR_PARAM_DISABLE); - - } - } + switch (hintType) { + case GR_HINT_STWHINT: + { + if (hintMask & GR_STWHINT_W_DIFF_TMU0) + grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, + GR_PARAM_ENABLE); + else + grVertexLayout(GR_PARAM_Q0, GR_VERTEX_OOW_TMU0_OFFSET << 2, + GR_PARAM_DISABLE); + + if (hintMask & GR_STWHINT_ST_DIFF_TMU1) + grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, + GR_PARAM_ENABLE); + else + grVertexLayout(GR_PARAM_ST1, GR_VERTEX_SOW_TMU1_OFFSET << 2, + GR_PARAM_DISABLE); + + if (hintMask & GR_STWHINT_W_DIFF_TMU1) + grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, + GR_PARAM_ENABLE); + else + grVertexLayout(GR_PARAM_Q1, GR_VERTEX_OOW_TMU1_OFFSET << 2, + GR_PARAM_DISABLE); + + } + } } -void FX_grHints(GrHint_t hintType, FxU32 hintMask) { - BEGIN_BOARD_LOCK(); - FX_grHints_NoLock(hintType, hintMask); - END_BOARD_LOCK(); +void +FX_grHints(GrHint_t hintType, FxU32 hintMask) +{ + BEGIN_BOARD_LOCK(); + FX_grHints_NoLock(hintType, hintMask); + END_BOARD_LOCK(); } /* * Glide3 doesn't have the grSstQueryHardware function anymore. * Instead, we call grGet() and fill in the data structures ourselves. */ -int FX_grSstQueryHardware(GrHwConfiguration *config) +int +FX_grSstQueryHardware(GrHwConfiguration * config) { int i, j; int numFB; BEGIN_BOARD_LOCK(); - grGet(GR_NUM_BOARDS, 4, (void*)&(config->num_sst)); + grGet(GR_NUM_BOARDS, 4, (void *) &(config->num_sst)); if (config->num_sst == 0) return 0; - for (i = 0; i< config->num_sst; i++) { + for (i = 0; i < config->num_sst; i++) { FxI32 result; config->SSTs[i].type = GR_SSTTYPE_VOODOO; @@ -335,24 +374,25 @@ int FX_grSstQueryHardware(GrHwConfiguration *config) grGet(GR_MEMORY_FB, 4, &result); config->SSTs[i].sstBoard.VoodooConfig.fbRam = result / (1024 * 1024); - + grGet(GR_NUM_TMU, 4, &result); config->SSTs[i].sstBoard.VoodooConfig.nTexelfx = result; grGet(GR_REVISION_FB, 4, &result); config->SSTs[i].sstBoard.VoodooConfig.fbiRev = result; - - grGet(GR_NUM_FB,4,(void*)&numFB); + + grGet(GR_NUM_FB, 4, (void *) &numFB); if (numFB > 1) - config->SSTs[i].sstBoard.VoodooConfig.sliDetect = FXTRUE; + config->SSTs[i].sstBoard.VoodooConfig.sliDetect = FXTRUE; else - config->SSTs[i].sstBoard.VoodooConfig.sliDetect = FXFALSE; + config->SSTs[i].sstBoard.VoodooConfig.sliDetect = FXFALSE; for (j = 0; j < config->SSTs[i].sstBoard.VoodooConfig.nTexelfx; j++) { - grGet(GR_MEMORY_TMU, 4, &result); - config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRam = result / (1024*1024); - grGet(GR_REVISION_TMU, 4, &result); - config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRev = result; + grGet(GR_MEMORY_TMU, 4, &result); + config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRam = + result / (1024 * 1024); + grGet(GR_REVISION_TMU, 4, &result); + config->SSTs[i].sstBoard.VoodooConfig.tmuConfig[j].tmuRev = result; } } END_BOARD_LOCK(); @@ -361,7 +401,8 @@ int FX_grSstQueryHardware(GrHwConfiguration *config) #else -int FX_grSstScreenWidth() +int +FX_grSstScreenWidth() { int i; BEGIN_BOARD_LOCK(); @@ -370,7 +411,8 @@ int FX_grSstScreenWidth() return i; } -int FX_grSstScreenHeight() +int +FX_grSstScreenHeight() { int i; BEGIN_BOARD_LOCK(); @@ -379,51 +421,49 @@ int FX_grSstScreenHeight() return i; } -int FX_grSstQueryHardware(GrHwConfiguration *c) +int +FX_grSstQueryHardware(GrHwConfiguration * c) { int i; BEGIN_BOARD_LOCK(); i = grSstQueryHardware(c); END_BOARD_LOCK(); return i; -} +} -#endif /* FX_GLIDE3 */ +#endif /* FX_GLIDE3 */ /* It appears to me that this function is needed either way. */ -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) +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) { FX_GrContext_t i; BEGIN_BOARD_LOCK(); - i = grSstWinOpen( hWnd, - screen_resolution, - refresh_rate, - color_format, - origin_location, - nColBuffers, - nAuxBuffers ); - + i = grSstWinOpen(hWnd, + screen_resolution, + refresh_rate, + color_format, origin_location, nColBuffers, nAuxBuffers); + /* - fprintf(stderr, - "grSstWinOpen( win %d res %d ref %d fmt %d\n" - " org %d ncol %d naux %d )\n" - " ==> %d\n", - hWnd, - screen_resolution, - refresh_rate, - color_format, - origin_location, - nColBuffers, - nAuxBuffers, - i); - */ + fprintf(stderr, + "grSstWinOpen( win %d res %d ref %d fmt %d\n" + " org %d ncol %d naux %d )\n" + " ==> %d\n", + hWnd, + screen_resolution, + refresh_rate, + color_format, + origin_location, + nColBuffers, + nAuxBuffers, + i); + */ END_BOARD_LOCK(); return i; } @@ -437,9 +477,10 @@ FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd, */ extern int gl_fx_dummy_function_glidew(void); -int gl_fx_dummy_function_glidew(void) +int +gl_fx_dummy_function_glidew(void) { - return 0; + return 0; } #endif /* FX */ |