Small optimization for big-endian (e.g., PowerPC) systems.
[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 SILICON INTEGRATED SYSTEMS CORP 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 <stdlib.h>
50 # include <string.h>
51 typedef struct _Box
52 {
53 short x1, y1, x2, y2;
54 }
55 BoxRec;
56 #define NullBox ((BoxPtr)0)
57 typedef struct _Box *BoxPtr;
58 #endif /* GLX_DIRECT_RENDERING */
59
60 /* BitBlt Commands */
61 #define CMD0_DD_ENABLE 0x06
62 #define CMD0_SRC_VIDEO 0x00
63 #define CMD0_SRC_CPU 0x10
64 #define CMD0_PAT_FG_COLOR 0x00
65 #define CMD1_DIR_X_DEC 0x00
66 #define CMD1_DIR_X_INC 0x01
67 #define CMD1_DIR_Y_DEC 0x00
68 #define CMD1_DIR_Y_INC 0x02
69 #define REG_SRC_ADDR 0x8200
70 #define REG_CMD0 0x823c
71
72 typedef struct
73 {
74 GLshort wSrcPitch;
75 GLshort wDestPitch;
76 }
77 _PITCH;
78 typedef struct
79 {
80 GLshort wWidth;
81 GLshort wHeight;
82 }
83 _DIM;
84 typedef struct
85 {
86 GLshort wY;
87 GLshort wX;
88 }
89 _POS;
90
91 typedef struct
92 {
93 GLubyte cCmd0;
94 GLubyte cRop;
95 GLubyte cCmd1;
96 GLubyte cReserved;
97 }
98 _CMD;
99
100 typedef struct
101 {
102 GLshort wStatus0;
103 GLbyte cStatus0_GLbyte3;
104 GLbyte cStatus0_GLbyte4;
105 }
106 _CMDQUESTATUS;
107
108 typedef struct
109 {
110 GLint dwSrcBaseAddr;
111 GLint dwSrcPitch;
112 _POS stdwSrcPos;
113 _POS stdwDestPos;
114 GLint dwDestBaseAddr;
115 GLshort wDestPitch;
116 GLshort wDestHeight;
117 _DIM stdwDim;
118 GLint dwFgRopColor;
119 GLint dwBgRopColor;
120 GLint dwSrcHiCKey;
121 GLint dwSrcLoCKey;
122 GLint dwMaskA;
123 GLint dwMaskB;
124 GLint dwClipA;
125 GLint dwClipB;
126 _CMD stdwCmd;
127 _CMDQUESTATUS stdwCmdQueStatus;
128 }
129 ENGPACKET, *LPENGPACKET;
130
131 /* Hardware Info */
132 #include "sis_reg.h"
133
134 /* HW capability */
135 #define SIS_MAX_TEXTURE_SIZE 2048
136 #define SIS_MAX_TEXTURES 2
137
138 #define SIS_MAX_FRAME_LENGTH 3
139
140 GLint doFPtoFixedNoRound( GLfloat dwInValue, int nFraction );
141
142 #endif