diff options
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/glide/fxapi.c | 91 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxdd.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxdrv.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxg.c | 27 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxg.h | 3 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxtexman.c | 10 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxwgl.c | 79 |
7 files changed, 104 insertions, 120 deletions
diff --git a/src/mesa/drivers/glide/fxapi.c b/src/mesa/drivers/glide/fxapi.c index 8ffa36c9c3..10d572a9e0 100644 --- a/src/mesa/drivers/glide/fxapi.c +++ b/src/mesa/drivers/glide/fxapi.c @@ -262,7 +262,7 @@ fxMesaCreateContext(GLuint win, int i; const char *str; - int sliaa, numSLI, samplesPerChip, tmuRam, fbRam; + int sliaa, numSLI, samplesPerChip; struct SstCard_St *voodoo; struct tdfx_glide *Glide; @@ -273,8 +273,6 @@ fxMesaCreateContext(GLuint win, GLuint redBits, greenBits, blueBits, alphaBits; GrPixelFormat_t pixFmt; - GLboolean useBGR; - if (TDFX_DEBUG & VERBOSE_DRIVER) { fprintf(stderr, "fxMesaCreateContext(...)\n"); } @@ -312,11 +310,7 @@ fxMesaCreateContext(GLuint win, break; /* XXX ugly hack here for sharing display lists */ case FXMESA_SHARE_CONTEXT: - { - const void *vPtr = &attribList[++i]; - GLcontext **ctx = (GLcontext **)vPtr; - shareCtx = *ctx; - } + shareCtx = (GLcontext *)attribList[++i]; break; default: fprintf(stderr, "fxMesaCreateContext: ERROR: wrong parameter (%d) passed\n", attribList[i]); @@ -373,11 +367,11 @@ fxMesaCreateContext(GLuint win, switch (voodoo->type) { case GR_SSTTYPE_VOODOO: case GR_SSTTYPE_Banshee: - useBGR = GL_TRUE; + fxMesa->bgrOrder = GL_TRUE; fxMesa->snapVertices = GL_TRUE; break; case GR_SSTTYPE_Voodoo2: - useBGR = GL_TRUE; + fxMesa->bgrOrder = GL_TRUE; fxMesa->snapVertices = GL_FALSE; break; case GR_SSTTYPE_Voodoo4: @@ -387,7 +381,7 @@ fxMesaCreateContext(GLuint win, } case GR_SSTTYPE_Voodoo3: default: - useBGR = GL_FALSE; + fxMesa->bgrOrder = GL_FALSE; fxMesa->snapVertices = GL_FALSE; break; } @@ -579,29 +573,6 @@ fxMesaCreateContext(GLuint win, goto errorhandler; } - /* Not that it matters, but tmuRam and fbRam change after grSstWinOpen. */ - tmuRam = voodoo->tmuConfig[GR_TMU0].tmuRam; - fbRam = voodoo->fbRam; - BEGIN_BOARD_LOCK(); - { - FxI32 result; - grGet(GR_MEMORY_TMU, 4, &result); - tmuRam = result / (1024 * 1024); - grGet(GR_MEMORY_FB, 4, &result); - fbRam = result / (1024 * 1024); - } - END_BOARD_LOCK(); - - sprintf(fxMesa->rendererString, "Mesa %s v0.60 %s %dMB FB, %dMB TM, %d TMU, %s", - grGetString(GR_RENDERER), - grGetString(GR_HARDWARE), - fbRam, - tmuRam * voodoo->nTexelfx, - voodoo->nTexelfx, - (voodoo->numChips > 1) ? "SLI" : "NOSLI"); - - fxMesa->bgrOrder = useBGR; - /* screen */ fxMesa->screen_width = FX_grSstScreenWidth(); fxMesa->screen_height = FX_grSstScreenHeight(); @@ -617,22 +588,38 @@ fxMesaCreateContext(GLuint win, fxMesa->clipMaxY = fxMesa->height; if (fxMesa->verbose) { - char buf[80]; - - strcpy(buf, grGetString(GR_VERSION)); - fprintf(stderr, "Voodoo Using Glide %s\n", buf); - fprintf(stderr, "Voodoo Number of boards: %d\n", glbHWConfig.num_sst); - fprintf(stderr, "Voodoo Number of TMUs: %d\n", voodoo->nTexelfx); - fprintf(stderr, "Voodoo fbRam: %d\n", voodoo->fbRam); - fprintf(stderr, "Voodoo fbiRev: %d\n", voodoo->fbiRev); - fprintf(stderr, "Voodoo chips detected: %d\n", voodoo->numChips); - fprintf(stderr, "Voodoo pixel order = %s, vertex snapping = %d\n", - useBGR ? "BGR" : "RGB", - fxMesa->snapVertices); - fprintf(stderr, "Voodoo screen: %dx%d:%d\n", - fxMesa->screen_width, fxMesa->screen_height, colDepth); + FxI32 tmuRam, fbRam; + + /* Not that it matters, but tmuRam and fbRam change after grSstWinOpen. */ + tmuRam = voodoo->tmuConfig[GR_TMU0].tmuRam; + fbRam = voodoo->fbRam; + BEGIN_BOARD_LOCK(); + grGet(GR_MEMORY_TMU, 4, &tmuRam); + grGet(GR_MEMORY_FB, 4, &fbRam); + END_BOARD_LOCK(); + + fprintf(stderr, "Voodoo Using Glide %s\n", grGetString(GR_VERSION)); + fprintf(stderr, "Voodoo Board: %d/%d, %s, %d GPU\n", + fxMesa->board + 1, + glbHWConfig.num_sst, + grGetString(GR_HARDWARE), + voodoo->numChips); + fprintf(stderr, "Voodoo Memory: FB = %ld, TM = %d x %ld\n", + fbRam, + voodoo->nTexelfx, + tmuRam); + fprintf(stderr, "Voodoo Screen: %dx%d:%d %s, %svertex snapping\n", + fxMesa->screen_width, + fxMesa->screen_height, + colDepth, + fxMesa->bgrOrder ? "BGR" : "RGB", + fxMesa->snapVertices ? "" : "no "); } + sprintf(fxMesa->rendererString, "Mesa %s v0.60 %s", + grGetString(GR_RENDERER), + grGetString(GR_HARDWARE)); + fxMesa->glVis = _mesa_create_visual(GL_TRUE, /* RGB mode */ doubleBuffer, GL_FALSE, /* stereo */ @@ -759,10 +746,10 @@ fxMesaDestroyContext(fxMesaContext fxMesa) fxMesa->stats.swapBuffer = 1; fprintf(stderr, "Textures Stats:\n"); - fprintf(stderr, " Free texture memory on TMU0: %d:\n", + fprintf(stderr, " Free texture memory on TMU0: %d\n", fxMesa->freeTexMem[FX_TMU0]); if (fxMesa->haveTwoTMUs) - fprintf(stderr, " Free texture memory on TMU1: %d:\n", + fprintf(stderr, " Free texture memory on TMU1: %d\n", fxMesa->freeTexMem[FX_TMU1]); fprintf(stderr, " # request to TMM to upload a texture objects: %u\n", fxMesa->stats.reqTexUpload); @@ -872,6 +859,7 @@ fxMesaSwapBuffers(void) grBufferSwap(fxMesaCurrentCtx->swapInterval); +#if 0 /* * Don't allow swap buffer commands to build up! */ @@ -883,6 +871,7 @@ fxMesaSwapBuffers(void) in order to enable this option) */ /* usleep(10000); */ ; +#endif fxMesaCurrentCtx->stats.swapBuffer++; } @@ -897,7 +886,7 @@ void GLAPIENTRY fxCloseHardware(void) { if (glbGlideInitialized) { - if (fxMesaCurrentCtx && fxMesaCurrentCtx->verbose) { + if (getenv("MESA_FX_INFO")) { GrSstPerfStats_t st; FX_grSstPerfStats(&st); diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index 2f0d4fc9b2..cbd906627d 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -1338,6 +1338,10 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa) grLfbWriteColorFormat(GR_COLORFORMAT_ABGR); } + if (fxMesa->Glide.grSetNumPendingBuffers != NULL) { + fxMesa->Glide.grSetNumPendingBuffers(fxMesa->maxPendingSwapBuffers); + } + fxMesa->textureAlign = FX_grGetInteger(GR_TEXTURE_ALIGN); /* [koolsmoky] */ { @@ -1499,6 +1503,10 @@ fxDDInitExtensions(GLcontext * ctx) } /* core-level extensions */ +#if 0 + /* not until texel fetchers are right */ + _mesa_enable_extension(ctx, "GL_SGIS_generate_mipmaps"); +#endif #if 1 _mesa_enable_extension(ctx, "GL_ARB_vertex_buffer_object"); #endif @@ -1507,10 +1515,6 @@ fxDDInitExtensions(GLcontext * ctx) _mesa_enable_extension(ctx, "GL_ARB_fragment_program"); _mesa_enable_extension(ctx, "GL_ARB_vertex_program"); #endif -#if 0 - /* not until texel fetchers are right */ - _mesa_enable_extension(ctx, "GL_SGIS_generate_mipmaps"); -#endif } diff --git a/src/mesa/drivers/glide/fxdrv.h b/src/mesa/drivers/glide/fxdrv.h index 3e7e433f24..a619cf1014 100644 --- a/src/mesa/drivers/glide/fxdrv.h +++ b/src/mesa/drivers/glide/fxdrv.h @@ -539,7 +539,7 @@ struct tfxMesaContext FxBool HaveTexUma; /* TEXUMA */ FxBool HaveTexus2; /* Texus 2 - FXT1 */ struct tdfx_glide Glide; - char rendererString[100]; + char rendererString[64]; }; diff --git a/src/mesa/drivers/glide/fxg.c b/src/mesa/drivers/glide/fxg.c index 7f75f1292c..d49878ae18 100644 --- a/src/mesa/drivers/glide/fxg.c +++ b/src/mesa/drivers/glide/fxg.c @@ -814,6 +814,7 @@ const char *TRP_TXCOMPRESS (FxU32 compress) /* ** glide extensions */ +void (FX_CALL *real_grSetNumPendingBuffers) (FxI32 NumPendingBuffers); char * (FX_CALL *real_grGetRegistryOrEnvironmentStringExt) (char *theEntry); void (FX_CALL *real_grGetGammaTableExt) (FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue); void (FX_CALL *real_grChromaRangeModeExt) (GrChromakeyMode_t mode); @@ -1024,14 +1025,6 @@ FxBool FX_CALL trap_grSstWinClose (GrContext_t context) #undef FN_NAME } -void FX_CALL trap_grSetNumPendingBuffers (FxI32 NumPendingBuffers) -{ -#define FN_NAME "grSetNumPendingBuffers" - TRAP_LOG("%s(%ld)\n", FN_NAME, NumPendingBuffers); - grSetNumPendingBuffers(NumPendingBuffers); -#undef FN_NAME -} - FxBool FX_CALL trap_grSelectContext (GrContext_t context) { #define FN_NAME "grSelectContext" @@ -1821,6 +1814,15 @@ void FX_CALL trap_guFogGenerateLinear (GrFog_t *fogtable, /* ** glide extensions */ +void FX_CALL trap_grSetNumPendingBuffers (FxI32 NumPendingBuffers) +{ +#define FN_NAME "grSetNumPendingBuffers" + TRAP_LOG("%s(%ld)\n", FN_NAME, NumPendingBuffers); + assert(real_grSetNumPendingBuffers); + (*real_grSetNumPendingBuffers)(NumPendingBuffers); +#undef FN_NAME +} + char *FX_CALL trap_grGetRegistryOrEnvironmentStringExt (char *theEntry) { #define FN_NAME "grGetRegistryOrEnvironmentStringExt" @@ -2243,14 +2245,17 @@ void tdfx_hook_glide (struct tdfx_glide *Glide) #if DEBUG_TRAP #define GET_EXT_ADDR(name) *(GrProc *)&real_##name = grGetProcAddress(#name), Glide->name = trap_##name #define GET_EXT_FAKE(name) GET_EXT_ADDR(name); if (real_##name == NULL) real_##name = fake_##name +#define GET_EXT_NULL(name) GET_EXT_ADDR(name); if (real_##name == NULL) Glide->name = NULL #else /* DEBUG_TRAP */ #define GET_EXT_ADDR(name) *(GrProc *)&Glide->name = grGetProcAddress(#name) #define GET_EXT_FAKE(name) GET_EXT_ADDR(name); if (Glide->name == NULL) Glide->name = fake_##name +#define GET_EXT_NULL(name) GET_EXT_ADDR(name) #endif /* DEBUG_TRAP */ /* ** glide extensions */ + GET_EXT_NULL(grSetNumPendingBuffers); GET_EXT_FAKE(grGetRegistryOrEnvironmentStringExt); GET_EXT_ADDR(grGetGammaTableExt); GET_EXT_ADDR(grChromaRangeModeExt); @@ -2284,9 +2289,9 @@ void tdfx_hook_glide (struct tdfx_glide *Glide) /* ** texus */ - GET_EXT_ADDR(txImgQuantize); - GET_EXT_ADDR(txMipQuantize); - GET_EXT_ADDR(txPalToNcc); + GET_EXT_NULL(txImgQuantize); + GET_EXT_NULL(txMipQuantize); + GET_EXT_NULL(txPalToNcc); #undef GET_EXT_ADDR } diff --git a/src/mesa/drivers/glide/fxg.h b/src/mesa/drivers/glide/fxg.h index cc8c059cd2..57a891b6a9 100644 --- a/src/mesa/drivers/glide/fxg.h +++ b/src/mesa/drivers/glide/fxg.h @@ -74,7 +74,6 @@ void FX_CALL trap_grFinish (void); void FX_CALL trap_grFlush (void); GrContext_t FX_CALL trap_grSstWinOpen (FxU32 hWnd, GrScreenResolution_t screen_resolution, GrScreenRefresh_t refresh_rate, GrColorFormat_t color_format, GrOriginLocation_t origin_location, int nColBuffers, int nAuxBuffers); FxBool FX_CALL trap_grSstWinClose (GrContext_t context); -void FX_CALL trap_grSetNumPendingBuffers (FxI32 NumPendingBuffers); FxBool FX_CALL trap_grSelectContext (GrContext_t context); void FX_CALL trap_grSstOrigin (GrOriginLocation_t origin); void FX_CALL trap_grSstSelect (int which_sst); @@ -207,7 +206,6 @@ void FX_CALL trap_guFogGenerateLinear (GrFog_t *fogtable, float nearZ, float far #define grFlush trap_grFlush #define grSstWinOpen trap_grSstWinOpen #define grSstWinClose trap_grSstWinClose -#define grSetNumPendingBuffers trap_grSetNumPendingBuffers #define grSelectContext trap_grSelectContext #define grSstOrigin trap_grSstOrigin #define grSstSelect trap_grSstSelect @@ -335,6 +333,7 @@ struct tdfx_glide { /* ** glide extensions */ + void (FX_CALL *grSetNumPendingBuffers) (FxI32 NumPendingBuffers); char * (FX_CALL *grGetRegistryOrEnvironmentStringExt) (char *theEntry); void (FX_CALL *grGetGammaTableExt) (FxU32 nentries, FxU32 *red, FxU32 *green, FxU32 *blue); void (FX_CALL *grChromaRangeModeExt) (GrChromakeyMode_t mode); diff --git a/src/mesa/drivers/glide/fxtexman.c b/src/mesa/drivers/glide/fxtexman.c index 5a6f18a169..0208d15f3c 100644 --- a/src/mesa/drivers/glide/fxtexman.c +++ b/src/mesa/drivers/glide/fxtexman.c @@ -152,13 +152,7 @@ fxTMUInit(fxMesaContext fxMesa, int tmu) chunk = (fxMesa->type >= GR_SSTTYPE_Banshee) ? (end - start) : FX_2MB_SPLIT; if (fxMesa->verbose) { - fprintf(stderr, "Voodoo %s configuration:\n", - (tmu == FX_TMU0) ? "TMU0" : "TMU1"); - fprintf(stderr, "Voodoo Lower texture memory address (%u)\n", - (unsigned int) start); - fprintf(stderr, "Voodoo Higher texture memory address (%u)\n", - (unsigned int) end); - fprintf(stderr, "Voodoo Splitting Texture memory in %luMB blocks:\n", chunk >> 20); + fprintf(stderr, "Voodoo TMU%d configuration:\n", tmu); } fxMesa->freeTexMem[tmu] = end - start; @@ -173,7 +167,7 @@ fxTMUInit(fxMesaContext fxMesa, int tmu) blockend = blockstart + chunk; if (fxMesa->verbose) - fprintf(stderr, "Voodoo %07u-%07u\n", + fprintf(stderr, "Voodoo %08u-%08u\n", (unsigned int) blockstart, (unsigned int) blockend); tmn = fxTMNewRangeNode(fxMesa, blockstart, blockend); diff --git a/src/mesa/drivers/glide/fxwgl.c b/src/mesa/drivers/glide/fxwgl.c index c70bb3b892..3abb1a0c85 100644 --- a/src/mesa/drivers/glide/fxwgl.c +++ b/src/mesa/drivers/glide/fxwgl.c @@ -334,9 +334,7 @@ wglCreateContext(HDC hdc) { char *env; /* always log when debugging, or if user demands */ -#if !FX_DEBUG - if ((env = getenv("MESA_FX_INFO")) && env[0] == 'r') -#endif + if (TDFX_DEBUG || ((env = getenv("MESA_FX_INFO")) && env[0] == 'r')) freopen("MESA.LOG", "w", stderr); } @@ -702,47 +700,12 @@ wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR * ppfd) int i, best = -1, qt_valid_pix; PIXELFORMATDESCRIPTOR pfd = *ppfd; -#if 0 - FILE *pix_file; - pix_file = fopen("pix_log.txt", "a"); - if (pix_file) { - fprintf(pix_file, "wglChoosePixelFormat\n"); - fprintf(pix_file, "nSize = %d\n",pfd.nSize); - fprintf(pix_file, "nVersion = %d\n",pfd.nVersion); - fprintf(pix_file, "dwFlags = %d\n",pfd.dwFlags); - fprintf(pix_file, "iPixelType = %d\n",pfd.iPixelType); - fprintf(pix_file, "cColorBits = %d\n",pfd.cColorBits); - fprintf(pix_file, "cRedBits = %d\n",pfd.cRedBits); - fprintf(pix_file, "cRedShift = %d\n",pfd.cRedShift); - fprintf(pix_file, "cGreenBits = %d\n",pfd.cGreenBits); - fprintf(pix_file, "cGreenShift = %d\n",pfd.cGreenShift); - fprintf(pix_file, "cBlueBits = %d\n",pfd.cBlueBits); - fprintf(pix_file, "cBlueShift = %d\n",pfd.cBlueShift); - fprintf(pix_file, "cAlphaBits = %d\n",pfd.cAlphaBits); - fprintf(pix_file, "cAlphaShift = %d\n",pfd.cAlphaShift); - fprintf(pix_file, "cAccumBits = %d\n",pfd.cAccumBits); - fprintf(pix_file, "cAccumRedBits = %d\n",pfd.cAccumRedBits); - fprintf(pix_file, "cAccumGreenBits = %d\n",pfd.cAccumGreenBits); - fprintf(pix_file, "cAccumBlueBits = %d\n",pfd.cAccumBlueBits); - fprintf(pix_file, "cAccumAlphaBits = %d\n",pfd.cAccumAlphaBits); - fprintf(pix_file, "cDepthBits = %d\n",pfd.cDepthBits); - fprintf(pix_file, "cStencilBits = %d\n",pfd.cStencilBits); - fprintf(pix_file, "cAuxBuffers = %d\n",pfd.cAuxBuffers); - fprintf(pix_file, "iLayerType = %d\n",pfd.iLayerType); - fprintf(pix_file, "bReserved = %d\n",pfd.bReserved); - fprintf(pix_file, "dwLayerMask = %d\n",pfd.dwLayerMask); - fprintf(pix_file, "dwVisibleMask = %d\n",pfd.dwVisibleMask); - fprintf(pix_file, "dwDamageMask = %d\n",pfd.dwDamageMask); - fclose(pix_file); - } -#endif - qt_valid_pix = pfd_tablen(); #if 1 || QUAKE2 || GORE /* QUAKE2: 24+32 */ /* GORE : 24+16 */ - if (pfd.cColorBits == 24) { + if ((pfd.cColorBits == 24) || (pfd.cColorBits == 32)) { /* the first 2 entries are 16bit */ pfd.cColorBits = (qt_valid_pix > 2) ? 32 : 16; } @@ -783,10 +746,8 @@ wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR * ppfd) if (pfd.cAlphaBits > 0 && pix[i].pfd.cAlphaBits == 0) continue; /* need alpha buffer */ -#if 0 - if ((pfd.cColorBits == 32) && (pfd.cStencilBits > 0 && pix[i].pfd.cStencilBits == 0)) - continue; /* need stencil */ -#endif + if (pfd.cStencilBits > 0 && pix[i].pfd.cStencilBits == 0) + continue; /* need stencil buffer */ if (pfd.iPixelType == pix[i].pfd.iPixelType) { best = i + 1; @@ -795,6 +756,38 @@ wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR * ppfd) } if (best == -1) { + FILE *err = fopen("MESA.LOG", "w"); + if (err != NULL) { + fprintf(err, "wglChoosePixelFormat failed\n"); + fprintf(err, "\tnSize = %d\n", ppfd->nSize); + fprintf(err, "\tnVersion = %d\n", ppfd->nVersion); + fprintf(err, "\tdwFlags = %d\n", ppfd->dwFlags); + fprintf(err, "\tiPixelType = %d\n", ppfd->iPixelType); + fprintf(err, "\tcColorBits = %d\n", ppfd->cColorBits); + fprintf(err, "\tcRedBits = %d\n", ppfd->cRedBits); + fprintf(err, "\tcRedShift = %d\n", ppfd->cRedShift); + fprintf(err, "\tcGreenBits = %d\n", ppfd->cGreenBits); + fprintf(err, "\tcGreenShift = %d\n", ppfd->cGreenShift); + fprintf(err, "\tcBlueBits = %d\n", ppfd->cBlueBits); + fprintf(err, "\tcBlueShift = %d\n", ppfd->cBlueShift); + fprintf(err, "\tcAlphaBits = %d\n", ppfd->cAlphaBits); + fprintf(err, "\tcAlphaShift = %d\n", ppfd->cAlphaShift); + fprintf(err, "\tcAccumBits = %d\n", ppfd->cAccumBits); + fprintf(err, "\tcAccumRedBits = %d\n", ppfd->cAccumRedBits); + fprintf(err, "\tcAccumGreenBits = %d\n", ppfd->cAccumGreenBits); + fprintf(err, "\tcAccumBlueBits = %d\n", ppfd->cAccumBlueBits); + fprintf(err, "\tcAccumAlphaBits = %d\n", ppfd->cAccumAlphaBits); + fprintf(err, "\tcDepthBits = %d\n", ppfd->cDepthBits); + fprintf(err, "\tcStencilBits = %d\n", ppfd->cStencilBits); + fprintf(err, "\tcAuxBuffers = %d\n", ppfd->cAuxBuffers); + fprintf(err, "\tiLayerType = %d\n", ppfd->iLayerType); + fprintf(err, "\tbReserved = %d\n", ppfd->bReserved); + fprintf(err, "\tdwLayerMask = %d\n", ppfd->dwLayerMask); + fprintf(err, "\tdwVisibleMask = %d\n", ppfd->dwVisibleMask); + fprintf(err, "\tdwDamageMask = %d\n", ppfd->dwDamageMask); + fclose(err); + } + SetLastError(0); return (0); } |