From b5c3199afe0d90787223cb57c35ff22e38b3c920 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 25 Feb 2010 15:55:00 -0500 Subject: [PATCH] Remove dos driver --- Makefile | 3 - include/GL/Makefile.am | 2 +- src/mesa/drivers/dos/blit.S | 1040 ------------------------------- src/mesa/drivers/dos/dmesa.c | 359 ----------- src/mesa/drivers/dos/dpmi.c | 166 ----- src/mesa/drivers/dos/internal.h | 105 ---- src/mesa/drivers/dos/null.c | 224 ------- src/mesa/drivers/dos/null.h | 41 -- src/mesa/drivers/dos/vesa.c | 719 --------------------- src/mesa/drivers/dos/vesa.h | 65 -- src/mesa/drivers/dos/vga.c | 289 --------- src/mesa/drivers/dos/vga.h | 42 -- src/mesa/drivers/dos/video.c | 442 ------------- src/mesa/drivers/dos/video.h | 56 -- 14 files changed, 1 insertion(+), 3552 deletions(-) delete mode 100644 src/mesa/drivers/dos/blit.S delete mode 100644 src/mesa/drivers/dos/dmesa.c delete mode 100644 src/mesa/drivers/dos/dpmi.c delete mode 100644 src/mesa/drivers/dos/internal.h delete mode 100644 src/mesa/drivers/dos/null.c delete mode 100644 src/mesa/drivers/dos/null.h delete mode 100644 src/mesa/drivers/dos/vesa.c delete mode 100644 src/mesa/drivers/dos/vesa.h delete mode 100644 src/mesa/drivers/dos/vga.c delete mode 100644 src/mesa/drivers/dos/vga.h delete mode 100644 src/mesa/drivers/dos/video.c delete mode 100644 src/mesa/drivers/dos/video.h diff --git a/Makefile b/Makefile index 0527fa0d824..659e11c5fb6 100644 --- a/Makefile +++ b/Makefile @@ -270,7 +270,6 @@ MAIN_FILES = \ $(DIRECTORY)/src/mesa/drivers/beos/Makefile \ $(DIRECTORY)/src/mesa/drivers/common/*.[ch] \ $(DIRECTORY)/src/mesa/drivers/common/descrip.mms \ - $(DIRECTORY)/src/mesa/drivers/dos/*.[chS] \ $(DIRECTORY)/src/mesa/drivers/fbdev/Makefile \ $(DIRECTORY)/src/mesa/drivers/fbdev/glfbdev.c \ $(DIRECTORY)/src/mesa/drivers/glide/*.[ch] \ @@ -472,8 +471,6 @@ GLUT_FILES = \ $(DIRECTORY)/src/glut/beos/*.[ch] \ $(DIRECTORY)/src/glut/beos/*.cpp \ $(DIRECTORY)/src/glut/beos/Makefile \ - $(DIRECTORY)/src/glut/dos/*.[ch] \ - $(DIRECTORY)/src/glut/dos/PC_HW/*.[chS] \ $(DIRECTORY)/src/glut/ggi/*.[ch] \ $(DIRECTORY)/src/glut/ggi/Makefile \ $(DIRECTORY)/src/glut/fbdev/Makefile \ diff --git a/include/GL/Makefile.am b/include/GL/Makefile.am index ca528f606df..a62495766cb 100644 --- a/include/GL/Makefile.am +++ b/include/GL/Makefile.am @@ -28,7 +28,7 @@ if NEED_GLUT sel_inc_glut = $(INC_GLUT) endif -EXTRA_HEADERS = amesa.h dosmesa.h foomesa.h glut_h.dja mesa_wgl.h mglmesa.h \ +EXTRA_HEADERS = amesa.h foomesa.h glut_h.dja mesa_wgl.h mglmesa.h \ vms_x_fix.h wmesa.h \ $(INC_GGI) $(INC_OSMESA) $(INC_SVGA) $(INC_X11) $(INC_GLUT) diff --git a/src/mesa/drivers/dos/blit.S b/src/mesa/drivers/dos/blit.S deleted file mode 100644 index 02dc8400d8d..00000000000 --- a/src/mesa/drivers/dos/blit.S +++ /dev/null @@ -1,1040 +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 for Mesa - * - * Author: Daniel Borca - * Email : dborca@yahoo.com - * Web : http://www.geocities.com/dborca - */ - - - .file "blit.S" - -/* - * extern unsigned int vesa_gran_mask, vesa_gran_shift; - * extern int vl_video_selector; - - * extern void *vl_current_draw_buffer; - * extern int vl_current_stride, vl_current_height; - * extern int vl_current_offset, vl_current_delta; - */ - - .text - -/* Desc: VESA bank switching routine (BIOS) - * - * In : EBX=0, EDX = bank number - * Out : - - * - * Note: thrashes EAX - */ - .p2align 5,,31 -_vesa_swbankBIOS: - movw $0x4f05, %ax - int $0x10 - ret - - .p2align 2,,3 - .global _vesa_swbank -_vesa_swbank: .long _vesa_swbankBIOS - -/* Desc: void vesa_b_dump_virtual (void); - * - * In : - - * Out : - - * - * Note: uses current draw buffer - */ - .p2align 5,,31 - .global _vesa_b_dump_virtual -_vesa_b_dump_virtual: - cld - pushl %es - pushl %ebx - pushl %esi - pushl %edi - pushl %ebp - movl _vl_video_selector, %es - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vesa_gran_shift, %ecx - movl _vesa_gran_mask, %ebp - movl %edi, %edx - xorl %ebx, %ebx - andl %ebp, %edi - shrl %cl, %edx - incl %ebp - call *_vesa_swbank - movl _vl_current_stride, %ecx - movl _vl_current_height, %eax - movl _vl_current_delta, %ebx - shrl $2, %ecx - .balign 4 - 0: - pushl %ecx - .balign 4 - 1: - cmpl %ebp, %edi - jb 2f - pushl %eax - pushl %ebx - incl %edx - xorl %ebx, %ebx - call *_vesa_swbank - popl %ebx - popl %eax - subl %ebp, %edi - .balign 4 - 2: - movsl - decl %ecx - jnz 1b - popl %ecx - addl %ebx, %edi - decl %eax - jnz 0b - popl %ebp - popl %edi - popl %esi - popl %ebx - popl %es - ret - -/* Desc: void vesa_l_dump_virtual (void); - * - * In : - - * Out : - - * - * Note: uses current draw buffer - */ - .p2align 5,,31 - .global _vesa_l_dump_virtual -_vesa_l_dump_virtual: - cld - pushl %es - pushl %esi - pushl %edi - movl _vl_video_selector, %es - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vl_current_stride, %ecx - movl _vl_current_height, %edx - movl _vl_current_delta, %eax - shrl $2, %ecx - .balign 4 - 0: - pushl %ecx - rep; movsl - popl %ecx - addl %eax, %edi - decl %edx - jnz 0b - popl %edi - popl %esi - popl %es - ret - -/* Desc: void vesa_l_dump_virtual_mmx (void); - * - * In : - - * Out : - - * - * Note: uses current draw buffer - */ - .p2align 5,,31 - .global _vesa_l_dump_virtual_mmx -_vesa_l_dump_virtual_mmx: -#ifdef USE_MMX_ASM - pushl %esi - pushl %edi - movl _vl_video_selector, %fs - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vl_current_stride, %ecx - movl _vl_current_height, %edx - movl _vl_current_delta, %eax - shrl $3, %ecx - .balign 4 - 0: - pushl %ecx - .balign 4 - 1: - movq (%esi), %mm0 - addl $8, %esi - movq %mm0, %fs:(%edi) - addl $8, %edi - decl %ecx - jnz 1b - popl %ecx - addl %eax, %edi - decl %edx - jnz 0b - popl %edi - popl %esi - emms -#endif - ret - - - -#define CVT_32_TO_16(s, tmp) \ - /* SRC = bbbbbbbbggggggggrrrrrrrr******** */\ - movl %e##s##x, %tmp ;\ - /* TMP = bbbbbbbbggggggggrrrrrrrr******** */\ - shrb $2, %s##h ;\ - /* SRC = bbbbbbbbgggggg00rrrrrrrr******** */\ - andl $0xF80000, %tmp ;\ - /* TMP = 0000000000000000000rrrrr00000000 */\ - shrw $3, %s##x ;\ - /* SRC = bbbbbgggggg00000rrrrrrrr******** */\ - shrl $8, %tmp ;\ - /* TMP = 00000000000rrrrr0000000000000000 */\ - orl %tmp, %e##s##x ;\ - /* SRC = bbbbbggggggrrrrrrrrrrrrr******** */ - -#define CVT_32_TO_15(s, tmp) \ - /* SRC = bbbbbbbbggggggggrrrrrrrr******** */\ - movl %e##s##x, %tmp ;\ - /* TMP = bbbbbbbbggggggggrrrrrrrr******** */\ - shrb $3, %s##h ;\ - /* SRC = bbbbbbbbgggggg00rrrrrrrr******** */\ - andl $0xF80000, %tmp ;\ - /* TMP = 0000000000000000000rrrrr00000000 */\ - shrw $3, %s##x ;\ - /* SRC = bbbbbgggggg00000rrrrrrrr******** */\ - shrl $9, %tmp ;\ - /* TMP = 00000000000rrrrr0000000000000000 */\ - orl %tmp, %e##s##x ;\ - /* SRC = bbbbbggggggrrrrrrrrrrrrr******** */ - -#define CVT_16_TO_15(src, tmp) \ - /* SRC = bbbbbggggggrrrrrBBBBBGGGGGGRRRRR */\ - movl %src, %tmp ;\ - /* TMP = bbbbbggggggrrrrrBBBBBGGGGGGRRRRR */\ - andl $0x1F001F, %src ;\ - /* SRC = bbbbb00000000000BBBBB00000000000 */\ - andl $0xFFC0FFC0, %tmp ;\ - /* TMP = 000000gggggrrrrr000000GGGGGRRRRR */\ - shrl %tmp ;\ - /* TMP = 00000gggggrrrrr000000GGGGGRRRRR0 */\ - orl %tmp, %src ;\ - /* SRC = bbbbbgggggrrrrr0BBBBBGGGGGRRRRR0 */\ - - - -/* transform BGRA to BGR */ - .p2align 5,,31 - .global _vesa_l_dump_32_to_24 -_vesa_l_dump_32_to_24: - pushl %ebx - pushl %esi - pushl %edi - movl _vl_video_selector, %fs - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vl_current_stride, %ecx - movl _vl_current_height, %edx - movl _vl_current_delta, %ebx - .balign 4 - 0: - pushl %ecx - 1: - movl (%esi), %eax - addl $4, %esi - movw %ax, %fs:(%edi) - shrl $16, %eax - movb %al, %fs:2(%edi) - addl $3, %edi - subl $3, %ecx - jnz 1b - popl %ecx - addl %ebx, %edi - decl %edx - jnz 0b - popl %edi - popl %esi - popl %ebx - ret - -/* transform BGRA to B5G6R5 */ - .p2align 5,,31 - .global _vesa_l_dump_32_to_16 -_vesa_l_dump_32_to_16: - pushl %ebp - pushl %ebx - pushl %esi - pushl %edi - movl _vl_video_selector, %fs - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vl_current_stride, %ecx - movl _vl_current_height, %edx - movl _vl_current_delta, %ebx - .balign 4 - 0: - pushl %ecx - 1: - movl (%esi), %eax - addl $4, %esi - CVT_32_TO_16(a, ebp) - movw %ax, %fs:(%edi) - addl $2, %edi - subl $2, %ecx - jnz 1b - popl %ecx - addl %ebx, %edi - decl %edx - jnz 0b - popl %edi - popl %esi - popl %ebx - popl %ebp - ret - -/* transform BGRA to B5G5R5 */ - .p2align 5,,31 - .global _vesa_l_dump_32_to_15 -_vesa_l_dump_32_to_15: - pushl %ebp - pushl %ebx - pushl %esi - pushl %edi - movl _vl_video_selector, %fs - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vl_current_stride, %ecx - movl _vl_current_height, %edx - movl _vl_current_delta, %ebx - .balign 4 - 0: - pushl %ecx - 1: - movl (%esi), %eax - addl $4, %esi - CVT_32_TO_15(a, ebp) - movw %ax, %fs:(%edi) - addl $2, %edi - subl $2, %ecx - jnz 1b - popl %ecx - addl %ebx, %edi - decl %edx - jnz 0b - popl %edi - popl %esi - popl %ebx - popl %ebp - ret - -/* transform BGRA to fake8 */ - .p2align 5,,31 - .global _vesa_l_dump_32_to_8 -_vesa_l_dump_32_to_8: - pushl %ebp - pushl %ebx - pushl %esi - pushl %edi - movl _vl_video_selector, %fs - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vl_current_stride, %ecx - movl _vl_current_height, %edx - movl _vl_current_delta, %ebx - .balign 4 - 0: - pushl %edx - pushl %ecx - pushl %ebx - 1: - movl (%esi), %eax - addl $4, %esi -#if 1 - xorl %ebx, %ebx - movl %eax, %edx - movb %ah, %bl - shrl $16, %edx - andl $0xFF, %edx - andl $0xFF, %eax - - movb _array_b(%eax), %al - movb _array_r(%edx), %dl - movb _array_g(%ebx), %bl - - imull $36, %eax - imull $6, %ebx - addl %edx, %eax - addl %ebx, %eax -#endif - movb %al, %fs:(%edi) - incl %edi - decl %ecx - jnz 1b - popl %ebx - popl %ecx - popl %edx - addl %ebx, %edi - decl %edx - jnz 0b - popl %edi - popl %esi - popl %ebx - popl %ebp - ret - -/* transform BGR to BGRx */ - .p2align 5,,31 - .global _vesa_l_dump_24_to_32 -_vesa_l_dump_24_to_32: - pushl %ebx - pushl %esi - pushl %edi - movl _vl_video_selector, %fs - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vl_current_stride, %ecx - movl _vl_current_height, %edx - movl _vl_current_delta, %ebx - .balign 4 - 0: - pushl %ecx - 1: - movl (%esi), %eax - addl $3, %esi - movl %eax, %fs:(%edi) - addl $4, %edi - subl $4, %ecx - jnz 1b - popl %ecx - addl %ebx, %edi - decl %edx - jnz 0b - popl %edi - popl %esi - popl %ebx - ret - -/* transform BGR to fake8 */ - .p2align 5,,31 - .global _vesa_l_dump_24_to_8 -_vesa_l_dump_24_to_8: - pushl %ebp - pushl %ebx - pushl %esi - pushl %edi - movl _vl_video_selector, %fs - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vl_current_stride, %ecx - movl _vl_current_height, %edx - movl _vl_current_delta, %ebx - .balign 4 - 0: - pushl %edx - pushl %ecx - pushl %ebx - 1: - movl (%esi), %eax - addl $3, %esi -#if 1 - xorl %ebx, %ebx - movl %eax, %edx - movb %ah, %bl - shrl $16, %edx - andl $0xFF, %edx - andl $0xFF, %eax - - movb _array_b(%eax), %al - movb _array_r(%edx), %dl - movb _array_g(%ebx), %bl - - imull $36, %eax - imull $6, %ebx - addl %edx, %eax - addl %ebx, %eax -#endif - movb %al, %fs:(%edi) - incl %edi - decl %ecx - jnz 1b - popl %ebx - popl %ecx - popl %edx - addl %ebx, %edi - decl %edx - jnz 0b - popl %edi - popl %esi - popl %ebx - popl %ebp - ret - -/* transform B5G6R5 to B5G5R5 */ - .p2align 5,,31 - .global _vesa_l_dump_16_to_15 -_vesa_l_dump_16_to_15: - pushl %ebp - pushl %ebx - pushl %esi - pushl %edi - movl _vl_video_selector, %fs - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vl_current_stride, %ecx - movl _vl_current_height, %edx - movl _vl_current_delta, %ebx - .balign 4 - 0: - pushl %ecx - 1: - movl (%esi), %eax - addl $4, %esi - CVT_16_TO_15(eax, ebp) - movl %eax, %fs:(%edi) - addl $4, %edi - subl $4, %ecx - jnz 1b - popl %ecx - addl %ebx, %edi - decl %edx - jnz 0b - popl %edi - popl %esi - popl %ebx - popl %ebp - ret - -/* transform B5G6R5 to fake8 */ - .p2align 5,,31 - .global _vesa_l_dump_16_to_8 -_vesa_l_dump_16_to_8: - pushl %ebp - pushl %ebx - pushl %esi - pushl %edi - movl _vl_video_selector, %fs - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vl_current_stride, %ecx - movl _vl_current_height, %edx - movl _vl_current_delta, %ebx - .balign 4 - 0: - pushl %ecx - pushl %ebx - 1: - movl (%esi), %eax - addl $4, %esi -#if 1 - movl %eax, %ebx - andl $0xFFFF, %eax - shrl $16, %ebx - movb _tab_16_8(%eax), %al - movb _tab_16_8(%ebx), %ah -#endif - movw %ax, %fs:(%edi) - addl $2, %edi - subl $2, %ecx - jnz 1b - popl %ebx - popl %ecx - addl %ebx, %edi - decl %edx - jnz 0b - popl %edi - popl %esi - popl %ebx - popl %ebp - ret - - - - .p2align 5,,31 - .global _vesa_b_dump_32_to_24 -_vesa_b_dump_32_to_24: - pushl %ebx - pushl %esi - pushl %edi - pushl %ebp - movl _vl_video_selector, %fs - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vesa_gran_shift, %ecx - movl _vesa_gran_mask, %ebp - movl %edi, %edx - xorl %ebx, %ebx - andl %ebp, %edi - shrl %cl, %edx - incl %ebp - call *_vesa_swbank - movl _vl_current_stride, %ecx - movl _vl_current_height, %eax - movl $0x00FFFFFF, %ebx - .balign 4 - 0: - pushl %eax - pushl %ecx - .balign 4 - 1: - cmpl %ebp, %edi - jb 2f - pushl %ebx - incl %edx - xorl %ebx, %ebx - call *_vesa_swbank - popl %ebx - subl %ebp, %edi - .balign 4 - 2: - movb (%esi), %al /* XXX too many accesses */ - incl %esi - rorl $8, %ebx - jnc 2b - movb %al, %fs:(%edi) - incl %edi - decl %ecx - jnz 1b - popl %ecx - popl %eax - addl _vl_current_delta, %edi - decl %eax - jnz 0b - popl %ebp - popl %edi - popl %esi - popl %ebx - ret - - .p2align 5,,31 - .global _vesa_b_dump_32_to_16 -_vesa_b_dump_32_to_16: - pushl %ebx - pushl %esi - pushl %edi - pushl %ebp - movl _vl_video_selector, %fs - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vesa_gran_shift, %ecx - movl _vesa_gran_mask, %ebp - movl %edi, %edx - xorl %ebx, %ebx - andl %ebp, %edi - shrl %cl, %edx - incl %ebp - call *_vesa_swbank - movl _vl_current_stride, %ecx - movl _vl_current_height, %eax - .balign 4 - 0: - pushl %eax - pushl %ecx - .balign 4 - 1: - cmpl %ebp, %edi - jb 2f - incl %edx - xorl %ebx, %ebx - call *_vesa_swbank - subl %ebp, %edi - .balign 4 - 2: - movl (%esi), %eax - addl $4, %esi - CVT_32_TO_16(a, ebx) - movw %ax, %fs:(%edi) - addl $2, %edi - subl $2, %ecx - jnz 1b - popl %ecx - popl %eax - addl _vl_current_delta, %edi - decl %eax - jnz 0b - popl %ebp - popl %edi - popl %esi - popl %ebx - ret - - .p2align 5,,31 - .global _vesa_b_dump_32_to_15 -_vesa_b_dump_32_to_15: - pushl %ebx - pushl %esi - pushl %edi - pushl %ebp - movl _vl_video_selector, %fs - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vesa_gran_shift, %ecx - movl _vesa_gran_mask, %ebp - movl %edi, %edx - xorl %ebx, %ebx - andl %ebp, %edi - shrl %cl, %edx - incl %ebp - call *_vesa_swbank - movl _vl_current_stride, %ecx - movl _vl_current_height, %eax - .balign 4 - 0: - pushl %eax - pushl %ecx - .balign 4 - 1: - cmpl %ebp, %edi - jb 2f - incl %edx - xorl %ebx, %ebx - call *_vesa_swbank - subl %ebp, %edi - .balign 4 - 2: - movl (%esi), %eax - addl $4, %esi - CVT_32_TO_15(a, ebx) - movw %ax, %fs:(%edi) - addl $2, %edi - subl $2, %ecx - jnz 1b - popl %ecx - popl %eax - addl _vl_current_delta, %edi - decl %eax - jnz 0b - popl %ebp - popl %edi - popl %esi - popl %ebx - ret - - .p2align 5,,31 - .global _vesa_b_dump_32_to_8 -_vesa_b_dump_32_to_8: - pushl %ebx - pushl %esi - pushl %edi - pushl %ebp - movl _vl_video_selector, %fs - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vesa_gran_shift, %ecx - movl _vesa_gran_mask, %ebp - movl %edi, %edx - xorl %ebx, %ebx - andl %ebp, %edi - shrl %cl, %edx - incl %ebp - call *_vesa_swbank - movl _vl_current_stride, %ecx - movl _vl_current_height, %eax - .balign 4 - 0: - pushl %eax - pushl %ecx - pushl %edx - .balign 4 - 1: - cmpl %ebp, %edi - jb 2f - popl %edx - incl %edx - pushl %edx - xorl %ebx, %ebx - call *_vesa_swbank - subl %ebp, %edi - .balign 4 - 2: - movl (%esi), %eax - addl $4, %esi -#if 1 - xorl %ebx, %ebx - movl %eax, %edx - movb %ah, %bl - shrl $16, %edx - andl $0xFF, %edx - andl $0xFF, %eax - - movb _array_b(%eax), %al - movb _array_r(%edx), %dl - movb _array_g(%ebx), %bl - - imull $36, %eax - imull $6, %ebx - addl %edx, %eax - addl %ebx, %eax -#endif - movb %al, %fs:(%edi) - incl %edi - decl %ecx - jnz 1b - popl %edx - popl %ecx - popl %eax - addl _vl_current_delta, %edi - decl %eax - jnz 0b - popl %ebp - popl %edi - popl %esi - popl %ebx - ret - - .p2align 5,,31 - .global _vesa_b_dump_24_to_32 -_vesa_b_dump_24_to_32: - pushl %ebx - pushl %esi - pushl %edi - pushl %ebp - movl _vl_video_selector, %fs - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vesa_gran_shift, %ecx - movl _vesa_gran_mask, %ebp - movl %edi, %edx - xorl %ebx, %ebx - andl %ebp, %edi - shrl %cl, %edx - incl %ebp - call *_vesa_swbank - movl _vl_current_stride, %ecx - movl _vl_current_height, %eax - movl _vl_current_delta, %ebx - .balign 4 - 0: - pushl %eax - pushl %ecx - .balign 4 - 1: - cmpl %ebp, %edi - jb 2f - pushl %ebx - incl %edx - xorl %ebx, %ebx - call *_vesa_swbank - popl %ebx - subl %ebp, %edi - .balign 4 - 2: - movl (%esi), %eax - addl $3, %esi - movl %eax, %fs:(%edi) - addl $4, %edi - subl $4, %ecx - jnz 1b - popl %ecx - popl %eax - addl %ebx, %edi - decl %eax - jnz 0b - popl %ebp - popl %edi - popl %esi - popl %ebx - ret - - .p2align 5,,31 - .global _vesa_b_dump_24_to_8 -_vesa_b_dump_24_to_8: - pushl %ebx - pushl %esi - pushl %edi - pushl %ebp - movl _vl_video_selector, %fs - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vesa_gran_shift, %ecx - movl _vesa_gran_mask, %ebp - movl %edi, %edx - xorl %ebx, %ebx - andl %ebp, %edi - shrl %cl, %edx - incl %ebp - call *_vesa_swbank - movl _vl_current_stride, %ecx - movl _vl_current_height, %eax - .balign 4 - 0: - pushl %eax - pushl %ecx - pushl %edx - .balign 4 - 1: - cmpl %ebp, %edi - jb 2f - popl %edx - incl %edx - pushl %edx - xorl %ebx, %ebx - call *_vesa_swbank - subl %ebp, %edi - .balign 4 - 2: - movl (%esi), %eax - addl $3, %esi -#if 1 - xorl %ebx, %ebx - movl %eax, %edx - movb %ah, %bl - shrl $16, %edx - andl $0xFF, %edx - andl $0xFF, %eax - - movb _array_b(%eax), %al - movb _array_r(%edx), %dl - movb _array_g(%ebx), %bl - - imull $36, %eax - imull $6, %ebx - addl %edx, %eax - addl %ebx, %eax -#endif - movb %al, %fs:(%edi) - incl %edi - decl %ecx - jnz 1b - popl %edx - popl %ecx - popl %eax - addl _vl_current_delta, %edi - decl %eax - jnz 0b - popl %ebp - popl %edi - popl %esi - popl %ebx - ret - - .p2align 5,,31 - .global _vesa_b_dump_16_to_15 -_vesa_b_dump_16_to_15: - pushl %ebx - pushl %esi - pushl %edi - pushl %ebp - movl _vl_video_selector, %fs - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vesa_gran_shift, %ecx - movl _vesa_gran_mask, %ebp - movl %edi, %edx - xorl %ebx, %ebx - andl %ebp, %edi - shrl %cl, %edx - incl %ebp - call *_vesa_swbank - movl _vl_current_stride, %ecx - movl _vl_current_height, %eax - .balign 4 - 0: - pushl %eax - pushl %ecx - .balign 4 - 1: - cmpl %ebp, %edi - jb 2f - incl %edx - xorl %ebx, %ebx - call *_vesa_swbank - subl %ebp, %edi - .balign 4 - 2: - movw (%esi), %ax - addl $2, %esi - CVT_16_TO_15(eax, ebx) - movw %ax, %fs:(%edi) - addl $2, %edi - subl $2, %ecx - jnz 1b - popl %ecx - popl %eax - addl _vl_current_delta, %edi - decl %eax - jnz 0b - popl %ebp - popl %edi - popl %esi - popl %ebx - ret - - .p2align 5,,31 - .global _vesa_b_dump_16_to_8 -_vesa_b_dump_16_to_8: - pushl %ebx - pushl %esi - pushl %edi - pushl %ebp - movl _vl_video_selector, %fs - movl _vl_current_draw_buffer, %esi - movl _vl_current_offset, %edi - movl _vesa_gran_shift, %ecx - movl _vesa_gran_mask, %ebp - movl %edi, %edx - xorl %ebx, %ebx - andl %ebp, %edi - shrl %cl, %edx - incl %ebp - call *_vesa_swbank - movl _vl_current_stride, %ecx - movl _vl_current_height, %eax - movl _vl_current_delta, %ebx - .balign 4 - 0: - pushl %eax - pushl %ecx - .balign 4 - 1: - cmpl %ebp, %edi - jb 2f - pushl %ebx - incl %edx - xorl %ebx, %ebx - call *_vesa_swbank - popl %ebx - subl %ebp, %edi - .balign 4 - 2: - movw (%esi), %ax - addl $2, %esi -#if 1 - andl $0xFFFF, %eax - movb _tab_16_8(%eax), %al -#endif - movb %al, %fs:(%edi) - addl $1, %edi - subl $1, %ecx - jnz 1b - popl %ecx - popl %eax - addl %ebx, %edi - decl %eax - jnz 0b - popl %ebp - popl %edi - popl %esi - popl %ebx - ret diff --git a/src/mesa/drivers/dos/dmesa.c b/src/mesa/drivers/dos/dmesa.c deleted file mode 100644 index 003c06a8fff..00000000000 --- a/src/mesa/drivers/dos/dmesa.c +++ /dev/null @@ -1,359 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.3 - * - * Copyright (C) 1999-2004 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 for Mesa - * - * Author: Daniel Borca - * Email : dborca@users.sourceforge.net - * Web : http://www.geocities.com/dborca - */ - - -#include "main/context.h" -#include "main/imports.h" -#include "main/mtypes.h" - -#include "video.h" - -#include "GL/osmesa.h" -#include "GL/dmesa.h" - - -/* - * This has nothing to do with Mesa Visual structure. - * We keep this one around for backwards compatibility, - * and to store video mode data for DMesaCreateContext. - */ -struct dmesa_visual { - GLenum format; /* OSMesa framebuffer format */ - GLint depthBits; - GLint stencilBits; - GLint accumBits; -}; - -/* - * This has nothing to do with Mesa Buffer structure. - * We keep this one around for backwards compatibility, - * and to store various data. - */ -struct dmesa_buffer { - int xpos, ypos; /* position */ - int width, height; /* size in pixels */ - GLenum type; - void *the_window; /* your window handle, etc */ -}; - -/* - * This has nothing to do with Mesa Context structure. - * We keep this one around for backwards compatibility, - * and to store real off-screen context. - */ -struct dmesa_context { - OSMesaContext osmesa; - DMesaBuffer buffer; -}; - - -static DMesaContext ctx; - - -/**************************************************************************** - * DMesa Public API Functions - ***************************************************************************/ - -/* - * The exact arguments to this function will depend on your window system - */ -DMesaVisual -DMesaCreateVisual (GLint width, - GLint height, - GLint colDepth, - GLint refresh, - GLboolean dbFlag, - GLboolean rgbFlag, - GLint alphaSize, - GLint depthSize, - GLint stencilSize, - GLint accumSize) -{ - DMesaVisual visual; - GLenum format; - int fbbits; - - if (dbFlag) { - return NULL; - } - - if (!rgbFlag) { - format = OSMESA_COLOR_INDEX; - fbbits = 8; - } else if (alphaSize) { - format = OSMESA_BGRA; - fbbits = 32; - } else if (colDepth == 15 || colDepth == 16) { - format = OSMESA_RGB_565; - fbbits = 16; - } else { - format = OSMESA_BGR; - fbbits = 24; - } - - if ((visual = (DMesaVisual)CALLOC_STRUCT(dmesa_visual)) == NULL) { - return NULL; - } - - if (vl_video_init(width, height, colDepth, rgbFlag, refresh, fbbits) <= 0) { - FREE(visual); - return NULL; - } - - visual->format = format; - visual->depthBits = depthSize; - visual->stencilBits = stencilSize; - visual->accumBits = accumSize; - return visual; -} - - -void -DMesaDestroyVisual (DMesaVisual visual) -{ - vl_video_exit(); - FREE(visual); -} - - -DMesaBuffer -DMesaCreateBuffer (DMesaVisual visual, - GLint xpos, GLint ypos, - GLint width, GLint height) -{ - DMesaBuffer buffer; - GLenum type; - int bytesPerPixel; - - switch (visual->format) { - case OSMESA_COLOR_INDEX: - bytesPerPixel = 1; - type = CHAN_TYPE; - break; - case OSMESA_RGB_565: - bytesPerPixel = 2; - type = GL_UNSIGNED_SHORT_5_6_5; - break; - case OSMESA_BGR: - bytesPerPixel = 3; - type = CHAN_TYPE; - break; - default: - bytesPerPixel = 4; - type = CHAN_TYPE; - } - - if ((buffer = (DMesaBuffer)CALLOC_STRUCT(dmesa_buffer)) != NULL) { - buffer->xpos = xpos; - buffer->ypos = ypos; - buffer->width = width; - buffer->height = height; - buffer->type = type; - buffer->the_window = MALLOC(width * height * bytesPerPixel + 1); - if (buffer->the_window == NULL) { - FREE(buffer); - buffer = NULL; - } - } - - return buffer; -} - - -void -DMesaDestroyBuffer (DMesaBuffer buffer) -{ - FREE(buffer->the_window); - FREE(buffer); -} - - -DMesaContext -DMesaCreateContext (DMesaVisual visual, DMesaContext share) -{ - DMesaContext dmesa; - if ((dmesa = (DMesaContext)CALLOC_STRUCT(dmesa_context)) != NULL) { - dmesa->osmesa = OSMesaCreateContextExt( - visual->format, - visual->depthBits, - visual->stencilBits, - visual->accumBits, - (share != NULL) ? share->osmesa : NULL); - if (dmesa->osmesa == NULL) { - FREE(dmesa); - dmesa = NULL; - } - } - return dmesa; -} - - -void -DMesaDestroyContext (DMesaContext dmesa) -{ - OSMesaDestroyContext(dmesa->osmesa); - FREE(dmesa); -} - - -GLboolean -DMesaMoveBuffer (GLint xpos, GLint ypos) -{ - const DMesaContext dmesa = DMesaGetCurrentContext(); - DMesaBuffer b = dmesa->buffer; - - if (vl_sync_buffer(&b->the_window, xpos, ypos, b->width, b->height) == 0) { - b->xpos = xpos; - b->ypos = ypos; - return GL_TRUE; - } - - return GL_FALSE; -} - - -GLboolean -DMesaResizeBuffer (GLint width, GLint height) -{ - const DMesaContext dmesa = DMesaGetCurrentContext(); - DMesaBuffer b = dmesa->buffer; - - if (vl_sync_buffer(&b->the_window, b->xpos, b->ypos, width, height) == 0) { - b->width = width; - b->height = height; - return GL_TRUE; - } - - return GL_FALSE; -} - - -GLboolean -DMesaMakeCurrent (DMesaContext dmesa, DMesaBuffer buffer) -{ - if (dmesa == NULL || buffer == NULL) { - ctx = NULL; - return GL_TRUE; - } - if (OSMesaMakeCurrent(dmesa->osmesa, buffer->the_window, - buffer->type, - buffer->width, buffer->height) && - vl_sync_buffer(&buffer->the_window, buffer->xpos, buffer->ypos, buffer->width, buffer->height) == 0) { - OSMesaPixelStore(OSMESA_Y_UP, GL_FALSE); - dmesa->buffer = buffer; - ctx = dmesa; - return GL_TRUE; - } - return GL_FALSE; -} - - -void -DMesaSwapBuffers (DMesaBuffer buffer) -{ - /* copy/swap back buffer to front if applicable */ - GET_CURRENT_CONTEXT(ctx); - _mesa_notifySwapBuffers(ctx); - vl_flip(); - (void)buffer; -} - - -void -DMesaSetCI (int ndx, GLfloat red, GLfloat green, GLfloat blue) -{ - vl_setCI(ndx, red, green, blue); -} - - -DMesaContext -DMesaGetCurrentContext (void) -{ - return ctx; -} - - -DMesaBuffer -DMesaGetCurrentBuffer (void) -{ - const DMesaContext dmesa = DMesaGetCurrentContext(); - - if (dmesa != NULL) { - return dmesa->buffer; - } - - return NULL; -} - - -DMesaProc -DMesaGetProcAddress (const char *name) -{ - DMesaProc p = (DMesaProc)_glapi_get_proc_address(name); - - /* TODO: handle DMesa* namespace - if (p == NULL) { - } - */ - - return p; -} - - -int -DMesaGetIntegerv (GLenum pname, GLint *params) -{ - switch (pname) { - case DMESA_GET_SCREEN_SIZE: - vl_get(VL_GET_SCREEN_SIZE, params); - break; - case DMESA_GET_DRIVER_CAPS: - params[0] = 0; - break; - case DMESA_GET_VIDEO_MODES: - return vl_get(VL_GET_VIDEO_MODES, params); - case DMESA_GET_BUFFER_ADDR: { - const DMesaContext dmesa = DMesaGetCurrentContext(); - if (dmesa != NULL) { - DMesaBuffer b = dmesa->buffer; - if (b != NULL) { - params[0] = (GLint)b->the_window; - } - } - break; - } - default: - return -1; - } - - return 0; -} diff --git a/src/mesa/drivers/dos/dpmi.c b/src/mesa/drivers/dos/dpmi.c deleted file mode 100644 index bd33b8856cf..00000000000 --- a/src/mesa/drivers/dos/dpmi.c +++ /dev/null @@ -1,166 +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 for Mesa - * - * Author: Daniel Borca - * Email : dborca@yahoo.com - * Web : http://www.geocities.com/dborca - */ - - -#include - -#include "internal.h" - - -#ifndef MAX -#define MAX(x, y) (((x) < (y)) ? (y) : (x)) -#endif - - -/* _create_linear_mapping: - * Maps a physical address range into linear memory. - */ -int -_create_linear_mapping (unsigned long *linear, unsigned long physaddr, int size) -{ - __dpmi_meminfo meminfo; - - if (physaddr >= 0x100000) { - /* map into linear memory */ - meminfo.address = physaddr; - meminfo.size = size; - if (__dpmi_physical_address_mapping(&meminfo) != 0) { - return -1; - } - - *linear = meminfo.address; - } else { - /* exploit 1 -> 1 physical to linear mapping in low megabyte */ - *linear = physaddr; - } - - return 0; -} - - -/* _remove_linear_mapping: - * Frees the DPMI resources being used to map a linear address range. - */ -void -_remove_linear_mapping (unsigned long *linear) -{ - __dpmi_meminfo meminfo; - - if (*linear) { - if (*linear >= 0x100000) { - meminfo.address = *linear; - __dpmi_free_physical_address_mapping(&meminfo); - } - - *linear = 0; - } -} - - -/* _create_selector: - * Allocates a selector to access a region of linear memory. - */ -int -_create_selector (int *segment, unsigned long base, int size) -{ - /* allocate an ldt descriptor */ - if ((*segment=__dpmi_allocate_ldt_descriptors(1)) < 0) { - *segment = 0; - return -1; - } - - /* create the linear mapping */ - if (_create_linear_mapping(&base, base, size)) { - __dpmi_free_ldt_descriptor(*segment); - *segment = 0; - return -1; - } - - /* set the descriptor base and limit */ - __dpmi_set_segment_base_address(*segment, base); - __dpmi_set_segment_limit(*segment, MAX(size-1, 0xFFFF)); - - return 0; -} - - -/* _remove_selector: - * Frees a DPMI segment selector. - */ -void -_remove_selector (int *segment) -{ - if (*segment) { - unsigned long base; - __dpmi_get_segment_base_address(*segment, &base); - _remove_linear_mapping(&base); - __dpmi_free_ldt_descriptor(*segment); - *segment = 0; - } -} - - -/* Desc: retrieve CPU MMX capability - * - * In : - - * Out : FALSE if CPU cannot do MMX - * - * Note: - - */ -int -_can_mmx (void) -{ -#ifdef USE_MMX_ASM - int x86_cpu_features = 0; - __asm("\n\ - pushfl \n\ - popl %%eax \n\ - movl %%eax, %%ecx \n\ - xorl $0x200000, %%eax\n\ - pushl %%eax \n\ - popfl \n\ - pushfl \n\ - popl %%eax \n\ - pushl %%ecx \n\ - popfl \n\ - xorl %%ecx, %%eax \n\ - jz 0f \n\ - movl $1, %%eax \n\ - cpuid \n\ - movl %%edx, %0 \n\ - 0: \n\ - ":"=g"(x86_cpu_features)::"%eax", "%ebx", "%ecx", "%edx"); - return (x86_cpu_features & 0x00800000); -#else - return 0; -#endif -} diff --git a/src/mesa/drivers/dos/internal.h b/src/mesa/drivers/dos/internal.h deleted file mode 100644 index 0fa7c772223..00000000000 --- a/src/mesa/drivers/dos/internal.h +++ /dev/null @@ -1,105 +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 for Mesa - * - * Author: Daniel Borca - * Email : dborca@users.sourceforge.net - * Web : http://www.geocities.com/dborca - */ - - -#ifndef INTERNAL_H_included -#define INTERNAL_H_included - -#include "../main/mtypes.h" - - -/* - * general purpose defines, etc. - */ -#ifndef FALSE -#define FALSE 0 -#define TRUE !FALSE -#endif - -#define __PACKED__ __attribute__((packed)) - -typedef unsigned char word8; -typedef unsigned short word16; -typedef unsigned long word32; - -#define _16_ *(word16 *)& -#define _32_ *(word32 *)& - -typedef void (*BLTFUNC) (void); - - -/* - * video mode structure - */ -typedef struct vl_mode { - int xres, yres; - int bpp; - - int mode; - int scanlen; - - int sel; - int gran; -} vl_mode; - - -/* - * video driver structure - */ -typedef struct { - vl_mode *(*init) (void); - int (*entermode) (vl_mode *p, int refresh, int fbbits); - void (*blit) (void); - void (*setCI_f) (int index, float red, float green, float blue); - void (*setCI_i) (int index, int red, int green, int blue); - int (*get) (int pname, int *params); - void (*restore) (void); - void (*fini) (void); -} vl_driver; - - -/* - * memory mapping - */ -int _create_linear_mapping (unsigned long *linear, unsigned long physaddr, int size); -void _remove_linear_mapping (unsigned long *linear); -int _create_selector (int *segment, unsigned long base, int size); -void _remove_selector (int *segment); - - -/* - * system routines - */ -int _can_mmx (void); - - -#endif diff --git a/src/mesa/drivers/dos/null.c b/src/mesa/drivers/dos/null.c deleted file mode 100644 index 55846299fbb..00000000000 --- a/src/mesa/drivers/dos/null.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 4.1 - * - * 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 for Mesa - * - * Author: Daniel Borca - * Email : dborca@users.sourceforge.net - * Web : http://www.geocities.com/dborca - */ - - -#include -#include - -#include "video.h" -#include "null.h" - - -static vl_mode *modes; - -#define null_color_precision 8 - - -static void -null_blit_nop (void) -{ -} - - -/* Desc: Attempts to detect NUL, check video modes and create selectors. - * - * In : - - * Out : mode array - * - * Note: - - */ -static vl_mode * -null_init (void) -{ - static int m[][2] = { - { 320, 200 }, - { 320, 240 }, - { 400, 300 }, - { 512, 384 }, - { 640, 400 }, - { 640, 480 }, - { 800, 600 }, - { 1024, 768 }, - { 1280, 1024 }, - { 1600, 1200 } - }; - static int b[] = { - 8, - 15, - 16, - 24, - 32 - }; - const unsigned int m_count = sizeof(m) / sizeof(m[0]); - const unsigned int b_count = sizeof(b) / sizeof(b[0]); - - unsigned int i, j, k; - - if (modes == NULL) { - modes = malloc(sizeof(vl_mode) * (1 + m_count * b_count)); - - if (modes != NULL) { - for (k = 0, i = 0; i < m_count; i++) { - for (j = 0; j < b_count; j++, k++) { - modes[k].xres = m[i][0]; - modes[k].yres = m[i][1]; - modes[k].bpp = b[j]; - modes[k].mode = 0x4000; - modes[k].scanlen = m[i][0] * ((b[j] + 7) / 8); - modes[k].sel = -1; - modes[k].gran = -1; - } - } - modes[k].xres = -1; - modes[k].yres = -1; - modes[k].bpp = -1; - modes[k].mode = 0xffff; - modes[k].scanlen = -1; - modes[k].sel = -1; - modes[k].gran = -1; - } - } - - return modes; -} - - -/* Desc: Frees all resources allocated by NUL init code. - * - * In : - - * Out : - - * - * Note: - - */ -static void -null_fini (void) -{ - if (modes != NULL) { - free(modes); - modes = NULL; - } -} - - -/* Desc: Attempts to enter specified video mode. - * - * In : ptr to mode structure, refresh rate - * Out : 0 if success - * - * Note: - - */ -static int -null_entermode (vl_mode *p, int refresh, int fbbits) -{ - NUL.blit = null_blit_nop; - - return 0; - - (void)(p && refresh && fbbits); /* silence compiler warning */ -} - - -/* Desc: Restores to the mode prior to first call to null_entermode. - * - * In : - - * Out : - - * - * Note: - - */ -static void -null_restore (void) -{ -} - - -/* Desc: set one palette entry - * - * In : color index, R, G, B - * Out : - - * - * Note: uses integer values - */ -static void -null_setCI_i (int index, int red, int green, int blue) -{ - (void)(index && red && green && blue); /* silence compiler warning */ -} - - -/* Desc: set one palette entry - * - * In : color index, R, G, B - * Out : - - * - * Note: uses normalized values - */ -static void -null_setCI_f (int index, float red, float green, float blue) -{ - float max = (1 << null_color_precision) - 1; - - null_setCI_i(index, (int)(red * max), (int)(green * max), (int)(blue * max)); -} - - -/* Desc: state retrieval - * - * In : parameter name, ptr to storage - * Out : 0 if request successfully processed - * - * Note: - - */ -static int -null_get (int pname, int *params) -{ - switch (pname) { - default: - params[0] = params[0]; /* silence compiler warning */ - return -1; - } - return 0; -} - - -/* - * the driver - */ -vl_driver NUL = { - null_init, - null_entermode, - NULL, - null_setCI_f, - null_setCI_i, - null_get, - null_restore, - null_fini -}; diff --git a/src/mesa/drivers/dos/null.h b/src/mesa/drivers/dos/null.h deleted file mode 100644 index bbdc7966e07..00000000000 --- a/src/mesa/drivers/dos/null.h +++ /dev/null @@ -1,41 +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 for Mesa - * - * Author: Daniel Borca - * Email : dborca@yahoo.com - * Web : http://www.geocities.com/dborca - */ - - -#ifndef NULL_H_included -#define NULL_H_included - -#include "internal.h" - -extern vl_driver NUL; - -#endif diff --git a/src/mesa/drivers/dos/vesa.c b/src/mesa/drivers/dos/vesa.c deleted file mode 100644 index 3fdd3e25db4..00000000000 --- a/src/mesa/drivers/dos/vesa.c +++ /dev/null @@ -1,719 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 4.1 - * - * 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 for Mesa - * - * Author: Daniel Borca - * Email : dborca@users.sourceforge.net - * Web : http://www.geocities.com/dborca - */ - - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "video.h" -#include "vesa.h" - - -static vl_mode modes[128]; - -static word16 vesa_ver; -static int banked_selector, linear_selector; -static int oldmode = -1; - -static int vesa_color_precision = 6; - -static word16 *vesa_pmcode; -unsigned int vesa_gran_mask, vesa_gran_shift; - - -/* - * VESA info - */ -#define V_SIGN 0 -#define V_MINOR 4 -#define V_MAJOR 5 -#define V_OEM_OFS 6 -#define V_OEM_SEG 8 -#define V_MODE_OFS 14 -#define V_MODE_SEG 16 -#define V_MEMORY 18 - -/* - * mode info - */ -#define M_ATTR 0 -#define M_GRAN 4 -#define M_SCANLEN 16 -#define M_XRES 18 -#define M_YRES 20 -#define M_BPP 25 -#define M_RED 31 -#define M_GREEN 33 -#define M_BLUE 35 -#define M_PHYS_PTR 40 - -/* - * VESA 3.0 CRTC timings structure - */ -typedef struct CRTCInfoBlock { - unsigned short HorizontalTotal; - unsigned short HorizontalSyncStart; - unsigned short HorizontalSyncEnd; - unsigned short VerticalTotal; - unsigned short VerticalSyncStart; - unsigned short VerticalSyncEnd; - unsigned char Flags; - unsigned long PixelClock; /* units of Hz */ - unsigned short RefreshRate; /* units of 0.01 Hz */ - unsigned char reserved[40]; -} __PACKED__ CRTCInfoBlock; - -#define HNEG (1 << 2) -#define VNEG (1 << 3) -#define DOUBLESCAN (1 << 0) - - -/* Desc: Attempts to detect VESA, check video modes and create selectors. - * - * In : - - * Out : mode array - * - * Note: - - */ -static vl_mode * -vesa_init (void) -{ - __dpmi_regs r; - word16 *p; - vl_mode *q; - char vesa_info[512], tmp[512]; - int maxsize = 0; - word32 linearfb = 0; - - if (vesa_ver) { - return modes; - } - - _farpokel(_stubinfo->ds_selector, 0, 0x32454256); - r.x.ax = 0x4f00; - r.x.di = 0; - r.x.es = _stubinfo->ds_segment; - __dpmi_int(0x10, &r); - movedata(_stubinfo->ds_selector, 0, _my_ds(), (unsigned)vesa_info, 512); - if ((r.x.ax != 0x004f) || ((_32_ vesa_info[V_SIGN]) != 0x41534556)) { - return NULL; - } - - p = (word16 *)(((_16_ vesa_info[V_MODE_SEG]) << 4) + (_16_ vesa_info[V_MODE_OFS])); - 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[M_BPP]) { - case 16: - q->bpp = tmp[M_RED] + tmp[M_GREEN] + tmp[M_BLUE]; - break; - case 8: - case 15: - case 24: - case 32: - q->bpp = tmp[M_BPP]; - break; - default: - q->bpp = 0; - } - if ((r.x.ax == 0x004f) && ((tmp[M_ATTR] & 0x11) == 0x11) && q->bpp) { - q->xres = _16_ tmp[M_XRES]; - q->yres = _16_ tmp[M_YRES]; - q->scanlen = _16_ tmp[M_SCANLEN]; - q->gran = (_16_ tmp[M_GRAN]) << 10; - if (tmp[M_ATTR] & 0x80) { - vl_mode *q1 = q + 1; - *q1 = *q++; - linearfb = _32_ tmp[M_PHYS_PTR]; - q->mode |= 0x4000; - } - if (maxsize < (q->scanlen * q->yres)) { - maxsize = q->scanlen * q->yres; - } - q++; - } - } while (TRUE); - - if (q == modes) { - return NULL; - } - if (_create_selector(&banked_selector, 0xa0000, modes[0].gran)) { - return NULL; - } - if (linearfb) { - maxsize = ((maxsize + 0xfffUL) & ~0xfffUL); - if (_create_selector(&linear_selector, linearfb, maxsize)) { - linear_selector = banked_selector; - } - } - - for (q = modes; q->mode != 0xffff; q++) { - q->sel = banked_selector; - if (q->mode & 0x4000) { - if (linear_selector != banked_selector) { - q->sel = linear_selector; - } else { - q->mode &= ~0x4000; - } - } - } - - if (vesa_info[V_MAJOR] >= 2) { - r.x.ax = 0x4f0a; - r.x.bx = 0; - __dpmi_int(0x10, &r); - if (r.x.ax == 0x004f) { - vesa_pmcode = (word16 *)malloc(r.x.cx); - if (vesa_pmcode != NULL) { - movedata(__djgpp_dos_sel, (r.x.es << 4) + r.x.di, _my_ds(), (unsigned)vesa_pmcode, r.x.cx); - if (vesa_pmcode[3]) { - p = (word16 *)((long)vesa_pmcode + vesa_pmcode[3]); - while (*p++ != 0xffff) { - } - } else { - p = NULL; - } - if (p && (*p != 0xffff)) { - free(vesa_pmcode); - vesa_pmcode = NULL; - } else { - vesa_swbank = (void *)((long)vesa_pmcode + vesa_pmcode[0]); - } - } - } - } - - vesa_ver = _16_ vesa_info[V_MINOR]; - return modes; -} - - -/* Desc: Frees all resources allocated by VESA init code. - * - * In : - - * Out : - - * - * Note: - - */ -static void -vesa_fini (void) -{ - if (vesa_ver) { - _remove_selector(&linear_selector); - _remove_selector(&banked_selector); - if (vesa_pmcode != NULL) { - free(vesa_pmcode); - vesa_pmcode = NULL; - } - } -} - - -/* Desc: Uses VESA 3.0 function 0x4F0B to find the closest pixel clock to the requested value. - * - * In : mode, clock - * Out : desired clock - * - * Note: - - */ -static unsigned long -_closest_pixclk (int mode_no, unsigned long vclk) -{ - __dpmi_regs r; - - r.x.ax = 0x4F0B; - r.h.bl = 0; - r.d.ecx = vclk; - r.x.dx = mode_no; - __dpmi_int(0x10, &r); - - return (r.x.ax == 0x004f) ? r.d.ecx : 0; -} - - -/* Desc: Calculates CRTC mode timings. - * - * In : crtc block, geometry, adjust - * Out : - * - * Note: - */ -static void -_crtc_timing (CRTCInfoBlock *crtc, int xres, int yres, int xadjust, int yadjust) -{ - int HTotal, VTotal; - int HDisp, VDisp; - int HSS, VSS; - int HSE, VSE; - int HSWidth, VSWidth; - int SS, SE; - int doublescan = FALSE; - - if (yres < 400) { - doublescan = TRUE; - yres *= 2; - } - - HDisp = xres; - HTotal = (int)(HDisp * 1.27) & ~0x7; - HSWidth = (int)((HTotal - HDisp) / 5) & ~0x7; - HSS = HDisp + 16; - HSE = HSS + HSWidth; - VDisp = yres; - VTotal = VDisp * 1.07; - VSWidth = (VTotal / 100) + 1; - VSS = VDisp + ((int)(VTotal - VDisp) / 5) + 1; - VSE = VSS + VSWidth; - - SS = HSS + xadjust; - SE = HSE + xadjust; - - if (xadjust < 0) { - if (SS < (HDisp + 8)) { - SS = HDisp + 8; - SE = SS + HSWidth; - } - } else { - if ((HTotal - 24) < SE) { - SE = HTotal - 24; - SS = SE - HSWidth; - } - } - - HSS = SS; - HSE = SE; - - SS = VSS + yadjust; - SE = VSE + yadjust; - - if (yadjust < 0) { - if (SS < (VDisp + 3)) { - SS = VDisp + 3; - SE = SS + VSWidth; - } - } else { - if ((VTotal - 4) < SE) { - SE = VTotal - 4; - SS = SE - VSWidth; - } - } - - VSS = SS; - VSE = SE; - - crtc->HorizontalTotal = HTotal; - crtc->HorizontalSyncStart = HSS; - crtc->HorizontalSyncEnd = HSE; - crtc->VerticalTotal = VTotal; - crtc->VerticalSyncStart = VSS; - crtc->VerticalSyncEnd = VSE; - crtc->Flags = HNEG | VNEG; - - if (doublescan) { - crtc->Flags |= DOUBLESCAN; - } -} - - -/* Desc: Attempts to choose a suitable blitter. - * - * In : ptr to mode structure, software framebuffer bits - * Out : blitter funciton, or NULL - * - * Note: - - */ -static BLTFUNC -_choose_blitter (vl_mode *p, int fbbits) -{ - BLTFUNC blitter; - - if (p->mode & 0x4000) { - blitter = _can_mmx() ? vesa_l_dump_virtual_mmx : vesa_l_dump_virtual; - switch (p->bpp) { - case 8: - switch (fbbits) { - case 8: - break; - case 16: - blitter = vesa_l_dump_16_to_8; - break; - case 24: - blitter = vesa_l_dump_24_to_8; - break; - case 32: - blitter = vesa_l_dump_32_to_8; - break; - case 15: - default: - return NULL; - } - break; - case 15: - switch (fbbits) { - case 16: - blitter = vesa_l_dump_16_to_15; - break; - case 32: - blitter = vesa_l_dump_32_to_15; - break; - case 8: - case 15: - case 24: - default: - return NULL; - } - break; - case 16: - switch (fbbits) { - case 16: - break; - case 32: - blitter = vesa_l_dump_32_to_16; - break; - case 8: - case 15: - case 24: - default: - return NULL; - } - break; - case 24: - switch (fbbits) { - case 24: - break; - case 32: - blitter = vesa_l_dump_32_to_24; - break; - case 8: - case 15: - case 16: - default: - return NULL; - } - break; - case 32: - switch (fbbits) { - case 24: - blitter = vesa_l_dump_24_to_32; - break; - case 32: - break; - case 8: - case 15: - case 16: - default: - return NULL; - } - break; - } - } else { - blitter = vesa_b_dump_virtual; - switch (p->bpp) { - case 8: - switch (fbbits) { - case 8: - break; - case 16: - blitter = vesa_b_dump_16_to_8; - break; - case 24: - blitter = vesa_b_dump_24_to_8; - break; - case 32: - blitter = vesa_b_dump_32_to_8; - break; - case 15: - default: - return NULL; - } - break; - case 15: - switch (fbbits) { - case 16: - blitter = vesa_b_dump_16_to_15; - break; - case 32: - blitter = vesa_b_dump_32_to_15; - break; - case 8: - case 15: - case 24: - default: - return NULL; - } - break; - case 16: - switch (fbbits) { - case 16: - break; - case 32: - blitter = vesa_b_dump_32_to_16; - break; - case 8: - case 15: - case 24: - default: - return NULL; - } - break; - case 24: - switch (fbbits) { - case 24: - break; - case 32: - blitter = vesa_b_dump_32_to_24; - break; - case 8: - case 15: - case 16: - default: - return NULL; - } - break; - case 32: - switch (fbbits) { - case 24: - blitter = vesa_b_dump_24_to_32; - break; - case 32: - break; - case 8: - case 15: - case 16: - default: - return NULL; - } - break; - } - } - - return blitter; -} - - -/* Desc: Attempts to enter specified video mode. - * - * In : ptr to mode structure, refresh rate - * Out : 0 if success - * - * Note: - - */ -static int -vesa_entermode (vl_mode *p, int refresh, int fbbits) -{ - __dpmi_regs r; - - if (!(p->mode & 0x4000)) { - { int n; for (vesa_gran_shift = 0, n = p->gran; n; vesa_gran_shift++, n >>= 1); } - vesa_gran_mask = (1 << (--vesa_gran_shift)) - 1; - if ((unsigned)p->gran != (vesa_gran_mask + 1)) { - return !0; - } - } - - VESA.blit = _choose_blitter(p, fbbits); - if (VESA.blit == NULL) { - return !0; - } - - if (oldmode == -1) { - r.x.ax = 0x4f03; - __dpmi_int(0x10, &r); - oldmode = r.x.bx; - } - - r.x.ax = 0x4f02; - r.x.bx = p->mode; - - if (refresh && ((vesa_ver >> 8) >= 3)) { - /* VESA 3.0 stuff for controlling the refresh rate */ - CRTCInfoBlock crtc; - unsigned long vclk; - double f0; - - _crtc_timing(&crtc, p->xres, p->yres, 0, 0); - - vclk = (double)crtc.HorizontalTotal * crtc.VerticalTotal * refresh; - vclk = _closest_pixclk(p->mode, vclk); - - if (vclk != 0) { - f0 = (double)vclk / (crtc.HorizontalTotal * crtc.VerticalTotal); - /*_current_refresh_rate = (int)(f0 + 0.5);*/ - - crtc.PixelClock = vclk; - crtc.RefreshRate = refresh * 100; - - movedata(_my_ds(), (unsigned)&crtc, _stubinfo->ds_selector, 0, sizeof(crtc)); - - r.x.di = 0; - r.x.es = _stubinfo->ds_segment; - r.x.bx |= 0x0800; - } - } - - __dpmi_int(0x10, &r); - if (r.x.ax != 0x004f) { - return !0; - } - - if (p->bpp == 8) { - r.x.ax = 0x4f08; - r.x.bx = 0x0800; - __dpmi_int(0x10, &r); - if (r.x.ax == 0x004f) { - r.x.ax = 0x4f08; - r.h.bl = 0x01; - __dpmi_int(0x10, &r); - vesa_color_precision = r.h.bh; - } - } - - return 0; -} - - -/* Desc: Restores to the mode prior to first call to vesa_entermode. - * - * In : - - * Out : - - * - * Note: - - */ -static void -vesa_restore (void) -{ - __dpmi_regs r; - - if (oldmode != -1) { - if (oldmode < 0x100) { - __asm("int $0x10"::"a"(oldmode)); - } else { - r.x.ax = 0x4f02; - r.x.bx = oldmode; - __dpmi_int(0x10, &r); - } - oldmode = -1; - } -} - - -/* Desc: set one palette entry - * - * In : color index, R, G, B - * Out : - - * - * Note: uses integer values - */ -static void -vesa_setCI_i (int index, int red, int green, int blue) -{ -#if 0 - __asm("\n\ - movw $0x1010, %%ax \n\ - movb %1, %%dh \n\ - movb %2, %%ch \n\ - int $0x10 \n\ - "::"b"(index), "m"(red), "m"(green), "c"(blue):"%eax", "%edx"); -#else - outportb(0x03C8, index); - outportb(0x03C9, red); - outportb(0x03C9, green); - outportb(0x03C9, blue); -#endif -} - - -/* Desc: set one palette entry - * - * In : color index, R, G, B - * Out : - - * - * Note: uses normalized values - */ -static void -vesa_setCI_f (int index, float red, float green, float blue) -{ - float max = (1 << vesa_color_precision) - 1; - - vesa_setCI_i(index, (int)(red * max), (int)(green * max), (int)(blue * max)); -} - - -/* Desc: state retrieval - * - * In : parameter name, ptr to storage - * Out : 0 if request successfully processed - * - * Note: - - */ -static int -vesa_get (int pname, int *params) -{ - switch (pname) { - case VL_GET_CI_PREC: - params[0] = vesa_color_precision; - break; - default: - return -1; - } - return 0; -} - - -/* - * the driver - */ -vl_driver VESA = { - vesa_init, - vesa_entermode, - NULL, - vesa_setCI_f, - vesa_setCI_i, - vesa_get, - vesa_restore, - vesa_fini -}; diff --git a/src/mesa/drivers/dos/vesa.h b/src/mesa/drivers/dos/vesa.h deleted file mode 100644 index 4b3c3ab8329..00000000000 --- a/src/mesa/drivers/dos/vesa.h +++ /dev/null @@ -1,65 +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 for Mesa - * - * Author: Daniel Borca - * Email : dborca@yahoo.com - * Web : http://www.geocities.com/dborca - */ - - -#ifndef VESA_H_included -#define VESA_H_included - -#include "internal.h" - -extern void *vesa_swbank; - -extern void vesa_b_dump_virtual (void); -extern void vesa_l_dump_virtual (void); -extern void vesa_l_dump_virtual_mmx (void); - -extern void vesa_l_dump_32_to_24 (void); -extern void vesa_l_dump_32_to_16 (void); -extern void vesa_l_dump_32_to_15 (void); -extern void vesa_l_dump_32_to_8 (void); -extern void vesa_l_dump_24_to_32 (void); -extern void vesa_l_dump_24_to_8 (void); -extern void vesa_l_dump_16_to_15 (void); -extern void vesa_l_dump_16_to_8 (void); - -extern void vesa_b_dump_32_to_24 (void); -extern void vesa_b_dump_32_to_16 (void); -extern void vesa_b_dump_32_to_15 (void); -extern void vesa_b_dump_32_to_8 (void); -extern void vesa_b_dump_24_to_32 (void); -extern void vesa_b_dump_24_to_8 (void); -extern void vesa_b_dump_16_to_15 (void); -extern void vesa_b_dump_16_to_8 (void); - -extern vl_driver VESA; - -#endif diff --git a/src/mesa/drivers/dos/vga.c b/src/mesa/drivers/dos/vga.c deleted file mode 100644 index 5a6447dd87b..00000000000 --- a/src/mesa/drivers/dos/vga.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 4.1 - * - * 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 for Mesa - * - * Author: Daniel Borca - * Email : dborca@users.sourceforge.net - * Web : http://www.geocities.com/dborca - */ - - -#include -#include - -#include "video.h" -#include "vga.h" - - -static vl_mode modes[] = { - { - /* .xres = */ 320, - /* .yres = */ 200, - /* .bpp = */ 8, - /* .mode = */ 0x13 | 0x4000, - /* .scanlen = */ 320, - /* .sel = */ -1, - /* .gran = */ 320*200 - }, - { - /* .xres = */ -1, - /* .yres = */ -1, - /* .bpp = */ -1, - /* .mode = */ 0xffff, - /* .scanlen = */ -1, - /* .sel = */ -1, - /* .gran = */ -1 - } -}; - -static word16 vga_ver; -static int linear_selector; -static int oldmode = -1; - -#define vga_color_precision 6 - - -/* Desc: Attempts to detect VGA, check video modes and create selectors. - * - * In : - - * Out : mode array - * - * Note: - - */ -static vl_mode * -vga_init (void) -{ - int rv = 0; - - if (vga_ver) { - return modes; - } - - __asm("\n\ - movw $0x1a00, %%ax \n\ - int $0x10 \n\ - cmpb $0x1a, %%al \n\ - jne 0f \n\ - cmpb $0x07, %%bl \n\ - jb 0f \n\ - andl $0xff, %%ebx \n\ - movl %%ebx, %0 \n\ - 0:":"=g"(rv)::"%eax", "%ebx"); - if (rv == 0) { - return NULL; - } - - if (_create_selector(&linear_selector, 0xa0000, 0x10000)) { - return NULL; - } - - modes[0].sel = linear_selector; - - vga_ver = rv; - return modes; -} - - -/* Desc: Frees all resources allocated by VGA init code. - * - * In : - - * Out : - - * - * Note: - - */ -static void -vga_fini (void) -{ - if (vga_ver) { - _remove_selector(&linear_selector); - } -} - - -/* Desc: Attempts to choose a suitable blitter. - * - * In : ptr to mode structure, software framebuffer bits - * Out : blitter funciton, or NULL - * - * Note: - - */ -static BLTFUNC -_choose_blitter (vl_mode *p, int fbbits) -{ - BLTFUNC blitter; - - switch (fbbits) { - case 8: - blitter = _can_mmx() ? vesa_l_dump_virtual_mmx : vesa_l_dump_virtual; - break; - case 16: - blitter = vesa_l_dump_16_to_8; - break; - case 24: - blitter = vesa_l_dump_24_to_8; - break; - case 32: - blitter = vesa_l_dump_32_to_8; - break; - default: - return NULL; - } - - return blitter; - - (void)p; -} - - -/* Desc: Attempts to enter specified video mode. - * - * In : ptr to mode structure, refresh rate - * Out : 0 if success - * - * Note: - - */ -static int -vga_entermode (vl_mode *p, int refresh, int fbbits) -{ - if (!(p->mode & 0x4000)) { - return -1; - } - - VGA.blit = _choose_blitter(p, fbbits); - if (VGA.blit == NULL) { - return !0; - } - - if (oldmode == -1) { - __asm("\n\ - movb $0x0f, %%ah \n\ - int $0x10 \n\ - andl $0xff, %%eax \n\ - movl %%eax, %0 \n\ - ":"=g"(oldmode)::"%eax", "%ebx"); - } - - __asm("int $0x10"::"a"(p->mode&0xff)); - - return 0; - - (void)refresh; /* silence compiler warning */ -} - - -/* Desc: Restores to the mode prior to first call to vga_entermode. - * - * In : - - * Out : - - * - * Note: - - */ -static void -vga_restore (void) -{ - if (oldmode != -1) { - __asm("int $0x10"::"a"(oldmode)); - oldmode = -1; - } -} - - -/* Desc: set one palette entry - * - * In : color index, R, G, B - * Out : - - * - * Note: uses integer values - */ -static void -vga_setCI_i (int index, int red, int green, int blue) -{ -#if 0 - __asm("\n\ - movw $0x1010, %%ax \n\ - movb %1, %%dh \n\ - movb %2, %%ch \n\ - int $0x10 \n\ - "::"b"(index), "m"(red), "m"(green), "c"(blue):"%eax", "%edx"); -#else - outportb(0x03C8, index); - outportb(0x03C9, red); - outportb(0x03C9, green); - outportb(0x03C9, blue); -#endif -} - - -/* Desc: set one palette entry - * - * In : color index, R, G, B - * Out : - - * - * Note: uses normalized values - */ -static void -vga_setCI_f (int index, float red, float green, float blue) -{ - float max = (1 << vga_color_precision) - 1; - - vga_setCI_i(index, (int)(red * max), (int)(green * max), (int)(blue * max)); -} - - -/* Desc: state retrieval - * - * In : parameter name, ptr to storage - * Out : 0 if request successfully processed - * - * Note: - - */ -static int -vga_get (int pname, int *params) -{ - switch (pname) { - case VL_GET_CI_PREC: - params[0] = vga_color_precision; - break; - default: - return -1; - } - return 0; -} - - -/* - * the driver - */ -vl_driver VGA = { - vga_init, - vga_entermode, - NULL, - vga_setCI_f, - vga_setCI_i, - vga_get, - vga_restore, - vga_fini -}; diff --git a/src/mesa/drivers/dos/vga.h b/src/mesa/drivers/dos/vga.h deleted file mode 100644 index 7c17625a3ca..00000000000 --- a/src/mesa/drivers/dos/vga.h +++ /dev/null @@ -1,42 +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 for Mesa - * - * Author: Daniel Borca - * Email : dborca@yahoo.com - * Web : http://www.geocities.com/dborca - */ - - -#ifndef VGA_H_included -#define VGA_H_included - -#include "internal.h" -#include "vesa.h" - -extern vl_driver VGA; - -#endif diff --git a/src/mesa/drivers/dos/video.c b/src/mesa/drivers/dos/video.c deleted file mode 100644 index 468207fbf6f..00000000000 --- a/src/mesa/drivers/dos/video.c +++ /dev/null @@ -1,442 +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 for Mesa - * - * Author: Daniel Borca - * Email : dborca@users.sourceforge.net - * Web : http://www.geocities.com/dborca - * - * Thanks to CrazyPyro (Neil Funk) for FakeColor - */ - - -#include - -#include "internal.h" -#include "vesa.h" -#include "vga.h" -#include "null.h" -#include "video.h" - - -static vl_driver *drv; -/* based upon mode specific data: valid entire session */ -int vl_video_selector; -static vl_mode *video_mode; -static int video_scanlen, video_bypp; -/* valid until next buffer */ -void *vl_current_draw_buffer, *vl_current_read_buffer; -int vl_current_stride, vl_current_width, vl_current_height, vl_current_bytes; -int vl_current_offset, vl_current_delta; - - -void (*vl_flip) (void); - - -/* FakeColor data */ -#define R_CNT 6 -#define G_CNT 6 -#define B_CNT 6 - -#define R_BIAS 7 -#define G_BIAS 7 -#define B_BIAS 7 - -static word32 VGAPalette[256]; -word8 array_r[256]; -word8 array_g[256]; -word8 array_b[256]; -word8 tab_16_8[0x10000]; - - -/* lookup table for scaling 5 bit colors up to 8 bits */ -static int _rgb_scale_5[32] = { - 0, 8, 16, 25, 33, 41, 49, 58, - 66, 74, 82, 90, 99, 107, 115, 123, - 132, 140, 148, 156, 165, 173, 181, 189, - 197, 206, 214, 222, 230, 239, 247, 255 -}; - -/* lookup table for scaling 6 bit colors up to 8 bits */ -static int _rgb_scale_6[64] = { - 0, 4, 8, 12, 16, 20, 24, 28, - 32, 36, 40, 45, 49, 53, 57, 61, - 65, 69, 73, 77, 81, 85, 89, 93, - 97, 101, 105, 109, 113, 117, 121, 125, - 130, 134, 138, 142, 146, 150, 154, 158, - 162, 166, 170, 174, 178, 182, 186, 190, - 194, 198, 202, 206, 210, 215, 219, 223, - 227, 231, 235, 239, 243, 247, 251, 255 -}; - - -/* Desc: color composition (w/o ALPHA) - * - * In : array of integers (R, G, B) - * Out : color - * - * Note: - - */ -static int -v_mixrgb8fake (const unsigned char rgb[]) -{ - return array_b[rgb[2]]*G_CNT*R_CNT - + array_g[rgb[1]]*R_CNT - + array_r[rgb[0]]; -} - - -/* Desc: color decomposition - * - * In : pixel offset, array of integers to hold color components (R, G, B, A) - * Out : - - * - * Note: uses current read buffer - */ -static void -v_getrgb8fake6 (unsigned int offset, unsigned char rgb[]) -{ - word32 c = VGAPalette[((word8 *)vl_current_read_buffer)[offset]]; - rgb[0] = _rgb_scale_6[(c >> 16) & 0x3F]; - rgb[1] = _rgb_scale_6[(c >> 8) & 0x3F]; - rgb[2] = _rgb_scale_6[ c & 0x3F]; -} -static void -v_getrgb8fake8 (unsigned int offset, unsigned char rgb[]) -{ - word32 c = VGAPalette[((word8 *)vl_current_read_buffer)[offset]]; - rgb[0] = c >> 16; - rgb[1] = c >> 8; - rgb[2] = c; -} - - -/* Desc: create R5G6B5 to FakeColor table lookup - * - * In : - - * Out : - - * - * Note: - - */ -static void -init_tab_16_8 (void) -{ - int i; - for (i = 0; i < 0x10000; i++) { - unsigned char rgb[3]; - rgb[0] = _rgb_scale_5[(i >> 11) & 0x1F]; - rgb[1] = _rgb_scale_6[(i >> 5) & 0x3F]; - rgb[2] = _rgb_scale_5[ i & 0x1F]; - tab_16_8[i] = v_mixrgb8fake(rgb); - } - (void)v_getrgb8fake6; - (void)v_getrgb8fake8; -} - - -/* Desc: set one palette entry - * - * In : index, R, G, B - * Out : - - * - * Note: color components are in range [0.0 .. 1.0] - */ -void -vl_setCI (int index, float red, float green, float blue) -{ - drv->setCI_f(index, red, green, blue); -} - - -/* Desc: set one palette entry - * - * In : color, R, G, B - * Out : - - * - * Note: - - */ -static void -fake_setcolor (int c, int r, int g, int b) -{ - VGAPalette[c] = 0xff000000 | (r<<16) | (g<<8) | b; - - drv->setCI_i(c, r, g, b); -} - - -/* Desc: build FakeColor palette - * - * In : CI precision in bits - * Out : - - * - * Note: - - */ -static void -fake_buildpalette (int bits) -{ - double c_r, c_g, c_b; - int r, g, b, color = 0; - - double max = (1 << bits) - 1; - - for (b = 0; b < B_CNT; ++b) { - for (g = 0; g < G_CNT; ++g) { - for (r = 0; r < R_CNT; ++r) { - c_r = 0.5 + (double)r * (max-R_BIAS) / (R_CNT-1.) + R_BIAS; - c_g = 0.5 + (double)g * (max-G_BIAS) / (G_CNT-1.) + G_BIAS; - c_b = 0.5 + (double)b * (max-B_BIAS) / (B_CNT-1.) + B_BIAS; - fake_setcolor(color++, (int)c_r, (int)c_g, (int)c_b); - } - } - } - - for (color = 0; color < 256; color++) { - c_r = (double)color * R_CNT / 256.; - c_g = (double)color * G_CNT / 256.; - c_b = (double)color * B_CNT / 256.; - array_r[color] = (int)c_r; - array_g[color] = (int)c_g; - array_b[color] = (int)c_b; - } -} - - -/* 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) { - /* are we forced to NUL driver? */ - if (getenv("DMESA_NULDRV")) { - if ((q = NUL.init()) != NULL) { - drv = &NUL; - } - return q; - } - /* 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 - * Out : 0 if success - * - * Note: - - */ -int -vl_sync_buffer (void **buffer, int x, int y, int width, int height) -{ - if ((/*XXX*/width & 7) || (x < 0) || (y < 0) || (x+width > video_mode->xres) || (y+height > video_mode->yres)) { - return -1; - } else { - void *newbuf = *buffer; - - if ((newbuf == NULL) || (vl_current_width != width) || (vl_current_height != height)) { - newbuf = realloc(newbuf, width * height * video_bypp); - } - - if (newbuf == NULL) { - return -2; - } - - vl_current_width = width; - vl_current_height = height; - vl_current_stride = vl_current_width * video_bypp; - vl_current_bytes = vl_current_stride * height; - - vl_current_offset = video_scanlen * y + video_bypp * x; - vl_current_delta = video_scanlen - vl_current_stride; - - vl_current_draw_buffer = vl_current_read_buffer = *buffer = newbuf; - return 0; - } -} - - -/* Desc: state retrieval - * - * In : name, storage - * Out : -1 for an error - * - * Note: - - */ -int -vl_get (int pname, int *params) -{ - switch (pname) { - case VL_GET_SCREEN_SIZE: - 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 != NULL) ? drv->get(pname, params) : -1; - } - return 0; -} - - -/* Desc: setup mode - * - * In : ptr to mode definition - * Out : 0 if success - * - * Note: - - */ -static int -vl_setup_mode (vl_mode *p) -{ - if (p == NULL) { - return -1; - } - - switch (p->bpp) { - case 8: - break; - case 15: - break; - case 16: - break; - case 24: - break; - case 32: - break; - default: - return -1; - } - - video_mode = p; - video_bypp = (p->bpp+7)/8; - video_scanlen = p->scanlen; - vl_video_selector = p->sel; - - return 0; -} - - -/* Desc: restore to the mode prior to first call to `vl_video_init'. - * - * In : - - * Out : - - * - * Note: - - */ -void -vl_video_exit (void) -{ - drv->restore(); - drv->fini(); - video_mode = NULL; -} - - -/* Desc: enter mode - * - * In : xres, yres, bits/pixel, RGB, refresh rate - * Out : pixel width in bits if success - * - * Note: - - */ -int -vl_video_init (int width, int height, int bpp, int rgb, int refresh, int fbbits) -{ - int fake; - vl_mode *p, *q; - unsigned int min; - - fake = 0; - if (!rgb) { - bpp = 8; - } else if (bpp == 8) { - fake = 1; - } - - /* initialize hardware */ - if ((q = v_init_hw()) == NULL) { - return 0; - } - - /* search for a mode that fits our request */ - for (min = -1, p = NULL; q->mode != 0xffff; q++) { - if ((q->xres >= width) && (q->yres >= height) && (q->bpp == bpp)) { - if (min >= (unsigned)(q->xres * q->yres)) { - min = q->xres * q->yres; - p = q; - } - } - } - - /* setup and enter mode */ - if ((vl_setup_mode(p) == 0) && (drv->entermode(p, refresh, fbbits) == 0)) { - vl_flip = drv->blit; - if (fake) { - drv->get(VL_GET_CI_PREC, (int *)(&min)); - fake_buildpalette(min); - init_tab_16_8(); - } - return bpp; - } - - /* abort */ - return 0; -} diff --git a/src/mesa/drivers/dos/video.h b/src/mesa/drivers/dos/video.h deleted file mode 100644 index e0841167429..00000000000 --- a/src/mesa/drivers/dos/video.h +++ /dev/null @@ -1,56 +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 for Mesa - * - * Author: Daniel Borca - * Email : dborca@users.sourceforge.net - * Web : http://www.geocities.com/dborca - */ - - -#ifndef VIDEO_H_included -#define VIDEO_H_included - -typedef int fixed; - -#define VL_GET_CARD_NAME 0x0100 -#define VL_GET_VRAM 0x0101 -#define VL_GET_CI_PREC 0x0200 -#define VL_GET_HPIXELS 0x0201 -#define VL_GET_SCREEN_SIZE 0x0202 -#define VL_GET_VIDEO_MODES 0x0300 - -extern void (*vl_flip) (void); - -void vl_setCI (int index, float red, float green, float blue); - -int vl_sync_buffer (void **buffer, int x, int y, int width, int height); -int vl_get (int pname, int *params); - -void vl_video_exit (void); -int vl_video_init (int width, int height, int bpp, int rgb, int refresh, int fbbits); - -#endif -- 2.30.2