summaryrefslogtreecommitdiff
path: root/src/vtypes.h
blob: 257870bdfd8ac2b5629423f33d561cda23454047 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#ifndef _VTYPES_H_
#define _VTYPES_H_



/*
 * includes
 */

#include <X11/Xmd.h>
#include "xf86Pci.h"

#ifdef XSERVER_LIBPCIACCESS
#include <pciaccess.h>
#endif

/*
 * defines
 */

/* chip types */
#define V1000_DEVICE            0x0001
#define V2000_DEVICE            0x2000

/* Size of microcode */
#define MC_SIZE                 0x10000


#define XSERVER



/*
 * typedefs
 */

/* generic type definitions for central services */
typedef CARD32 vu32;
typedef CARD16 vu16;
typedef CARD8  vu8;
typedef INT32 vs32;
typedef INT16 vs16;
typedef INT8  vs8;

typedef enum {
    V_PIXFMT_DSTFMT=0,
    V_PIXFMT_332=1,       /**/
#define V_PIXFMT_233 V_PIXFMT_332
    V_PIXFMT_8I=2,        /**/
    V_PIXFMT_8A=3,
    V_PIXFMT_565=4,       /**/
    V_PIXFMT_4444=5,      /**/
    V_PIXFMT_1555=6,      /**/
    /* 7 reserved */
    V_PIXFMT_4I_565=8,
    V_PIXFMT_4I_4444=9,
    V_PIXFMT_4I_1555=10,
    /* 11 reserved */
    V_PIXFMT_8888=12,     /**/
    V_PIXFMT_Y0CRY1CB=13
#define V_PIXFMT_Y0CBY1CR V_PIXFMT_Y0CRY1CB
    /* 14 reserved */
    /* 15 reserved */
} vpixfmt;



/*
 * structs
 */

struct verite_modeinfo_t {
    int clock;              /* pixel clock */
    int hdisplay;           /* horizontal timing */
    int hsyncstart;
    int hsyncend;
    int htotal;
    int hskew;
    int vdisplay;           /* vertical timing */
    int vsyncstart;
    int vsyncend;
    int vtotal;
    int screenwidth;        /* further mode information */
    int virtualwidth;
    int screenheight;
    int virtualheight;
    int bitsperpixel;
    int hsynchi;
    int vsynchi;
    int pixelformat;        /* set by the mode init routines */
    int fifosize;
    int flags;              /* additional information like interlace etc */
    vu8 pll_n;
    vu8 pll_m;
    vu8 pll_p;
    vu8 refresh;
    vu8 doubleclock;
    vu16 stride0;
    vu16 stride1;
};

typedef struct _renditionRegs {
    CARD8 mode;
    CARD8 memendian;
    CARD32 sclkpll;
    CARD32 dramctl;
    CARD8 plldev;
    CARD32 pclkpll;
    CARD8 daccmd0;
    CARD8 daccmd1;
    CARD8 daccmd2;
    CARD8 daccmd3;
    CARD32 crtch;
    CARD32 crtcv;
    CARD32 vbasea;
    CARD32 crtcoff;
    CARD32 crtcctl;
} RenditionRegRec, *RenditionRegPtr;

/* structure describing the Verite board and its functionality */
struct verite_board_t {
    /* type of chip */
    vu16  chip;

    /* */
    IOADDRESS io_base, vgaio_base;
    vu32 mmio_base;
    vu32 vmmio_base;
    vu32 mem_size;
    vu8 *mem_base;
    vu8 *vmem_base;
    Bool init;

    /* */
    Bool accel;

    /* */
    vu32 csucode_base;
    vu32 ucode_base;
    vu32 ucode_entry;
    vu32 cursor_base;

    int Rop;
    int Color;

    /* mode information */
    struct verite_modeinfo_t mode;
    
    /* saved text mode settings */
    vu8 cursor_hi;
    vu8 cursor_low;
    vu8 offset_hi;
    vu8 offset_low;
    vu8 *scr_contents;

    Bool hwcursor_used;     /* Is HW-cursor used? */
    vu16 hwcursor_vmemsize; /* How much videomem does it use */
    vu32 hwcursor_membase;  /* videomem adress for V2K-cursor */
                            /* Has to be on 1024-byte boundry */

    vu32 fbOffset;          /* Currently busy fb-memory marker */
    Bool overclock_mem;     /* Memory overclock ? */

    Bool shadowfb;          /* Use ShadowFB ? */
    vu8 *shadowPtr;
    vu32 shadowPitch;
    void (*PointerMoved)(int index, int x, int y);

    int rotate;             /* Rotate clockwise or counterclockwise */

    vu8 ucode_buffer[MC_SIZE]; /* Space for microcode, when not needed */
};
    

/*
 * This structure is used to wrap the screen's CloseScreen vector.
 */
typedef struct _renditionRec
{
    struct verite_board_t board;        /* information on the board */
    struct verite_modeinfo_t mode;      /* information on the mode */
#ifdef XSERVER_LIBPCIACCESS
    struct pci_device * PciInfo;
#else
    PCITAG pcitag;                      /* tag for the PCI config space */
    pciVideoPtr PciInfo;                /* PCI config data */
#endif
    EntityInfoPtr pEnt;                 /* entity information */
    CloseScreenProcPtr CloseScreen;     /* wrap CloseScreen */
    xf86CursorInfoPtr CursorInfoRec;    /* Cursor data */
    XAAInfoRecPtr AccelInfoRec;         /* Needed for XAA */
    OptionInfoPtr Options;
    RenditionRegRec saveRegs;
} renditionRec, *renditionPtr;

#define RENDITIONPTR(p)     ((renditionPtr)((p)->driverPrivate))

#endif /* #ifndef _VTYPES_H_ */

/*
 * end of file vtypes.h
 */