cg6.h revision 185b32ea
1/*
2 * GX and Turbo GX framebuffer - defines.
3 *
4 * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com)
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19 * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24#ifndef CG6_H
25#define CG6_H
26
27#include "xf86.h"
28#include "xf86_OSproc.h"
29#include "xf86RamDac.h"
30#include <X11/Xmd.h>
31#include "gcstruct.h"
32#include "cg6_regs.h"
33#include "xf86sbusBus.h"
34#ifdef HAVE_XAA_H
35#include "xaa.h"
36#endif
37#include "exa.h"
38
39/* Various offsets in virtual (ie. mmap()) spaces Linux and Solaris support. */
40#define CG6_FBC_VOFF	0x70000000
41#define CG6_TEC_VOFF	0x70001000
42#define CG6_BTREGS_VOFF	0x70002000
43#define CG6_FHC_VOFF	0x70004000
44#define CG6_THC_VOFF	0x70005000
45#define CG6_ROM_VOFF	0x70006000
46#define CG6_RAM_VOFF	0x70016000
47#define CG6_DHC_VOFF	0x80000000
48
49typedef struct {
50	unsigned int fg, bg;			/* FG/BG colors for stipple */
51	unsigned int patalign;                  /* X/Y alignment of bits */
52        unsigned int alu;			/* Transparent/Opaque + rop */
53        unsigned int bits[32];                  /* The stipple bits themselves */
54} Cg6StippleRec, *Cg6StipplePtr;
55
56typedef struct {
57	int type;
58	Cg6StipplePtr stipple;
59} Cg6PrivGCRec, *Cg6PrivGCPtr;
60
61typedef struct {
62	unsigned char	*fb;
63	Cg6FbcPtr	fbc;
64	Cg6ThcPtr	thc;
65	int		vclipmax;
66	int		width;
67	int		height;
68	int		maxheight;
69	int		vidmem;
70
71	sbusDevicePtr	psdp;
72	Bool		HWCursor;
73	Bool		NoAccel;
74	Bool		useXAA;
75	CloseScreenProcPtr CloseScreen;
76	xf86CursorInfoPtr CursorInfoRec;
77	unsigned int	CursorXY;
78	int		CursorBg, CursorFg;
79	Bool		CursorEnabled;
80	OptionInfoPtr	Options;
81
82#ifdef HAVE_XAA_H
83        unsigned char	*buffers[1];
84        CARD32  	scanline[1024];
85        int             words_in_scanline, scan_x, scan_y, scan_xe;
86        XAAInfoRecPtr   pXAA;
87#endif
88        int             clipxa, clipxe;
89	ExaDriverPtr	pExa;
90	int		srcoff, fg;
91} Cg6Rec, *Cg6Ptr;
92
93extern int  Cg6ScreenPrivateIndex;
94extern int  Cg6GCPrivateIndex;
95extern int  Cg6WindowPrivateIndex;
96
97#define GET_CG6_FROM_SCRN(p)    ((Cg6Ptr)((p)->driverPrivate))
98
99#define Cg6GetScreenPrivate(s)						\
100((Cg6Ptr) (s)->devPrivates[Cg6ScreenPrivateIndex].ptr)
101
102#define Cg6GetGCPrivate(g)						\
103((Cg6PrivGCPtr) (g)->devPrivates [Cg6GCPrivateIndex].ptr)
104
105#define Cg6GetWindowPrivate(w)						\
106((Cg6StipplePtr) (w)->devPrivates[Cg6WindowPrivateIndex].ptr)
107
108#define Cg6SetWindowPrivate(w,p) 					\
109((w)->devPrivates[Cg6WindowPrivateIndex].ptr = (pointer) p)
110
111extern int cg6RopTable[];
112
113int CG6AccelInit(ScrnInfoPtr);
114Bool Cg6DGAInit(ScreenPtr);
115int CG6EXAInit(ScreenPtr);
116
117#endif /* CG6_H */
118