newport.h revision 00bccce4
1ba0eab60Smacallan/*
2ba0eab60Smacallan * Id: newport.h,v 1.4 2000/11/29 20:58:10 agx Exp $
3ba0eab60Smacallan */
4ba0eab60Smacallan/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h,v 1.9 2002/09/30 22:17:55 alanh Exp $ */
5ba0eab60Smacallan
6ba0eab60Smacallan#ifndef __NEWPORT_H__
7ba0eab60Smacallan#define __NEWPORT_H__
8ba0eab60Smacallan
9ba0eab60Smacallan/* use 32bpp shadow framebuffer surface instead of 24bpp */
10ba0eab60Smacallan#define NEWPORT_USE32BPP
11ba0eab60Smacallan/* enable accel patch */
12ba0eab60Smacallan#define NEWPORT_ACCEL
13ba0eab60Smacallan
14ba0eab60Smacallan#ifdef NEWPORT_ACCEL
15ba0eab60Smacallan#ifndef NEWPORT_USE32BPP
16ba0eab60Smacallan#define NEWPORT_USE32BPP
17ba0eab60Smacallan#endif
18ba0eab60Smacallan#endif
19ba0eab60Smacallan
20ba0eab60Smacallan/*
21ba0eab60Smacallan * All drivers should include these:
22ba0eab60Smacallan */
23ba0eab60Smacallan#include "xf86.h"
24ba0eab60Smacallan#include "xf86_OSproc.h"
25ba0eab60Smacallan#include "compiler.h"
2600bccce4Smrg#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6
27ba0eab60Smacallan#include "xf86Resources.h"
2800bccce4Smrg#endif
29ba0eab60Smacallan
30ba0eab60Smacallan#include "xf86cmap.h"
31ba0eab60Smacallan
32ba0eab60Smacallan/* xaa & hardware cursor */
33ba0eab60Smacallan#include "xaa.h"
34ba0eab60Smacallan#include "xaalocal.h"
35ba0eab60Smacallan#include "xf86Cursor.h"
36ba0eab60Smacallan
37ba0eab60Smacallan/* register definitions of the Newport card */
38ba0eab60Smacallan#include "newport_regs.h"
39ba0eab60Smacallan
40c3c49246Smacallan#define NEWPORT_REGISTERS   0xf0000
41ba0eab60Smacallan#define NEWPORT_BASE_ADDR0  0x1f0f0000
42ba0eab60Smacallan#define NEWPORT_BASE_OFFSET 0x00400000
43ba0eab60Smacallan#define NEWPORT_MAX_BOARDS 4
44ba0eab60Smacallan
45ba0eab60Smacallan#if 0
46ba0eab60Smacallan# define DEBUG 1
47ba0eab60Smacallan#endif
48ba0eab60Smacallan
49ba0eab60Smacallan#ifdef DEBUG
50ba0eab60Smacallan# define TRACE_ENTER(str)       ErrorF("newport: " str " %d\n",pScrn->scrnIndex)
51ba0eab60Smacallan# define TRACE_EXIT(str)        ErrorF("newport: " str " done\n")
52ba0eab60Smacallan# define TRACE(str)             ErrorF("newport trace: " str "\n")
53ba0eab60Smacallan#else
54ba0eab60Smacallan# define TRACE_ENTER(str)
55ba0eab60Smacallan# define TRACE_EXIT(str)
56ba0eab60Smacallan# define TRACE(str)
57ba0eab60Smacallan#endif
58ba0eab60Smacallan
59ba0eab60Smacallantypedef struct {
60ba0eab60Smacallan	unsigned busID;
61ba0eab60Smacallan	int bitplanes;
62ba0eab60Smacallan	Bool NoAccel;
63ba0eab60Smacallan	/* revision numbers of the various pieces of silicon */
64ba0eab60Smacallan	unsigned int board_rev, cmap_rev, rex3_rev, xmap9_rev, bt445_rev;
65ba0eab60Smacallan	/* shadow copies of frequently used registers */
66ba0eab60Smacallan	NewportRegsPtr pNewportRegs;	/* Pointer to REX3 registers */
67ba0eab60Smacallan	npireg_t drawmode1;		/* REX3 drawmode1 common to all drawing operations */
68ba0eab60Smacallan	CARD16 vc2ctrl;                 /* VC2 control register */
69ba0eab60Smacallan
70ba0eab60Smacallan	/* ShadowFB stuff: */
71ba0eab60Smacallan	CARD32* ShadowPtr;
72ba0eab60Smacallan	unsigned long int ShadowPitch;
73ba0eab60Smacallan	unsigned int Bpp;		/* Bytes per pixel */
74ba0eab60Smacallan
75ba0eab60Smacallan	/* HWCursour stuff: */
76ba0eab60Smacallan	Bool hwCursor;
77ba0eab60Smacallan	xf86CursorInfoPtr CursorInfoRec;
78ba0eab60Smacallan	CARD16 curs_cmap_base;          /* MSB of the cursor's cmap */
79ba0eab60Smacallan
80ba0eab60Smacallan	/* wrapped funtions: */
81ba0eab60Smacallan	CloseScreenProcPtr  CloseScreen;
82ba0eab60Smacallan
83ba0eab60Smacallan	/* newport register backups: */
84ba0eab60Smacallan	npireg_t txt_drawmode0;		/* Rex3 drawmode0 register */
85ba0eab60Smacallan	npireg_t txt_drawmode1;		/* Rex3 drawmode1 register */
86ba0eab60Smacallan	npireg_t txt_wrmask;		/* Rex3 write mask register */
87ba0eab60Smacallan	npireg_t txt_smask1x;		/* Rex3 screen mask 1 registers */
88ba0eab60Smacallan	npireg_t txt_smask1y;
89ba0eab60Smacallan	npireg_t txt_smask2x;		/* Rex3 screen mask 2 registers */
90ba0eab60Smacallan	npireg_t txt_smask2y;
91ba0eab60Smacallan	npireg_t txt_clipmode;		/* Rex3 clip mode register */
92ba0eab60Smacallan
93ba0eab60Smacallan	CARD16 txt_vc2ctrl;             /* VC2 control register */
94ba0eab60Smacallan	CARD16 txt_vc2cur_x;            /* VC2 hw cursor x location */
95ba0eab60Smacallan	CARD16 txt_vc2cur_y;            /* VC2 hw cursor x location */
96ba0eab60Smacallan	CARD32  txt_vc2cur_data[64];    /* VC2 hw cursor glyph data */
97ba0eab60Smacallan
98ba0eab60Smacallan	CARD8  txt_xmap9_cfg0;		/* 0. Xmap9's control register */
99ba0eab60Smacallan	CARD8  txt_xmap9_cfg1;		/* 1. Xmap9's control register */
100ba0eab60Smacallan	CARD8  txt_xmap9_ccmsb;         /* cursor cmap msb */
101ba0eab60Smacallan	CARD8  txt_xmap9_mi;		/* Xmap9s' mode index register */
102ba0eab60Smacallan	CARD32 txt_xmap9_mod0;		/* Xmap9s' mode 0 register */
103ba0eab60Smacallan
104ba0eab60Smacallan	LOCO txt_colormap[256];
105ba0eab60Smacallan
106ba0eab60Smacallan	/* XAA stuff */
107ba0eab60Smacallan	XAAInfoRecPtr pXAAInfoRec;
108ba0eab60Smacallan        /* writing to these regs causes pipeline stall
109ba0eab60Smacallan	   so be smart and check the shadow before writing it */
110ba0eab60Smacallan	unsigned int shadow_drawmode1;
111ba0eab60Smacallan	unsigned int shadow_colorvram;
112ba0eab60Smacallan	unsigned int shadow_colorback;
113ba0eab60Smacallan	unsigned int shadow_xymove;
114ba0eab60Smacallan	unsigned int shadow_wrmask;
115ba0eab60Smacallan	unsigned int shadow_clipmode;
116ba0eab60Smacallan	unsigned int fifoleft; /* number of slots left in fifo */
117ba0eab60Smacallan
118ba0eab60Smacallan	unsigned int shadow_drawmode0;
119ba0eab60Smacallan	unsigned int shadow_colori;
120ba0eab60Smacallan	unsigned int shadow_smask0x;
121ba0eab60Smacallan	unsigned int shadow_smask0y;
122ba0eab60Smacallan
123ba0eab60Smacallan	unsigned int setup_drawmode0;
124ba0eab60Smacallan	unsigned int setup_drawmode1;
125ba0eab60Smacallan	unsigned char dashline_pat[2048/8];
126ba0eab60Smacallan	unsigned int dashline_patlen;
127ba0eab60Smacallan
128ba0eab60Smacallan	int clipsx, clipex, clipsy, clipey;
129ba0eab60Smacallan	int skipleft;
130ba0eab60Smacallan
131ba0eab60Smacallan	unsigned int pat8x8[8][8];
132ba0eab60Smacallan
133ba0eab60Smacallan	unsigned int (*Color2Planes)(unsigned int color);
134ba0eab60Smacallan
135ba0eab60Smacallan#ifdef RENDER
136ba0eab60Smacallan	unsigned int uTextureWidth;
137ba0eab60Smacallan	unsigned int uTextureHeight;
138ba0eab60Smacallan	unsigned int uTextureSize;
139ba0eab60Smacallan	unsigned int *pTexture;
140ba0eab60Smacallan	unsigned int uTextureFlags;
141ba0eab60Smacallan#endif
142ba0eab60Smacallan
143ba0eab60Smacallan	OptionInfoPtr Options;
144ba0eab60Smacallan} NewportRec, *NewportPtr;
145ba0eab60Smacallan
146ba0eab60Smacallan#define NEWPORTPTR(p) ((NewportPtr)((p)->driverPrivate))
147ba0eab60Smacallan#define NEWPORTREGSPTR(p) ((NEWPORTPTR(p))->pNewportRegs)
148ba0eab60Smacallan
149ba0eab60Smacallan/* Newport_regs.c */
150ba0eab60Smacallanunsigned short NewportVc2Get(NewportRegsPtr, unsigned char vc2Ireg);
151ba0eab60Smacallanvoid NewportVc2Set(NewportRegsPtr pNewportRegs, unsigned char vc2Ireg, unsigned short val);
152ba0eab60Smacallanvoid NewportWait(NewportRegsPtr pNewportRegs);
153ba0eab60Smacallanvoid NewportBfwait(NewportRegsPtr pNewportRegs);
154ba0eab60Smacallanvoid NewportXmap9SetModeRegister(NewportRegsPtr pNewportRegs, CARD8 address, CARD32 mode);
155ba0eab60SmacallanCARD32 NewportXmap9GetModeRegister(NewportRegsPtr pNewportRegs, unsigned chip, CARD8 address);
156ba0eab60Smacallanvoid NewportBackupRex3( ScrnInfoPtr pScrn);
157ba0eab60Smacallanvoid NewportRestoreRex3( ScrnInfoPtr pScrn);
158ba0eab60Smacallanvoid NewportBackupXmap9s( ScrnInfoPtr pScrn);
159ba0eab60Smacallanvoid NewportRestoreXmap9s( ScrnInfoPtr pScrn);
160ba0eab60Smacallanvoid NewportBackupVc2( ScrnInfoPtr pScrn);
161ba0eab60Smacallanvoid NewportRestoreVc2( ScrnInfoPtr pScrn);
162ba0eab60Smacallanvoid NewportBackupVc2Cursor( ScrnInfoPtr pScrn);
163ba0eab60Smacallanvoid NewportRestoreVc2Cursor( ScrnInfoPtr pScrn);
164ba0eab60Smacallan
165ba0eab60Smacallan/* newort_cmap.c */
166ba0eab60Smacallanvoid NewportLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
167ba0eab60Smacallan			LOCO* colors, VisualPtr pVisual);
168ba0eab60Smacallanvoid NewportRestorePalette(ScrnInfoPtr pScrn);
169ba0eab60Smacallanvoid NewportBackupPalette(ScrnInfoPtr pScrn);
170ba0eab60Smacallanvoid NewportCmapSetRGB( NewportRegsPtr pNewportRegs, unsigned short addr, LOCO color);
171ba0eab60Smacallan
172ba0eab60Smacallan/* newport_shadow.c */
173ba0eab60Smacallanvoid NewportRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
174ba0eab60Smacallanvoid NewportRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
175ba0eab60Smacallan
176ba0eab60Smacallan/* newport_cursor.c */
177ba0eab60SmacallanBool NewportHWCursorInit(ScreenPtr pScreen);
178ba0eab60Smacallanvoid NewportLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *bits);
179ba0eab60Smacallan
180ba0eab60Smacallan#endif /* __NEWPORT_H__ */
181