1/*
2 * Acceleration for the Leo (ZX) framebuffer - defines.
3 *
4 * Copyright (C) 1999, 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 LEO_H
25#define LEO_H
26
27#include "xf86.h"
28#include "xf86_OSproc.h"
29#include "xf86Cursor.h"
30#include <X11/Xmd.h>
31#include "gcstruct.h"
32#include "leo_regs.h"
33#include "xf86sbusBus.h"
34
35#include "compat-api.h"
36/* Various offsets in virtual (ie. mmap()) spaces Linux and Solaris support. */
37#define LEO_FB0_VOFF		0x00000000
38#define LEO_LC0_VOFF		0x00800000
39#define LEO_LD0_VOFF		0x00801000
40#define LEO_LX0_CURSOR_VOFF	0x00802000
41#define LEO_FB1_VOFF		0x00803000
42#define LEO_LC1_VOFF		0x01003000
43#define LEO_LD1			0x01004000
44#define LEO_LX0_VERT_VOFF	0x01005000
45#define LEO_LX_KRN_VOFF		0x01006000
46#define LEO_LC0_KRN_VOFF	0x01007000
47#define LEO_LC1_KRN_VOFF	0x01008000
48#define LEO_LD_GBL_VOFF		0x01009000
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} LeoStippleRec, *LeoStipplePtr;
56
57typedef struct {
58	int type;
59	LeoStipplePtr stipple;
60} LeoPrivGCRec, *LeoPrivGCPtr;
61
62typedef struct {
63	LeoCommand0	*lc0;
64	LeoDraw		*ld0;
65	LeoCursor	*dac;
66	unsigned	*fb;
67	int		vclipmax;
68	int		width;
69	int		height;
70	/* cache one stipple; figuring out if we can use the stipple is as hard as
71	 * computing it, so we just use this one and leave it here if it
72	 * can't be used this time
73	 */
74	LeoStipplePtr	tmpStipple;
75
76	sbusDevicePtr	psdp;
77	Bool		HWCursor;
78	Bool		NoAccel;
79	Bool		vtSema;
80	CloseScreenProcPtr CloseScreen;
81	xf86CursorInfoPtr CursorInfoRec;
82	unsigned char	CursorShiftX, CursorShiftY;
83	unsigned char	*CursorData;
84	OptionInfoPtr	Options;
85} LeoRec, *LeoPtr;
86
87#define GET_LEO_FROM_SCRN(p)    ((LeoPtr)((p)->driverPrivate))
88
89#if HAS_DEVPRIVATEKEYREC
90extern DevPrivateKeyRec LeoGCPrivateIndex;
91#else
92extern int LeoGCPrivateIndex;
93#endif
94
95#define LEO_OLDPRIV (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 4)
96#if LEO_OLDPRIV
97#define LeoGetGCPrivate(g) (g)->devPrivates[LeoGCPrivateIndex].ptr
98#else
99#define LeoGetGCPrivate(g) dixLookupPrivate(&(g)->devPrivates, &LeoGCPrivateIndex)
100#endif
101
102extern int leoRopTable[];
103
104#endif /* LEO_H */
105