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