workaround for crash-upon-exit in verbose mode

fxMesa now uses grQueryResolution
minor fixes to X11 and DOS drivers
This commit is contained in:
Daniel Borca 2004-03-02 08:15:24 +00:00
parent 725a56f157
commit fa21787b52
8 changed files with 92 additions and 94 deletions

View file

@ -6,9 +6,9 @@
Mesa-6.0 release notes: Mesa-6.0 release notes:
----------------------- -----------------------
1) Glide2 support has been ceased; in order to keep Voodoo Graphics 1) Glide2 support has been ceased; in order to keep Voodoo Rush
and Voodoo Rush compatibility, please visit the Glide SourceForge compatibility, please visit the Glide SourceForge and help us
and help us to fix Glide3 for those cards. to fix Glide3 for those cards.
2) The current release is a WIP; among other things, the Linux build works 2) The current release is a WIP; among other things, the Linux build works
only to some extent. Any help will be appreciated. only to some extent. Any help will be appreciated.
3) Glide3 can be found at http://sourceforge.net/projects/glide/ 3) Glide3 can be found at http://sourceforge.net/projects/glide/

View file

@ -73,7 +73,7 @@ export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH);$(LIBDIR);$(GLIDE)/lib
CC = gcc CC = gcc
CFLAGS += -I$(TOP)/include -I. -Imain -Iglapi CFLAGS += -I$(TOP)/include -I. -Imain -Iglapi
ifeq ($(FX),1) ifeq ($(FX),1)
CFLAGS += -D__DOS__ -DH3 CFLAGS += -D__DOS__
CFLAGS += -I$(GLIDE)/include -DFX CFLAGS += -I$(GLIDE)/include -DFX
LIBNAME = "Mesa/FX DJGPP" LIBNAME = "Mesa/FX DJGPP"
else else

View file

@ -74,7 +74,6 @@ CC = mingw32-gcc
CFLAGS += -DBUILD_GL32 -D_OPENGL32_ -D_MSC_VER CFLAGS += -DBUILD_GL32 -D_OPENGL32_ -D_MSC_VER
CFLAGS += -I$(TOP)/include -I. -Imain -Iglapi CFLAGS += -I$(TOP)/include -I. -Imain -Iglapi
ifeq ($(FX),1) ifeq ($(FX),1)
CFLAGS += -DH3
CFLAGS += -I$(GLIDE)/include -DFX CFLAGS += -I$(GLIDE)/include -DFX
LDLIBS += -L$(GLIDE)/lib -lglide3x LDLIBS += -L$(GLIDE)/lib -lglide3x
GL_DEF = drivers/glide/fxopengl.def GL_DEF = drivers/glide/fxopengl.def

View file

@ -59,7 +59,7 @@ HAVE_3DNOW = 1
################################## ##################################
# build flags # build flags
################################## ##################################
FLAGS = -DH3 -DFX -DBUILD_GL32 FLAGS = -DFX -DBUILD_GL32
!if "$(USE_IEEE)"=="1" !if "$(USE_IEEE)"=="1"
FLAGS = $(FLAGS) -D__i386__ FLAGS = $(FLAGS) -D__i386__

View file

@ -1360,44 +1360,7 @@ int DMesaGetIntegerv (GLenum pname, GLint *params)
#ifndef FX #ifndef FX
return vl_get(VL_GET_VIDEO_MODES, params); return vl_get(VL_GET_VIDEO_MODES, params);
#else #else
{ return -1; /* TODO */
/* `vmode' struct must be sync'ed with `internal.h' (vl_mode)
* `vmode' list must be sync'ed with `fxapi.c'
* `hw >= 6' means Napalm and can do 32bit rendering
* TODO: we should take an envvar for `fxMesaSelectCurrentBoard'
*/
static struct {
int width, height;
int bpp;
} vmode[] = {
{ 320, 200, 16 },
{ 320, 240, 16 },
{ 512, 384, 16 },
{ 640, 400, 16 },
{ 640, 480, 16 },
{ 800, 600, 16 },
{1024, 768, 16 },
{ 320, 200, 32 },
{ 320, 240, 32 },
{ 512, 384, 32 },
{ 640, 400, 32 },
{ 640, 480, 32 },
{ 800, 600, 32 },
{1024, 768, 32 }
};
int hw = fxMesaSelectCurrentBoard(0);
int i, n = sizeof(vmode) / sizeof(vmode[0]);
if (hw < 6) {
n /= 2;
}
if (params) {
for (i = 0; i < n; i++) {
params[i] = (GLint)(&vmode[i]);
}
}
return n;
}
#endif #endif
case DMESA_GET_BUFFER_ADDR: case DMESA_GET_BUFFER_ADDR:
#ifndef FX #ifndef FX

View file

@ -203,34 +203,65 @@ gl3DfxSetPaletteEXT(GLuint * pal)
static GrScreenResolution_t fxBestResolution (int width, int height) static GrScreenResolution_t fxBestResolution (int width, int height)
{ {
static int resolutions[][5] = { static int resolutions[][3] = {
#if 1 /* Voodoo^2 can't fullscreen these, because of Glide */ { GR_RESOLUTION_320x200, 320, 200 },
{ 320, 200, GR_RESOLUTION_320x200 }, { GR_RESOLUTION_320x240, 320, 240 },
{ 320, 240, GR_RESOLUTION_320x240 }, { GR_RESOLUTION_400x256, 400, 256 },
#endif { GR_RESOLUTION_512x384, 512, 384 },
{ 512, 384, GR_RESOLUTION_512x384 }, { GR_RESOLUTION_640x200, 640, 200 },
{ 640, 400, GR_RESOLUTION_640x400 }, { GR_RESOLUTION_640x350, 640, 350 },
{ 640, 480, GR_RESOLUTION_640x480 }, { GR_RESOLUTION_640x400, 640, 400 },
{ 800, 600, GR_RESOLUTION_800x600 }, { GR_RESOLUTION_640x480, 640, 480 },
{1024, 768, GR_RESOLUTION_1024x768 }, { GR_RESOLUTION_800x600, 800, 600 },
{1280, 1024, GR_RESOLUTION_1280x1024}, { GR_RESOLUTION_960x720, 960, 720 },
{1600, 1200, GR_RESOLUTION_1600x1200}, { GR_RESOLUTION_856x480, 856, 480 },
{ GR_RESOLUTION_512x256, 512, 256 },
{ GR_RESOLUTION_1024x768, 1024, 768 },
{ GR_RESOLUTION_1280x1024, 1280, 1024 },
{ GR_RESOLUTION_1600x1200, 1600, 1200 },
{ GR_RESOLUTION_400x300, 400, 300 },
{ GR_RESOLUTION_1152x864, 1152, 864 },
{ GR_RESOLUTION_1280x960, 1280, 960 },
{ GR_RESOLUTION_1600x1024, 1600, 1024 },
{ GR_RESOLUTION_1792x1344, 1792, 1344 },
{ GR_RESOLUTION_1856x1392, 1856, 1392 },
{ GR_RESOLUTION_1920x1440, 1920, 1440 },
{ GR_RESOLUTION_2048x1536, 2048, 1536 },
{ GR_RESOLUTION_2048x2048, 2048, 2048 }
}; };
int i, NUM_RESOLUTIONS = sizeof(resolutions) / sizeof(resolutions[0]); int i, size;
int lastvalidres = 4; /* set default to GR_RESOLUTION_640x480 */ int lastvalidres = GR_RESOLUTION_640x480;
int min = 2048 * 2048; /* max is GR_RESOLUTION_2048x2048 */ int min = 2048 * 2048; /* max is GR_RESOLUTION_2048x2048 */
GrResolution resTemplate = {
GR_QUERY_ANY,
GR_QUERY_ANY,
2 /*GR_QUERY_ANY */,
GR_QUERY_ANY
};
GrResolution *presSupported;
for (i = 0; i < NUM_RESOLUTIONS; i++) { fxQueryHardware();
if ((width <= resolutions[i][0]) && (height <= resolutions[i][1])) {
if (min > (resolutions[i][0] * resolutions[i][1])) { size = grQueryResolutions(&resTemplate, NULL);
min = resolutions[i][0] * resolutions[i][1]; presSupported = malloc(size);
lastvalidres = i;
size /= sizeof(GrResolution);
grQueryResolutions(&resTemplate, presSupported);
for (i = 0; i < size; i++) {
int r = presSupported[i].resolution;
if ((width <= resolutions[r][1]) && (height <= resolutions[r][2])) {
if (min > (resolutions[r][1] * resolutions[r][2])) {
min = resolutions[r][1] * resolutions[r][2];
lastvalidres = r;
} }
} }
} }
return resolutions[lastvalidres][2]; free(presSupported);
return resolutions[lastvalidres][0];
} }
@ -770,6 +801,25 @@ fxMesaDestroyContext(fxMesaContext fxMesa)
glbTotNumCtx--; glbTotNumCtx--;
if (!glbTotNumCtx && getenv("MESA_FX_INFO")) {
GrSstPerfStats_t st;
FX_grSstPerfStats(&st);
fprintf(stderr, "Pixels Stats:\n");
fprintf(stderr, " # pixels processed (minus buffer clears): %u\n",
(unsigned) st.pixelsIn);
fprintf(stderr, " # pixels not drawn due to chroma key test failure: %u\n",
(unsigned) st.chromaFail);
fprintf(stderr, " # pixels not drawn due to depth test failure: %u\n",
(unsigned) st.zFuncFail);
fprintf(stderr,
" # pixels not drawn due to alpha test failure: %u\n",
(unsigned) st.aFuncFail);
fprintf(stderr, " # pixels drawn (including buffer clears and LFB writes): %u\n",
(unsigned) st.pixelsOut);
}
/* [dBorca] /* [dBorca]
* close the hardware first, so we can debug * close the hardware first, so we can debug
* atexit problems (memory leaks, etc). * atexit problems (memory leaks, etc).
@ -886,27 +936,6 @@ void GLAPIENTRY
fxCloseHardware(void) fxCloseHardware(void)
{ {
if (glbGlideInitialized) { if (glbGlideInitialized) {
if (getenv("MESA_FX_INFO")) {
GrSstPerfStats_t st;
FX_grSstPerfStats(&st);
fprintf(stderr, "Pixels Stats:\n");
fprintf(stderr, " # pixels processed (minus buffer clears): %u\n",
(unsigned) st.pixelsIn);
fprintf(stderr,
" # pixels not drawn due to chroma key test failure: %u\n",
(unsigned) st.chromaFail);
fprintf(stderr,
" # pixels not drawn due to depth test failure: %u\n",
(unsigned) st.zFuncFail);
fprintf(stderr,
" # pixels not drawn due to alpha test failure: %u\n",
(unsigned) st.aFuncFail);
fprintf(stderr,
" # pixels drawn (including buffer clears and LFB writes): %u\n",
(unsigned) st.pixelsOut);
}
if (glbTotNumCtx == 0) { if (glbTotNumCtx == 0) {
grGlideShutdown(); grGlideShutdown();
glbGlideInitialized = 0; glbGlideInitialized = 0;

View file

@ -746,8 +746,10 @@ wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR * ppfd)
if (pfd.cAlphaBits > 0 && pix[i].pfd.cAlphaBits == 0) if (pfd.cAlphaBits > 0 && pix[i].pfd.cAlphaBits == 0)
continue; /* need alpha buffer */ continue; /* need alpha buffer */
#if 0 /* [dBorca] regression bug? */
if (pfd.cStencilBits > 0 && pix[i].pfd.cStencilBits == 0) if (pfd.cStencilBits > 0 && pix[i].pfd.cStencilBits == 0)
continue; /* need stencil buffer */ continue; /* need stencil buffer */
#endif
if (pfd.iPixelType == pix[i].pfd.iPixelType) { if (pfd.iPixelType == pix[i].pfd.iPixelType) {
best = i + 1; best = i + 1;

View file

@ -1830,15 +1830,19 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w,
} }
attribs[numAttribs++] = FXMESA_NONE; attribs[numAttribs++] = FXMESA_NONE;
/* [dBorca] we should take an envvar for `fxMesaSelectCurrentBoard'!!! */ /* [dBorca] we should take an envvar for `fxMesaSelectCurrentBoard'!!! */
if ((hw = fxMesaSelectCurrentBoard(0))==GR_SSTTYPE_VOODOO) { hw = fxMesaSelectCurrentBoard(0);
if ((hw == GR_SSTTYPE_VOODOO) || (hw == GR_SSTTYPE_Voodoo2)) {
b->FXctx = fxMesaCreateBestContext(0, b->width, b->height, attribs); b->FXctx = fxMesaCreateBestContext(0, b->width, b->height, attribs);
if ((v->undithered_pf!=PF_Index) && (b->backimage)) { if ((v->undithered_pf!=PF_Index) && (b->backimage)) {
b->FXisHackUsable = b->FXctx ? GL_TRUE : GL_FALSE; b->FXisHackUsable = b->FXctx ? GL_TRUE : GL_FALSE;
if (fxEnvVar[0]=='w' || fxEnvVar[0]=='W') if (b->FXctx && (fxEnvVar[0]=='w' || fxEnvVar[0]=='W')) {
b->FXwindowHack = b->FXctx ? GL_TRUE : GL_FALSE; b->FXwindowHack = GL_TRUE;
else FX_grSstControl(GR_CONTROL_DEACTIVATE);
}
else {
b->FXwindowHack = GL_FALSE; b->FXwindowHack = GL_FALSE;
}
} }
} }
else { else {
@ -2210,6 +2214,10 @@ GLboolean XMesaSetFXmode( GLint mode )
return GL_FALSE; return GL_FALSE;
} }
if (ctx) { if (ctx) {
/* [dBorca] Hack alert:
* oh, this is sooo wrong: ctx above is
* really an fxMesaContext, not an XMesaContext
*/
XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaContext xmesa = XMESA_CONTEXT(ctx);
if (mode == XMESA_FX_WINDOW) { if (mode == XMESA_FX_WINDOW) {
if (xmesa->xm_draw_buffer->FXisHackUsable) { if (xmesa->xm_draw_buffer->FXisHackUsable) {
@ -2269,10 +2277,7 @@ static void FXgetImage( XMesaBuffer b )
xmesa_alloc_back_buffer( b ); xmesa_alloc_back_buffer( b );
} }
/* [dBorca] /* [dBorca] we're always in the right GR_COLORFORMAT... aren't we? */
* not needed for Voodoo2 anymore.
* should we test fxMesa->bgrOrder?
*/
/* grLfbWriteColorFormat(GR_COLORFORMAT_ARGB); */ /* grLfbWriteColorFormat(GR_COLORFORMAT_ARGB); */
if (b->xm_visual->undithered_pf==PF_5R6G5B) { if (b->xm_visual->undithered_pf==PF_5R6G5B) {
/* Special case: 16bpp RGB */ /* Special case: 16bpp RGB */