4
* Copyright � 2003-2004 Anders Carlsson
6
* Permission to use, copy, modify, distribute, and sell this software and its
7
* documentation for any purpose is hereby granted without fee, provided that
8
* the above copyright notice appear in all copies and that both that
9
* copyright notice and this permission notice appear in supporting
10
* documentation, and that the name of Anders Carlsson not be used in
11
* advertising or publicity pertaining to distribution of the software without
12
* specific, written prior permission. Anders Carlsson makes no
13
* representations about the suitability of this software for any purpose. It
14
* is provided "as is" without express or implied warranty.
16
* ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18
* EVENT SHALL ANDERS CARLSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
* PERFORMANCE OF THIS SOFTWARE.
31
#define MGA_REG_BASE(c) ((c)->attr.address[1])
32
#define MGA_REG_SIZE(c) (0x4000)
34
#define MGA_OUT32(mmio, a, v) (*(VOL32 *) ((mmio) + (a)) = (v))
35
#define MGA_IN32(mmio, a) (*(VOL32 *) ((mmio) + (a)))
37
#define MGA_REG_EXEC (0x0100)
38
#define MGA_REG_DWGCTL (0x1c00)
39
#define MGA_REG_PLNWT (0x1c1c)
40
#define MGA_REG_FCOL (0x1c24)
41
#define MGA_REG_MACCESS (0x1c04)
42
#define MGA_REG_SGN (0x1c58)
43
#define MGA_REG_AR0 (0x1c60)
44
#define MGA_REG_AR1 (0x1c64)
45
#define MGA_REG_AR2 (0x1c68)
46
#define MGA_REG_AR3 (0x1c6C)
47
#define MGA_REG_AR4 (0x1c70)
48
#define MGA_REG_AR5 (0x1c74)
49
#define MGA_REG_AR6 (0x1c78)
51
#define MGA_REG_CXBNDRY (0x1c80)
52
#define MGA_REG_FXBNDRY (0x1c84)
53
#define MGA_REG_YDSTLEN (0x1c88)
54
#define MGA_REG_PITCH (0x1c8c)
55
#define MGA_REG_YTOP (0x1c98)
56
#define MGA_REG_YBOT (0x1c9c)
57
#define MGA_REG_FIFOSTATUS (0x1e10)
58
#define MGA_REG_STATUS (0x1e14)
59
#define MGA_REG_CACHEFLUSH (0x1fff)
60
#define MGA_REG_SRCORG (0x2cb4)
61
#define MGA_REG_DSTORG (0x2cb8)
63
#define MGA_G4XX_DEVICE_ID (0x0525)
71
#define MGA_OPCOD_TRAP (4)
72
#define MGA_OPCOD_TEXTURE_TRAP (6)
73
#define MGA_OPCOD_BITBLT (8)
75
#define MGA_DWGCTL_SOLID (1 << 11)
76
#define MGA_DWGCTL_ARZERO (1 << 12)
77
#define MGA_DWGCTL_SGNZERO (1 << 13)
78
#define MGA_DWGCTL_SHIFTZERO (1 << 14)
80
#define MGA_DWGCTL_BFCOL (2 << 25)
82
#define MGA_ATYPE_RPL (0 << 4)
83
#define MGA_ATYPE_RSTR (1 << 4)
84
#define MGA_ATYPE_ZI (3 << 4)
85
#define MGA_ATYPE_BLK (4 << 4)
86
#define MGA_ATYPE_I (7 << 4)
88
typedef volatile CARD8 VOL8;
89
typedef volatile CARD16 VOL16;
90
typedef volatile CARD32 VOL32;
92
typedef struct _mgaCardInfo {
98
#define getMgaCardInfo(kd) ((MgaCardInfo *) ((kd)->card->driver))
99
#define mgaCardInfo(kd) MgaCardInfo *mgac = getMgaCardInfo(kd)
101
typedef struct _mgaScreenInfo {
102
VesaScreenPrivRec vesa;
104
KaaScreenInfoRec kaa;
110
#define getMgaScreenInfo(kd) ((MgaScreenInfo *) ((kd)->screen->driver))
111
#define mgaScreenInfo(kd) MgaScreenInfo *mgas = getMgaScreenInfo(kd)
118
mgaMapReg (KdCardInfo *card, MgaCardInfo *mgac);
121
mgaUnmapReg (KdCardInfo *card, MgaCardInfo *mgac);
124
mgaSetMMIO (KdCardInfo *card, MgaCardInfo *mgac);
127
mgaResetMMIO (KdCardInfo *card, MgaCardInfo *mgac);
130
mgaDrawSetup (ScreenPtr pScreen);
133
mgaDrawInit (ScreenPtr pScreen);
136
mgaDrawEnable (ScreenPtr pScreen);
139
mgaDrawDisable (ScreenPtr pScreen);
142
mgaDrawFini (ScreenPtr pScreen);
144
extern KdCardFuncs mgaFuncs;
148
mgaWaitAvail (int n);
154
mgaSetup (ScreenPtr pScreen, int dest_bpp, int wait);
158
#define MGA_FALLBACK(x) \
164
#define MGA_FALLBACK(x) return FALSE;