add the SiS driver - no kernel driver yet
[mesa.git] / src / mesa / drivers / dri / sis / sis_common2.h
1 /**************************************************************************
2
3 Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
4 All Rights Reserved.
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the
8 "Software"), to deal in the Software without restriction, including
9 without limitation the rights to use, copy, modify, merge, publish,
10 distribute, sub license, and/or sell copies of the Software, and to
11 permit persons to whom the Software is furnished to do so, subject to
12 the following conditions:
13
14 The above copyright notice and this permission notice (including the
15 next paragraph) shall be included in all copies or substantial portions
16 of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
22 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
26 **************************************************************************/
27 /* $XFree86: xc/lib/GL/mesa/src/drv/sis/sis_common.h,v 1.5 2000/09/26 15:56:48 tsi Exp $ */
28
29 /*
30 * Authors:
31 * Sung-Ching Lin <sclin@sis.com.tw>
32 */
33
34 #ifndef _sis_common_h_
35 #define _sis_common_h_
36
37 #if 0
38 #define free(x)
39 #define calloc(x,y) sis_debug_malloc((x)*(y))
40 extern void *sis_debug_malloc(int x);
41 #endif
42
43 #if defined(SIS_DUMP)
44 #include "sis_debug.h"
45 #endif
46
47 #ifdef GLX_DIRECT_RENDERING
48 # include <stdio.h>
49 # include <unistd.h>
50 # include <stdlib.h>
51 # include <string.h>
52 typedef struct _Box
53 {
54 short x1, y1, x2, y2;
55 }
56 BoxRec;
57 #define NullBox ((BoxPtr)0)
58 typedef struct _Box *BoxPtr;
59 #endif /* GLX_DIRECT_RENDERING */
60
61 /* BitBlt Commands */
62 #define CMD0_DD_ENABLE 0x06
63 #define CMD0_SRC_VIDEO 0x00
64 #define CMD0_SRC_CPU 0x10
65 #define CMD0_PAT_FG_COLOR 0x00
66 #define CMD1_DIR_X_DEC 0x00
67 #define CMD1_DIR_X_INC 0x01
68 #define CMD1_DIR_Y_DEC 0x00
69 #define CMD1_DIR_Y_INC 0x02
70 #define REG_SRC_ADDR 0x8200
71 #define REG_CMD0 0x823c
72
73 typedef struct
74 {
75 GLshort wSrcPitch;
76 GLshort wDestPitch;
77 }
78 _PITCH;
79 typedef struct
80 {
81 GLshort wWidth;
82 GLshort wHeight;
83 }
84 _DIM;
85 typedef struct
86 {
87 GLshort wY;
88 GLshort wX;
89 }
90 _POS;
91
92 typedef struct
93 {
94 GLubyte cCmd0;
95 GLubyte cRop;
96 GLubyte cCmd1;
97 GLubyte cReserved;
98 }
99 _CMD;
100
101 typedef struct
102 {
103 GLshort wStatus0;
104 GLbyte cStatus0_GLbyte3;
105 GLbyte cStatus0_GLbyte4;
106 }
107 _CMDQUESTATUS;
108
109 typedef struct
110 {
111 GLint dwSrcBaseAddr;
112 GLint dwSrcPitch;
113 _POS stdwSrcPos;
114 _POS stdwDestPos;
115 GLint dwDestBaseAddr;
116 GLshort wDestPitch;
117 GLshort wDestHeight;
118 _DIM stdwDim;
119 GLint dwFgRopColor;
120 GLint dwBgRopColor;
121 GLint dwSrcHiCKey;
122 GLint dwSrcLoCKey;
123 GLint dwMaskA;
124 GLint dwMaskB;
125 GLint dwClipA;
126 GLint dwClipB;
127 _CMD stdwCmd;
128 _CMDQUESTATUS stdwCmdQueStatus;
129 }
130 ENGPACKET, *LPENGPACKET;
131
132 /* Hardware Info */
133 #include "sis_reg.h"
134
135 /* HW capability */
136 #define SIS_MAX_TEXTURE_SIZE 2048
137 #define SIS_MAX_TEXTURES 2
138
139 #define SIS_MAX_FRAME_LENGTH 3
140
141 GLint doFPtoFixedNoRound( GLfloat dwInValue, int nFraction );
142
143 #endif