First import
[xorg_rtime.git] / xorg-server-1.4 / hw / kdrive / neomagic / neomagic.h
blob9b100051b9c79d90bd6cc4f90a4e9a112fe55f5b
1 /*
3 * Copyright © 2004 Franco Catrin
5 * Permission to use, copy, modify, distribute, and sell this software and its
6 * documentation for any purpose is hereby granted without fee, provided that
7 * the above copyright notice appear in all copies and that both that
8 * copyright notice and this permission notice appear in supporting
9 * documentation, and that the name of Franco Catrin not be used in
10 * advertising or publicity pertaining to distribution of the software without
11 * specific, written prior permission. Franco Catrin makes no
12 * representations about the suitability of this software for any purpose. It
13 * is provided "as is" without express or implied warranty.
15 * FRANCO CATRIN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17 * EVENT SHALL FRANCO CATRIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21 * PERFORMANCE OF THIS SOFTWARE.
24 #ifndef _NEOMAGIC_H_
25 #define _NEOMAGIC_H_
26 #include <backend.h>
27 #include "kxv.h"
28 #include "klinux.h"
29 #include "vesa.h"
32 #define DBGOUT DebugF
34 #define ENTER() DBGOUT("Enter %s\n", __FUNCTION__)
35 #define LEAVE() DBGOUT("Leave %s\n", __FUNCTION__)
37 #define NEO_VENDOR 0x10c8
38 #define CAP_NM2070 0x01 /* If it's a NM2070 series */
39 #define CAP_NM2090 0x02 /* If it's a NM2090 series */
40 #define CAP_NM2097 0x03 /* If it's a NM2097 series */
41 #define CAP_NM2200 0x04 /* If it's a NM2200 series */
43 #define NEO_BS0_BLT_BUSY 0x00000001
44 #define NEO_BS0_FIFO_AVAIL 0x00000002
45 #define NEO_BS0_FIFO_PEND 0x00000004
47 #define NEO_BC0_DST_Y_DEC 0x00000001
48 #define NEO_BC0_X_DEC 0x00000002
49 #define NEO_BC0_SRC_TRANS 0x00000004
50 #define NEO_BC0_SRC_IS_FG 0x00000008
51 #define NEO_BC0_SRC_Y_DEC 0x00000010
52 #define NEO_BC0_FILL_PAT 0x00000020
53 #define NEO_BC0_SRC_MONO 0x00000040
54 #define NEO_BC0_SYS_TO_VID 0x00000080
56 #define NEO_BC1_DEPTH8 0x00000100
57 #define NEO_BC1_DEPTH16 0x00000200
58 #define NEO_BC1_X_320 0x00000400
59 #define NEO_BC1_X_640 0x00000800
60 #define NEO_BC1_X_800 0x00000c00
61 #define NEO_BC1_X_1024 0x00001000
62 #define NEO_BC1_X_1152 0x00001400
63 #define NEO_BC1_X_1280 0x00001800
64 #define NEO_BC1_X_1600 0x00001c00
65 #define NEO_BC1_DST_TRANS 0x00002000
66 #define NEO_BC1_MSTR_BLT 0x00004000
67 #define NEO_BC1_FILTER_Z 0x00008000
69 #define NEO_BC2_WR_TR_DST 0x00800000
71 #define NEO_BC3_SRC_XY_ADDR 0x01000000
72 #define NEO_BC3_DST_XY_ADDR 0x02000000
73 #define NEO_BC3_CLIP_ON 0x04000000
74 #define NEO_BC3_FIFO_EN 0x08000000
75 #define NEO_BC3_BLT_ON_ADDR 0x10000000
76 #define NEO_BC3_SKIP_MAPPING 0x80000000
78 #define NEO_MODE1_DEPTH8 0x0100
79 #define NEO_MODE1_DEPTH16 0x0200
80 #define NEO_MODE1_DEPTH24 0x0300
81 #define NEO_MODE1_X_320 0x0400
82 #define NEO_MODE1_X_640 0x0800
83 #define NEO_MODE1_X_800 0x0c00
84 #define NEO_MODE1_X_1024 0x1000
85 #define NEO_MODE1_X_1152 0x1400
86 #define NEO_MODE1_X_1280 0x1800
87 #define NEO_MODE1_X_1600 0x1c00
88 #define NEO_MODE1_BLT_ON_ADDR 0x2000
90 typedef volatile CARD8 VOL8;
91 typedef volatile CARD16 VOL16;
92 typedef volatile CARD32 VOL32;
94 #define NEO_REG_SIZE(c) (0x200000L)
96 typedef volatile struct {
97 CARD32 bltStat;
98 CARD32 bltCntl;
99 CARD32 xpColor;
100 CARD32 fgColor;
101 CARD32 bgColor;
102 CARD32 pitch;
103 CARD32 clipLT;
104 CARD32 clipRB;
105 CARD32 srcBitOffset;
106 CARD32 srcStart;
107 CARD32 reserved0;
108 CARD32 dstStart;
109 CARD32 xyExt;
111 CARD32 reserved1[19];
113 CARD32 pageCntl;
114 CARD32 pageBase;
115 CARD32 postBase;
116 CARD32 postPtr;
117 CARD32 dataPtr;
118 } NeoMMIO;
120 typedef struct _neoCardInfo {
121 VesaCardPrivRec backendCard;
123 CARD32 reg_base;
124 NeoMMIO *mmio;
125 int dstOrg;
126 int dstPitch;
127 int dstPixelWidth;
129 int srcOrg;
130 int srcPitch;
131 int srcPixelWidth;
133 struct NeoChipInfo *chip;
135 CARD32 bltCntl;
137 } NeoCardInfo;
139 struct NeoChipInfo {
140 CARD16 vendor;
141 CARD16 device;
142 CARD8 caps;
143 char *name;
144 int videoRam;
145 int maxClock;
146 int cursorMem;
147 int cursorOff;
148 int linearSize;
149 int maxWidth;
150 int maxHeight;
153 #define getNeoCardInfo(kd) ((NeoCardInfo *) ((kd)->card->driver))
154 #define neoCardInfo(kd) NeoCardInfo *neoc = getNeoCardInfo(kd)
156 typedef struct _neoScreenInfo {
157 VesaScreenPrivRec backendScreen;
159 CARD8 *screen;
160 CARD8 *off_screen;
161 int off_screen_size;
162 int pitch;
163 int depth;
164 KdVideoAdaptorPtr pAdaptor;
165 KaaScreenInfoRec kaa;
166 } NeoScreenInfo;
168 #define getNeoScreenInfo(kd) ((NeoScreenInfo *) ((kd)->screen->driver))
169 #define neoScreenInfo(kd) NeoScreenInfo *neos = getNeoScreenInfo(kd)
171 #define SetupNeo(s) KdScreenPriv(s); \
172 neoCardInfo(pScreenPriv); \
173 neoScreenInfo(pScreenPriv);
175 void
176 neoPreserve (KdCardInfo *card);
178 Bool
179 neoEnable (ScreenPtr pScreen);
181 void
182 neoDisable (ScreenPtr pScreen);
184 Bool
185 neoMapReg (KdCardInfo *card, NeoCardInfo *nvidiac);
187 void
188 neoUnmapReg (KdCardInfo *card, NeoCardInfo *nvidiac);
190 CARD8
191 neoGetIndex (NeoCardInfo *nvidiac, CARD16 addr, CARD8 id);
193 void
194 neoSetIndex (NeoCardInfo *nvidiac, CARD16 addr, CARD8 id, CARD8 val);
196 Bool
197 neoDrawInit (ScreenPtr pScreen);
199 void
200 neoDrawEnable (ScreenPtr pScreen);
202 void
203 neoDrawDisable (ScreenPtr pScreen);
205 void
206 neoDrawFini (ScreenPtr pScreen);
208 extern KdCardFuncs neoFuncs;
210 #endif /* _NEOMAGIC_H_ */