1#ifndef _VTYPES_H_
2#define _VTYPES_H_
3
4
5
6/*
7 * includes
8 */
9
10#include <X11/Xmd.h>
11#include "xf86Pci.h"
12
13#ifdef XSERVER_LIBPCIACCESS
14#include <pciaccess.h>
15#endif
16
17/*
18 * defines
19 */
20
21/* chip types */
22#define V1000_DEVICE            0x0001
23#define V2000_DEVICE            0x2000
24
25/* Size of microcode */
26#define MC_SIZE                 0x10000
27
28
29#define XSERVER
30
31
32
33/*
34 * typedefs
35 */
36
37/* generic type definitions for central services */
38typedef CARD32 vu32;
39typedef CARD16 vu16;
40typedef CARD8  vu8;
41typedef INT32 vs32;
42typedef INT16 vs16;
43typedef INT8  vs8;
44
45typedef enum {
46    V_PIXFMT_DSTFMT=0,
47    V_PIXFMT_332=1,       /**/
48#define V_PIXFMT_233 V_PIXFMT_332
49    V_PIXFMT_8I=2,        /**/
50    V_PIXFMT_8A=3,
51    V_PIXFMT_565=4,       /**/
52    V_PIXFMT_4444=5,      /**/
53    V_PIXFMT_1555=6,      /**/
54    /* 7 reserved */
55    V_PIXFMT_4I_565=8,
56    V_PIXFMT_4I_4444=9,
57    V_PIXFMT_4I_1555=10,
58    /* 11 reserved */
59    V_PIXFMT_8888=12,     /**/
60    V_PIXFMT_Y0CRY1CB=13
61#define V_PIXFMT_Y0CBY1CR V_PIXFMT_Y0CRY1CB
62    /* 14 reserved */
63    /* 15 reserved */
64} vpixfmt;
65
66
67
68/*
69 * structs
70 */
71
72struct verite_modeinfo_t {
73    int clock;              /* pixel clock */
74    int hdisplay;           /* horizontal timing */
75    int hsyncstart;
76    int hsyncend;
77    int htotal;
78    int hskew;
79    int vdisplay;           /* vertical timing */
80    int vsyncstart;
81    int vsyncend;
82    int vtotal;
83    int screenwidth;        /* further mode information */
84    int virtualwidth;
85    int screenheight;
86    int virtualheight;
87    int bitsperpixel;
88    int hsynchi;
89    int vsynchi;
90    int pixelformat;        /* set by the mode init routines */
91    int fifosize;
92    int flags;              /* additional information like interlace etc */
93    vu8 pll_n;
94    vu8 pll_m;
95    vu8 pll_p;
96    vu8 refresh;
97    vu8 doubleclock;
98    vu16 stride0;
99    vu16 stride1;
100};
101
102typedef struct _renditionRegs {
103    CARD8 mode;
104    CARD8 memendian;
105    CARD32 sclkpll;
106    CARD32 dramctl;
107    CARD8 plldev;
108    CARD32 pclkpll;
109    CARD8 daccmd0;
110    CARD8 daccmd1;
111    CARD8 daccmd2;
112    CARD8 daccmd3;
113    CARD32 crtch;
114    CARD32 crtcv;
115    CARD32 vbasea;
116    CARD32 crtcoff;
117    CARD32 crtcctl;
118} RenditionRegRec, *RenditionRegPtr;
119
120/* structure describing the Verite board and its functionality */
121struct verite_board_t {
122    /* type of chip */
123    vu16  chip;
124
125    /* */
126    unsigned long io_base, vgaio_base;
127    vu32 mmio_base;
128    vu32 vmmio_base;
129    vu32 mem_size;
130    vu8 *mem_base;
131    vu8 *vmem_base;
132    Bool init;
133
134    /* */
135    vu32 csucode_base;
136    vu32 ucode_base;
137    vu32 ucode_entry;
138    vu32 cursor_base;
139
140    int Rop;
141    int Color;
142
143    /* mode information */
144    struct verite_modeinfo_t mode;
145
146    /* saved text mode settings */
147    vu8 cursor_hi;
148    vu8 cursor_low;
149    vu8 offset_hi;
150    vu8 offset_low;
151    vu8 *scr_contents;
152
153    Bool hwcursor_used;     /* Is HW-cursor used? */
154    vu16 hwcursor_vmemsize; /* How much videomem does it use */
155    vu32 hwcursor_membase;  /* videomem adress for V2K-cursor */
156                            /* Has to be on 1024-byte boundry */
157
158    vu32 fbOffset;          /* Currently busy fb-memory marker */
159    Bool overclock_mem;     /* Memory overclock ? */
160
161    Bool shadowfb;          /* Use ShadowFB ? */
162    vu8 *shadowPtr;
163    vu32 shadowPitch;
164    void (*PointerMoved)(SCRN_ARG_TYPE arg, int x, int y);
165
166    int rotate;             /* Rotate clockwise or counterclockwise */
167
168    vu8 ucode_buffer[MC_SIZE]; /* Space for microcode, when not needed */
169};
170
171
172/*
173 * This structure is used to wrap the screen's CloseScreen vector.
174 */
175typedef struct _renditionRec
176{
177    struct verite_board_t board;        /* information on the board */
178    struct verite_modeinfo_t mode;      /* information on the mode */
179#ifdef XSERVER_LIBPCIACCESS
180    struct pci_device * PciInfo;
181#else
182    PCITAG pcitag;                      /* tag for the PCI config space */
183    pciVideoPtr PciInfo;                /* PCI config data */
184#endif
185    EntityInfoPtr pEnt;                 /* entity information */
186    CloseScreenProcPtr CloseScreen;     /* wrap CloseScreen */
187    xf86CursorInfoPtr CursorInfoRec;    /* Cursor data */
188#ifdef HAVE_XAA_H
189    XAAInfoRecPtr AccelInfoRec;         /* Needed for XAA */
190#endif
191    OptionInfoPtr Options;
192    RenditionRegRec saveRegs;
193} renditionRec, *renditionPtr;
194
195#define RENDITIONPTR(p)     ((renditionPtr)((p)->driverPrivate))
196
197#endif /* #ifndef _VTYPES_H_ */
198
199/*
200 * end of file vtypes.h
201 */
202