pnozz.h revision f55eacde
1a6b33934Smacallan/*
2a6b33934Smacallan * SBus Weitek P9100 driver - defines
3a6b33934Smacallan *
4a6b33934Smacallan * Copyright (C) 2005 Michael Lorenz
5a6b33934Smacallan *
6a6b33934Smacallan * Permission is hereby granted, free of charge, to any person obtaining a copy
7a6b33934Smacallan * of this software and associated documentation files (the "Software"), to deal
8a6b33934Smacallan * in the Software without restriction, including without limitation the rights
9a6b33934Smacallan * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10a6b33934Smacallan * copies of the Software, and to permit persons to whom the Software is
11a6b33934Smacallan * furnished to do so, subject to the following conditions:
12a6b33934Smacallan *
13a6b33934Smacallan * The above copyright notice and this permission notice shall be included in
14a6b33934Smacallan * all copies or substantial portions of the Software.
15a6b33934Smacallan *
16a6b33934Smacallan * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17a6b33934Smacallan * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18a6b33934Smacallan * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19a6b33934Smacallan * MICHAEL LORENZ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20a6b33934Smacallan * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21a6b33934Smacallan * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22a6b33934Smacallan */
23f55eacdeSjdc/* $NetBSD: pnozz.h,v 1.2 2021/05/27 04:48:10 jdc Exp $ */
24a6b33934Smacallan
25a6b33934Smacallan#ifndef PNOZZ_H
26a6b33934Smacallan#define PNOZZ_H
27a6b33934Smacallan
28a6b33934Smacallan#include "xf86.h"
29a6b33934Smacallan#include "xf86_OSproc.h"
30a6b33934Smacallan#include "xf86RamDac.h"
31a6b33934Smacallan#include <X11/Xmd.h>
32f55eacdeSjdc#include <dev/sun/fbio.h>
33a6b33934Smacallan#include "gcstruct.h"
34a6b33934Smacallan#include "pnozz_regs.h"
35a6b33934Smacallan#include "xf86sbusBus.h"
36f55eacdeSjdc#ifdef HAVE_XAA_H
37a6b33934Smacallan#include "xaa.h"
38f55eacdeSjdc#endif
39f55eacdeSjdc#include "exa.h"
40a6b33934Smacallan
41a6b33934Smacallantypedef struct {
42a6b33934Smacallan	unsigned int fg, bg;			/* FG/BG colors for stipple */
43a6b33934Smacallan	unsigned int patalign;                  /* X/Y alignment of bits */
44a6b33934Smacallan        unsigned int alu;			/* Transparent/Opaque + rop */
45a6b33934Smacallan        unsigned int bits[32];                  /* The stipple bits themselves */
46a6b33934Smacallan} PnozzStippleRec, *PnozzStipplePtr;
47a6b33934Smacallan
48a6b33934Smacallantypedef struct {
49a6b33934Smacallan	int type;
50a6b33934Smacallan	PnozzStipplePtr stipple;
51a6b33934Smacallan} PnozzPrivGCRec, *PnozzPrivGCPtr;
52a6b33934Smacallan
53a6b33934Smacallantypedef struct {
54a6b33934Smacallan	unsigned char	*fb;	/* 2MB framebuffer */
55a6b33934Smacallan	unsigned char	*fbc;	/* registers, so we can just add a byte offset */
56a6b33934Smacallan	int		vclipmax;
57a6b33934Smacallan	int		width;
58a6b33934Smacallan	int		height, scanlinesize, maxheight;
59a6b33934Smacallan	int		depthshift;
60f55eacdeSjdc	int		vidmem;
61a6b33934Smacallan
62a6b33934Smacallan	sbusDevicePtr	psdp;
63f55eacdeSjdc	struct fbcursor Cursor;
64a6b33934Smacallan	Bool		HWCursor;
65a6b33934Smacallan	Bool		NoAccel;
66f55eacdeSjdc	Bool		useXAA;
67a6b33934Smacallan	CloseScreenProcPtr CloseScreen;
68a6b33934Smacallan
69a6b33934Smacallan	xf86CursorInfoPtr CursorInfoRec;
70f55eacdeSjdc	unsigned int	CursorXY;
71f55eacdeSjdc	int		CursorBg, CursorFg;
72f55eacdeSjdc	Bool		CursorEnabled;
73f55eacdeSjdc	unsigned int	cursmask[32];	/* cursor mask bits */
74f55eacdeSjdc	unsigned int	cursbits[32];	/* what to show where mask enabled */
75a6b33934Smacallan	unsigned char pal[9];
76a6b33934Smacallan
77a6b33934Smacallan	OptionInfoPtr	Options;
78f55eacdeSjdc	ExaDriverPtr	pExa;
79f55eacdeSjdc	int		srcoff;
80f55eacdeSjdc#ifdef HAVE_XAA_H
81a6b33934Smacallan	unsigned char	*buffers[2];
82f55eacdeSjdc#endif
83a6b33934Smacallan	/*
84a6b33934Smacallan	 * XXX this is enough for everything a SPARCbook could do on it's
85a6b33934Smacallan	 * internal display but not necessarily for an external one
86a6b33934Smacallan	 */
87a6b33934Smacallan	CARD32		Buffer[6400];
88a6b33934Smacallan	int		words, last_word;
89a6b33934Smacallan	int		offset_mask;
90a6b33934Smacallan
91a6b33934Smacallan	int		DidSave;
92a6b33934Smacallan	unsigned int	SvSysConf;	/* System Configuration Register */
93a6b33934Smacallan	unsigned int	CRTC[4];	/* CRTC values for horizontal timing */
94a6b33934Smacallan	unsigned int	SvMemCtl;	/* memory control register */
95a6b33934Smacallan	unsigned char	SvDAC_MCCR;	/* DAC Misc Clock Ctrl (0x02) */
96a6b33934Smacallan	unsigned char	SvDAC_PF;	/* DAC Pixel Format (0x0a) */
97a6b33934Smacallan	unsigned char	SvDAC_MC3;	/* DAC Misc Control 3 */
98a6b33934Smacallan	unsigned char	SvVCO;		/* DAC System PLL VCO divider */
99a6b33934Smacallan	unsigned char	SvPLL;		/* clock multiplier / divider */
100a6b33934Smacallan
101a6b33934Smacallan} PnozzRec, *PnozzPtr;
102a6b33934Smacallan
103a6b33934Smacallanextern int  PnozzScreenPrivateIndex;
104a6b33934Smacallanextern int  PnozzGCPrivateIndex;
105a6b33934Smacallanextern int  PnozzWindowPrivateIndex;
106a6b33934Smacallan
107a6b33934Smacallan#define GET_PNOZZ_FROM_SCRN(p)    ((p->driverPrivate))
108a6b33934Smacallan
109a6b33934Smacallan#define PnozzGetScreenPrivate(s)						\
110a6b33934Smacallan((PnozzPtr) (s)->devPrivates[PnozzScreenPrivateIndex].ptr)
111a6b33934Smacallan
112a6b33934Smacallan#define PnozzGetGCPrivate(g)						\
113a6b33934Smacallan((PnozzPrivGCPtr) (g)->devPrivates [PnozzGCPrivateIndex].ptr)
114a6b33934Smacallan
115a6b33934Smacallan#define PnozzGetWindowPrivate(w)						\
116a6b33934Smacallan((PnozzStipplePtr) (w)->devPrivates[PnozzWindowPrivateIndex].ptr)
117a6b33934Smacallan
118a6b33934Smacallan#define PnozzSetWindowPrivate(w,p) 					\
119a6b33934Smacallan((w)->devPrivates[PnozzWindowPrivateIndex].ptr = (pointer) p)
120a6b33934Smacallan
121a6b33934Smacallanvoid pnozz_write_4(PnozzPtr, int, unsigned int);
122a6b33934Smacallanunsigned int pnozz_read_4(PnozzPtr, int);
123a6b33934Smacallanvoid pnozz_write_dac(PnozzPtr, int, unsigned char);
124a6b33934Smacallanunsigned char pnozz_read_dac(PnozzPtr, int);
125a6b33934Smacallanvoid pnozz_write_dac_ctl_reg(PnozzPtr, int, unsigned char);
126a6b33934Smacallanvoid pnozz_write_dac_ctl_reg_2(PnozzPtr, int, unsigned short);
127a6b33934Smacallanunsigned char pnozz_read_dac_ctl_reg(PnozzPtr, int);
128a6b33934Smacallanvoid pnozz_write_dac_cmap_reg(PnozzPtr, int, unsigned int);
129a6b33934Smacallan
130a6b33934Smacallanint PnozzAccelInit(ScrnInfoPtr);
131f55eacdeSjdcBool PnozzDGAInit(ScreenPtr);
132f55eacdeSjdcint PnozzEXAInit(ScreenPtr);
133a6b33934Smacallanvoid PnozzHideCursor(ScrnInfoPtr);
134a6b33934Smacallanvoid PnozzShowCursor(ScrnInfoPtr);
135a6b33934Smacallan
136f55eacdeSjdc#endif /* PNOZZ_H */
137