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