DMesa: removed MGA2064W driver
authorDaniel Borca <dborca@users.sourceforge.net>
Fri, 19 Dec 2003 11:26:46 +0000 (11:26 +0000)
committerDaniel Borca <dborca@users.sourceforge.net>
Fri, 19 Dec 2003 11:26:46 +0000 (11:26 +0000)
DMesa: added capability to query visuals
fxMesa: WGL_3DFX_gamma_control
fxMesa: minor fixes to interface (fxQueryHardware vs fxMesaSelect...)

18 files changed:
Makefile.DJ
Makefile.X11
docs/README.DJ
include/GL/dmesa.h
include/GL/fxmesa.h
progs/demos/tunnel2.c
src/mesa/Makefile.DJ
src/mesa/drivers/dos/dmesa.c
src/mesa/drivers/dos/internal.h
src/mesa/drivers/dos/vesa.c
src/mesa/drivers/dos/vga.c
src/mesa/drivers/dos/video.c
src/mesa/drivers/dos/video.h
src/mesa/drivers/glide/fxapi.c
src/mesa/drivers/glide/fxg.c
src/mesa/drivers/glide/fxopengl.def
src/mesa/drivers/glide/fxwgl.c
src/mesa/drivers/x11/xm_api.c

index f7c8277..93983f9 100644 (file)
@@ -43,9 +43,6 @@
 #                      As a consequence, you'll need the DJGPP Glide3
 #                      library to build any application.
 #                      default = no
-#      MATROX=1        build for Matrox Millennium I (MGA2064W) cards.
-#                      This is experimental and not intensively tested.
-#                      default = no
 #      HAVE_X86=1      optimize for i386.
 #                      default = no
 #      HAVE_MMX=1      allow MMX specializations, provided your assembler
index 85a5937..f45e211 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile.X11,v 1.102 2003/12/17 15:11:41 brianp Exp $
+# $Id: Makefile.X11,v 1.103 2003/12/19 11:26:46 dborca Exp $
 
 # Mesa 3-D graphics library
 # Version:  5.1
@@ -541,7 +541,6 @@ LIB_FILES = \
        $(DIRECTORY)/src/mesa/drivers/beos/*.h                          \
        $(DIRECTORY)/src/mesa/drivers/common/*.[ch]                     \
        $(DIRECTORY)/src/mesa/drivers/dos/*.[chS]                       \
-       $(DIRECTORY)/src/mesa/drivers/dos/mga/*.[ch]                    \
        $(DIRECTORY)/src/mesa/drivers/dri/common/*.[ch]                 \
        $(DIRECTORY)/src/mesa/drivers/fbdev/glfbdev.c                   \
        $(DIRECTORY)/src/mesa/drivers/glide/*.[ch]                      \
index d8bb589..446e8d9 100644 (file)
@@ -1,4 +1,4 @@
-                       Mesa 5.1 DOS/DJGPP Port v1.4
+                       Mesa 6.0 DOS/DJGPP Port v1.5
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
@@ -6,7 +6,7 @@
 Description:
 ~~~~~~~~~~~~
 
-Well, guess what... this is the DOS port of Mesa 5.1, for DJGPP fans... Whoa!
+Well, guess what... this is the DOS port of Mesa 6.0, for DJGPP fans... Whoa!
 The driver has its origins in ddsample.c, written by Brian Paul and found by me
 in Mesa 3.4.2.
 
@@ -42,9 +42,6 @@ Available options:
                        As a consequence, you'll need the DJGPP Glide3
                        library to build any application.
                        default = no
-       MATROX=1        build for Matrox Millennium I (MGA2064W) cards.
-                       This is experimental and not intensively tested.
-                       default = no
        HAVE_X86=1      optimize for i386.
                        default = no
        HAVE_MMX=1      allow MMX specializations, provided your assembler
@@ -103,9 +100,8 @@ FAQ:
 2. Using Mesa for DJGPP
 
    Q) DMesa is so SLOOOW! The Win32 OpenGL performs so much better...
-   A) Is that a question? If you have a 3dfx Voodoo Banshee or higher card,
-      you're lucky (check http://sourceforge.net/projects/glide for the DJGPP
-      port). If you have a Matrox Millennium I card, you just MIGHT be lucky...
+   A) Is that a question? If you have a 3dfx Voodoo^2 or higher card, you're
+      lucky (check http://sourceforge.net/projects/glide for the DJGPP port).
       If you haven't, sorry; everything is done in software. Suggestions?
 
    Q) I tried to set refresh rate w/ DMesa, but without success.
@@ -119,6 +115,23 @@ FAQ:
       lazy programmer and I found that the easiest way to keep buffer handling
       at peak performance ;-).
 
+   Q) How do I query for a list of available video modes to choose as a visual?
+   A) This is an ugly hack, for which I'm sure I'll burn in hell.
+      First, query for a list of modes:
+       n = DMesaGetIntegerv(DMESA_GET_VIDEO_MODES, NULL);
+      If `n' is strictly positive, you allocate an array of pointers to a given
+      struct (which is guaranteed to be extended only - not changed in future):
+       struct {
+               int xres, yres;
+               int bpp;
+       } **l = malloc(n * sizeof(void **));
+      Now pass the newly allocated buffer to fill in:
+       DMesaGetIntegerv(DMESA_GET_VIDEO_MODES, (GLint *)l);
+      And collect the info:
+       for (i = 0; i < n; i++) {
+           printf("%dx%d:%d\n", l[i]->xres, l[i]->yres, l[i]->bpp);
+       }
+
    Q) The GLUT is incomplete.
    A) See below.
 
@@ -217,6 +230,10 @@ v1.4 (dec-2003)
        * minor changes to PC_HW/timer interface
        x hacked and slashed the 3dfx driver (w/ help from Hiroshi Morii)
 
+v1.5 (dec-2003)
+       + added interface to query available "visuals" (GLFW - Marcus Geelnard)
+       - removed Matrox Millennium MGA2064W driver
+
 
 
 Contact:
index 46aa4e2..364792a 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 /*
- * DOS/DJGPP device driver v1.4 for Mesa
+ * DOS/DJGPP device driver v1.5 for Mesa
  *
  *  Copyright (C) 2002 - Borca Daniel
  *  Email : dborca@users.sourceforge.net
@@ -135,6 +135,7 @@ void DMesaSetCI (int ndx, GLfloat red, GLfloat green, GLfloat blue);
  */
 #define DMESA_GET_SCREEN_SIZE 0x0100
 #define DMESA_GET_DRIVER_CAPS 0x0200
+#define DMESA_GET_VIDEO_MODES 0x0300
 
 #define DMESA_DRIVER_SWDB_BIT 0x1 /* software double-buffered */
 #define DMESA_DRIVER_LLWO_BIT 0x2 /* lower-left window origin */
index fd3dbae..5c63a8d 100644 (file)
@@ -73,7 +73,7 @@ GLAPI fxMesaContext GLAPIENTRY fxMesaCreateBestContext(GLuint win,
                                                      const GLint attribList[]);
 GLAPI void GLAPIENTRY fxMesaDestroyContext(fxMesaContext ctx);
 
-GLAPI GLboolean GLAPIENTRY fxMesaSelectCurrentBoard(int n);
+GLAPI GLint GLAPIENTRY fxMesaSelectCurrentBoard(int n);
 
 GLAPI void GLAPIENTRY fxMesaMakeCurrent(fxMesaContext ctx);
 
@@ -85,8 +85,6 @@ GLAPI void GLAPIENTRY fxMesaSetNearFar(GLfloat nearVal, GLfloat farVal);
 
 GLAPI void GLAPIENTRY fxMesaUpdateScreenSize(fxMesaContext ctx);
 
-GLAPI GLboolean GLAPIENTRY fxQueryHardware(void);
-
 GLAPI void GLAPIENTRY fxCloseHardware(void);
 
 GLAPI void GLAPIENTRY fxGetScreenGeometry (GLint *w, GLint *h);
index 048cd6d..436f01b 100644 (file)
@@ -31,7 +31,7 @@ static int fullscreen = 1;
 #endif
 
 #ifdef FX
-GLboolean fxMesaSelectCurrentBoard(int);
+GLint fxMesaSelectCurrentBoard(int);
 #endif
 
 static int WIDTHC0 = 640;
@@ -549,7 +549,7 @@ main(int ac, char **av)
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
 
 #ifdef FX
-   if (!fxMesaSelectCurrentBoard(0)) {
+   if (fxMesaSelectCurrentBoard(0) < 0) {
       fprintf(stderr, "The first Voodoo Graphics board is missing !?!?\n");
       return -1;
    }
@@ -568,7 +568,7 @@ main(int ac, char **av)
    glutSpecialFunc(special);
 
 #ifdef FX
-   if (!fxMesaSelectCurrentBoard(1)) {
+   if (fxMesaSelectCurrentBoard(1) < 0) {
       fprintf(stderr, "The second Voodoo Graphics board is missing !\n");
       exit(-1);
    }
index cd336fc..71e4486 100644 (file)
@@ -40,9 +40,6 @@
 #                      As a consequence, you'll need the DJGPP Glide3
 #                      library to build any application.
 #                      default = no
-#      MATROX=1        build for Matrox Millennium I (MGA2064W) cards.
-#                      This is experimental and not intensively tested.
-#                      default = no
 #      HAVE_X86=1      optimize for i386.
 #                      default = no
 #      HAVE_MMX=1      allow MMX specializations, provided your assembler
@@ -80,13 +77,8 @@ CFLAGS += -D__DOS__ -DH3
 CFLAGS += -I$(GLIDE)/include -DFX
 LIBNAME = "Mesa/FX DJGPP"
 else
-ifeq ($(MATROX),1)
-CFLAGS += -DMATROX
-LIBNAME = "Mesa/MGA DJGPP"
-else
 LIBNAME = "Mesa DJGPP"
 endif
-endif
 
 AR = ar
 ARFLAGS = rus
@@ -305,13 +297,6 @@ DRIVER_SOURCES += \
        drivers/glide/fxglidew.c \
        drivers/glide/fxg.c
 else
-ifeq ($(MATROX),1)
-DRIVER_SOURCES += \
-       drivers/dos/mga/mga.c \
-       drivers/dos/mga/mga_hw.c \
-       drivers/dos/mga/mga_mode.c \
-       drivers/dos/dpmi.c
-else
 DRIVER_SOURCES += \
        drivers/dos/video.c \
        drivers/dos/virtual.S \
@@ -320,7 +305,6 @@ DRIVER_SOURCES += \
        drivers/dos/vga.c \
        drivers/dos/dpmi.c
 endif
-endif
 
 SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(DRIVER_SOURCES)
 
@@ -369,5 +353,4 @@ clean:
        -$(call UNLINK,tnl/*.o)
        -$(call UNLINK,x86/*.o)
        -$(call UNLINK,drivers/dos/*.o)
-       -$(call UNLINK,drivers/dos/mga/*.o)
        -$(call UNLINK,drivers/glide/*.o)
index a5d052b..5b4f71a 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 /*
- * DOS/DJGPP device driver v1.4 for Mesa
+ * DOS/DJGPP device driver v1.5 for Mesa
  *
  *  Copyright (c) 2003 - Borca Daniel
  *  Email : dborca@users.sourceforge.net
 #include "tnl/tnl.h"
 #include "tnl/t_context.h"
 #include "tnl/t_pipeline.h"
-#ifndef MATROX
 #include "video.h"
-#else  /* MATROX */
-#include "mga/mga.h"
-#endif /* MATROX */
 #else  /* FX */
 #include "GL/fxmesa.h"
 #endif /* FX */
@@ -76,9 +72,6 @@ struct dmesa_visual {
    GLboolean rgb_flag;          /* RGB mode? */
    GLboolean sw_alpha;          /* use Mesa's alpha buffer? */
    GLuint depth;                /* bits per pixel (1, 8, 24, etc) */
-#ifdef MATROX
-   int stride_in_pixels;
-#endif
    int zbuffer;                 /* Z=buffer: 0=no, 1=SW, -1=HW */
 };
 
@@ -116,18 +109,7 @@ struct dmesa_context {
 #define FLIP(y)  (dmesa->Buffer->height - (y) - 1)
 #define FLIP2(y) (_b_ - (y))
 
-
-#ifndef MATROX
 #define DSTRIDE dmesa->Buffer->width
-#else
-#define DSTRIDE dmesa->visual->stride_in_pixels
-#define vl_putpixel mga_putpixel
-#define vl_mixrgba  mga_mixrgb
-#define vl_mixrgb   mga_mixrgb
-#define vl_getrgba  mga_getrgba
-#define vl_setz     mga_setz
-#define vl_getz     mga_getz
-#endif
 
 /****************************************************************************
  * RGB[A]
@@ -138,7 +120,6 @@ static void write_rgba_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
  const DMesaContext dmesa = (DMesaContext)ctx;
  GLuint i, offset;
 
-#ifndef MATROX
  offset = DSTRIDE * FLIP(y) + x;
  if (mask) {
     /* draw some pixels */
@@ -153,29 +134,6 @@ static void write_rgba_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
         vl_putpixel(offset, vl_mixrgba(rgba[i]));
     }
  }
-#else  /* MATROX */
- y = FLIP(y);
- if (mask) {
-    /* draw some pixels */
-    offset = 0;
-    for (i = 0; i < n; i++) {
-        if (mask[i]) {
-           ++offset;
-        } else {
-           if (offset != 0) {
-              mga_draw_span_rgb_tx32(x + i - offset, y, offset, (const unsigned long *)(&rgba[i-offset]));
-              offset = 0;
-           }
-        }
-    }
-    if (offset != 0) {
-       mga_draw_span_rgb_tx32(x + n - offset, y, offset, (const unsigned long *)(&rgba[n-offset]));
-    }
- } else {
-    /* draw all pixels */
-    mga_draw_span_rgb_tx32(x, y, n, (const unsigned long *)rgba);
- }
-#endif /* MATROX */
 }
 
 
@@ -319,7 +277,6 @@ static void read_rgba_pixels (const GLcontext *ctx,
 /****************************************************************************
  * Index
  ***************************************************************************/
-#ifndef MATROX
 static void write_index_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
                               const GLuint index[], const GLubyte mask[])
 {
@@ -477,90 +434,12 @@ static void read_index_pixels (const GLcontext *ctx,
     }
  }
 }
-#endif /* !MATROX */
 
 
 
 /****************************************************************************
  * Z-buffer
  ***************************************************************************/
-#ifdef MATROX
-static void write_depth_span (GLcontext *ctx, GLuint n, GLint x, GLint y,
-                              const GLdepth depth[], const GLubyte mask[])
-{
- const DMesaContext dmesa = (DMesaContext)ctx;
- GLuint i, offset;
-
- offset = DSTRIDE * FLIP(y) + x;
- if (mask) {
-    /* draw some values */
-    for (i=0; i<n; i++, offset++) {
-        if (mask[i]) {
-           vl_setz(offset, depth[i]);
-        }
-    }
- } else {
-    /* draw all values */
-    for (i=0; i<n; i++, offset++) {
-        vl_setz(offset, depth[i]);
-    }
- }
-}
-
-
-
-static void read_depth_span (GLcontext *ctx, GLuint n, GLint x, GLint y,
-                             GLdepth depth[])
-{
- const DMesaContext dmesa = (DMesaContext)ctx;
- GLuint i, offset;
-
- offset = DSTRIDE * FLIP(y) + x;
- /* read all values */
- for (i=0; i<n; i++, offset++) {
-     depth[i] = vl_getz(offset);
- }
-}
-
-
-
-static void write_depth_pixels (GLcontext *ctx, GLuint n,
-                                const GLint x[], const GLint y[],
-                                const GLdepth depth[], const GLubyte mask[])
-{
- const DMesaContext dmesa = (DMesaContext)ctx;
- GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1;
-
- if (mask) {
-    /* draw some values */
-    for (i=0; i<n; i++) {
-        if (mask[i]) {
-           vl_setz(FLIP2(y[i])*_w_ + x[i], depth[i]);
-        }
-    }
- } else {
-    /* draw all values */
-    for (i=0; i<n; i++) {
-        vl_setz(FLIP2(y[i])*_w_ + x[i], depth[i]);
-    }
- }
-}
-
-
-
-static void read_depth_pixels (GLcontext *ctx, GLuint n,
-                               const GLint x[], const GLint y[],
-                               GLdepth depth[])
-{
- const DMesaContext dmesa = (DMesaContext)ctx;
- GLuint i, _w_ = DSTRIDE, _b_ = dmesa->Buffer->height - 1;
-
- /* read all values */
- for (i=0; i<n; i++) {
-     depth[i] = vl_getz(FLIP2(y[i])*_w_ + x[i]);
- }
-}
-#endif /* MATROX */
 
 
 
@@ -571,8 +450,6 @@ static void read_depth_pixels (GLcontext *ctx, GLuint n,
 /*
  * NON-depth-buffered flat triangle.
  */
-#ifndef MATROX
-
 #define NAME tri_rgb_flat
 
 #define SETUP_CODE \
@@ -589,34 +466,11 @@ static void read_depth_pixels (GLcontext *ctx, GLuint n,
 
 #include "swrast/s_tritemp.h"
 
-#else  /* MATROX */
-
-static void tri_rgb_flat (GLcontext *ctx,
-                          const SWvertex *v0,
-                          const SWvertex *v1,
-                          const SWvertex *v2)
-{
- const DMesaContext dmesa = (DMesaContext)ctx;
- GLuint _b_ = dmesa->Buffer->height - 1;
- MGAvertex m0, m1, m2;
- m0.win[0] = v0->win[0];
- m0.win[1] = FLIP2(v0->win[1]);
- m1.win[0] = v1->win[0];
- m1.win[1] = FLIP2(v1->win[1]);
- m2.win[0] = v2->win[0];
- m2.win[1] = FLIP2(v2->win[1]);
- *(unsigned long *)m2.color = *(unsigned long *)v2->color;
- mga_draw_tri_rgb_flat((int)SWRAST_CONTEXT(ctx)->_BackfaceSign, &m0, &m1, &m2);
-}
-#endif /* MATROX */
-
 
 
 /*
  * Z-less flat triangle.
  */
-#ifndef MATROX
-
 #define NAME tri_rgb_flat_zless
 
 #define INTERP_Z 1
@@ -641,37 +495,11 @@ static void tri_rgb_flat (GLcontext *ctx,
 
 #include "swrast/s_tritemp.h"
 
-#else  /* MATROX */
-
-static void tri_rgb_flat_zless (GLcontext *ctx,
-                                const SWvertex *v0,
-                                const SWvertex *v1,
-                                const SWvertex *v2)
-{
- const DMesaContext dmesa = (DMesaContext)ctx;
- GLuint _b_ = dmesa->Buffer->height - 1;
- MGAvertex m0, m1, m2;
- m0.win[0] = v0->win[0];
- m0.win[1] = FLIP2(v0->win[1]);
- m0.win[2] = v0->win[2];
- m1.win[0] = v1->win[0];
- m1.win[1] = FLIP2(v1->win[1]);
- m1.win[2] = v1->win[2];
- m2.win[0] = v2->win[0];
- m2.win[1] = FLIP2(v2->win[1]);
- m2.win[2] = v2->win[2];
- *(unsigned long *)m2.color = *(unsigned long *)v2->color;
- mga_draw_tri_rgb_flat_zless((int)SWRAST_CONTEXT(ctx)->_BackfaceSign, &m0, &m1, &m2);
-}
-#endif /* MATROX */
-
 
 
 /*
  * NON-depth-buffered iterated triangle.
  */
-#ifndef MATROX
-
 #define NAME tri_rgb_iter
 
 #define INTERP_RGB 1
@@ -692,36 +520,11 @@ static void tri_rgb_flat_zless (GLcontext *ctx,
 
 #include "swrast/s_tritemp.h"
 
-#else  /* MATROX */
-
-static void tri_rgb_iter (GLcontext *ctx,
-                          const SWvertex *v0,
-                          const SWvertex *v1,
-                          const SWvertex *v2)
-{
- const DMesaContext dmesa = (DMesaContext)ctx;
- GLuint _b_ = dmesa->Buffer->height - 1;
- MGAvertex m0, m1, m2;
- m0.win[0] = v0->win[0];
- m0.win[1] = FLIP2(v0->win[1]);
- m1.win[0] = v1->win[0];
- m1.win[1] = FLIP2(v1->win[1]);
- m2.win[0] = v2->win[0];
- m2.win[1] = FLIP2(v2->win[1]);
- *(unsigned long *)m0.color = *(unsigned long *)v0->color;
- *(unsigned long *)m1.color = *(unsigned long *)v1->color;
- *(unsigned long *)m2.color = *(unsigned long *)v2->color;
- mga_draw_tri_rgb_iter((int)SWRAST_CONTEXT(ctx)->_BackfaceSign, &m0, &m1, &m2);
-}
-#endif /* MATROX */
-
 
 
 /*
  * Z-less iterated triangle.
  */
-#ifndef MATROX
-
 #define NAME tri_rgb_iter_zless
 
 #define INTERP_Z 1
@@ -749,32 +552,6 @@ static void tri_rgb_iter (GLcontext *ctx,
 
 #include "swrast/s_tritemp.h"
 
-#else  /* MATROX */
-
-static void tri_rgb_iter_zless (GLcontext *ctx,
-                                const SWvertex *v0,
-                                const SWvertex *v1,
-                                const SWvertex *v2)
-{
- const DMesaContext dmesa = (DMesaContext)ctx;
- GLuint _b_ = dmesa->Buffer->height - 1;
- MGAvertex m0, m1, m2;
- m0.win[0] = v0->win[0];
- m0.win[1] = FLIP2(v0->win[1]);
- m0.win[2] = v0->win[2];
- m1.win[0] = v1->win[0];
- m1.win[1] = FLIP2(v1->win[1]);
- m1.win[2] = v1->win[2];
- m2.win[0] = v2->win[0];
- m2.win[1] = FLIP2(v2->win[1]);
- m2.win[2] = v2->win[2];
- *(unsigned long *)m0.color = *(unsigned long *)v0->color;
- *(unsigned long *)m1.color = *(unsigned long *)v1->color;
- *(unsigned long *)m2.color = *(unsigned long *)v2->color;
- mga_draw_tri_rgb_iter_zless((int)SWRAST_CONTEXT(ctx)->_BackfaceSign, &m0, &m1, &m2);
-}
-#endif /* MATROX */
-
 
 
 /*
@@ -828,41 +605,9 @@ static void dmesa_choose_tri (GLcontext *ctx)
  * Optimized line rendering
  ***************************************************************************/
 
-#ifdef MATROX
-static __inline void matrox_line_clip_hack (GLcontext *ctx, int _b_, MGAvertex *m0, const SWvertex *vert0, MGAvertex *m1, const SWvertex *vert1)
-{
- int x0 = vert0->win[0];
- int y0 = vert0->win[1];
- int x1 = vert1->win[0];
- int y1 = vert1->win[1];
- /* s_linetemp.h { */
- GLint w = ctx->DrawBuffer->Width;
- GLint h = ctx->DrawBuffer->Height;
- if ((x0==w) | (x1==w)) {
-    if ((x0==w) & (x1==w))
-       return;
-    x0 -= x0==w;
-    x1 -= x1==w;
- }
- if ((y0==h) | (y1==h)) {
-    if ((y0==h) & (y1==h))
-       return;
-    y0 -= y0==h;
-    y1 -= y1==h;
- }
- /* } s_linetemp.h */
- m0->win[0] = x0;
- m0->win[1] = FLIP2(y0);
- m1->win[0] = x1;
- m1->win[1] = FLIP2(y1);
-}
-#endif
-
 /*
  * NON-depth-buffered flat line.
  */
-#ifndef MATROX
-
 #define NAME line_rgb_flat
 
 #define INTERP_XY 1
@@ -878,28 +623,11 @@ static __inline void matrox_line_clip_hack (GLcontext *ctx, int _b_, MGAvertex *
 
 #include "swrast/s_linetemp.h"
 
-#else  /* MATROX */
-
-static void line_rgb_flat (GLcontext *ctx,
-                           const SWvertex *vert0,
-                           const SWvertex *vert1)
-{
- const DMesaContext dmesa = (DMesaContext)ctx;
- GLuint _b_ = dmesa->Buffer->height - 1;
- MGAvertex m0, m1;
- matrox_line_clip_hack(ctx, _b_, &m0, vert0, &m1, vert1);
- *(unsigned long *)m1.color = *(unsigned long *)vert1->color;
- mga_draw_line_rgb_flat(&m0, &m1);
-}
-#endif /* MATROX */
-
 
 
 /*
  * Z-less flat line.
  */
-#ifndef MATROX
-
 #define NAME line_rgb_flat_zless
 
 #define INTERP_XY 1
@@ -921,65 +649,19 @@ static void line_rgb_flat (GLcontext *ctx,
 
 #include "swrast/s_linetemp.h"
 
-#else  /* MATROX */
 
-static void line_rgb_flat_zless (GLcontext *ctx,
-                                 const SWvertex *vert0,
-                                 const SWvertex *vert1)
-{
- const DMesaContext dmesa = (DMesaContext)ctx;
- GLuint _b_ = dmesa->Buffer->height - 1;
- MGAvertex m0, m1;
- matrox_line_clip_hack(ctx, _b_, &m0, vert0, &m1, vert1);
- m0.win[2] = vert0->win[2];
- m1.win[2] = vert1->win[2];
- *(unsigned long *)m1.color = *(unsigned long *)vert1->color;
- mga_draw_line_rgb_flat_zless(&m0, &m1);
-}
-#endif /* MATROX */
 
-
-
-#ifndef MATROX
-#define line_rgb_iter NULL
-#define line_rgb_iter_zless NULL
-#else  /* MATROX */
 /*
  * NON-depth-buffered iterated line.
  */
-static void line_rgb_iter (GLcontext *ctx,
-                           const SWvertex *vert0,
-                           const SWvertex *vert1)
-{
- const DMesaContext dmesa = (DMesaContext)ctx;
- GLuint _b_ = dmesa->Buffer->height - 1;
- MGAvertex m0, m1;
- matrox_line_clip_hack(ctx, _b_, &m0, vert0, &m1, vert1);
- *(unsigned long *)m0.color = *(unsigned long *)vert0->color;
- *(unsigned long *)m1.color = *(unsigned long *)vert1->color;
- mga_draw_line_rgb_iter(&m0, &m1);
-}
+#define line_rgb_iter NULL
 
 
 
 /*
  * Z-less iterated line.
  */
-static void line_rgb_iter_zless (GLcontext *ctx,
-                                 const SWvertex *vert0,
-                                 const SWvertex *vert1)
-{
- const DMesaContext dmesa = (DMesaContext)ctx;
- GLuint _b_ = dmesa->Buffer->height - 1;
- MGAvertex m0, m1;
- matrox_line_clip_hack(ctx, _b_, &m0, vert0, &m1, vert1);
- m0.win[2] = vert0->win[2];
- m1.win[2] = vert1->win[2];
- *(unsigned long *)m0.color = *(unsigned long *)vert0->color;
- *(unsigned long *)m1.color = *(unsigned long *)vert1->color;
- mga_draw_line_rgb_iter_zless(&m0, &m1);
-}
-#endif /* MATROX */
+#define line_rgb_iter_zless NULL
 
 
 
@@ -1067,7 +749,6 @@ static void clear (GLcontext *ctx, GLbitfield mask, GLboolean all,
 
  /* we can't handle color or index masking */
  if ((*colorMask == 0xffffffff) && (ctx->Color.IndexMask == 0xffffffff)) {
-#ifndef MATROX
     if (mask & DD_BACK_LEFT_BIT) {
        int color = c->visual->rgb_flag ? c->ClearColor : c->ClearIndex;
 
@@ -1079,27 +760,6 @@ static void clear (GLcontext *ctx, GLbitfield mask, GLboolean all,
 
        mask &= ~DD_BACK_LEFT_BIT;
     }
-#else  /* MATROX */
-    unsigned short z = -1;
-    int color = c->ClearColor;
-    if (mask & DD_DEPTH_BIT) {
-       z = ctx->Depth.Clear * 0xffff;
-    }
-    if (all) {
-       mga_clear(mask & DD_FRONT_LEFT_BIT,
-                 mask & DD_BACK_LEFT_BIT,
-                 mask & DD_DEPTH_BIT,
-                 0, 0, c->Buffer->width, c->Buffer->height,
-                 color, z);
-    } else {
-       mga_clear(mask & DD_FRONT_LEFT_BIT,
-                 mask & DD_BACK_LEFT_BIT,
-                 mask & DD_DEPTH_BIT,
-                 x, y, width, height,
-                 color, z);
-    }
-    mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT | DD_DEPTH_BIT);
-#endif /* MATROX */
  }
 
  if (mask) {
@@ -1149,10 +809,7 @@ static const GLubyte* get_string (GLcontext *ctx, GLenum name)
  switch (name) {
         case GL_RENDERER:
              return (const GLubyte *)"Mesa DJGPP"
-                                     #ifdef MATROX
-                                     " (MGA)"
-                                     #endif
-                                     "\0port (c) Borca Daniel oct-2003";
+                                     "\0port (c) Borca Daniel dec-2003";
         default:
              return NULL;
  }
@@ -1285,17 +942,7 @@ static void dmesa_init_pointers (GLcontext *ctx)
  /* The span functions should be in `dmesa_update_state', but I'm
   * pretty sure they will never change during the life of the Visual
   */
-#ifdef MATROX
- if (((DMesaContext)ctx)->visual->zbuffer == -1) {
-    /* Depth span/pixel functions */
-    dd->WriteDepthSpan = write_depth_span;
-    dd->WriteDepthPixels = write_depth_pixels;
-    dd->ReadDepthSpan = read_depth_span;
-    dd->ReadDepthPixels = read_depth_pixels;
- }
-#endif
 
-#ifndef MATROX
  /* Index span/pixel functions */
  dd->WriteCI32Span = write_index_span;
  dd->WriteCI8Span = write_index8_span;
@@ -1304,7 +951,6 @@ static void dmesa_init_pointers (GLcontext *ctx)
  dd->WriteMonoCIPixels = write_mono_index_pixels;
  dd->ReadCI32Span = read_index_span;
  dd->ReadCI32Pixels = read_index_pixels;
-#endif
 
  /* RGB(A) span/pixel functions */
  dd->WriteRGBASpan = write_rgba_span;
@@ -1355,15 +1001,9 @@ DMesaVisual DMesaCreateVisual (GLint width,
  GLint redBits, greenBits, blueBits, alphaBits, indexBits;
  GLboolean sw_alpha;
 
-#ifndef MATROX
  if (!dbFlag) {
     return NULL;
  }
-#else
- if (!rgbFlag) {
-    return NULL;
- }
-#endif
 
  alphaBits = 0;
 
@@ -1420,15 +1060,9 @@ DMesaVisual DMesaCreateVisual (GLint width,
  alphaBits = alphaSize;
  sw_alpha = (alphaBits > 0);
 
-#ifndef MATROX
  if ((colDepth=vl_video_init(width, height, colDepth, rgbFlag, refresh)) <= 0) {
     return NULL;
  }
-#else
- if (mga_open(width, height, colDepth, dbFlag ? 2 : 1, depthSize == 16, refresh) < 0) {
-    return NULL;
- }
-#endif
 
  if ((v=(DMesaVisual)CALLOC_STRUCT(dmesa_visual)) != NULL) {
     /* Create core visual */
@@ -1455,12 +1089,6 @@ DMesaVisual DMesaCreateVisual (GLint width,
     v->sw_alpha = sw_alpha;
 
     v->zbuffer = (depthSize > 0) ? 1 : 0;
-#ifdef MATROX
-    mga_get(MGA_GET_HPIXELS, &v->stride_in_pixels);
-    if (depthSize == 16) {
-       v->zbuffer = -1;
-    }
-#endif
  }
 
  return v;
@@ -1493,11 +1121,7 @@ void DMesaDestroyVisual (DMesaVisual v)
 #ifndef FX
  _mesa_destroy_visual((GLvisual *)v);
 
-#ifndef MATROX
  vl_video_exit();
-#else
- mga_close(1, 1);
-#endif
 
 #else
  fxMesaDestroyContext((fxMesaContext)v);
@@ -1537,9 +1161,7 @@ DMesaBuffer DMesaCreateBuffer (DMesaVisual visual,
 void DMesaDestroyBuffer (DMesaBuffer b)
 {
 #ifndef FX
-#ifndef MATROX
  free(b->the_window);
-#endif
  _mesa_destroy_framebuffer((GLframebuffer *)b);
 #endif
 }
@@ -1605,7 +1227,7 @@ void DMesaDestroyContext (DMesaContext c)
 
 GLboolean DMesaMoveBuffer (GLint xpos, GLint ypos)
 {
-#if !defined(FX) && !defined(MATROX)
+#ifndef FX
  GET_CURRENT_CONTEXT(ctx);
  DMesaBuffer b = ((DMesaContext)ctx)->Buffer;
 
@@ -1626,7 +1248,7 @@ GLboolean DMesaMoveBuffer (GLint xpos, GLint ypos)
 
 GLboolean DMesaResizeBuffer (GLint width, GLint height)
 {
-#if !defined(FX) && !defined(MATROX)
+#ifndef FX
  GET_CURRENT_CONTEXT(ctx);
  DMesaBuffer b = ((DMesaContext)ctx)->Buffer;
 
@@ -1652,11 +1274,9 @@ GLboolean DMesaMakeCurrent (DMesaContext c, DMesaBuffer b)
 {
 #ifndef FX
  if ((c != NULL) && (b != NULL)) {
-#ifndef MATROX
     if (vl_sync_buffer(&b->the_window, b->xpos, b->ypos, b->width, b->height) != 0) {
        return GL_FALSE;
     }
-#endif
 
     c->Buffer = b;
 
@@ -1685,14 +1305,8 @@ void DMesaSwapBuffers (DMesaBuffer b)
 #ifndef FX
  GET_CURRENT_CONTEXT(ctx);
  _mesa_notifySwapBuffers(ctx);
-#ifndef MATROX
  vl_flip();
 #else
- if (((DMesaContext)ctx)->visual->db_flag) {
-    mga_swapbuffers(1);
- }
-#endif
-#else
  fxMesaSwapBuffers();
 #endif
 }
@@ -1701,7 +1315,7 @@ void DMesaSwapBuffers (DMesaBuffer b)
 
 void DMesaSetCI (int ndx, GLfloat red, GLfloat green, GLfloat blue)
 {
-#if !defined(FX) && !defined(MATROX)
+#ifndef FX
  vl_setCI(ndx, red, green, blue);
 #endif
 }
@@ -1722,33 +1336,64 @@ void *DMesaGetCurrentContext (void)
 
 int DMesaGetIntegerv (GLenum pname, GLint *params)
 {
- if (DMesaGetCurrentContext() == NULL) {
-    return -1;
- }
-
  switch (pname) {
         case DMESA_GET_SCREEN_SIZE:
              #ifndef FX
-             #ifndef MATROX
              vl_get(VL_GET_SCREEN_SIZE, params);
              #else
-             mga_get(MGA_GET_SCREEN_SIZE, params);
-             #endif
-             #else
              fxGetScreenGeometry(&params[0], &params[1]);
              #endif
              break;
         case DMESA_GET_DRIVER_CAPS:
              #ifndef FX
-             #ifndef MATROX
              params[0] = DMESA_DRIVER_SWDB_BIT;
              #else
-             params[0] = 0;
-             #endif
-             #else
              params[0] = DMESA_DRIVER_LLWO_BIT;
              #endif
              break;
+        case DMESA_GET_VIDEO_MODES:
+             #ifndef FX
+             return vl_get(VL_GET_VIDEO_MODES, params);
+             #else
+             {
+              /* `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
         default:
              return -1;
  }
index dfb9274..fd47dbb 100644 (file)
  */
 
 /*
- * DOS/DJGPP device driver v1.4 for Mesa
+ * DOS/DJGPP device driver v1.5 for Mesa
  *
  *  Copyright (C) 2002 - Borca Daniel
- *  Email : dborca@yahoo.com
+ *  Email : dborca@users.sourceforge.net
  *  Web   : http://www.geocities.com/dborca
  */
 
@@ -59,11 +59,12 @@ typedef unsigned long word32;
  * video mode structure
  */
 typedef struct vl_mode {
-        int mode;
         int xres, yres;
-        int scanlen;
         int bpp;
 
+        int mode;
+        int scanlen;
+
         int sel;
         int gran;
 } vl_mode;
index ea5bcb7..e87651e 100644 (file)
  */
 
 /*
- * DOS/DJGPP device driver v1.3 for Mesa
+ * DOS/DJGPP device driver v1.5 for Mesa
  *
  *  Copyright (C) 2002 - Borca Daniel
- *  Email : dborca@yahoo.com
+ *  Email : dborca@users.sourceforge.net
  *  Web   : http://www.geocities.com/dborca
  */
 
@@ -450,6 +450,7 @@ static void vesa_restore (void)
     r.x.ax = 0x4f02;
     r.x.bx = oldmode;
     __dpmi_int(0x10, &r);
+    oldmode = -1;
  }
 }
 
index 9de32f0..3a4bd9b 100644 (file)
  */
 
 /*
- * DOS/DJGPP device driver v1.3 for Mesa
+ * DOS/DJGPP device driver v1.5 for Mesa
  *
  *  Copyright (C) 2002 - Borca Daniel
- *  Email : dborca@yahoo.com
+ *  Email : dborca@users.sourceforge.net
  *  Web   : http://www.geocities.com/dborca
  */
 
@@ -152,6 +152,7 @@ static void vga_restore (void)
 {
  if (oldmode != -1) {
     __asm("int $0x10"::"a"(oldmode));
+    oldmode = -1;
  }
 }
 
index 5432141..41903eb 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 /*
- * DOS/DJGPP device driver v1.4 for Mesa
+ * DOS/DJGPP device driver v1.5 for Mesa
  *
  *  Copyright (C) 2002 - Borca Daniel
  *  Email : dborca@users.sourceforge.net
@@ -416,6 +416,33 @@ void v_init_pixeltables (void)
 
 
 
+/* Desc: initialize hardware
+ *
+ * In  : -
+ * Out : list of available modes
+ *
+ * Note: when returning non-NULL, global variable `drv' is guaranteed to be ok
+ */
+static vl_mode *v_init_hw (void)
+{
+ static vl_mode *q = NULL;
+
+ if (q == NULL) {
+    /* initialize hardware */
+    if ((q = VESA.init()) != NULL) {
+       drv = &VESA;
+    } else if ((q = VGA.init()) != NULL) {
+       drv = &VGA;
+    } else {
+       drv = NULL;
+    }
+ }
+
+ return q;
+}
+
+
+
 /* Desc: sync buffer with video hardware
  *
  * In  : ptr to old buffer, position, size
@@ -456,7 +483,7 @@ int vl_sync_buffer (void **buffer, int x, int y, int width, int height)
 /* Desc: state retrieval
  *
  * In  : name, storage
- * Out : -
+ * Out : -1 for an error
  *
  * Note: -
  */
@@ -467,8 +494,28 @@ int vl_get (int pname, int *params)
              params[0] = video_mode->xres;
              params[1] = video_mode->yres;
              break;
+        case VL_GET_VIDEO_MODES:
+             {
+              int n;
+              vl_mode *q;
+              if ((q = v_init_hw()) == NULL) {
+                 return -1;
+              }
+              /* count available visuals */
+              for (n = 0; q->mode != 0xffff; q++) {
+                  if ((q + 1)->mode == (q->mode | 0x4000)) {
+                     /* same mode, but linear */
+                     q++;
+                  }
+                  if (params) {
+                     params[n] = (int)q;
+                  }
+                  n++;
+              }
+              return n;
+             }
         default:
-             return drv->get(pname, params);
+             return (drv != NULL) ? drv->get(pname, params) : -1;
  }
  return 0;
 }
@@ -541,6 +588,7 @@ void vl_video_exit (void)
 {
  drv->restore();
  drv->fini();
+ video_mode = NULL;
 }
 
 
@@ -571,12 +619,8 @@ int vl_video_init (int width, int height, int bpp, int rgb, int refresh)
 #endif
 
  /* initialize hardware */
- drv = &VESA;
- if ((q=drv->init()) == NULL) {
-    drv = &VGA;
-    if ((q=drv->init()) == NULL) {
-       return 0;
-    }
+ if ((q = v_init_hw()) == NULL) {
+    return 0;
  }
 
  /* search for a mode that fits our request */
index 55560ee..e928f19 100644 (file)
  */
 
 /*
- * DOS/DJGPP device driver v1.3 for Mesa
+ * DOS/DJGPP device driver v1.5 for Mesa
  *
  *  Copyright (C) 2002 - Borca Daniel
- *  Email : dborca@yahoo.com
+ *  Email : dborca@users.sourceforge.net
  *  Web   : http://www.geocities.com/dborca
  */
 
@@ -41,6 +41,7 @@ typedef int fixed;
 #define VL_GET_CI_PREC     0x0200
 #define VL_GET_HPIXELS     0x0201
 #define VL_GET_SCREEN_SIZE 0x0202
+#define VL_GET_VIDEO_MODES 0x0300
 
 extern int (*vl_mixfix) (fixed r, fixed g, fixed b);
 extern int (*vl_mixrgb) (const unsigned char rgb[]);
index e928b15..12b919b 100644 (file)
@@ -102,19 +102,46 @@ cleangraphics_handler(int s)
 
 
 /*
+ * Query 3Dfx hardware presence/kind
+ */
+static GLboolean GLAPIENTRY fxQueryHardware (void)
+{
+ if (TDFX_DEBUG & VERBOSE_DRIVER) {
+    fprintf(stderr, "fxQueryHardware()\n");
+ }
+
+ if (!glbGlideInitialized) {
+    grGlideInit();
+    glb3DfxPresent = FX_grSstQueryHardware(&glbHWConfig);
+
+    glbGlideInitialized = 1;
+
+#if defined(__WIN32__)
+    _onexit((_onexit_t) cleangraphics);
+#elif defined(__linux__)
+    /* Only register handler if environment variable is not defined. */
+    if (!getenv("MESA_FX_NO_SIGNALS")) {
+       atexit(cleangraphics);
+    }
+#endif
+ }
+
+ return glb3DfxPresent;
+}
+
+
+/*
  * Select the Voodoo board to use when creating
  * a new context.
  */
-GLboolean GLAPIENTRY fxMesaSelectCurrentBoard (int n)
+GLint GLAPIENTRY fxMesaSelectCurrentBoard (int n)
 {
    fxQueryHardware();
 
    if ((n < 0) || (n >= glbHWConfig.num_sst))
-      return GL_FALSE;
-
-   glbCurrentBoard = n;
+      return -1;
 
-   return GL_TRUE;
+   return glbHWConfig.SSTs[glbCurrentBoard = n].type;
 }
 
 
@@ -415,7 +442,7 @@ fxMesaCreateContext(GLuint win,
      redBits   = 5;
      greenBits = 5;
      blueBits  = 5;
-     alphaBits = 1;
+     alphaBits = depthSize ? 1 : 8;
      switch(fxMesa->fsaa) {
        case 8:
          pixFmt = GR_PIXFMT_AA_8_ARGB_1555;
@@ -852,35 +879,6 @@ fxMesaSwapBuffers(void)
 
 
 /*
- * Query 3Dfx hardware presence/kind
- */
-GLboolean GLAPIENTRY fxQueryHardware (void)
-{
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
-    fprintf(stderr, "fxQueryHardware()\n");
- }
-
- if (!glbGlideInitialized) {
-    grGlideInit();
-    glb3DfxPresent = FX_grSstQueryHardware(&glbHWConfig);
-
-    glbGlideInitialized = 1;
-
-#if defined(__WIN32__)
-    _onexit((_onexit_t) cleangraphics);
-#elif defined(__linux__)
-    /* Only register handler if environment variable is not defined. */
-    if (!getenv("MESA_FX_NO_SIGNALS")) {
-       atexit(cleangraphics);
-    }
-#endif
- }
-
- return glb3DfxPresent;
-}
-
-
-/*
  * Shutdown Glide library
  */
 void GLAPIENTRY
index 6a06ee1..7f75f12 100644 (file)
@@ -2212,6 +2212,7 @@ void FX_CALL fake_grTexDownloadTableExt (GrChipID_t   tmu,
                                          GrTexTable_t type,
                                          void         *data)
 {
+ (void)tmu;
  grTexDownloadTable(type, data);
 }
 
@@ -2221,12 +2222,14 @@ void FX_CALL fake_grTexDownloadTablePartialExt (GrChipID_t   tmu,
                                                 int          start,
                                                 int          end)
 {
+ (void)tmu;
  grTexDownloadTablePartial(type, data, start, end);
 }
 
 void FX_CALL fake_grTexNCCTableExt (GrChipID_t   tmu,
                                     GrNCCTable_t table)
 {
+ (void)tmu;
  grTexNCCTable(table);
 }
 
index 03ca664..8461492 100644 (file)
@@ -907,7 +907,6 @@ EXPORTS
 ;fxMesaSetNearFar
  fxMesaSwapBuffers
  fxMesaUpdateScreenSize
- fxQueryHardware
  wglChoosePixelFormat
  wglCopyContext
  wglCreateContext
index 72a8c56..4196020 100644 (file)
@@ -77,6 +77,7 @@ struct __pixelformat__
 };
 
 WINGDIAPI void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *);
+static GLushort gammaTable[3*256];
 
 struct __pixelformat__ pix[] = {
    /* 16bit RGB565 single buffer with depth */
@@ -426,12 +427,34 @@ wglGetSwapIntervalEXT (void)
 GLAPI BOOL GLAPIENTRY
 wglGetDeviceGammaRamp3DFX (HDC hdc, LPVOID arrays)
 {
+ /* gammaTable should be per-context */
+ memcpy(arrays, gammaTable, 3*256*sizeof(GLushort));
  return TRUE;
 }
 
 GLAPI BOOL GLAPIENTRY
 wglSetDeviceGammaRamp3DFX (HDC hdc, LPVOID arrays)
 {
+ GLint i, tableSize, inc, index;
+ GLushort *red, *green, *blue;
+ FxU32 gammaTableR[256], gammaTableG[256], gammaTableB[256];
+
+ /* gammaTable should be per-context */
+ memcpy(gammaTable, arrays, 3*256*sizeof(GLushort));
+
+ tableSize = FX_grGetInteger(GR_GAMMA_TABLE_ENTRIES);
+ inc = 256 / tableSize;
+ red = (GLushort *)arrays;
+ green = (GLushort *)arrays + 256;
+ blue = (GLushort *)arrays + 512;
+ for (i = 0, index = 0; i < tableSize; i++, index += inc) {
+     gammaTableR[i] = red[index] >> 8;
+     gammaTableG[i] = green[index] >> 8;
+     gammaTableB[i] = blue[index] >> 8;
+ }
+
+ grLoadGammaTable(tableSize, gammaTableR, gammaTableG, gammaTableB);
+
  return TRUE;
 }
 
index 02c67c2..f1d4ea0 100644 (file)
@@ -1799,8 +1799,8 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w,
        }
        attribs[numAttribs++] = FXMESA_NONE;
 
-       /* [dBorca] need to revise this ASAP!!! */
-       /*if ((hw = fxQueryHardware())==GR_SSTTYPE_VOODOO) {
+       /* [dBorca]  we should take an envvar for `fxMesaSelectCurrentBoard'!!! */
+       if ((hw = fxMesaSelectCurrentBoard(0))==GR_SSTTYPE_VOODOO) {
          b->FXctx = fxMesaCreateBestContext(0, b->width, b->height, attribs);
          if ((v->undithered_pf!=PF_Index) && (b->backimage)) {
           b->FXisHackUsable = b->FXctx ? GL_TRUE : GL_FALSE;
@@ -1810,7 +1810,7 @@ XMesaBuffer XMesaCreateWindowBuffer2( XMesaVisual v, XMesaWindow w,
             b->FXwindowHack = GL_FALSE;
          }
        }
-       else */{
+       else {
          if (fxEnvVar[0]=='w' || fxEnvVar[0]=='W')
           b->FXctx = fxMesaCreateContext(w, GR_RESOLUTION_NONE,
                                          GR_REFRESH_75Hz, attribs);