diff options
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dos/dmesaint.h | 231 | ||||
-rw-r--r-- | src/mesa/drivers/dos/dvesa.c | 549 | ||||
-rw-r--r-- | src/mesa/drivers/dos/dvesa.h | 127 | ||||
-rw-r--r-- | src/mesa/drivers/dos/vbeaf.c | 607 | ||||
-rw-r--r-- | src/mesa/drivers/dos/vbeaf.h | 813 | ||||
-rw-r--r-- | src/mesa/drivers/dos/vbeafint.h | 50 |
6 files changed, 0 insertions, 2377 deletions
diff --git a/src/mesa/drivers/dos/dmesaint.h b/src/mesa/drivers/dos/dmesaint.h deleted file mode 100644 index b8aa7064d5..0000000000 --- a/src/mesa/drivers/dos/dmesaint.h +++ /dev/null @@ -1,231 +0,0 @@ -/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * DOS/DJGPP device driver v0.1 for Mesa 4.0
- *
- * Copyright (C) 2002 - Borca Daniel
- * Email : dborca@yahoo.com
- * Web : http://www.geocities.com/dborca
- */
-
-
-#ifndef DMESAINT_H_included
-#define DMESAINT_H_included
-
-
-
-#define FLIP(y) (c->Buffer->height - (y) - 1)
-#define FLIP2(y) (h - (y) - 1)
-
-
-
-/**********************************************************************/
-/***** Write spans of pixels *****/
-/**********************************************************************/
-#define WRITE_RGBA_SPAN(bpp) \
-static void write_rgba_span_##bpp (const GLcontext *ctx, GLuint n, GLint x, GLint y, \
- const GLubyte rgba[][4], const GLubyte mask[]) \
-{ \
- DMesaContext c = (DMesaContext)ctx->DriverCtx; \
- void *b = c->Buffer->the_window; \
- GLuint i, offset; \
- \
- offset = c->Buffer->width * FLIP(y) + x; \
- if (mask) { \
- /* draw some pixels */ \
- for (i=0; i<n; i++, offset++) { \
- if (mask[i]) { \
- dv_putpixel##bpp(b, offset, dv_color##bpp(rgba[i])); \
- } \
- } \
- } else { \
- /* draw all pixels */ \
- for (i=0; i<n; i++, offset++) { \
- dv_putpixel##bpp(b, offset, dv_color##bpp(rgba[i])); \
- } \
- } \
-}
-
-
-
-#define WRITE_RGB_SPAN(bpp) \
-static void write_rgb_span_##bpp (const GLcontext *ctx, GLuint n, GLint x, GLint y, \
- const GLubyte rgb[][3], const GLubyte mask[]) \
-{ \
- DMesaContext c = (DMesaContext)ctx->DriverCtx; \
- void *b = c->Buffer->the_window; \
- GLuint i, offset; \
- \
- offset = c->Buffer->width * FLIP(y) + x; \
- if (mask) { \
- /* draw some pixels */ \
- for (i=0; i<n; i++, offset++) { \
- if (mask[i]) { \
- dv_putpixel##bpp(b, offset, dv_color##bpp(rgb[i])); \
- } \
- } \
- } else { \
- /* draw all pixels */ \
- for (i=0; i<n; i++, offset++) { \
- dv_putpixel##bpp(b, offset, dv_color##bpp(rgb[i])); \
- } \
- } \
-}
-
-
-
-#define WRITE_MONO_RGBA_SPAN(bpp) \
-static void write_mono_rgba_span_##bpp (const GLcontext *ctx, \
- GLuint n, GLint x, GLint y, \
- const GLchan color[4], const GLubyte mask[]) \
-{ \
- DMesaContext c = (DMesaContext)ctx->DriverCtx; \
- void *b = c->Buffer->the_window; \
- GLuint i, offset, rgba = dv_color##bpp(color); \
- \
- offset = c->Buffer->width * FLIP(y) + x; \
- if (mask) { \
- /* draw some pixels */ \
- for (i=0; i<n; i++, offset++) { \
- if (mask[i]) { \
- dv_putpixel##bpp(b, offset, rgba); \
- } \
- } \
- } else { \
- /* draw all pixels */ \
- for (i=0; i<n; i++, offset++) { \
- dv_putpixel##bpp(b, offset, rgba); \
- } \
- } \
-}
-
-
-
-/**********************************************************************/
-/***** Read spans of pixels *****/
-/**********************************************************************/
-#define READ_RGBA_SPAN(bpp) \
-static void read_rgba_span_##bpp (const GLcontext *ctx, GLuint n, GLint x, GLint y, \
- GLubyte rgba[][4]) \
-{ \
- DMesaContext c = (DMesaContext)ctx->DriverCtx; \
- void *b = c->Buffer->the_window; \
- GLuint i, offset; \
- \
- offset = c->Buffer->width * FLIP(y) + x; \
- /* read all pixels */ \
- for (i=0; i<n; i++, offset++) { \
- dv_getrgba##bpp(b, offset, rgba[i]); \
- } \
-}
-
-
-
-/**********************************************************************/
-/***** Write arrays of pixels *****/
-/**********************************************************************/
-#define WRITE_RGBA_PIXELS(bpp) \
-static void write_rgba_pixels_##bpp (const GLcontext *ctx, \
- GLuint n, const GLint x[], const GLint y[], \
- const GLubyte rgba[][4], const GLubyte mask[]) \
-{ \
- DMesaContext c = (DMesaContext)ctx->DriverCtx; \
- void *b = c->Buffer->the_window; \
- GLuint i, w = c->Buffer->width, h = c->Buffer->height; \
- \
- if (mask) { \
- /* draw some pixels */ \
- for (i=0; i<n; i++) { \
- if (mask[i]) { \
- dv_putpixel##bpp(b, FLIP2(y[i])*w + x[i], dv_color##bpp(rgba[i])); \
- } \
- } \
- } else { \
- /* draw all pixels */ \
- for (i=0; i<n; i++) { \
- dv_putpixel##bpp(b, FLIP2(y[i])*w + x[i], dv_color##bpp(rgba[i])); \
- } \
- } \
-}
-
-
-
-#define WRITE_MONO_RGBA_PIXELS(bpp) \
-static void write_mono_rgba_pixels_##bpp (const GLcontext *ctx, \
- GLuint n, const GLint x[], const GLint y[], \
- const GLchan color[4], const GLubyte mask[]) \
-{ \
- DMesaContext c = (DMesaContext)ctx->DriverCtx; \
- void *b = c->Buffer->the_window; \
- GLuint i, w = c->Buffer->width, h = c->Buffer->height, rgba = dv_color##bpp(color); \
- \
- if (mask) { \
- /* draw some pixels */ \
- for (i=0; i<n; i++) { \
- if (mask[i]) { \
- dv_putpixel##bpp(b, FLIP2(y[i])*w + x[i], rgba); \
- } \
- } \
- } else { \
- /* draw all pixels */ \
- for (i=0; i<n; i++) { \
- dv_putpixel##bpp(b, FLIP2(y[i])*w + x[i], rgba); \
- } \
- } \
-}
-
-
-
-
-/**********************************************************************/
-/***** Read arrays of pixels *****/
-/**********************************************************************/
-#define READ_RGBA_PIXELS(bpp) \
-static void read_rgba_pixels_##bpp (const GLcontext *ctx, \
- GLuint n, const GLint x[], const GLint y[], \
- GLubyte rgba[][4], const GLubyte mask[]) \
-{ \
- DMesaContext c = (DMesaContext)ctx->DriverCtx; \
- void *b = c->Buffer->the_window; \
- GLuint i, w = c->Buffer->width, h = c->Buffer->height; \
- \
- if (mask) { \
- /* read some pixels */ \
- for (i=0; i<n; i++) { \
- if (mask[i]) { \
- dv_getrgba##bpp(b, FLIP2(y[i])*w + x[i], rgba[i]); \
- } \
- } \
- } else { \
- /* read all pixels */ \
- for (i=0; i<n; i++) { \
- dv_getrgba##bpp(b, FLIP2(y[i])*w + x[i], rgba[i]); \
- } \
- } \
-}
-
-
-
-#endif
diff --git a/src/mesa/drivers/dos/dvesa.c b/src/mesa/drivers/dos/dvesa.c deleted file mode 100644 index 27464e530d..0000000000 --- a/src/mesa/drivers/dos/dvesa.c +++ /dev/null @@ -1,549 +0,0 @@ -/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * DOS/DJGPP device driver v0.1 for Mesa 4.0
- *
- * Copyright (C) 2002 - Borca Daniel
- * Email : dborca@yahoo.com
- * Web : http://www.geocities.com/dborca
- */
-
-
-#include <dpmi.h>
-#include <string.h>
-#include <stubinfo.h>
-#include <sys/exceptn.h>
-#include <sys/farptr.h>
-#include <sys/segments.h>
-
-#include "dvesa.h"
-
-
-
-typedef struct dvmode {
- int mode;
- int xres, yres;
- int scanlen;
- int bpp;
- word32 opaque;
-} dvmode;
-
-#define _16_ *(word16 *)&
-#define _32_ *(word32 *)&
-
-static int init;
-static int selector = -1;
-static int granularity;
-static dvmode modes[128];
-static void (*dv_putpixel) (void *buffer, int offset, int color);
-int (*dv_color) (const unsigned char rgba[]);
-void (*dv_dump_virtual) (void *buffer, int width, int height, int offset, int delta);
-void (*dv_clear_virtual) (void *buffer, int len, int color);
-
-extern void dv_dump_virtual_linear (void *buffer, int width, int height, int offset, int delta);
-extern void dv_dump_virtual_banked (void *buffer, int width, int height, int offset, int delta);
-
-extern void dv_clear_virtual16 (void *buffer, int len, int color);
-extern void dv_clear_virtual24 (void *buffer, int len, int color);
-extern void dv_clear_virtual32 (void *buffer, int len, int color);
-
-/* lookup table for scaling 5 bit colors up to 8 bits */
-int _rgb_scale_5[32] =
-{
- 0, 8, 16, 24, 32, 41, 49, 57,
- 65, 74, 82, 90, 98, 106, 115, 123,
- 131, 139, 148, 156, 164, 172, 180, 189,
- 197, 205, 213, 222, 230, 238, 246, 255
-};
-
-/* lookup table for scaling 6 bit colors up to 8 bits */
-int _rgb_scale_6[64] =
-{
- 0, 4, 8, 12, 16, 20, 24, 28,
- 32, 36, 40, 44, 48, 52, 56, 60,
- 64, 68, 72, 76, 80, 85, 89, 93,
- 97, 101, 105, 109, 113, 117, 121, 125,
- 129, 133, 137, 141, 145, 149, 153, 157,
- 161, 165, 170, 174, 178, 182, 186, 190,
- 194, 198, 202, 206, 210, 214, 218, 222,
- 226, 230, 234, 238, 242, 246, 250, 255
-};
-
-
-
-/*
- * colors
- */
-int dv_color15 (const unsigned char rgba[])
-{
- return ((rgba[0]>>3)<<10)|((rgba[1]>>3)<<5)|(rgba[2]>>3);
-}
-int dv_color16 (const unsigned char rgba[])
-{
- return ((rgba[0]>>3)<<11)|((rgba[1]>>2)<<5)|(rgba[2]>>3);
-}
-int dv_color32 (const unsigned char rgba[])
-{
- return (rgba[0]<<16)|(rgba[1]<<8)|(rgba[2]);
-}
-
-
-
-/*
- * getpixel + decompose
- */
-void dv_getrgba15 (void *buffer, int offset, unsigned char rgba[4])
-{
- int c = ((word16 *)buffer)[offset];
- rgba[0] = _rgb_scale_5[(c >> 10) & 0x1F];
- rgba[1] = _rgb_scale_5[(c >> 5) & 0x1F];
- rgba[2] = _rgb_scale_5[c & 0x1F];
- rgba[3] = 255;
-}
-void dv_getrgba16 (void *buffer, int offset, unsigned char rgba[4])
-{
- int c = ((word16 *)buffer)[offset];
- rgba[0] = _rgb_scale_5[(c >> 11) & 0x1F];
- rgba[1] = _rgb_scale_6[(c >> 5) & 0x3F];
- rgba[2] = _rgb_scale_5[c & 0x1F];
- rgba[3] = 255;
-}
-void dv_getrgba24 (void *buffer, int offset, unsigned char rgba[4])
-{
- int c = *(word32 *)(buffer+offset*3);
- rgba[0] = c >> 16;
- rgba[1] = c >> 8;
- rgba[2] = c;
- rgba[3] = 255;
-}
-void dv_getrgba32 (void *buffer, int offset, unsigned char rgba[4])
-{
- int c = ((word32 *)buffer)[offset];
- rgba[0] = c >> 16;
- rgba[1] = c >> 8;
- rgba[2] = c;
- rgba[3] = 255;
-}
-
-
-
-/*
- * request mapping from DPMI
- */
-static word32 _map_linear (word32 phys, word32 len)
-{
- __dpmi_meminfo meminfo;
-
- if (phys >= 0x100000) {
- /* map into linear memory */
- meminfo.address = (long)phys;
- meminfo.size = len;
- if (__dpmi_physical_address_mapping(&meminfo)) {
- return 0;
- }
- return meminfo.address;
- } else {
- /* exploit 1 -> 1 physical to linear mapping in low megabyte */
- return phys;
- }
-}
-
-
-
-/*
- * attempts to detect VESA and video modes
- */
-static word16 dv_get_vesa (void)
-{
- __dpmi_regs r;
- unsigned short *p;
- dvmode *q;
- char vesa_info[512], tmp[512];
-
- _farpokel(_stubinfo->ds_selector, 0, 0x32454256);
- r.x.ax = 0x4f00;
- r.x.di = 0;
- r.x.es = _stubinfo->ds_segment;
- __dpmi_int(0x10, &r);
- if (r.x.ax==0x004f) {
- movedata(_stubinfo->ds_selector, 0, _my_ds(), (unsigned)vesa_info, 512);
- if ((_32_ vesa_info[0])==0x41534556) {
- p = (unsigned short *)(((_16_ vesa_info[0x10])<<4) + (_16_ vesa_info[0x0e]));
- q = modes;
- do {
- if ((q->mode=_farpeekw(__djgpp_dos_sel, (unsigned long)(p++)))==0xffff) {
- break;
- }
-
- r.x.ax = 0x4f01;
- r.x.cx = q->mode;
- r.x.di = 512;
- r.x.es = _stubinfo->ds_segment;
- __dpmi_int(0x10, &r);
- movedata(_stubinfo->ds_selector, 512, _my_ds(), (unsigned)tmp, 256);
- switch (tmp[0x19]) {
- case 16:
- q->bpp = tmp[0x1f] + tmp[0x21] + tmp[0x23];
- break;
- case 15:
- case 24:
- case 32:
- q->bpp = tmp[0x19];
- break;
- default:
- q->bpp = 0;
- }
- if ((r.x.ax==0x004f)&&((tmp[0]&0x11)==0x11)&&q->bpp) {
- q->xres = _16_ tmp[0x12];
- q->yres = _16_ tmp[0x14];
- q->scanlen = _16_ tmp[0x10];
- q->opaque = (_16_ tmp[4])<<10;
- if (tmp[0]&0x80) {
- *(q+1) = *q++;
- q->opaque = _32_ tmp[0x28];
- q->mode |= 0x4000;
- }
- q++;
- }
- } while (!0);
-
- return _16_ vesa_info[4];
- }
- }
-
- return 0;
-}
-
-
-
-/*
- * select a mode
- */
-dvmode *dv_select_mode (int x, int y, int width, int height, int depth, int *delta, int *offset)
-{
- dvmode *p, *q;
- unsigned int min;
-
- if ((width&3)||(height&3)||(depth<=8)) {
- return NULL;
- }
-
- if (!init) {
- init = !init;
- if (!dv_get_vesa()) {
- return NULL;
- }
- }
-
- for (min=-1, p=NULL, q=modes; q->mode!=0xffff; q++) {
- if ((q->xres>=(x+width))&&(q->yres>=(y+height))&&(q->bpp==depth)) {
- if (min>(unsigned)(q->xres*q->yres)) {
- min = q->xres*q->yres;
- p = q;
- }
- }
- }
-
- if (p) {
- int sel = -1;
- unsigned base, limit;
-
- if ((p->mode|0x4000)==(p+1)->mode) {
- p++;
- }
-
- if (selector==-1) {
- if ((selector=sel=__dpmi_allocate_ldt_descriptors(1))==-1) {
- return NULL;
- }
- }
- if (p->mode&0x4000) {
- limit = ((p->scanlen*p->yres+0xfffUL)&~0xfffUL) - 1;
- if ((base=_map_linear(p->opaque, limit))==NULL) {
- if (sel!=-1) {
- selector = -1;
- __dpmi_free_ldt_descriptor(sel);
- }
- return NULL;
- }
- dv_dump_virtual = dv_dump_virtual_linear;
- } else {
- limit = granularity = p->opaque;
- base = 0xa0000;
- dv_dump_virtual = dv_dump_virtual_banked;
- }
- __dpmi_set_segment_base_address(selector, base);
- __dpmi_set_descriptor_access_rights(selector, ((_my_ds()&3)<<5)|0x4092);
- __dpmi_set_segment_limit(selector, limit);
-
- switch (p->bpp) {
- case 15:
- dv_clear_virtual = dv_clear_virtual16;
- dv_putpixel = dv_putpixel16;
- dv_color = dv_color15;
- break;
- case 16:
- dv_clear_virtual = dv_clear_virtual16;
- dv_putpixel = dv_putpixel16;
- dv_color = dv_color16;
- break;
- case 24:
- dv_clear_virtual = dv_clear_virtual24;
- dv_putpixel = dv_putpixel24;
- dv_color = dv_color32;
- break;
- case 32:
- dv_clear_virtual = dv_clear_virtual32;
- dv_putpixel = dv_putpixel32;
- dv_color = dv_color32;
- break;
- default:
- dv_clear_virtual = NULL;
- dv_putpixel = NULL;
- }
-
- *delta = p->scanlen - ((depth+7)/8) * width;
- *offset = p->scanlen*y + ((depth+7)/8) * x;
-
- __asm__("movw $0x4f02, %%ax; int $0x10"::"b"(p->mode):"%eax");
- }
-
- return p;
-}
-
-
-
-/*
- * fill rectangle
- */
-void dv_fillrect (void *buffer, int bwidth, int x, int y, int width, int height, int color)
-{
- int i, offset;
-
- offset = y*bwidth + x;
- bwidth -= width;
- for (height+=y; y<height; y++) {
- for (i=0; i<width; i++, offset++) {
- dv_putpixel(buffer, offset, color);
- }
- offset += bwidth;
- }
-}
-
-
-
-/*
- * dv_dump_virtual_linear
- */
-__asm__("\n\
- .balign 4 \n\
- .global _dv_dump_virtual_linear \n\
-_dv_dump_virtual_linear: \n\
- pushl %fs \n\
- pushl %ebx \n\
- pushl %esi \n\
- pushl %edi \n\
- movl _selector, %fs \n\
- movl 4*4+4+0(%esp), %esi \n\
- movl 4*4+4+12(%esp), %edi \n\
- movl 4*4+4+4(%esp), %ecx \n\
- movl 4*4+4+8(%esp), %edx \n\
- movl 4*4+4+16(%esp), %ebx \n\
- shrl $2, %ecx \n\
- .balign 4 \n\
- 0: \n\
- pushl %ecx \n\
- .balign 4 \n\
- 1: \n\
- movl (%esi), %eax \n\
- addl $4, %esi \n\
- movl %eax, %fs:(%edi) \n\
- addl $4, %edi \n\
- decl %ecx \n\
- jnz 1b \n\
- popl %ecx \n\
- addl %ebx, %edi \n\
- decl %edx \n\
- jnz 0b \n\
- popl %edi \n\
- popl %esi \n\
- popl %ebx \n\
- popl %fs \n\
- ret");
-/*
- * dv_dump_virtual_banked
- */
-__asm__("\n\
- .balign 4 \n\
- .global _dv_dump_virtual_banked \n\
-_dv_dump_virtual_banked: \n\
- pushl %fs \n\
- pushl %ebx \n\
- pushl %esi \n\
- pushl %edi \n\
- pushl %ebp \n\
- movl _selector, %fs \n\
- movl 4*5+4+0(%esp), %esi \n\
- movl _granularity, %ebp \n\
- xorl %edx, %edx \n\
- movl 4*5+4+12(%esp), %eax \n\
- divl %ebp \n\
- movl %edx, %edi \n\
- pushl %eax \n\
- movl %eax, %edx \n\
- xorl %ebx, %ebx \n\
- movw $0x4f05, %ax \n\
- int $0x10 \n\
- movl 4*6+4+16(%esp), %ebx \n\
- movl 4*6+4+4(%esp), %ecx \n\
- movl 4*6+4+8(%esp), %edx \n\
- shrl $2, %ecx \n\
- .balign 4 \n\
- 0: \n\
- pushl %ecx \n\
- .balign 4 \n\
- 1: \n\
- cmpl %ebp, %edi \n\
- jb 2f \n\
- pushl %ebx \n\
- pushl %edx \n\
- incl 12(%esp) \n\
- movw $0x4f05, %ax \n\
- movl 12(%esp), %edx \n\
- xorl %ebx, %ebx \n\
- int $0x10 \n\
- popl %edx \n\
- popl %ebx \n\
- subl %ebp, %edi \n\
- 2: \n\
- movl (%esi), %eax \n\
- addl $4, %esi \n\
- movl %eax, %fs:(%edi) \n\
- addl $4, %edi \n\
- decl %ecx \n\
- jnz 1b \n\
- popl %ecx \n\
- addl %ebx, %edi \n\
- decl %edx \n\
- jnz 0b \n\
- popl %eax \n\
- popl %ebp \n\
- popl %edi \n\
- popl %esi \n\
- popl %ebx \n\
- popl %fs \n\
- ret");
-
-
-
-/*
- * dv_clear_virtual??
- */
-__asm__("\n\
- .balign 4 \n\
- .global _dv_clear_virtual16 \n\
-_dv_clear_virtual16: \n\
- movl 12(%esp), %eax \n\
- pushw %ax \n\
- pushw %ax \n\
- popl %eax \n\
- jmp _dv_clear_virtual_common\n\
- .balign 4 \n\
- .global _dv_clear_virtual32 \n\
-_dv_clear_virtual32: \n\
- movl 12(%esp), %eax \n\
- \n\
- .balign 4 \n\
- .global _dv_clear_virtual_common\n\
-_dv_clear_virtual_common: \n\
- movl 8(%esp), %ecx \n\
- movl 4(%esp), %edx \n\
- shrl $2, %ecx \n\
- .balign 4 \n\
- 0: \n\
- movl %eax, (%edx) \n\
- addl $4, %edx \n\
- decl %ecx \n\
- jnz 0b \n\
- ret");
-__asm__("\n\
- .balign 4 \n\
- .global _dv_clear_virtual24 \n\
-_dv_clear_virtual24: \n\
- movl 8(%esp), %edx \n\
- movl $0xaaaaaaab, %eax \n\
- mull %edx \n\
- movl 12(%esp), %eax \n\
- movl %edx, %ecx \n\
- movl 4(%esp), %edx \n\
- pushl %ebx \n\
- shrl %ecx \n\
- movb 18(%esp), %bl \n\
- .balign 4 \n\
- 0: \n\
- movw %ax, (%edx) \n\
- movb %bl, 2(%edx) \n\
- addl $3, %edx \n\
- decl %ecx \n\
- jnz 0b \n\
- popl %ebx \n\
- ret");
-
-
-
-/*
- * dv_putpixel??
- */
-__asm__("\n\
- .balign 4 \n\
- .global _dv_putpixel16 \n\
-_dv_putpixel16: \n\
- movl 8(%esp), %edx \n\
- shll %edx \n\
- movl 12(%esp), %eax \n\
- addl 4(%esp), %edx \n\
- movw %ax, (%edx) \n\
- ret");
-__asm__("\n\
- .balign 4 \n\
- .global _dv_putpixel32 \n\
-_dv_putpixel32: \n\
- movl 8(%esp), %edx \n\
- shll $2, %edx \n\
- movl 12(%esp), %eax \n\
- addl 4(%esp), %edx \n\
- movl %eax, (%edx) \n\
- ret");
-__asm__("\n\
- .global _dv_putpixel24 \n\
-_dv_putpixel24: \n\
- movl 8(%esp), %edx \n\
- leal (%edx, %edx, 2), %edx \n\
- movl 12(%esp), %eax \n\
- addl 4(%esp), %edx \n\
- movw %ax, (%edx) \n\
- shrl $16, %eax \n\
- movb %al, 2(%edx) \n\
- ret");
diff --git a/src/mesa/drivers/dos/dvesa.h b/src/mesa/drivers/dos/dvesa.h deleted file mode 100644 index aaa4be7950..0000000000 --- a/src/mesa/drivers/dos/dvesa.h +++ /dev/null @@ -1,127 +0,0 @@ -/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * DOS/DJGPP device driver v0.1 for Mesa 4.0
- *
- * Copyright (C) 2002 - Borca Daniel
- * Email : dborca@yahoo.com
- * Web : http://www.geocities.com/dborca
- */
-
-
-#ifndef DVESA_H_included
-#define DVESA_H_included
-
-typedef unsigned char word8;
-typedef unsigned short word16;
-typedef unsigned long word32;
-
-struct dvmode;
-
-extern int (*dv_color) (const unsigned char rgba[]);
-extern void (*dv_dump_virtual) (void *buffer, int width, int height, int offset, int delta);
-extern void (*dv_clear_virtual) (void *buffer, int len, int color);
-
-struct dvmode *dv_select_mode (int x, int y, int width, int height, int depth, int *delta, int *offset);
-void dv_fillrect (void *buffer, int bwidth, int x, int y, int width, int height, int color);
-
-/*
- * not so public...
- */
-extern int _rgb_scale_5[32];
-extern int _rgb_scale_6[64];
-
-/*
- * dv_putpixel inlines
- */
-#define dv_putpixel15 dv_putpixel16
-extern __inline__ void dv_putpixel16 (void *buffer, int offset, int color)
-{
- ((word16 *)buffer)[offset] = (word16)color;
-}
-extern __inline__ void dv_putpixel24 (void *buffer, int offset, int color)
-{
- *(word16 *)(buffer+offset*3) = (word16)color;
- *(word8 *)(buffer+offset*3+2) = (word8)(color>>16);
-}
-extern __inline__ void dv_putpixel32 (void *buffer, int offset, int color)
-{
- ((word32 *)buffer)[offset] = color;
-}
-
-/*
- * dv_color inlines
- */
-extern __inline__ int dv_color15 (const unsigned char rgba[])
-{
- return ((rgba[0]>>3)<<10)|((rgba[1]>>3)<<5)|(rgba[2]>>3);
-}
-extern __inline__ int dv_color16 (const unsigned char rgba[])
-{
- return ((rgba[0]>>3)<<11)|((rgba[1]>>2)<<5)|(rgba[2]>>3);
-}
-#define dv_color24 dv_color32
-extern __inline__ int dv_color32 (const unsigned char rgba[])
-{
- return (rgba[0]<<16)|(rgba[1]<<8)|(rgba[2]);
-}
-
-/*
- * dv_getrgba inlines
- */
-extern __inline__ void dv_getrgba15 (void *buffer, int offset, unsigned char rgba[4])
-{
- int c = ((word16 *)buffer)[offset];
- rgba[0] = _rgb_scale_5[(c >> 10) & 0x1F];
- rgba[1] = _rgb_scale_5[(c >> 5) & 0x1F];
- rgba[2] = _rgb_scale_5[c & 0x1F];
- rgba[3] = 255;
-}
-extern __inline__ void dv_getrgba16 (void *buffer, int offset, unsigned char rgba[4])
-{
- int c = ((word16 *)buffer)[offset];
- rgba[0] = _rgb_scale_5[(c >> 11) & 0x1F];
- rgba[1] = _rgb_scale_6[(c >> 5) & 0x3F];
- rgba[2] = _rgb_scale_5[c & 0x1F];
- rgba[3] = 255;
-}
-extern __inline__ void dv_getrgba24 (void *buffer, int offset, unsigned char rgba[4])
-{
- int c = *(word32 *)(buffer+offset*3);
- rgba[0] = c >> 16;
- rgba[1] = c >> 8;
- rgba[2] = c;
- rgba[3] = 255;
-}
-extern __inline__ void dv_getrgba32 (void *buffer, int offset, unsigned char rgba[4])
-{
- int c = ((word32 *)buffer)[offset];
- rgba[0] = c >> 16;
- rgba[1] = c >> 8;
- rgba[2] = c;
- rgba[3] = 255;
-}
-
-#endif
diff --git a/src/mesa/drivers/dos/vbeaf.c b/src/mesa/drivers/dos/vbeaf.c deleted file mode 100644 index eef1793985..0000000000 --- a/src/mesa/drivers/dos/vbeaf.c +++ /dev/null @@ -1,607 +0,0 @@ -/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * DOS/DJGPP device driver v0.2 for Mesa 4.0
- *
- * Copyright (C) 2002 - Borca Daniel
- * Email : dborca@yahoo.com
- * Web : http://www.geocities.com/dborca
- */
-
-
-#include <ctype.h>
-#include <dpmi.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/exceptn.h>
-#include <sys/nearptr.h>
-
-#include "dpmiint.h"
-#include "vbeaf.h"
-
-
-
-#define MMAP unsigned long
-#define NOMM 0
-#define MVAL(a) (void *)((a)-__djgpp_base_address)
-
-
-
-#define SAFE_CALL(FUNC)\
-{ \
- int _ds, _es, _ss; \
- \
- __asm__ __volatile__( \
- " movw %%ds, %w0 ; " \
- " movw %%es, %w1 ; " \
- " movw %%ss, %w2 ; " \
- " movw %w3, %%ds ; " \
- " movw %w3, %%es ; " \
- " movw %w3, %%ss ; " \
- \
- : "=&q" (_ds), \
- "=&q" (_es), \
- "=&q" (_ss) \
- : "q" (__djgpp_ds_alias) \
- ); \
- \
- FUNC \
- \
- __asm__ __volatile__( \
- "movw %w0, %%ds ; " \
- "movw %w1, %%es ; " \
- "movw %w2, %%ss ; " \
- : \
- : "q" (_ds), \
- "q" (_es), \
- "q" (_ss) \
- ); \
-}
-
-#define SAFISH_CALL(FUNC) FUNC
-
-
-
-extern void _af_int86(), _af_call_rm(), _af_wrapper_end();
-
-
-
-static AF_DRIVER *af_driver = NULL; /* the VBE/AF driver */
-int _accel_active = FALSE; /* is the accelerator busy? */
-static FAF_HWPTR_DATA *faf_farptr; /* FreeBE/AF farptr data */
-static MMAP af_memmap[4] = { NOMM, NOMM, NOMM, NOMM };
-static MMAP af_banked_mem = NOMM;
-static MMAP af_linear_mem = NOMM;
-
-
-
-__inline__ fixed itofix (int x)
-{
- return x << 16;
-}
-
-
-
-/*
- * loads the driver from disk
- */
-static int load_driver (char *filename)
-{
- FILE *f;
- size_t size;
-
- if ((f=fopen(filename, "rb"))!=NULL) {
- fseek(f, 0, SEEK_END);
- size = ftell(f);
- fseek(f, 0, SEEK_SET);
- if ((af_driver=(AF_DRIVER *)malloc(size))!=NULL) {
- if (fread(af_driver, size, 1, f)) {
- return 0;
- } else {
- free(af_driver);
- }
- }
- fclose(f);
- }
-
- return -1;
-}
-
-
-
-/*
- * Calls a VBE/AF function using the version 1.0 style asm interface.
- */
-static int call_vbeaf_asm (void *proc)
-{
- int ret;
-
- proc = (void *)((long)af_driver + (long)proc);
-
- /* use gcc-style inline asm */
- __asm__("\n\
- pushl %%ebx \n\
- movl %%ecx, %%ebx \n\
- call *%%edx \n\
- popl %%ebx \n\
- ": "=&a" (ret) /* return value in eax */
- : "c" (af_driver), /* VBE/AF driver in ds:ebx */
- "d" (proc) /* function ptr in edx */
- : "memory" /* assume everything is clobbered */
- );
-
- return ret;
-}
-
-
-
-/*
- * prepares the FreeBE/AF extension functions.
- */
-static int initialise_freebeaf_extensions (void)
-{
- typedef unsigned long (*EXT_INIT_FUNC)(AF_DRIVER *af, unsigned long id);
- EXT_INIT_FUNC ext_init;
- unsigned long magic;
- int v1, v2;
- void *ptr;
-
- /* safety check */
- if (!af_driver->OemExt) {
- return 0;
- }
-
- /* call the extension init function */
- ext_init = (EXT_INIT_FUNC)((long)af_driver + (long)af_driver->OemExt);
-
- magic = ext_init(af_driver, FAFEXT_INIT);
-
- /* check that it returned a nice magic number */
- v1 = (magic>>8)&0xFF;
- v2 = magic&0xFF;
-
- if (((magic&0xFFFF0000) != FAFEXT_MAGIC) || (!isdigit(v1)) || (!isdigit(v2))) {
- return 0;
- }
-
- /* export libc and pmode functions if the driver wants them */
- ptr = af_driver->OemExt(af_driver, FAFEXT_LIBC);
-#ifdef _FAFEXT_LIBC
- if (ptr)
- _fill_vbeaf_libc_exports(ptr);
-#endif
-
- ptr = af_driver->OemExt(af_driver, FAFEXT_PMODE);
-#ifdef _FAFEXT_PMODE
- if (ptr)
- _fill_vbeaf_pmode_exports(ptr);
-#endif
-
- return (v1-'0')*10 + (v2-'0');
-}
-
-
-
-/*
- * Sets up the DPMI memory mappings required by the VBE/AF driver,
- * returning zero on success.
- */
-static int initialise_vbeaf_driver (int faf_ext)
-{
- int c;
-
- /* query driver for the FreeBE/AF farptr extension */
- if (faf_ext > 0)
- faf_farptr = af_driver->OemExt(af_driver, FAFEXT_HWPTR);
- else
- faf_farptr = NULL;
-
- if (faf_farptr) {
- /* use farptr access */
- for (c=0; c<4; c++) {
- faf_farptr->IOMemMaps[c].sel = 0;
- faf_farptr->IOMemMaps[c].offset = 0;
- }
-
- faf_farptr->BankedMem.sel = 0;
- faf_farptr->BankedMem.offset = 0;
-
- faf_farptr->LinearMem.sel = 0;
- faf_farptr->LinearMem.offset = 0;
- } else {
- /* enable nearptr access */
- return -5;
- }
-
- /* create mapping for MMIO ports */
- for (c=0; c<4; c++) {
- if (af_driver->IOMemoryBase[c]) {
- if ((af_memmap[c]=_create_linear_mapping(af_driver->IOMemoryBase[c], af_driver->IOMemoryLen[c]))==NULL)
- return -4;
-
- if (faf_farptr) {
- /* farptr IO mapping */
- if ((faf_farptr->IOMemMaps[c].sel=_create_selector(af_memmap[c], af_driver->IOMemoryLen[c]))<0) {
- _remove_linear_mapping(af_memmap+c);
- return -4;
- }
- faf_farptr->IOMemMaps[c].offset = 0;
- af_driver->IOMemMaps[c] = NULL;
- } else {
- /* nearptr IO mapping */
- af_driver->IOMemMaps[c] = MVAL(af_memmap[c]);
- }
- }
- }
-
- /* create mapping for banked video RAM */
- if (af_driver->BankedBasePtr) {
- if ((af_banked_mem=_create_linear_mapping(af_driver->BankedBasePtr, 0x10000))==NULL)
- return -4;
-
- if (faf_farptr) {
- /* farptr banked vram mapping */
- if ((faf_farptr->BankedMem.sel=_create_selector(af_banked_mem, 0x10000))<0) {
- _remove_linear_mapping(&af_banked_mem);
- return -4;
- }
- faf_farptr->BankedMem.offset = 0;
- af_driver->BankedMem = NULL;
- } else {
- /* nearptr banked vram mapping */
- af_driver->BankedMem = MVAL(af_banked_mem);
- }
- }
-
- /* create mapping for linear video RAM */
- if (af_driver->LinearBasePtr) {
- if ((af_linear_mem=_create_linear_mapping(af_driver->LinearBasePtr, af_driver->LinearSize*1024))==NULL)
- return -4;
-
- if (faf_farptr) {
- /* farptr linear vram mapping */
- if ((faf_farptr->LinearMem.sel=_create_selector(af_linear_mem, af_driver->LinearSize*1024))<0) {
- _remove_linear_mapping(&af_linear_mem);
- return -4;
- }
- faf_farptr->LinearMem.offset = 0;
- af_driver->LinearMem = NULL;
- } else {
- /* nearptr linear vram mapping */
- af_driver->LinearMem = MVAL(af_linear_mem);
- }
- }
-
- /* callback functions: why are these needed? ugly, IMHO */
- af_driver->Int86 = (void *)_af_int86;
- af_driver->CallRealMode = (void *)_af_call_rm;
-
- return 0;
-}
-
-
-
-/* go_accel:
- * Prepares the hardware for an accelerated drawing operation.
- */
-static __inline__ void go_accel (void)
-{
- /* turn on the accelerator */
- if (!_accel_active) {
- if (af_driver->DisableDirectAccess)
- af_driver->DisableDirectAccess(af_driver);
-
- _accel_active = TRUE;
- }
-}
-
-
-
-void af_exit (void)
-{
- int c;
-
- /* undo memory mappings */
- if (faf_farptr) {
- for (c=0; c<4; c++)
- _remove_selector(&faf_farptr->IOMemMaps[c].sel);
-
- _remove_selector(&faf_farptr->BankedMem.sel);
- _remove_selector(&faf_farptr->LinearMem.sel);
- }
-
- for (c=0; c<4; c++)
- _remove_linear_mapping(af_memmap+c);
-
- _remove_linear_mapping(&af_banked_mem);
- _remove_linear_mapping(&af_linear_mem);
-
- if (af_driver) {
- free(af_driver);
- }
-}
-
-
-
-int af_init (char *filename)
-{
- int faf_ext, r;
-
- if (load_driver(filename)) {
- /* driver not found */
- return -1;
- }
-
- faf_ext = initialise_freebeaf_extensions();
-
- /* special setup for Plug and Play hardware */
- if (call_vbeaf_asm(af_driver->PlugAndPlayInit)) {
- af_exit();
- /* Plug and Play initialisation failed */
- return -2;
- }
-
- if ((r=initialise_vbeaf_driver(faf_ext))) {
- af_exit();
- /* -4, ... */
- return r;
- }
-
- /* low level driver initialisation */
- if (call_vbeaf_asm(af_driver->InitDriver)) {
- af_exit();
- /* VBE/AF device not present */
- return -3;
- }
-
- _go32_dpmi_lock_code((void *)_af_int86, (long)_af_wrapper_end-(long)_af_int86);
-
- return 0;
-}
-
-
-
-#include "video.h"
-
-
-
-static long page, xres, startx, starty;
-
-
-
-AF_MODE_INFO *af_getmode (int i, int *granularity)
-{
- static AF_MODE_INFO info;
- int mode = af_driver->AvailableModes[i];
-
- if ((mode==-1)||af_driver->GetVideoModeInfo(af_driver, mode, &info)) {
- return NULL;
- } else {
- *granularity = af_driver->BankSize * 1024;
- return &info;
- }
-}
-
-
-
-void *af_dump_virtual (void *buffer, int width, int height, int pitch)
-{
- SAFISH_CALL(
- go_accel();
-
- af_driver->BitBltSys(af_driver, buffer, pitch, 0, 0, width, height, startx, starty, 0);
- );
- return buffer;
-}
-
-
-
-void af_switch_bank (int bank)
-{
- af_driver->SetBank(af_driver, bank);
-}
-
-
-
-int af_flip (void)
-{
- SAFISH_CALL(
- go_accel();
-
- af_driver->SetDisplayStart(af_driver, page*xres, 0, 1);
- );
- if (page ^= 1) {
- startx += xres;
- } else {
- startx -= xres;
- }
-
- return page;
-}
-
-
-
-void af_fillrect (void *buffer, int x, int y, int width, int height, int color)
-{
- (void)buffer;
- SAFISH_CALL(
- go_accel();
-
- af_driver->DrawRect(af_driver, color, startx+x, starty+y, width, height);
- );
-}
-
-
-
-void af_triangle (int x1, int y1, int x2, int y2, int x3, int y3, int color)
-{
- AF_TRAP trap;
-
- /* sort along the vertical axis */
- #define TRI_SWAP(a, b) \
- { \
- int tmp = x##a; \
- x##a = x##b; \
- x##b = tmp; \
- \
- tmp = y##a; \
- y##a = y##b; \
- y##b = tmp; \
- }
-
- if (y2 < y1)
- TRI_SWAP(1, 2);
-
- if (y3 < y1) {
- TRI_SWAP(1, 3);
- TRI_SWAP(2, 3);
- } else if (y3 < y2)
- TRI_SWAP(2, 3);
-
- SAFISH_CALL(
- go_accel();
-
- if (y2 > y1) {
- /* draw the top half of the triangle as one trapezoid */
- trap.y = y1+starty;
- trap.count = y2-y1;
- trap.x1 = trap.x2 = itofix(x1+startx);
- trap.slope1 = itofix(x2-x1) / (y2-y1);
- trap.slope2 = itofix(x3-x1) / (y3-y1);
-
- if (trap.slope1 < 0)
- trap.x1 += MIN(trap.slope1+itofix(1), 0);
-
- if (trap.slope2 < 0)
- trap.x2 += MIN(trap.slope2+itofix(1), 0);
-
- if (trap.slope1 > trap.slope2)
- trap.x1 += MAX(ABS(trap.slope1), itofix(1));
- else
- trap.x2 += MAX(ABS(trap.slope2), itofix(1));
-
- af_driver->DrawTrap(af_driver, color, &trap);
-
- if (y3 > y2) {
- /* draw the bottom half as a second trapezoid */
- if (trap.slope1 < 0)
- trap.x1 -= MIN(trap.slope1+itofix(1), 0);
-
- if (trap.slope1 > trap.slope2)
- trap.x1 -= MAX(ABS(trap.slope1), itofix(1));
-
- trap.count = y3-y2;
- trap.slope1 = itofix(x3-x2) / (y3-y2);
-
- if (trap.slope1 < 0)
- trap.x1 += MIN(trap.slope1+itofix(1), 0);
-
- if (trap.x1 > trap.x2)
- trap.x1 += MAX(ABS(trap.slope1), itofix(1));
-
- af_driver->DrawTrap(af_driver, color, &trap);
- }
- } else if (y3 > y2) {
- /* we can draw the entire thing with a single trapezoid */
- trap.y = y1+starty;
- trap.count = y3-y2;
- trap.x1 = itofix(x2+startx);
- trap.x2 = itofix(x1+startx);
- trap.slope1 = itofix(x3-x2) / (y3-y2);
- trap.slope2 = (y3 > y1) ? (itofix(x3-x1) / (y3-y1)) : 0;
-
- if (trap.slope1 < 0)
- trap.x1 += MIN(trap.slope1+itofix(1), 0);
-
- if (trap.slope2 < 0)
- trap.x2 += MIN(trap.slope2+itofix(1), 0);
-
- if (trap.x1 > trap.x2)
- trap.x1 += MAX(ABS(trap.slope1), itofix(1));
- else
- trap.x2 += MAX(ABS(trap.slope2), itofix(1));
-
- af_driver->DrawTrap(af_driver, color, &trap);
- }
- );
-}
-
-
-
-int af_setup_mode (int mode, int caps)
-{
- if (CHECK_SOFTDB(caps) && af_driver->BitBltSys) {
- vl_flip = af_dump_virtual;
- }
- if (af_driver->SetBank) {
- vl_switch_bank = af_switch_bank;
- }
- if (!CHECK_SOFTDB(caps) && af_driver->DrawRect) {
- vl_clear = af_fillrect;
- }
-
- if (CHECK_SINGLE(caps) || CHECK_SOFTDB(caps)) {
- page = 0;
- } else {
- page = 1;
- }
-
- return (mode&0x4000)?faf_farptr->LinearMem.sel:faf_farptr->BankedMem.sel;
-}
-
-
-
-int af_setup_buffer (int x, int y)
-{
- startx = x + page*xres;
- starty = y;
-
- return page;
-}
-
-
-
-void *af_getprim (int primitive)
-{
- switch (primitive) {
- case TRI_RGB_FLAT:
- return af_driver->DrawTrap?(void *)af_triangle:NULL;
- default:
- return NULL;
- }
-}
-
-
-
-int af_enter_mode (int mode, int width, int height)
-{
- long wret;
- if (!af_driver->SetVideoMode(af_driver, mode, width, height, &wret, 1, NULL)) {
- xres = width/2;
- return wret;
- } else {
- return -1;
- }
-}
diff --git a/src/mesa/drivers/dos/vbeaf.h b/src/mesa/drivers/dos/vbeaf.h deleted file mode 100644 index 70ab669b48..0000000000 --- a/src/mesa/drivers/dos/vbeaf.h +++ /dev/null @@ -1,813 +0,0 @@ -/*
- * ______ ____ ______ _____ ______
- * | ____| | _ \| ____| / / _ \| ____|
- * | |__ _ __ ___ ___| |_) | |__ / / |_| | |__
- * | __| '__/ _ \/ _ \ _ <| __| / /| _ | __|
- * | | | | | __/ __/ |_) | |____ / / | | | | |
- * |_| |_| \___|\___|____/|______/_/ |_| |_|_|
- *
- *
- * VBE/AF structure definitions and constants.
- *
- * See freebe.txt for copyright information.
- */
-
-
-#define FREEBE_VERSION "v1.2"
-
-
-#ifndef ALLEGRO_H
-
-
-#include <pc.h>
-
-
-#define NULL 0
-
-#define TRUE 1
-#define FALSE 0
-
-#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)))
-
-#define ABS(x) (((x) >= 0) ? (x) : (-(x)))
-
-#define BYTES_PER_PIXEL(bpp) (((int)(bpp) + 7) / 8)
-
-typedef long fixed;
-
-
-#endif
-
-
-
-/* mode attribute flags */
-#define afHaveMultiBuffer 0x0001 /* multiple buffers */
-#define afHaveVirtualScroll 0x0002 /* virtual scrolling */
-#define afHaveBankedBuffer 0x0004 /* supports banked framebuffer */
-#define afHaveLinearBuffer 0x0008 /* supports linear framebuffer */
-#define afHaveAccel2D 0x0010 /* supports 2D acceleration */
-#define afHaveDualBuffers 0x0020 /* uses dual buffers */
-#define afHaveHWCursor 0x0040 /* supports a hardware cursor */
-#define afHave8BitDAC 0x0080 /* 8 bit palette DAC */
-#define afNonVGAMode 0x0100 /* not a VGA mode */
-#define afHaveDoubleScan 0x0200 /* supports double scanning */
-#define afHaveInterlaced 0x0400 /* supports interlacing */
-#define afHaveTripleBuffer 0x0800 /* supports triple buffering */
-#define afHaveStereo 0x1000 /* supports stereo LCD glasses */
-#define afHaveROP2 0x2000 /* supports ROP2 mix codes */
-#define afHaveHWStereoSync 0x4000 /* hardware stereo signalling */
-#define afHaveEVCStereoSync 0x8000 /* HW stereo sync via EVC connector */
-
-
-
-/* drawing modes */
-typedef enum
-{
- AF_FORE_MIX = 0, /* background pixels use the foreground mix */
- AF_REPLACE_MIX = 0, /* solid drawing mode */
- AF_AND_MIX, /* bitwise AND mode */
- AF_OR_MIX, /* bitwise OR mode */
- AF_XOR_MIX, /* bitwise XOR mode */
- AF_NOP_MIX, /* nothing is drawn */
-
- /* below here need only be supported if you set the afHaveROP2 flag */
- AF_R2_BLACK = 0x10,
- AF_R2_NOTMERGESRC,
- AF_R2_MASKNOTSRC,
- AF_R2_NOTCOPYSRC,
- AF_R2_MASKSRCNOT,
- AF_R2_NOT,
- AF_R2_XORSRC,
- AF_R2_NOTMASKSRC,
- AF_R2_MASKSRC,
- AF_R2_NOTXORSRC,
- AF_R2_NOP,
- AF_R2_MERGENOTSRC,
- AF_R2_COPYSRC,
- AF_R2_MERGESRCNOT,
- AF_R2_MERGESRC,
- AF_R2_WHITE,
-} AF_mixModes;
-
-
-
-/* fixed point coordinate pair */
-typedef struct AF_FIX_POINT
-{
- fixed x;
- fixed y;
-} AF_FIX_POINT;
-
-
-
-/* trapezium information block */
-typedef struct AF_TRAP
-{
- unsigned long y;
- unsigned long count;
- fixed x1;
- fixed x2;
- fixed slope1;
- fixed slope2;
-} AF_TRAP;
-
-
-
-/* hardware cursor description */
-typedef struct AF_CURSOR
-{
- unsigned long xorMask[32];
- unsigned long andMask[32];
- unsigned long hotx;
- unsigned long hoty;
-} AF_CURSOR;
-
-
-
-/* color value */
-typedef struct AF_PALETTE
-{
- unsigned char blue;
- unsigned char green;
- unsigned char red;
- unsigned char alpha;
-} AF_PALETTE;
-
-
-
-/* CRTC information block for refresh rate control */
-typedef struct AF_CRTCInfo
-{
- unsigned short HorizontalTotal __attribute__ ((packed)); /* horizontal total (pixels) */
- unsigned short HorizontalSyncStart __attribute__ ((packed)); /* horizontal sync start position */
- unsigned short HorizontalSyncEnd __attribute__ ((packed)); /* horizontal sync end position */
- unsigned short VerticalTotal __attribute__ ((packed)); /* vertical total (lines) */
- unsigned short VerticalSyncStart __attribute__ ((packed)); /* vertical sync start position */
- unsigned short VerticalSyncEnd __attribute__ ((packed)); /* vertical sync end position */
- unsigned char Flags __attribute__ ((packed)); /* initialisation flags for mode */
- unsigned int PixelClock __attribute__ ((packed)); /* pixel clock in units of Hz */
- unsigned short RefreshRate __attribute__ ((packed)); /* expected refresh rate in .01Hz */
- unsigned short NumBuffers __attribute__ ((packed)); /* number of display buffers */
-} AF_CRTCInfo;
-
-
-
-/* definitions for CRTC information block flags */
-#define afDoubleScan 0x0001 /* enable double scanned mode */
-#define afInterlaced 0x0002 /* enable interlaced mode */
-#define afHSyncNeg 0x0004 /* horizontal sync is negative */
-#define afVSyncNeg 0x0008 /* vertical sync is negative */
-
-
-
-typedef unsigned char AF_PATTERN; /* pattern array elements */
-typedef unsigned AF_STIPPLE; /* 16 bit line stipple pattern */
-typedef unsigned AF_COLOR; /* packed color values */
-
-
-
-/* mode information structure */
-typedef struct AF_MODE_INFO
-{
- unsigned short Attributes __attribute__ ((packed));
- unsigned short XResolution __attribute__ ((packed));
- unsigned short YResolution __attribute__ ((packed));
- unsigned short BytesPerScanLine __attribute__ ((packed));
- unsigned short BitsPerPixel __attribute__ ((packed));
- unsigned short MaxBuffers __attribute__ ((packed));
- unsigned char RedMaskSize __attribute__ ((packed));
- unsigned char RedFieldPosition __attribute__ ((packed));
- unsigned char GreenMaskSize __attribute__ ((packed));
- unsigned char GreenFieldPosition __attribute__ ((packed));
- unsigned char BlueMaskSize __attribute__ ((packed));
- unsigned char BlueFieldPosition __attribute__ ((packed));
- unsigned char RsvdMaskSize __attribute__ ((packed));
- unsigned char RsvdFieldPosition __attribute__ ((packed));
- unsigned short MaxBytesPerScanLine __attribute__ ((packed));
- unsigned short MaxScanLineWidth __attribute__ ((packed));
-
- /* VBE/AF 2.0 extensions */
- unsigned short LinBytesPerScanLine __attribute__ ((packed));
- unsigned char BnkMaxBuffers __attribute__ ((packed));
- unsigned char LinMaxBuffers __attribute__ ((packed));
- unsigned char LinRedMaskSize __attribute__ ((packed));
- unsigned char LinRedFieldPosition __attribute__ ((packed));
- unsigned char LinGreenMaskSize __attribute__ ((packed));
- unsigned char LinGreenFieldPosition __attribute__ ((packed));
- unsigned char LinBlueMaskSize __attribute__ ((packed));
- unsigned char LinBlueFieldPosition __attribute__ ((packed));
- unsigned char LinRsvdMaskSize __attribute__ ((packed));
- unsigned char LinRsvdFieldPosition __attribute__ ((packed));
- unsigned long MaxPixelClock __attribute__ ((packed));
- unsigned long VideoCapabilities __attribute__ ((packed));
- unsigned short VideoMinXScale __attribute__ ((packed));
- unsigned short VideoMinYScale __attribute__ ((packed));
- unsigned short VideoMaxXScale __attribute__ ((packed));
- unsigned short VideoMaxYScale __attribute__ ((packed));
-
- unsigned char reserved[76] __attribute__ ((packed));
-
-} AF_MODE_INFO;
-
-
-
-#define DC struct AF_DRIVER *dc
-
-
-
-/* main VBE/AF driver structure */
-typedef struct AF_DRIVER
-{
- /* header */
- char Signature[12] __attribute__ ((packed));
- unsigned long Version __attribute__ ((packed));
- unsigned long DriverRev __attribute__ ((packed));
- char OemVendorName[80] __attribute__ ((packed));
- char OemCopyright[80] __attribute__ ((packed));
- short *AvailableModes __attribute__ ((packed));
- unsigned long TotalMemory __attribute__ ((packed));
- unsigned long Attributes __attribute__ ((packed));
- unsigned long BankSize __attribute__ ((packed));
- unsigned long BankedBasePtr __attribute__ ((packed));
- unsigned long LinearSize __attribute__ ((packed));
- unsigned long LinearBasePtr __attribute__ ((packed));
- unsigned long LinearGranularity __attribute__ ((packed));
- unsigned short *IOPortsTable __attribute__ ((packed));
- unsigned long IOMemoryBase[4] __attribute__ ((packed));
- unsigned long IOMemoryLen[4] __attribute__ ((packed));
- unsigned long LinearStridePad __attribute__ ((packed));
- unsigned short PCIVendorID __attribute__ ((packed));
- unsigned short PCIDeviceID __attribute__ ((packed));
- unsigned short PCISubSysVendorID __attribute__ ((packed));
- unsigned short PCISubSysID __attribute__ ((packed));
- unsigned long Checksum __attribute__ ((packed));
- unsigned long res2[6] __attribute__ ((packed));
-
- /* near pointers mapped by the application */
- void *IOMemMaps[4] __attribute__ ((packed));
- void *BankedMem __attribute__ ((packed));
- void *LinearMem __attribute__ ((packed));
- unsigned long res3[5] __attribute__ ((packed));
-
- /* driver state variables */
- unsigned long BufferEndX __attribute__ ((packed));
- unsigned long BufferEndY __attribute__ ((packed));
- unsigned long OriginOffset __attribute__ ((packed));
- unsigned long OffscreenOffset __attribute__ ((packed));
- unsigned long OffscreenStartY __attribute__ ((packed));
- unsigned long OffscreenEndY __attribute__ ((packed));
- unsigned long res4[10] __attribute__ ((packed));
-
- /* relocatable 32 bit bank switch routine, for Windows (ugh!) */
- unsigned long SetBank32Len __attribute__ ((packed));
- void *SetBank32 __attribute__ ((packed));
-
- /* callback functions provided by the application */
- void *Int86 __attribute__ ((packed));
- void *CallRealMode __attribute__ ((packed));
-
- /* main driver setup routine */
- void *InitDriver __attribute__ ((packed));
-
- /* VBE/AF 1.0 asm interface (obsolete and not supported by Allegro) */
- void *af10Funcs[40] __attribute__ ((packed));
-
- /* VBE/AF 2.0 extensions */
- void *PlugAndPlayInit __attribute__ ((packed));
-
- /* extension query function, specific to FreeBE/AF */
- void *(*OemExt)(DC, unsigned long id);
-
- /* extension hook for implementing additional VESA interfaces */
- void *SupplementalExt __attribute__ ((packed));
-
- /* device driver functions */
- long (*GetVideoModeInfo)(DC, short mode, AF_MODE_INFO *modeInfo);
- long (*SetVideoMode)(DC, short mode, long virtualX, long virtualY, long *bytesPerLine, int numBuffers, AF_CRTCInfo *crtc);
- void (*RestoreTextMode)(DC);
- long (*GetClosestPixelClock)(DC, short mode, unsigned long pixelClock);
- void (*SaveRestoreState)(DC, int subfunc, void *saveBuf);
- void (*SetDisplayStart)(DC, long x, long y, long waitVRT);
- void (*SetActiveBuffer)(DC, long index);
- void (*SetVisibleBuffer)(DC, long index, long waitVRT);
- int (*GetDisplayStartStatus)(DC);
- void (*EnableStereoMode)(DC, int enable);
- void (*SetPaletteData)(DC, AF_PALETTE *pal, long num, long index, long waitVRT);
- void (*SetGammaCorrectData)(DC, AF_PALETTE *pal, long num, long index);
- void (*SetBank)(DC, long bank);
-
- /* hardware cursor functions */
- void (*SetCursor)(DC, AF_CURSOR *cursor);
- void (*SetCursorPos)(DC, long x, long y);
- void (*SetCursorColor)(DC, unsigned char red, unsigned char green, unsigned char blue);
- void (*ShowCursor)(DC, long visible);
-
- /* 2D rendering functions */
- void (*WaitTillIdle)(DC);
- void (*EnableDirectAccess)(DC);
- void (*DisableDirectAccess)(DC);
- void (*SetMix)(DC, long foreMix, long backMix);
- void (*Set8x8MonoPattern)(DC, unsigned char *pattern);
- void (*Set8x8ColorPattern)(DC, int index, unsigned long *pattern);
- void (*Use8x8ColorPattern)(DC, int index);
- void (*SetLineStipple)(DC, unsigned short stipple);
- void (*SetLineStippleCount)(DC, unsigned long count);
- void (*SetClipRect)(DC, long minx, long miny, long maxx, long maxy);
- void (*DrawScan)(DC, long color, long y, long x1, long x2);
- void (*DrawPattScan)(DC, long foreColor, long backColor, long y, long x1, long x2);
- void (*DrawColorPattScan)(DC, long y, long x1, long x2);
- void (*DrawScanList)(DC, unsigned long color, long y, long length, short *scans);
- void (*DrawPattScanList)(DC, unsigned long foreColor, unsigned long backColor, long y, long length, short *scans);
- void (*DrawColorPattScanList)(DC, long y, long length, short *scans);
- void (*DrawRect)(DC, unsigned long color, long left, long top, long width, long height);
- void (*DrawPattRect)(DC, unsigned long foreColor, unsigned long backColor, long left, long top, long width, long height);
- void (*DrawColorPattRect)(DC, long left, long top, long width, long height);
- void (*DrawLine)(DC, unsigned long color, fixed x1, fixed y1, fixed x2, fixed y2);
- void (*DrawStippleLine)(DC, unsigned long foreColor, unsigned long backColor, fixed x1, fixed y1, fixed x2, fixed y2);
- void (*DrawTrap)(DC, unsigned long color, AF_TRAP *trap);
- void (*DrawTri)(DC, unsigned long color, AF_FIX_POINT *v1, AF_FIX_POINT *v2, AF_FIX_POINT *v3, fixed xOffset, fixed yOffset);
- void (*DrawQuad)(DC, unsigned long color, AF_FIX_POINT *v1, AF_FIX_POINT *v2, AF_FIX_POINT *v3, AF_FIX_POINT *v4, fixed xOffset, fixed yOffset);
- void (*PutMonoImage)(DC, long foreColor, long backColor, long dstX, long dstY, long byteWidth, long srcX, long srcY, long width, long height, unsigned char *image);
- void (*PutMonoImageLin)(DC, long foreColor, long backColor, long dstX, long dstY, long byteWidth, long srcX, long srcY, long width, long height, long imageOfs);
- void (*PutMonoImageBM)(DC, long foreColor, long backColor, long dstX, long dstY, long byteWidth, long srcX, long srcY, long width, long height, long imagePhysAddr);
- void (*BitBlt)(DC, long left, long top, long width, long height, long dstLeft, long dstTop, long op);
- void (*BitBltSys)(DC, void *srcAddr, long srcPitch, long srcLeft, long srcTop, long width, long height, long dstLeft, long dstTop, long op);
- void (*BitBltLin)(DC, long srcOfs, long srcPitch, long srcLeft, long srcTop, long width, long height, long dstLeft, long dstTop, long op);
- void (*BitBltBM)(DC, long srcPhysAddr, long srcPitch, long srcLeft, long srcTop, long width, long height, long dstLeft, long dstTop, long op);
- void (*SrcTransBlt)(DC, long left, long top, long width, long height, long dstLeft, long dstTop, long op, unsigned long transparent);
- void (*SrcTransBltSys)(DC, void *srcAddr, long srcPitch, long srcLeft, long srcTop, long width, long height, long dstLeft, long dstTop, long op, unsigned long transparent);
- void (*SrcTransBltLin)(DC, long srcOfs, long srcPitch, long srcLeft, long srcTop, long width, long height, long dstLeft, long dstTop, long op, unsigned long transparent);
- void (*SrcTransBltBM)(DC, long srcPhysAddr, long srcPitch, long srcLeft, long srcTop, long width, long height, long dstLeft, long dstTop, long op, unsigned long transparent);
- void (*DstTransBlt)(DC, long left, long top, long width, long height, long dstLeft, long dstTop, long op, unsigned long transparent);
- void (*DstTransBltSys)(DC, void *srcAddr, long srcPitch, long srcLeft, long srcTop, long width, long height, long dstLeft, long dstTop, long op, unsigned long transparent);
- void (*DstTransBltLin)(DC, long srcOfs, long srcPitch, long srcLeft, long srcTop, long width, long height, long dstLeft, long dstTop, long op, unsigned long transparent);
- void (*DstTransBltBM)(DC, long srcPhysAddr, long srcPitch, long srcLeft, long srcTop, long width, long height, long dstLeft, long dstTop, long op, unsigned long transparent);
- void (*StretchBlt)(DC, long srcLeft, long srcTop, long srcWidth, long srcHeight, long dstLeft, long dstTop, long dstWidth, long dstHeight, long flags, long op);
- void (*StretchBltSys)(DC, void *srcAddr, long srcPitch, long srcLeft, long srcTop, long srcWidth, long srcHeight, long dstLeft, long dstTop, long dstWidth, long dstHeight, long flags, long op);
- void (*StretchBltLin)(DC, long srcOfs, long srcPitch, long srcLeft, long srcTop, long srcWidth, long srcHeight, long dstLeft, long dstTop, long dstWidth, long dstHeight, long flags, long op);
- void (*StretchBltBM)(DC, long srcPhysAddr, long srcPitch, long srcLeft, long srcTop, long srcWidth, long srcHeight, long dstLeft, long dstTop, long dstWidth, long dstHeight, long flags, long op);
- void (*SrcTransStretchBlt)(DC, long srcLeft, long srcTop, long srcWidth, long srcHeight, long dstLeft, long dstTop, long dstWidth, long dstHeight, long flags, long op, unsigned long transparent);
- void (*SrcTransStretchBltSys)(DC, void *srcAddr, long srcPitch, long srcLeft, long srcTop, long srcWidth, long srcHeight, long dstLeft, long dstTop, long dstWidth, long dstHeight, long flags, long op, unsigned long transparent);
- void (*SrcTransStretchBltLin)(DC, long srcOfs, long srcPitch, long srcLeft, long srcTop, long srcWidth, long srcHeight, long dstLeft, long dstTop, long dstWidth, long dstHeight, long flags, long op, unsigned long transparent);
- void (*SrcTransStretchBltBM)(DC, long srcPhysAddr, long srcPitch, long srcLeft, long srcTop, long srcWidth, long srcHeight, long dstLeft, long dstTop, long dstWidth, long dstHeight, long flags, long op, unsigned long transparent);
- void (*DstTransStretchBlt)(DC, long srcLeft, long srcTop, long srcWidth, long srcHeight, long dstLeft, long dstTop, long dstWidth, long dstHeight, long flags, long op, unsigned long transparent);
- void (*DstTransStretchBltSys)(DC, void *srcAddr, long srcPitch, long srcLeft, long srcTop, long srcWidth, long srcHeight, long dstLeft, long dstTop, long dstWidth, long dstHeight, long flags, long op, unsigned long transparent);
- void (*DstTransStretchBltLin)(DC, long srcOfs, long srcPitch, long srcLeft, long srcTop, long srcWidth, long srcHeight, long dstLeft, long dstTop, long dstWidth, long dstHeight, long flags, long op, unsigned long transparent);
- void (*DstTransStretchBltBM)(DC, long srcPhysAddr, long srcPitch, long srcLeft, long srcTop, long srcWidth, long srcHeight, long dstLeft, long dstTop, long dstWidth, long dstHeight, long flags, long op, unsigned long transparent);
-
- /* hardware video functions */
- void (*SetVideoInput)(DC, long width, long height, long format);
- void *(*SetVideoOutput)(DC, long left, long top, long width, long height);
- void (*StartVideoFrame)(DC);
- void (*EndVideoFrame)(DC);
-
-} AF_DRIVER;
-
-
-
-#undef DC
-
-
-
-/* register data for calling real mode interrupts (DPMI format) */
-typedef union
-{
- struct {
- unsigned long edi;
- unsigned long esi;
- unsigned long ebp;
- unsigned long res;
- unsigned long ebx;
- unsigned long edx;
- unsigned long ecx;
- unsigned long eax;
- } d;
- struct {
- unsigned short di, di_hi;
- unsigned short si, si_hi;
- unsigned short bp, bp_hi;
- unsigned short res, res_hi;
- unsigned short bx, bx_hi;
- unsigned short dx, dx_hi;
- unsigned short cx, cx_hi;
- unsigned short ax, ax_hi;
- unsigned short flags;
- unsigned short es;
- unsigned short ds;
- unsigned short fs;
- unsigned short gs;
- unsigned short ip;
- unsigned short cs;
- unsigned short sp;
- unsigned short ss;
- } x;
- struct {
- unsigned char edi[4];
- unsigned char esi[4];
- unsigned char ebp[4];
- unsigned char res[4];
- unsigned char bl, bh, ebx_b2, ebx_b3;
- unsigned char dl, dh, edx_b2, edx_b3;
- unsigned char cl, ch, ecx_b2, ecx_b3;
- unsigned char al, ah, eax_b2, eax_b3;
- } h;
-} RM_REGS;
-
-
-
-/* our API extensions use 32 bit magic numbers */
-#define FAF_ID(a,b,c,d) ((a<<24) | (b<<16) | (c<<8) | d)
-
-
-
-/* ID code and magic return value for initialising the extensions */
-#define FAFEXT_INIT FAF_ID('I','N','I','T')
-#define FAFEXT_MAGIC FAF_ID('E','X', 0, 0)
-#define FAFEXT_MAGIC1 FAF_ID('E','X','0','1')
-
-
-
-/* extension providing a hardware-specific way to access video memory */
-#define FAFEXT_HWPTR FAF_ID('H','P','T','R')
-
-
-#if (defined __i386__) && (!defined NO_HWPTR)
-
-
-/* use seg+offset far pointers on i386 */
-typedef struct FAF_HWPTR
-{
- int sel;
- unsigned long offset;
-} FAF_HWPTR;
-
-#include <sys/farptr.h>
-#include <sys/segments.h>
-
-#define hwptr_init(ptr, addr) \
- if ((addr) && (!(ptr).sel)) { \
- (ptr).sel = _my_ds(); \
- (ptr).offset = (unsigned long)(addr); \
- }
-
-#define hwptr_pokeb(ptr, off, val) _farpokeb((ptr).sel, (ptr).offset+(off), (val))
-#define hwptr_pokew(ptr, off, val) _farpokew((ptr).sel, (ptr).offset+(off), (val))
-#define hwptr_pokel(ptr, off, val) _farpokel((ptr).sel, (ptr).offset+(off), (val))
-
-#define hwptr_peekb(ptr, off) _farpeekb((ptr).sel, (ptr).offset+(off))
-#define hwptr_peekw(ptr, off) _farpeekw((ptr).sel, (ptr).offset+(off))
-#define hwptr_peekl(ptr, off) _farpeekl((ptr).sel, (ptr).offset+(off))
-
-#define hwptr_select(ptr) _farsetsel((ptr).sel)
-#define hwptr_unselect(ptr) (ptr).sel = _fargetsel()
-
-#define hwptr_nspokeb(ptr, off, val) _farnspokeb((ptr).offset+(off), (val))
-#define hwptr_nspokew(ptr, off, val) _farnspokew((ptr).offset+(off), (val))
-#define hwptr_nspokel(ptr, off, val) _farnspokel((ptr).offset+(off), (val))
-
-#define hwptr_nspeekb(ptr, off) _farnspeekb((ptr).offset+(off))
-#define hwptr_nspeekw(ptr, off) _farnspeekw((ptr).offset+(off))
-#define hwptr_nspeekl(ptr, off) _farnspeekl((ptr).offset+(off))
-
-
-#else
-
-
-/* use regular C pointers on other platforms or if hwptr is disabled */
-typedef void *FAF_HWPTR;
-
-#define hwptr_init(ptr, addr) ptr = (FAF_HWPTR)(addr)
-
-#define hwptr_pokeb(ptr, off, val) *((volatile unsigned char *)((ptr)+(off))) = (val)
-#define hwptr_pokew(ptr, off, val) *((volatile unsigned short *)((ptr)+(off))) = (val)
-#define hwptr_pokel(ptr, off, val) *((volatile unsigned long *)((ptr)+(off))) = (val)
-
-#define hwptr_peekb(ptr, off) (*((volatile unsigned char *)((ptr)+(off))))
-#define hwptr_peekw(ptr, off) (*((volatile unsigned short *)((ptr)+(off))))
-#define hwptr_peekl(ptr, off) (*((volatile unsigned long *)((ptr)+(off))))
-
-#define hwptr_select(ptr)
-#define hwptr_unselect(ptr) (ptr) = NULL
-
-#define hwptr_nspokeb(ptr, off, val) *((volatile unsigned char *)((ptr)+(off))) = (val)
-#define hwptr_nspokew(ptr, off, val) *((volatile unsigned short *)((ptr)+(off))) = (val)
-#define hwptr_nspokel(ptr, off, val) *((volatile unsigned long *)((ptr)+(off))) = (val)
-
-#define hwptr_nspeekb(ptr, off) (*((volatile unsigned char *)((ptr)+(off))))
-#define hwptr_nspeekw(ptr, off) (*((volatile unsigned short *)((ptr)+(off))))
-#define hwptr_nspeekl(ptr, off) (*((volatile unsigned long *)((ptr)+(off))))
-
-
-#endif /* hwptr structure definitions */
-
-
-/* interface structure containing hardware pointer data */
-typedef struct FAF_HWPTR_DATA
-{
- FAF_HWPTR IOMemMaps[4];
- FAF_HWPTR BankedMem;
- FAF_HWPTR LinearMem;
-} FAF_HWPTR_DATA;
-
-
-
-/* extension providing a way for the config program to set driver variables */
-#define FAFEXT_CONFIG FAF_ID('C','O','N','F')
-
-
-
-/* config variable, so the install program can communicate with the driver */
-typedef struct FAF_CONFIG_DATA
-{
- unsigned long id;
- unsigned long value;
-} FAF_CONFIG_DATA;
-
-
-
-/* config variable ID used to enable/disable specific hardware functions */
-#define FAF_CFG_FEATURES FAF_ID('F','E','A','T')
-
-
-
-/* bitfield values for the FAF_CFG_FEATURES variable */
-#define fafLinear 0x00000001
-#define fafBanked 0x00000002
-#define fafHWCursor 0x00000004
-#define fafDrawScan 0x00000008
-#define fafDrawPattScan 0x00000010
-#define fafDrawColorPattScan 0x00000020
-#define fafDrawScanList 0x00000040
-#define fafDrawPattScanList 0x00000080
-#define fafDrawColorPattScanList 0x00000100
-#define fafDrawRect 0x00000200
-#define fafDrawPattRect 0x00000400
-#define fafDrawColorPattRect 0x00000800
-#define fafDrawLine 0x00001000
-#define fafDrawStippleLine 0x00002000
-#define fafDrawTrap 0x00004000
-#define fafDrawTri 0x00008000
-#define fafDrawQuad 0x00010000
-#define fafPutMonoImage 0x00020000
-#define fafPutMonoImageLin 0x00040000
-#define fafPutMonoImageBM 0x00080000
-#define fafBitBlt 0x00100000
-#define fafBitBltSys 0x00200000
-#define fafBitBltLin 0x00400000
-#define fafBitBltBM 0x00800000
-#define fafSrcTransBlt 0x01000000
-#define fafSrcTransBltSys 0x02000000
-#define fafSrcTransBltLin 0x04000000
-#define fafSrcTransBltBM 0x08000000
-
-
-
-/* helper function for enabling/disabling driver routines */
-void fixup_feature_list(AF_DRIVER *af, unsigned long flags);
-
-
-
-/* extension providing libc exports (needed for Nucleus compatibility) */
-#define FAFEXT_LIBC FAF_ID('L','I','B','C')
-
-
-typedef struct FAF_LIBC_DATA
-{
- long size;
- void (*abort)();
- void *(*calloc)(unsigned long num_elements, unsigned long size);
- void (*exit)(int status);
- void (*free)(void *ptr);
- char *(*getenv)(const char *name);
- void *(*malloc)(unsigned long size);
- void *(*realloc)(void *ptr, unsigned long size);
- int (*system)(const char *s);
- int (*putenv)(const char *val);
- int (*open)(const char *file, int mode, int permissions);
- int (*access)(const char *filename, int flags);
- int (*close)(int fd);
- int (*lseek)(int fd, int offset, int whence);
- int (*read)(int fd, void *buffer, unsigned long count);
- int (*unlink)(const char *file);
- int (*write)(int fd, const void *buffer, unsigned long count);
- int (*isatty)(int fd);
- int (*remove)(const char *file);
- int (*rename)(const char *oldname, const char *newname);
- unsigned int (*time)(unsigned int *t);
- void (*setfileattr)(const char *filename, unsigned attrib);
- unsigned long (*getcurrentdate)();
-} FAF_LIBC_DATA;
-
-
-
-/* extension providing pmode exports (needed for Nucleus compatibility) */
-#define FAFEXT_PMODE FAF_ID('P','M','O','D')
-
-
-
-/* It has to be said, having this many exported functions is truly insane.
- * How on earth can SciTech need this much crap just to write a simple
- * video driver? Unfortunately we have to include it all in order to
- * support their Nucleus drivers...
- */
-
-typedef union
-{
- struct {
- unsigned long eax, ebx, ecx, edx, esi, edi, cflag;
- } e;
- struct {
- unsigned short ax, ax_hi;
- unsigned short bx, bx_hi;
- unsigned short cx, cx_hi;
- unsigned short dx, dx_hi;
- unsigned short si, si_hi;
- unsigned short di, di_hi;
- unsigned short cflag, cflag_hi;
- } x;
- struct {
- unsigned char al, ah; unsigned short ax_hi;
- unsigned char bl, bh; unsigned short bx_hi;
- unsigned char cl, ch; unsigned short cx_hi;
- unsigned char dl, dh; unsigned short dx_hi;
- } h;
-} SILLY_SCITECH_REGS;
-
-
-
-typedef struct
-{
- unsigned short es, cs, ss, ds, fs, gs;
-} SILLY_SCITECH_SREGS;
-
-
-
-typedef struct FAF_PMODE_DATA
-{
- long size;
- int (*getModeType)();
- void *(*getBIOSPointer)();
- void *(*getA0000Pointer)();
- void *(*mapPhysicalAddr)(unsigned long base, unsigned long limit);
- void *(*mallocShared)(long size);
- int (*mapShared)(void *ptr);
- void (*freeShared)(void *ptr);
- void *(*mapToProcess)(void *linear, unsigned long limit);
- void (*loadDS)();
- void (*saveDS)();
- void *(*mapRealPointer)(unsigned int r_seg, unsigned int r_off);
- void *(*allocRealSeg)(unsigned int size, unsigned int *r_seg, unsigned int *r_off);
- void (*freeRealSeg)(void *mem);
- void *(*allocLockedMem)(unsigned int size, unsigned long *physAddr);
- void (*freeLockedMem)(void *p);
- void (*callRealMode)(unsigned int seg, unsigned int off, SILLY_SCITECH_REGS *regs, SILLY_SCITECH_SREGS *sregs);
- int (*int86)(int intno, SILLY_SCITECH_REGS *in, SILLY_SCITECH_REGS *out);
- int (*int86x)(int intno, SILLY_SCITECH_REGS *in, SILLY_SCITECH_REGS *out, SILLY_SCITECH_SREGS *sregs);
- void (*DPMI_int86)(int intno, RM_REGS *regs);
- void (*segread)(SILLY_SCITECH_SREGS *sregs);
- int (*int386)(int intno, SILLY_SCITECH_REGS *in, SILLY_SCITECH_REGS *out);
- int (*int386x)(int intno, SILLY_SCITECH_REGS *in, SILLY_SCITECH_REGS *out, SILLY_SCITECH_SREGS *sregs);
- void (*availableMemory)(unsigned long *physical, unsigned long *total);
- void *(*getVESABuf)(unsigned int *len, unsigned int *rseg, unsigned int *roff);
- long (*getOSType)();
- void (*fatalError)(const char *msg);
- void (*setBankA)(int bank);
- void (*setBankAB)(int bank);
- const char *(*getCurrentPath)();
- const char *(*getVBEAFPath)();
- const char *(*getNucleusPath)();
- const char *(*getNucleusConfigPath)();
- const char *(*getUniqueID)();
- const char *(*getMachineName)();
- int (*VF_available)();
- void *(*VF_init)(unsigned long baseAddr, int bankSize, int codeLen, void *bankFunc);
- void (*VF_exit)();
- int (*kbhit)();
- int (*getch)();
- int (*openConsole)();
- int (*getConsoleStateSize)();
- void (*saveConsoleState)(void *stateBuf, int console_id);
- void (*restoreConsoleState)(const void *stateBuf, int console_id);
- void (*closeConsole)(int console_id);
- void (*setOSCursorLocation)(int x, int y);
- void (*setOSScreenWidth)(int width, int height);
- int (*enableWriteCombine)(unsigned long base, unsigned long length);
- void (*backslash)(char *filename);
-} FAF_PMODE_DATA;
-
-
-
-/* assorted helper functions */
-void trace_putc(char c);
-void trace_printf(char *msg, ...);
-
-void rm_int(int num, RM_REGS *regs);
-
-int allocate_dos_memory(int size, int *sel);
-void free_dos_memory(int sel);
-
-int allocate_selector(int addr, int size);
-void free_selector(int sel);
-
-int get_vesa_info(int *vram_size, unsigned long *linear_addr, void (*callback)(int vesa_num, int linear, int w, int h, int bpp, int bytes_per_scanline, int redsize, int redpos, int greensize, int greenpos, int bluesize, int bluepos, int rsvdsize, int rsvdpos));
-
-
-
-/* read_vga_register:
- * Reads the contents of a VGA hardware register.
- */
-extern inline int read_vga_register(int port, int index)
-{
- if (port==0x3C0)
- inportb(0x3DA);
-
- outportb(port, index);
- return inportb(port+1);
-}
-
-
-
-/* write_vga_register:
- * Writes a byte to a VGA hardware register.
- */
-extern inline void write_vga_register(int port, int index, int v)
-{
- if (port==0x3C0) {
- inportb(0x3DA);
- outportb(port, index);
- outportb(port, v);
- }
- else {
- outportb(port, index);
- outportb(port+1, v);
- }
-}
-
-
-
-/* alter_vga_register:
- * Alters specific bits of a VGA hardware register.
- */
-extern inline void alter_vga_register(int port, int index, int mask, int v)
-{
- int temp;
- temp = read_vga_register(port, index);
- temp &= (~mask);
- temp |= (v & mask);
- write_vga_register(port, index, temp);
-}
-
-
-
-/* test_vga_register:
- * Tests whether specific bits of a VGA hardware register can be changed.
- */
-extern inline int test_vga_register(int port, int index, int mask)
-{
- int old, nw1, nw2;
-
- old = read_vga_register(port, index);
- write_vga_register(port, index, old & (~mask));
- nw1 = read_vga_register(port, index) & mask;
- write_vga_register(port, index, old | mask);
- nw2 = read_vga_register(port, index) & mask;
- write_vga_register(port, index, old);
-
- return ((nw1==0) && (nw2==mask));
-}
-
-
-
-/* test_register:
- * Tests whether specific bits of a hardware register can be changed.
- */
-extern inline int test_register(int port, int mask)
-{
- int old, nw1, nw2;
-
- old = inportb(port);
- outportb(port, old & (~mask));
- nw1 = inportb(port) & mask;
- outportb(port, old | mask);
- nw2 = inportb(port) & mask;
- outportb(port, old);
-
- return ((nw1==0) && (nw2==mask));
-}
-
-
-
-/* PCI routines added by SET */
-#define PCIConfigurationAddress 0xCF8
-#define PCIConfigurationData 0xCFC
-#define PCIEnable 0x80000000
-
-extern int FindPCIDevice(int deviceID, int vendorID, int deviceIndex, int *handle);
-
-extern inline unsigned PCIReadLong(int handle, int index)
-{
- outportl(PCIConfigurationAddress, PCIEnable | handle | index);
- return inportl(PCIConfigurationData);
-}
diff --git a/src/mesa/drivers/dos/vbeafint.h b/src/mesa/drivers/dos/vbeafint.h deleted file mode 100644 index 5e636f08d3..0000000000 --- a/src/mesa/drivers/dos/vbeafint.h +++ /dev/null @@ -1,50 +0,0 @@ -/*
- * Mesa 3-D graphics library
- * Version: 4.0
- *
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * DOS/DJGPP device driver v0.2 for Mesa 4.0
- *
- * Copyright (C) 2002 - Borca Daniel
- * Email : dborca@yahoo.com
- * Web : http://www.geocities.com/dborca
- */
-
-
-#ifndef VBEAFINT_H_included
-#define VBEAFINT_H_included
-
-#include "vbeaf.h"
-
-int af_init (char *filename);
-void af_exit (void);
-
-AF_MODE_INFO *af_getmode (int i, int *granularity);
-int af_setup_mode (int mode, int caps);
-int af_enter_mode (int mode, int width, int height);
-int af_setup_buffer (int x, int y);
-int af_flip (void);
-
-void *af_getprim (int primitive);
-
-#endif
|