cg6.h revision f1295e53
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 "xorg-server.h"
28#include "xf86.h"
29#include "xf86_OSproc.h"
30#include "xf86RamDac.h"
31#include <X11/Xmd.h>
32#include "gcstruct.h"
33#include "cg6_regs.h"
34#include "xf86sbusBus.h"
35#ifdef HAVE_XAA_H
36#include "xaa.h"
37#endif
38#include "exa.h"
39
40/* Various offsets in virtual (ie. mmap()) spaces Linux and Solaris support. */
41#define CG6_FBC_VOFF	0x70000000
42#define CG6_TEC_VOFF	0x70001000
43#define CG6_BTREGS_VOFF	0x70002000
44#define CG6_FHC_VOFF	0x70004000
45#define CG6_THC_VOFF	0x70005000
46#define CG6_ROM_VOFF	0x70006000
47#define CG6_RAM_VOFF	0x70016000
48#define CG6_DHC_VOFF	0x80000000
49
50typedef struct {
51	unsigned int fg, bg;			/* FG/BG colors for stipple */
52	unsigned int patalign;                  /* X/Y alignment of bits */
53        unsigned int alu;			/* Transparent/Opaque + rop */
54        unsigned int bits[32];                  /* The stipple bits themselves */
55} Cg6StippleRec, *Cg6StipplePtr;
56
57typedef struct {
58	int type;
59	Cg6StipplePtr stipple;
60} Cg6PrivGCRec, *Cg6PrivGCPtr;
61
62typedef struct {
63	unsigned char	*fb;
64	Cg6FbcPtr	fbc;
65	Cg6ThcPtr	thc;
66	int		vclipmax;
67	int		width;
68	int		height;
69	int		maxheight;
70	int		vidmem;
71
72	sbusDevicePtr	psdp;
73	Bool		HWCursor;
74	Bool		NoAccel;
75	Bool		useXAA;
76	CloseScreenProcPtr CloseScreen;
77	xf86CursorInfoPtr CursorInfoRec;
78	unsigned int	CursorXY;
79	int		CursorBg, CursorFg;
80	Bool		CursorEnabled;
81	OptionInfoPtr	Options;
82
83#ifdef HAVE_XAA_H
84        unsigned char	*buffers[1];
85        CARD32  	scanline[1024];
86        int             words_in_scanline, scan_x, scan_y, scan_xe;
87        XAAInfoRecPtr   pXAA;
88#endif
89        int             clipxa, clipxe;
90	ExaDriverPtr	pExa;
91	int		srcoff, fg;
92} Cg6Rec, *Cg6Ptr;
93
94extern int  Cg6ScreenPrivateIndex;
95extern int  Cg6GCPrivateIndex;
96extern int  Cg6WindowPrivateIndex;
97
98#define GET_CG6_FROM_SCRN(p)    ((Cg6Ptr)((p)->driverPrivate))
99
100#define Cg6GetScreenPrivate(s)						\
101((Cg6Ptr) (s)->devPrivates[Cg6ScreenPrivateIndex].ptr)
102
103#define Cg6GetGCPrivate(g)						\
104((Cg6PrivGCPtr) (g)->devPrivates [Cg6GCPrivateIndex].ptr)
105
106#define Cg6GetWindowPrivate(w)						\
107((Cg6StipplePtr) (w)->devPrivates[Cg6WindowPrivateIndex].ptr)
108
109#define Cg6SetWindowPrivate(w,p) 					\
110((w)->devPrivates[Cg6WindowPrivateIndex].ptr = (pointer) p)
111
112extern int cg6RopTable[];
113
114int CG6AccelInit(ScrnInfoPtr);
115Bool Cg6DGAInit(ScreenPtr);
116int CG6EXAInit(ScreenPtr);
117
118#endif /* CG6_H */
119