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 */ 23556200c8Smrg/* $NetBSD: pnozz.h,v 1.3 2022/07/15 04:30:05 mrg Exp $ */ 24a6b33934Smacallan 25a6b33934Smacallan#ifndef PNOZZ_H 26a6b33934Smacallan#define PNOZZ_H 27a6b33934Smacallan 28a6b33934Smacallan#include "xf86.h" 29a6b33934Smacallan#include "xf86_OSproc.h" 30556200c8Smrg#if ABI_VIDEODRV_VERSION < SET_ABI_VERSION(25, 2) 31556200c8Smrg#include "xf86RamDac.h" 32556200c8Smrg#else 33556200c8Smrg#include "xf86Cursor.h" 34556200c8Smrg#endif 35a6b33934Smacallan#include <X11/Xmd.h> 36f55eacdeSjdc#include <dev/sun/fbio.h> 37a6b33934Smacallan#include "gcstruct.h" 38a6b33934Smacallan#include "pnozz_regs.h" 39a6b33934Smacallan#include "xf86sbusBus.h" 40f55eacdeSjdc#ifdef HAVE_XAA_H 41a6b33934Smacallan#include "xaa.h" 42f55eacdeSjdc#endif 43f55eacdeSjdc#include "exa.h" 44a6b33934Smacallan 45a6b33934Smacallantypedef struct { 46a6b33934Smacallan unsigned int fg, bg; /* FG/BG colors for stipple */ 47a6b33934Smacallan unsigned int patalign; /* X/Y alignment of bits */ 48a6b33934Smacallan unsigned int alu; /* Transparent/Opaque + rop */ 49a6b33934Smacallan unsigned int bits[32]; /* The stipple bits themselves */ 50a6b33934Smacallan} PnozzStippleRec, *PnozzStipplePtr; 51a6b33934Smacallan 52a6b33934Smacallantypedef struct { 53a6b33934Smacallan int type; 54a6b33934Smacallan PnozzStipplePtr stipple; 55a6b33934Smacallan} PnozzPrivGCRec, *PnozzPrivGCPtr; 56a6b33934Smacallan 57a6b33934Smacallantypedef struct { 58a6b33934Smacallan unsigned char *fb; /* 2MB framebuffer */ 59a6b33934Smacallan unsigned char *fbc; /* registers, so we can just add a byte offset */ 60a6b33934Smacallan int vclipmax; 61a6b33934Smacallan int width; 62a6b33934Smacallan int height, scanlinesize, maxheight; 63a6b33934Smacallan int depthshift; 64f55eacdeSjdc int vidmem; 65a6b33934Smacallan 66a6b33934Smacallan sbusDevicePtr psdp; 67f55eacdeSjdc struct fbcursor Cursor; 68a6b33934Smacallan Bool HWCursor; 69a6b33934Smacallan Bool NoAccel; 70f55eacdeSjdc Bool useXAA; 71a6b33934Smacallan CloseScreenProcPtr CloseScreen; 72a6b33934Smacallan 73a6b33934Smacallan xf86CursorInfoPtr CursorInfoRec; 74f55eacdeSjdc unsigned int CursorXY; 75f55eacdeSjdc int CursorBg, CursorFg; 76f55eacdeSjdc Bool CursorEnabled; 77f55eacdeSjdc unsigned int cursmask[32]; /* cursor mask bits */ 78f55eacdeSjdc unsigned int cursbits[32]; /* what to show where mask enabled */ 79a6b33934Smacallan unsigned char pal[9]; 80a6b33934Smacallan 81a6b33934Smacallan OptionInfoPtr Options; 82f55eacdeSjdc ExaDriverPtr pExa; 83f55eacdeSjdc int srcoff; 84f55eacdeSjdc#ifdef HAVE_XAA_H 85a6b33934Smacallan unsigned char *buffers[2]; 86f55eacdeSjdc#endif 87a6b33934Smacallan /* 88a6b33934Smacallan * XXX this is enough for everything a SPARCbook could do on it's 89a6b33934Smacallan * internal display but not necessarily for an external one 90a6b33934Smacallan */ 91a6b33934Smacallan CARD32 Buffer[6400]; 92a6b33934Smacallan int words, last_word; 93a6b33934Smacallan int offset_mask; 94a6b33934Smacallan 95a6b33934Smacallan int DidSave; 96a6b33934Smacallan unsigned int SvSysConf; /* System Configuration Register */ 97a6b33934Smacallan unsigned int CRTC[4]; /* CRTC values for horizontal timing */ 98a6b33934Smacallan unsigned int SvMemCtl; /* memory control register */ 99a6b33934Smacallan unsigned char SvDAC_MCCR; /* DAC Misc Clock Ctrl (0x02) */ 100a6b33934Smacallan unsigned char SvDAC_PF; /* DAC Pixel Format (0x0a) */ 101a6b33934Smacallan unsigned char SvDAC_MC3; /* DAC Misc Control 3 */ 102a6b33934Smacallan unsigned char SvVCO; /* DAC System PLL VCO divider */ 103a6b33934Smacallan unsigned char SvPLL; /* clock multiplier / divider */ 104a6b33934Smacallan 105a6b33934Smacallan} PnozzRec, *PnozzPtr; 106a6b33934Smacallan 107a6b33934Smacallanextern int PnozzScreenPrivateIndex; 108a6b33934Smacallanextern int PnozzGCPrivateIndex; 109a6b33934Smacallanextern int PnozzWindowPrivateIndex; 110a6b33934Smacallan 111a6b33934Smacallan#define GET_PNOZZ_FROM_SCRN(p) ((p->driverPrivate)) 112a6b33934Smacallan 113a6b33934Smacallan#define PnozzGetScreenPrivate(s) \ 114a6b33934Smacallan((PnozzPtr) (s)->devPrivates[PnozzScreenPrivateIndex].ptr) 115a6b33934Smacallan 116a6b33934Smacallan#define PnozzGetGCPrivate(g) \ 117a6b33934Smacallan((PnozzPrivGCPtr) (g)->devPrivates [PnozzGCPrivateIndex].ptr) 118a6b33934Smacallan 119a6b33934Smacallan#define PnozzGetWindowPrivate(w) \ 120a6b33934Smacallan((PnozzStipplePtr) (w)->devPrivates[PnozzWindowPrivateIndex].ptr) 121a6b33934Smacallan 122a6b33934Smacallan#define PnozzSetWindowPrivate(w,p) \ 123a6b33934Smacallan((w)->devPrivates[PnozzWindowPrivateIndex].ptr = (pointer) p) 124a6b33934Smacallan 125a6b33934Smacallanvoid pnozz_write_4(PnozzPtr, int, unsigned int); 126a6b33934Smacallanunsigned int pnozz_read_4(PnozzPtr, int); 127a6b33934Smacallanvoid pnozz_write_dac(PnozzPtr, int, unsigned char); 128a6b33934Smacallanunsigned char pnozz_read_dac(PnozzPtr, int); 129a6b33934Smacallanvoid pnozz_write_dac_ctl_reg(PnozzPtr, int, unsigned char); 130a6b33934Smacallanvoid pnozz_write_dac_ctl_reg_2(PnozzPtr, int, unsigned short); 131a6b33934Smacallanunsigned char pnozz_read_dac_ctl_reg(PnozzPtr, int); 132a6b33934Smacallanvoid pnozz_write_dac_cmap_reg(PnozzPtr, int, unsigned int); 133a6b33934Smacallan 134a6b33934Smacallanint PnozzAccelInit(ScrnInfoPtr); 135f55eacdeSjdcBool PnozzDGAInit(ScreenPtr); 136f55eacdeSjdcint PnozzEXAInit(ScreenPtr); 137a6b33934Smacallanvoid PnozzHideCursor(ScrnInfoPtr); 138a6b33934Smacallanvoid PnozzShowCursor(ScrnInfoPtr); 139a6b33934Smacallan 140f55eacdeSjdc#endif /* PNOZZ_H */ 141