summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/README.3DFX8
-rw-r--r--docs/README.DJ3
-rw-r--r--src/glut/dos/PC_HW/pc_hw.h6
-rw-r--r--src/glut/dos/PC_HW/pc_timer.c247
-rw-r--r--src/mesa/drivers/glide/fxdd.c30
-rw-r--r--src/mesa/drivers/glide/fxddtex.c35
-rw-r--r--src/mesa/drivers/glide/fxwgl.c13
7 files changed, 252 insertions, 90 deletions
diff --git a/docs/README.3DFX b/docs/README.3DFX
index 2b6b2e9e933..ffa5468e37c 100644
--- a/docs/README.3DFX
+++ b/docs/README.3DFX
@@ -6,9 +6,9 @@
Mesa-5.1 release notes:
-----------------------
-1) Glide2 support has been ceased; in order to keep Voodoo Graphics, Voodoo2
- and Voodoo Rush compatibility, please visit the Glide SourceForge and help
- us to fix Glide3 for those cards.
+1) Glide2 support has been ceased; in order to keep Voodoo Graphics
+ and Voodoo Rush compatibility, please visit the Glide SourceForge
+ and help us to fix Glide3 for those cards.
2) The current release is a WIP; among other things, the Linux build works
only to some extent. Any help will be appreciated.
3) Glide3 can be found at http://sourceforge.net/projects/glide/
@@ -18,7 +18,7 @@ Mesa-5.1 release notes:
Known supported HW/OS:
----------------------
-Voodoo Banshee, Voodoo3, Voodoo4, Voodoo5 5500
+Voodoo^2, Voodoo Banshee, Voodoo3, Voodoo4, Voodoo5
DOS (DJGPP), Windows9x/2k (MinGW/MSVC), Linux
diff --git a/docs/README.DJ b/docs/README.DJ
index da174f4acbd..722218cfda7 100644
--- a/docs/README.DJ
+++ b/docs/README.DJ
@@ -209,11 +209,12 @@ v1.3 (mar-2003)
* revamped GLUT
* switched to DXE3
-v1.4 (oct-2003)
+v1.4 (nov-2003)
+ enabled GLUT fonts with DXE
+ truly added multi-window support in GLUT (for Adrian Woodward)
* accomodated makefiles with the new sourcetree
* fixed some ALPHA issues
+ * minor changes to PC_HW/timer interface
x hacked and slashed the 3dfx driver (w/ help from Hiroshi Morii)
diff --git a/src/glut/dos/PC_HW/pc_hw.h b/src/glut/dos/PC_HW/pc_hw.h
index 26bb8ba17df..bd2293eb29d 100644
--- a/src/glut/dos/PC_HW/pc_hw.h
+++ b/src/glut/dos/PC_HW/pc_hw.h
@@ -1,5 +1,5 @@
/*
- * PC/HW routine collection v1.3 for DOS/DJGPP
+ * PC/HW routine collection v1.4 for DOS/DJGPP
*
* Copyright (C) 2002 - Borca Daniel
@@ -19,6 +19,8 @@
#define FALSE 0
#define TRUE !FALSE
+#define SQR(x) ((x) * (x))
+
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
#define MID(x,y,z) MAX((x), MIN((y), (z)))
@@ -201,6 +203,8 @@ int pc_keyshifts (void);
* timer
*/
int pc_install_int (PFUNC func, void *parm, unsigned int freq);
+int pc_remove_int (int fid);
+int pc_adjust_int (int fid, unsigned int freq);
void pc_remove_timer (void);
/*
diff --git a/src/glut/dos/PC_HW/pc_timer.c b/src/glut/dos/PC_HW/pc_timer.c
index bf39bd0a4c0..f11917db1aa 100644
--- a/src/glut/dos/PC_HW/pc_timer.c
+++ b/src/glut/dos/PC_HW/pc_timer.c
@@ -1,5 +1,5 @@
/*
- * PC/HW routine collection v1.3 for DOS/DJGPP
+ * PC/HW routine collection v1.4 for DOS/DJGPP
*
* Copyright (C) 2002 - Borca Daniel
@@ -8,6 +8,7 @@
#include <pc.h>
+#include <string.h>
#include "pc_hw.h"
@@ -17,6 +18,8 @@
#define PIT_FREQ 0x1234DD
+#define ADJUST(timer, basefreq) timer.counter = PIT_FREQ * timer.freq / SQR(basefreq)
+
#define unvolatile(__v, __t) __extension__ ({union { volatile __t __cp; __t __p; } __q; __q.__cp = __v; __q.__p;})
static int timer_installed;
@@ -29,15 +32,24 @@ typedef struct {
static TIMER timer_main, timer_func[MAX_TIMERS];
+
+
+/* Desc: main timer callback
+ *
+ * In : -
+ * Out : 0 to bypass BIOS, 1 to chain to BIOS
+ *
+ * Note: -
+ */
static int timer ()
{
int i;
- for (i=0;i<MAX_TIMERS;i++) {
+ for (i = 0; i < MAX_TIMERS; i++) {
TIMER *t = &timer_func[i];
if (t->func) {
t->clock_ticks += t->counter;
- if (t->clock_ticks>=timer_main.counter) {
+ if (t->clock_ticks >= timer_main.counter) {
t->clock_ticks -= timer_main.counter;
t->func(unvolatile(t->parm, void *));
}
@@ -45,7 +57,7 @@ static int timer ()
}
timer_main.clock_ticks += timer_main.counter;
- if (timer_main.clock_ticks>=0x10000) {
+ if (timer_main.clock_ticks >= 0x10000) {
timer_main.clock_ticks -= 0x10000;
return 1;
} else {
@@ -54,6 +66,15 @@ static int timer ()
}
} ENDOFUNC(timer)
+
+
+/* Desc: uninstall timer engine
+ *
+ * In : -
+ * Out : -
+ *
+ * Note: -
+ */
void pc_remove_timer (void)
{
if (timer_installed) {
@@ -70,11 +91,22 @@ void pc_remove_timer (void)
}
}
+
+
+/* Desc: install timer engine
+ *
+ * In : -
+ * Out : 0 for success
+ *
+ * Note: initial frequency is 18.2 Hz
+ */
static int install_timer (void)
{
- if (timer_installed||pc_install_irq(TIMER_IRQ, timer)) {
+ if (timer_installed || pc_install_irq(TIMER_IRQ, timer)) {
return -1;
} else {
+ memset(timer_func, 0, sizeof(timer_func));
+
LOCKDATA(timer_func);
LOCKDATA(timer_main);
LOCKFUNC(timer);
@@ -94,65 +126,198 @@ static int install_timer (void)
}
}
-static TIMER *find_slot (PFUNC func)
+
+
+/* Desc: install timerfunc
+ *
+ * In : callback function, opaque pointer to be passed to callee, freq (Hz)
+ * Out : timerfunc id (0 .. MAX_TIMERS-1)
+ *
+ * Note: returns -1 if error
+ */
+int pc_install_int (PFUNC func, void *parm, unsigned int freq)
{
int i;
+ TIMER *t = NULL;
- for (i=0;i<MAX_TIMERS;i++) {
- if (timer_func[i].func==func) {
- return &timer_func[i];
- }
+ /* ensure the timer engine is set up */
+ if (!timer_installed) {
+ if (install_timer()) {
+ return -1;
+ }
}
- for (i=0;i<MAX_TIMERS;i++) {
+
+ /* find an empty slot */
+ for (i = 0; i < MAX_TIMERS; i++) {
if (!timer_func[i].func) {
- return &timer_func[i];
+ t = &timer_func[i];
+ break;
}
}
+ if (t == NULL) {
+ return -1;
+ }
+
+ DISABLE();
+
+ t->func = func;
+ t->parm = parm;
+ t->freq = freq;
+ t->clock_ticks = 0;
+
+ /* update main timer / sons to match highest frequency */
+ if (freq > timer_main.freq) {
+ unsigned int new_counter = PIT_FREQ / freq;
+
+ for (i = 0; i < MAX_TIMERS; i++) {
+ if (timer_func[i].func) {
+ ADJUST(timer_func[i], freq);
+ }
+ }
- return NULL;
+ outportb(0x43, 0x34);
+ outportb(0x40, (unsigned char)new_counter);
+ outportb(0x40, (unsigned char)(new_counter>>8));
+ timer_main.clock_ticks = 0;
+ timer_main.counter = new_counter;
+ timer_main.freq = freq;
+ } else {
+ /* t == &timer_func[i] */
+ ADJUST(timer_func[i], timer_main.freq);
+ }
+
+ ENABLE();
+
+ return t - timer_func;
}
-int pc_install_int (PFUNC func, void *parm, unsigned int freq)
+
+
+/* Desc: remove timerfunc
+ *
+ * In : timerfunc id
+ * Out : 0 if success
+ *
+ * Note: tries to relax the main timer whenever possible
+ */
+int pc_remove_int (int fid)
{
int i;
- TIMER *t;
+ unsigned int freq = 0;
+ /* are we installed? */
if (!timer_installed) {
- if (install_timer()) {
- return -1;
- }
+ return -1;
}
- if ((t=find_slot(func))!=NULL) {
+ /* sanity check */
+ if ((fid < 0) || (fid >= MAX_TIMERS) || (timer_func[fid].func == NULL)) {
+ return -1;
+ }
+ timer_func[fid].func = NULL;
+
+ /* scan for maximum frequency */
+ for (i = 0; i < MAX_TIMERS; i++) {
+ TIMER *t = &timer_func[i];
+ if (t->func) {
+ if (freq < t->freq) {
+ freq = t->freq;
+ }
+ }
+ }
+
+ /* if there are no callbacks left, cleanup */
+ if (!freq) {
+ pc_remove_timer();
+ return 0;
+ }
+
+ /* if we just lowered the maximum frequency, try to relax the timer engine */
+ if (freq < timer_main.freq) {
unsigned int new_counter = PIT_FREQ / freq;
DISABLE();
- t->func = func;
- t->parm = parm;
- t->freq = freq;
- t->clock_ticks = 0;
-
- if (new_counter < timer_main.counter) {
- for (i=0;i<MAX_TIMERS;i++) {
- if (timer_func[i].func) {
- timer_func[i].counter = new_counter * timer_func[i].freq / freq;
- }
- }
- outportb(0x43, 0x34);
- outportb(0x40, (unsigned char)new_counter);
- outportb(0x40, (unsigned char)(new_counter>>8));
- timer_main.clock_ticks = 0;
- timer_main.counter = new_counter;
- timer_main.freq = freq;
- } else {
- t->counter = PIT_FREQ * freq / (timer_main.freq * timer_main.freq);
+ for (i = 0; i < MAX_TIMERS; i++) {
+ if (timer_func[i].func) {
+ ADJUST(timer_func[i], freq);
+ }
}
- ENABLE();
+ outportb(0x43, 0x34);
+ outportb(0x40, (unsigned char)new_counter);
+ outportb(0x40, (unsigned char)(new_counter>>8));
+ timer_main.clock_ticks = 0;
+ timer_main.counter = new_counter;
+ timer_main.freq = freq;
- return 0;
+ ENABLE();
}
- return -1;
+ return 0;
+}
+
+
+
+/* Desc: adjust timerfunc
+ *
+ * In : timerfunc id, new frequency (Hz)
+ * Out : 0 if success
+ *
+ * Note: might change the main timer frequency
+ */
+int pc_adjust_int (int fid, unsigned int freq)
+{
+ int i;
+
+ /* are we installed? */
+ if (!timer_installed) {
+ return -1;
+ }
+
+ /* sanity check */
+ if ((fid < 0) || (fid >= MAX_TIMERS) || (timer_func[fid].func == NULL)) {
+ return -1;
+ }
+ timer_func[fid].freq = freq;
+
+ /* scan for maximum frequency */
+ freq = 0;
+ for (i = 0; i < MAX_TIMERS; i++) {
+ TIMER *t = &timer_func[i];
+ if (t->func) {
+ if (freq < t->freq) {
+ freq = t->freq;
+ }
+ }
+ }
+
+ /* update main timer / sons to match highest frequency */
+ DISABLE();
+
+ /* using '>' is correct still (and avoids updating
+ * the HW timer too often), but doesn't relax the timer!
+ */
+ if (freq != timer_main.freq) {
+ unsigned int new_counter = PIT_FREQ / freq;
+
+ for (i = 0; i < MAX_TIMERS; i++) {
+ if (timer_func[i].func) {
+ ADJUST(timer_func[i], freq);
+ }
+ }
+
+ outportb(0x43, 0x34);
+ outportb(0x40, (unsigned char)new_counter);
+ outportb(0x40, (unsigned char)(new_counter>>8));
+ timer_main.clock_ticks = 0;
+ timer_main.counter = new_counter;
+ timer_main.freq = freq;
+ } else {
+ ADJUST(timer_func[fid], timer_main.freq);
+ }
+
+ ENABLE();
+
+ return 0;
}
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c
index e4f76374318..f4090122f5a 100644
--- a/src/mesa/drivers/glide/fxdd.c
+++ b/src/mesa/drivers/glide/fxdd.c
@@ -1220,26 +1220,22 @@ fxDDGetString(GLcontext * ctx, GLenum name)
return (GLubyte *)fxMesa->rendererString;
#if 0 /* hack to advertise vanilla extension names */
case GL_EXTENSIONS:
- {
- static const GLubyte *ext = NULL;
- if (ext == NULL) {
- GLubyte *x = _mesa_make_extension_string(ctx);
- if (x != NULL) {
- ext = _mesa_malloc(strlen((char *)x) + 1024);
- if (ext != NULL) {
- strcpy((char *)ext, (char *)x);
+ if (ctx->Extensions.String == NULL) {
+ GLubyte *ext = _mesa_make_extension_string(ctx);
+ if (ext != NULL) {
+ ctx->Extensions.String = _mesa_malloc(strlen((char *)ext) + 256);
+ if (ctx->Extensions.String != NULL) {
+ strcpy((char *)ctx->Extensions.String, (char *)ext);
#if 0 /* put any additional extension names here */
- strcat((char *)ext, " 3DFX_set_global_palette");
+ strcat((char *)ctx->Extensions.String, " 3DFX_set_global_palette");
#endif
- _mesa_free(x);
- } else {
- ext = x;
- }
- ctx->Extensions.String = ext;
- }
- }
- return ext;
+ _mesa_free(ext);
+ } else {
+ ctx->Extensions.String = ext;
+ }
+ }
}
+ return ctx->Extensions.String;
#endif
default:
return NULL;
diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c
index 9dc47ec8e4a..b84f8d4a9dc 100644
--- a/src/mesa/drivers/glide/fxddtex.c
+++ b/src/mesa/drivers/glide/fxddtex.c
@@ -539,6 +539,7 @@ fxTexGetInfo(int w, int h, GrLOD_t * lodlevel, GrAspectRatio_t * ar,
l = MAX2(logw, logh);
aspectratio = logw - logh;
+ ws = hs = 1;
/* hardware only allows a maximum aspect ratio of 8x1, so handle
* |aspectratio| > 3 by scaling the image and using an 8x1 aspect
@@ -548,44 +549,30 @@ fxTexGetInfo(int w, int h, GrLOD_t * lodlevel, GrAspectRatio_t * ar,
case 0:
s = 256.0f;
t = 256.0f;
- ws = 1;
- hs = 1;
break;
case 1:
s = 256.0f;
t = 128.0f;
- ws = 1;
- hs = 1;
break;
case 2:
s = 256.0f;
t = 64.0f;
- ws = 1;
- hs = 1;
break;
case 3:
s = 256.0f;
t = 32.0f;
- ws = 1;
- hs = 1;
break;
case -1:
s = 128.0f;
t = 256.0f;
- ws = 1;
- hs = 1;
break;
case -2:
s = 64.0f;
t = 256.0f;
- ws = 1;
- hs = 1;
break;
case -3:
s = 32.0f;
t = 256.0f;
- ws = 1;
- hs = 1;
break;
default:
if (aspectratio > 3) {
@@ -1129,30 +1116,30 @@ fxFetchFunction(GLint mesaFormat)
{
switch (mesaFormat) {
case MESA_FORMAT_I8:
- return fetch_intensity8;
+ return &fetch_intensity8;
case MESA_FORMAT_A8:
- return fetch_alpha8;
+ return &fetch_alpha8;
case MESA_FORMAT_L8:
- return fetch_luminance8;
+ return &fetch_luminance8;
case MESA_FORMAT_CI8:
- return fetch_index8;
+ return &fetch_index8;
case MESA_FORMAT_AL88:
- return fetch_luminance8_alpha8;
+ return &fetch_luminance8_alpha8;
case MESA_FORMAT_RGB565:
- return fetch_r5g6b5;
+ return &fetch_r5g6b5;
case MESA_FORMAT_ARGB4444:
- return fetch_r4g4b4a4;
+ return &fetch_r4g4b4a4;
case MESA_FORMAT_ARGB1555:
- return fetch_r5g5b5a1;
+ return &fetch_r5g5b5a1;
case MESA_FORMAT_ARGB8888:
- return fetch_a8r8g8b8;
+ return &fetch_a8r8g8b8;
case MESA_FORMAT_RGB_FXT1:
case MESA_FORMAT_RGBA_FXT1:
case MESA_FORMAT_RGB_DXT1:
case MESA_FORMAT_RGBA_DXT1:
case MESA_FORMAT_RGBA_DXT3:
case MESA_FORMAT_RGBA_DXT5:
- return fetch_r4g4b4a4;
+ return &fetch_r4g4b4a4;
default:
_mesa_problem(NULL, "Unexpected format in fxFetchFunction");
return NULL;
diff --git a/src/mesa/drivers/glide/fxwgl.c b/src/mesa/drivers/glide/fxwgl.c
index 308cb9ba76e..4609880f8d3 100644
--- a/src/mesa/drivers/glide/fxwgl.c
+++ b/src/mesa/drivers/glide/fxwgl.c
@@ -57,6 +57,11 @@ extern "C"
#define MAX_MESA_ATTRS 20
+#if (_MSC_VER >= 1200)
+#pragma warning( push )
+#pragma warning( disable : 4273 )
+#endif
+
struct __extensions__
{
PROC proc;
@@ -69,7 +74,7 @@ struct __pixelformat__
GLint mesaAttr[MAX_MESA_ATTRS];
};
-//WINGDIAPI void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *);
+WINGDIAPI void GLAPIENTRY gl3DfxSetPaletteEXT(GLuint *);
struct __pixelformat__ pix[] = {
/* 16bit RGB565 single buffer with depth */
@@ -866,7 +871,7 @@ wglDescribeLayerPlane(HDC hdc, int iPixelFormat, int iLayerPlane,
GLAPI int GLAPIENTRY
wglGetLayerPaletteEntries(HDC hdc, int iLayerPlane, int iStart,
- int cEntries, CONST COLORREF *pcr)
+ int cEntries, COLORREF *pcr)
{
SetLastError(0);
return (FALSE);
@@ -887,4 +892,8 @@ wglSetLayerPaletteEntries(HDC hdc,int iLayerPlane, int iStart,
return(FALSE);
}
+#if (_MSC_VER >= 1200)
+#pragma warning( pop )
+#endif
+
#endif /* FX */