diff options
author | Daniel Borca <[email protected]> | 2003-12-19 11:26:46 +0000 |
---|---|---|
committer | Daniel Borca <[email protected]> | 2003-12-19 11:26:46 +0000 |
commit | e9e98405e720845f06f7a375585491e938f4dacd (patch) | |
tree | ae25ec98796f3456f2a5a17ce0a3d02d7838fd33 /src/mesa | |
parent | eee77bf82fda5b9f3cf34e96e7d0010bf18db748 (diff) |
DMesa: removed MGA2064W driver
DMesa: added capability to query visuals
fxMesa: WGL_3DFX_gamma_control
fxMesa: minor fixes to interface (fxQueryHardware vs fxMesaSelect...)
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/Makefile.DJ | 17 | ||||
-rw-r--r-- | src/mesa/drivers/dos/dmesa.c | 455 | ||||
-rw-r--r-- | src/mesa/drivers/dos/internal.h | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dos/vesa.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dos/vga.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dos/video.c | 62 | ||||
-rw-r--r-- | src/mesa/drivers/dos/video.h | 5 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxapi.c | 68 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxg.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxopengl.def | 1 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxwgl.c | 23 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_api.c | 6 |
12 files changed, 179 insertions, 480 deletions
diff --git a/src/mesa/Makefile.DJ b/src/mesa/Makefile.DJ index cd336fc50e9..71e44861f80 100644 --- a/src/mesa/Makefile.DJ +++ b/src/mesa/Makefile.DJ @@ -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) diff --git a/src/mesa/drivers/dos/dmesa.c b/src/mesa/drivers/dos/dmesa.c index a5d052b39db..5b4f71ad69e 100644 --- a/src/mesa/drivers/dos/dmesa.c +++ b/src/mesa/drivers/dos/dmesa.c @@ -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 : [email protected] @@ -53,11 +53,7 @@ #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(¶ms[0], ¶ms[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; } diff --git a/src/mesa/drivers/dos/internal.h b/src/mesa/drivers/dos/internal.h index dfb9274ecc7..fd47dbb7b82 100644 --- a/src/mesa/drivers/dos/internal.h +++ b/src/mesa/drivers/dos/internal.h @@ -23,10 +23,10 @@ */ /* - * DOS/DJGPP device driver v1.4 for Mesa + * DOS/DJGPP device driver v1.5 for Mesa * * Copyright (C) 2002 - Borca Daniel - * Email : [email protected] + * Email : [email protected] * 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; diff --git a/src/mesa/drivers/dos/vesa.c b/src/mesa/drivers/dos/vesa.c index ea5bcb7a86e..e87651e4fd2 100644 --- a/src/mesa/drivers/dos/vesa.c +++ b/src/mesa/drivers/dos/vesa.c @@ -23,10 +23,10 @@ */ /* - * DOS/DJGPP device driver v1.3 for Mesa + * DOS/DJGPP device driver v1.5 for Mesa * * Copyright (C) 2002 - Borca Daniel - * Email : [email protected] + * Email : [email protected] * 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; } } diff --git a/src/mesa/drivers/dos/vga.c b/src/mesa/drivers/dos/vga.c index 9de32f0cd5e..3a4bd9b6876 100644 --- a/src/mesa/drivers/dos/vga.c +++ b/src/mesa/drivers/dos/vga.c @@ -23,10 +23,10 @@ */ /* - * DOS/DJGPP device driver v1.3 for Mesa + * DOS/DJGPP device driver v1.5 for Mesa * * Copyright (C) 2002 - Borca Daniel - * Email : [email protected] + * Email : [email protected] * 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; } } diff --git a/src/mesa/drivers/dos/video.c b/src/mesa/drivers/dos/video.c index 5432141bb0d..41903ebe799 100644 --- a/src/mesa/drivers/dos/video.c +++ b/src/mesa/drivers/dos/video.c @@ -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 : [email protected] @@ -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 */ diff --git a/src/mesa/drivers/dos/video.h b/src/mesa/drivers/dos/video.h index 55560ee25b8..e928f19c373 100644 --- a/src/mesa/drivers/dos/video.h +++ b/src/mesa/drivers/dos/video.h @@ -23,10 +23,10 @@ */ /* - * DOS/DJGPP device driver v1.3 for Mesa + * DOS/DJGPP device driver v1.5 for Mesa * * Copyright (C) 2002 - Borca Daniel - * Email : [email protected] + * Email : [email protected] * 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[]); diff --git a/src/mesa/drivers/glide/fxapi.c b/src/mesa/drivers/glide/fxapi.c index e928b156eb5..12b919b2e60 100644 --- a/src/mesa/drivers/glide/fxapi.c +++ b/src/mesa/drivers/glide/fxapi.c @@ -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 diff --git a/src/mesa/drivers/glide/fxg.c b/src/mesa/drivers/glide/fxg.c index 6a06ee1461c..7f75f1292c2 100644 --- a/src/mesa/drivers/glide/fxg.c +++ b/src/mesa/drivers/glide/fxg.c @@ -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); } diff --git a/src/mesa/drivers/glide/fxopengl.def b/src/mesa/drivers/glide/fxopengl.def index 03ca66444ef..84614923bae 100644 --- a/src/mesa/drivers/glide/fxopengl.def +++ b/src/mesa/drivers/glide/fxopengl.def @@ -907,7 +907,6 @@ EXPORTS ;fxMesaSetNearFar fxMesaSwapBuffers fxMesaUpdateScreenSize - fxQueryHardware wglChoosePixelFormat wglCopyContext wglCreateContext diff --git a/src/mesa/drivers/glide/fxwgl.c b/src/mesa/drivers/glide/fxwgl.c index 72a8c561b42..41960209e93 100644 --- a/src/mesa/drivers/glide/fxwgl.c +++ b/src/mesa/drivers/glide/fxwgl.c @@ -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; } diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 02c67c25cf3..f1d4ea0ccb0 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -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); |