1 |
|
---|
2 | /*
|
---|
3 | * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
|
---|
4 | *
|
---|
5 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
6 | * copy of this software and associated documentation files (the "Software"),
|
---|
7 | * to deal in the Software without restriction, including without limitation
|
---|
8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
9 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
10 | * Software is furnished to do so, subject to the following conditions:
|
---|
11 | *
|
---|
12 | * The above copyright notice and this permission notice shall be included in
|
---|
13 | * all copies or substantial portions of the Software.
|
---|
14 | *
|
---|
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
18 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
---|
19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
---|
20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
21 | * OTHER DEALINGS IN THE SOFTWARE.
|
---|
22 | *
|
---|
23 | * Except as contained in this notice, the name of the copyright holder(s)
|
---|
24 | * and author(s) shall not be used in advertising or otherwise to promote
|
---|
25 | * the sale, use or other dealings in this Software without prior written
|
---|
26 | * authorization from the copyright holder(s) and author(s).
|
---|
27 | */
|
---|
28 |
|
---|
29 | /*
|
---|
30 | * This file contains definitions of the public XFree86 data structures/types.
|
---|
31 | * Any data structures that video drivers need to access should go here.
|
---|
32 | */
|
---|
33 |
|
---|
34 | #ifndef _XF86STR_H
|
---|
35 | #define _XF86STR_H
|
---|
36 |
|
---|
37 | #include "misc.h"
|
---|
38 | #include "input.h"
|
---|
39 | #include "scrnintstr.h"
|
---|
40 | #include "pixmapstr.h"
|
---|
41 | #include "colormapst.h"
|
---|
42 | #include "xf86Module.h"
|
---|
43 | #include "xf86Opt.h"
|
---|
44 | #include "xf86Pci.h"
|
---|
45 |
|
---|
46 | #include <pciaccess.h>
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * Integer type that is of the size of the addressable memory (machine size).
|
---|
50 | * On most platforms \c uintptr_t will suffice. However, on some mixed
|
---|
51 | * 32-bit / 64-bit platforms, such as 32-bit binaries on 64-bit PowerPC, this
|
---|
52 | * must be 64-bits.
|
---|
53 | */
|
---|
54 | #include <inttypes.h>
|
---|
55 | #if defined(__powerpc__)
|
---|
56 | typedef uint64_t memType;
|
---|
57 | #else
|
---|
58 | typedef uintptr_t memType;
|
---|
59 | #endif
|
---|
60 |
|
---|
61 |
|
---|
62 | /* Video mode flags */
|
---|
63 |
|
---|
64 | typedef enum {
|
---|
65 | V_PHSYNC = 0x0001,
|
---|
66 | V_NHSYNC = 0x0002,
|
---|
67 | V_PVSYNC = 0x0004,
|
---|
68 | V_NVSYNC = 0x0008,
|
---|
69 | V_INTERLACE = 0x0010,
|
---|
70 | V_DBLSCAN = 0x0020,
|
---|
71 | V_CSYNC = 0x0040,
|
---|
72 | V_PCSYNC = 0x0080,
|
---|
73 | V_NCSYNC = 0x0100,
|
---|
74 | V_HSKEW = 0x0200, /* hskew provided */
|
---|
75 | V_BCAST = 0x0400,
|
---|
76 | V_PIXMUX = 0x1000,
|
---|
77 | V_DBLCLK = 0x2000,
|
---|
78 | V_CLKDIV2 = 0x4000
|
---|
79 | } ModeFlags;
|
---|
80 |
|
---|
81 | typedef enum {
|
---|
82 | INTERLACE_HALVE_V = 0x0001 /* Halve V values for interlacing */
|
---|
83 | } CrtcAdjustFlags;
|
---|
84 |
|
---|
85 | /* Flags passed to ChipValidMode() */
|
---|
86 | typedef enum {
|
---|
87 | MODECHECK_INITIAL = 0,
|
---|
88 | MODECHECK_FINAL = 1
|
---|
89 | } ModeCheckFlags;
|
---|
90 |
|
---|
91 | /* These are possible return values for xf86CheckMode() and ValidMode() */
|
---|
92 | typedef enum {
|
---|
93 | MODE_OK = 0, /* Mode OK */
|
---|
94 | MODE_HSYNC, /* hsync out of range */
|
---|
95 | MODE_VSYNC, /* vsync out of range */
|
---|
96 | MODE_H_ILLEGAL, /* mode has illegal horizontal timings */
|
---|
97 | MODE_V_ILLEGAL, /* mode has illegal horizontal timings */
|
---|
98 | MODE_BAD_WIDTH, /* requires an unsupported linepitch */
|
---|
99 | MODE_NOMODE, /* no mode with a maching name */
|
---|
100 | MODE_NO_INTERLACE, /* interlaced mode not supported */
|
---|
101 | MODE_NO_DBLESCAN, /* doublescan mode not supported */
|
---|
102 | MODE_NO_VSCAN, /* multiscan mode not supported */
|
---|
103 | MODE_MEM, /* insufficient video memory */
|
---|
104 | MODE_VIRTUAL_X, /* mode width too large for specified virtual size */
|
---|
105 | MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */
|
---|
106 | MODE_MEM_VIRT, /* insufficient video memory given virtual size */
|
---|
107 | MODE_NOCLOCK, /* no fixed clock available */
|
---|
108 | MODE_CLOCK_HIGH, /* clock required is too high */
|
---|
109 | MODE_CLOCK_LOW, /* clock required is too low */
|
---|
110 | MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */
|
---|
111 | MODE_BAD_HVALUE, /* horizontal timing was out of range */
|
---|
112 | MODE_BAD_VVALUE, /* vertical timing was out of range */
|
---|
113 | MODE_BAD_VSCAN, /* VScan value out of range */
|
---|
114 | MODE_HSYNC_NARROW, /* horizontal sync too narrow */
|
---|
115 | MODE_HSYNC_WIDE, /* horizontal sync too wide */
|
---|
116 | MODE_HBLANK_NARROW, /* horizontal blanking too narrow */
|
---|
117 | MODE_HBLANK_WIDE, /* horizontal blanking too wide */
|
---|
118 | MODE_VSYNC_NARROW, /* vertical sync too narrow */
|
---|
119 | MODE_VSYNC_WIDE, /* vertical sync too wide */
|
---|
120 | MODE_VBLANK_NARROW, /* vertical blanking too narrow */
|
---|
121 | MODE_VBLANK_WIDE, /* vertical blanking too wide */
|
---|
122 | MODE_PANEL, /* exceeds panel dimensions */
|
---|
123 | MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */
|
---|
124 | MODE_ONE_WIDTH, /* only one width is supported */
|
---|
125 | MODE_ONE_HEIGHT, /* only one height is supported */
|
---|
126 | MODE_ONE_SIZE, /* only one resolution is supported */
|
---|
127 | MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */
|
---|
128 | MODE_BANDWIDTH, /* mode requires too much memory bandwidth */
|
---|
129 | MODE_BAD = -2, /* unspecified reason */
|
---|
130 | MODE_ERROR = -1 /* error condition */
|
---|
131 | } ModeStatus;
|
---|
132 |
|
---|
133 | /*
|
---|
134 | * The mode sets are, from best to worst: USERDEF, DRIVER, and DEFAULT/BUILTIN.
|
---|
135 | * Preferred will bubble a mode to the top within a set.
|
---|
136 | */
|
---|
137 | # define M_T_BUILTIN 0x01 /* built-in mode */
|
---|
138 | # define M_T_CLOCK_C (0x02 | M_T_BUILTIN) /* built-in mode - configure clock */
|
---|
139 | # define M_T_CRTC_C (0x04 | M_T_BUILTIN) /* built-in mode - configure CRTC */
|
---|
140 | # define M_T_CLOCK_CRTC_C (M_T_CLOCK_C | M_T_CRTC_C)
|
---|
141 | /* built-in mode - configure CRTC and clock */
|
---|
142 | # define M_T_PREFERRED 0x08 /* preferred mode within a set */
|
---|
143 | # define M_T_DEFAULT 0x10 /* (VESA) default modes */
|
---|
144 | # define M_T_USERDEF 0x20 /* One of the modes from the config file */
|
---|
145 | # define M_T_DRIVER 0x40 /* Supplied by the driver (EDID, etc) */
|
---|
146 | # define M_T_USERPREF 0x80 /* mode preferred by the user config */
|
---|
147 |
|
---|
148 | /* Video mode */
|
---|
149 | typedef struct _DisplayModeRec {
|
---|
150 | struct _DisplayModeRec * prev;
|
---|
151 | struct _DisplayModeRec * next;
|
---|
152 | char * name; /* identifier for the mode */
|
---|
153 | ModeStatus status;
|
---|
154 | int type;
|
---|
155 |
|
---|
156 | /* These are the values that the user sees/provides */
|
---|
157 | int Clock; /* pixel clock freq (kHz) */
|
---|
158 | int HDisplay; /* horizontal timing */
|
---|
159 | int HSyncStart;
|
---|
160 | int HSyncEnd;
|
---|
161 | int HTotal;
|
---|
162 | int HSkew;
|
---|
163 | int VDisplay; /* vertical timing */
|
---|
164 | int VSyncStart;
|
---|
165 | int VSyncEnd;
|
---|
166 | int VTotal;
|
---|
167 | int VScan;
|
---|
168 | int Flags;
|
---|
169 |
|
---|
170 | /* These are the values the hardware uses */
|
---|
171 | int ClockIndex;
|
---|
172 | int SynthClock; /* Actual clock freq to
|
---|
173 | * be programmed (kHz) */
|
---|
174 | int CrtcHDisplay;
|
---|
175 | int CrtcHBlankStart;
|
---|
176 | int CrtcHSyncStart;
|
---|
177 | int CrtcHSyncEnd;
|
---|
178 | int CrtcHBlankEnd;
|
---|
179 | int CrtcHTotal;
|
---|
180 | int CrtcHSkew;
|
---|
181 | int CrtcVDisplay;
|
---|
182 | int CrtcVBlankStart;
|
---|
183 | int CrtcVSyncStart;
|
---|
184 | int CrtcVSyncEnd;
|
---|
185 | int CrtcVBlankEnd;
|
---|
186 | int CrtcVTotal;
|
---|
187 | Bool CrtcHAdjusted;
|
---|
188 | Bool CrtcVAdjusted;
|
---|
189 | int PrivSize;
|
---|
190 | INT32 * Private;
|
---|
191 | int PrivFlags;
|
---|
192 |
|
---|
193 | float HSync, VRefresh;
|
---|
194 | } DisplayModeRec, *DisplayModePtr;
|
---|
195 |
|
---|
196 | /* The monitor description */
|
---|
197 |
|
---|
198 | #define MAX_HSYNC 8
|
---|
199 | #define MAX_VREFRESH 8
|
---|
200 |
|
---|
201 | typedef struct { float hi, lo; } range;
|
---|
202 |
|
---|
203 | typedef struct { CARD32 red, green, blue; } rgb;
|
---|
204 |
|
---|
205 | typedef struct { float red, green, blue; } Gamma;
|
---|
206 |
|
---|
207 | /* The permitted gamma range is 1 / GAMMA_MAX <= g <= GAMMA_MAX */
|
---|
208 | #define GAMMA_MAX 10.0
|
---|
209 | #define GAMMA_MIN (1.0 / GAMMA_MAX)
|
---|
210 | #define GAMMA_ZERO (GAMMA_MIN / 100.0)
|
---|
211 |
|
---|
212 | typedef struct {
|
---|
213 | char * id;
|
---|
214 | char * vendor;
|
---|
215 | char * model;
|
---|
216 | int nHsync;
|
---|
217 | range hsync[MAX_HSYNC];
|
---|
218 | int nVrefresh;
|
---|
219 | range vrefresh[MAX_VREFRESH];
|
---|
220 | DisplayModePtr Modes; /* Start of the monitor's mode list */
|
---|
221 | DisplayModePtr Last; /* End of the monitor's mode list */
|
---|
222 | Gamma gamma; /* Gamma of the monitor */
|
---|
223 | int widthmm;
|
---|
224 | int heightmm;
|
---|
225 | pointer options;
|
---|
226 | pointer DDC;
|
---|
227 | Bool reducedblanking; /* Allow CVT reduced blanking modes? */
|
---|
228 | int maxPixClock; /* in kHz, like mode->Clock */
|
---|
229 | } MonRec, *MonPtr;
|
---|
230 |
|
---|
231 | /* the list of clock ranges */
|
---|
232 | typedef struct x_ClockRange {
|
---|
233 | struct x_ClockRange *next;
|
---|
234 | int minClock; /* (kHz) */
|
---|
235 | int maxClock; /* (kHz) */
|
---|
236 | int clockIndex; /* -1 for programmable clocks */
|
---|
237 | Bool interlaceAllowed;
|
---|
238 | Bool doubleScanAllowed;
|
---|
239 | int ClockMulFactor;
|
---|
240 | int ClockDivFactor;
|
---|
241 | int PrivFlags;
|
---|
242 | } ClockRange, *ClockRangePtr;
|
---|
243 |
|
---|
244 | /*
|
---|
245 | * The driverFunc. xorgDriverFuncOp specifies the action driver should
|
---|
246 | * perform. If requested option is not supported function should return
|
---|
247 | * FALSE. pointer can be used to pass arguments to the function or
|
---|
248 | * to return data to the caller.
|
---|
249 | */
|
---|
250 | typedef struct _ScrnInfoRec *ScrnInfoPtr;
|
---|
251 |
|
---|
252 | /* do not change order */
|
---|
253 | typedef enum {
|
---|
254 | RR_GET_INFO,
|
---|
255 | RR_SET_CONFIG,
|
---|
256 | RR_GET_MODE_MM,
|
---|
257 | GET_REQUIRED_HW_INTERFACES = 10
|
---|
258 | } xorgDriverFuncOp;
|
---|
259 |
|
---|
260 | typedef Bool xorgDriverFuncProc (ScrnInfoPtr, xorgDriverFuncOp,
|
---|
261 | pointer);
|
---|
262 |
|
---|
263 | /* RR_GET_INFO, RR_SET_CONFIG */
|
---|
264 | typedef struct {
|
---|
265 | int rotation;
|
---|
266 | int rate;
|
---|
267 | int width;
|
---|
268 | int height;
|
---|
269 | } xorgRRConfig;
|
---|
270 |
|
---|
271 | typedef union {
|
---|
272 | short RRRotations;
|
---|
273 | xorgRRConfig RRConfig;
|
---|
274 | } xorgRRRotation, *xorgRRRotationPtr;
|
---|
275 |
|
---|
276 | /* RR_GET_MODE_MM */
|
---|
277 | typedef struct {
|
---|
278 | DisplayModePtr mode;
|
---|
279 | int virtX;
|
---|
280 | int virtY;
|
---|
281 | int mmWidth;
|
---|
282 | int mmHeight;
|
---|
283 | } xorgRRModeMM, *xorgRRModeMMPtr;
|
---|
284 |
|
---|
285 | /* GET_REQUIRED_HW_INTERFACES */
|
---|
286 | #define HW_IO 1
|
---|
287 | #define HW_MMIO 2
|
---|
288 | #define HW_SKIP_CONSOLE 4
|
---|
289 | #define NEED_IO_ENABLED(x) (x & HW_IO)
|
---|
290 |
|
---|
291 | typedef CARD32 xorgHWFlags;
|
---|
292 |
|
---|
293 | /*
|
---|
294 | * The driver list struct. This contains the information required for each
|
---|
295 | * driver before a ScrnInfoRec has been allocated.
|
---|
296 | */
|
---|
297 | struct _DriverRec;
|
---|
298 |
|
---|
299 | typedef struct {
|
---|
300 | int driverVersion;
|
---|
301 | char * driverName;
|
---|
302 | void (*Identify)(int flags);
|
---|
303 | Bool (*Probe)(struct _DriverRec *drv, int flags);
|
---|
304 | const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype);
|
---|
305 | pointer module;
|
---|
306 | int refCount;
|
---|
307 | } DriverRec1;
|
---|
308 |
|
---|
309 | struct _SymTabRec;
|
---|
310 | struct _PciChipsets;
|
---|
311 |
|
---|
312 | typedef struct _DriverRec {
|
---|
313 | int driverVersion;
|
---|
314 | char * driverName;
|
---|
315 | void (*Identify)(int flags);
|
---|
316 | Bool (*Probe)(struct _DriverRec *drv, int flags);
|
---|
317 | const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype);
|
---|
318 | pointer module;
|
---|
319 | int refCount;
|
---|
320 | xorgDriverFuncProc *driverFunc;
|
---|
321 |
|
---|
322 | const struct pci_id_match * supported_devices;
|
---|
323 | Bool (*PciProbe)( struct _DriverRec * drv, int entity_num,
|
---|
324 | struct pci_device * dev, intptr_t match_data );
|
---|
325 | } DriverRec, *DriverPtr;
|
---|
326 |
|
---|
327 | /*
|
---|
328 | * AddDriver flags
|
---|
329 | */
|
---|
330 | #define HaveDriverFuncs 1
|
---|
331 |
|
---|
332 | /*
|
---|
333 | * These are the private bus types. New types can be added here. Types
|
---|
334 | * required for the public interface should be added to xf86str.h, with
|
---|
335 | * function prototypes added to xf86.h.
|
---|
336 | */
|
---|
337 |
|
---|
338 | /* Tolerate prior #include <linux/input.h> */
|
---|
339 | #if defined(linux) && defined(_INPUT_H)
|
---|
340 | #undef BUS_NONE
|
---|
341 | #undef BUS_PCI
|
---|
342 | #undef BUS_SBUS
|
---|
343 | #undef BUS_last
|
---|
344 | #endif
|
---|
345 |
|
---|
346 | typedef enum {
|
---|
347 | BUS_NONE,
|
---|
348 | BUS_PCI,
|
---|
349 | BUS_SBUS,
|
---|
350 | BUS_last /* Keep last */
|
---|
351 | } BusType;
|
---|
352 |
|
---|
353 | struct pci_device;
|
---|
354 |
|
---|
355 | typedef struct {
|
---|
356 | int fbNum;
|
---|
357 | } SbusBusId;
|
---|
358 |
|
---|
359 | typedef struct _bus {
|
---|
360 | BusType type;
|
---|
361 | union {
|
---|
362 | struct pci_device *pci;
|
---|
363 | SbusBusId sbus;
|
---|
364 | } id;
|
---|
365 | } BusRec, *BusPtr;
|
---|
366 |
|
---|
367 | #define MAXCLOCKS 128
|
---|
368 | typedef enum {
|
---|
369 | DAC_BPP8 = 0,
|
---|
370 | DAC_BPP16,
|
---|
371 | DAC_BPP24,
|
---|
372 | DAC_BPP32,
|
---|
373 | MAXDACSPEEDS
|
---|
374 | } DacSpeedIndex;
|
---|
375 |
|
---|
376 | typedef struct {
|
---|
377 | char * identifier;
|
---|
378 | char * vendor;
|
---|
379 | char * board;
|
---|
380 | char * chipset;
|
---|
381 | char * ramdac;
|
---|
382 | char * driver;
|
---|
383 | struct _confscreenrec * myScreenSection;
|
---|
384 | Bool claimed;
|
---|
385 | int dacSpeeds[MAXDACSPEEDS];
|
---|
386 | int numclocks;
|
---|
387 | int clock[MAXCLOCKS];
|
---|
388 | char * clockchip;
|
---|
389 | char * busID;
|
---|
390 | Bool active;
|
---|
391 | Bool inUse;
|
---|
392 | int videoRam;
|
---|
393 | int textClockFreq;
|
---|
394 | unsigned long BiosBase; /* Base address of video BIOS */
|
---|
395 | unsigned long MemBase; /* Frame buffer base address */
|
---|
396 | unsigned long IOBase;
|
---|
397 | int chipID;
|
---|
398 | int chipRev;
|
---|
399 | pointer options;
|
---|
400 | int irq;
|
---|
401 | int screen; /* For multi-CRTC cards */
|
---|
402 | } GDevRec, *GDevPtr;
|
---|
403 |
|
---|
404 | typedef struct {
|
---|
405 | int frameX0;
|
---|
406 | int frameY0;
|
---|
407 | int virtualX;
|
---|
408 | int virtualY;
|
---|
409 | int depth;
|
---|
410 | int fbbpp;
|
---|
411 | rgb weight;
|
---|
412 | rgb blackColour;
|
---|
413 | rgb whiteColour;
|
---|
414 | int defaultVisual;
|
---|
415 | char ** modes;
|
---|
416 | pointer options;
|
---|
417 | } DispRec, *DispPtr;
|
---|
418 |
|
---|
419 | typedef struct _confxvportrec {
|
---|
420 | char * identifier;
|
---|
421 | pointer options;
|
---|
422 | } confXvPortRec, *confXvPortPtr;
|
---|
423 |
|
---|
424 | typedef struct _confxvadaptrec {
|
---|
425 | char * identifier;
|
---|
426 | int numports;
|
---|
427 | confXvPortPtr ports;
|
---|
428 | pointer options;
|
---|
429 | } confXvAdaptorRec, *confXvAdaptorPtr;
|
---|
430 |
|
---|
431 | typedef struct _confscreenrec {
|
---|
432 | char * id;
|
---|
433 | int screennum;
|
---|
434 | int defaultdepth;
|
---|
435 | int defaultbpp;
|
---|
436 | int defaultfbbpp;
|
---|
437 | MonPtr monitor;
|
---|
438 | GDevPtr device;
|
---|
439 | int numdisplays;
|
---|
440 | DispPtr displays;
|
---|
441 | int numxvadaptors;
|
---|
442 | confXvAdaptorPtr xvadaptors;
|
---|
443 | pointer options;
|
---|
444 | } confScreenRec, *confScreenPtr;
|
---|
445 |
|
---|
446 | typedef enum {
|
---|
447 | PosObsolete = -1,
|
---|
448 | PosAbsolute = 0,
|
---|
449 | PosRightOf,
|
---|
450 | PosLeftOf,
|
---|
451 | PosAbove,
|
---|
452 | PosBelow,
|
---|
453 | PosRelative
|
---|
454 | } PositionType;
|
---|
455 |
|
---|
456 | typedef struct _screenlayoutrec {
|
---|
457 | confScreenPtr screen;
|
---|
458 | char * topname;
|
---|
459 | confScreenPtr top;
|
---|
460 | char * bottomname;
|
---|
461 | confScreenPtr bottom;
|
---|
462 | char * leftname;
|
---|
463 | confScreenPtr left;
|
---|
464 | char * rightname;
|
---|
465 | confScreenPtr right;
|
---|
466 | PositionType where;
|
---|
467 | int x;
|
---|
468 | int y;
|
---|
469 | char * refname;
|
---|
470 | confScreenPtr refscreen;
|
---|
471 | } screenLayoutRec, *screenLayoutPtr;
|
---|
472 |
|
---|
473 | typedef struct _InputInfoRec InputInfoRec;
|
---|
474 |
|
---|
475 | typedef struct _serverlayoutrec {
|
---|
476 | char * id;
|
---|
477 | screenLayoutPtr screens;
|
---|
478 | GDevPtr inactives;
|
---|
479 | InputInfoRec** inputs; /* NULL terminated */
|
---|
480 | pointer options;
|
---|
481 | } serverLayoutRec, *serverLayoutPtr;
|
---|
482 |
|
---|
483 | typedef struct _confdribufferrec {
|
---|
484 | int count;
|
---|
485 | int size;
|
---|
486 | enum {
|
---|
487 | XF86DRI_WC_HINT = 0x0001 /* Placeholder: not implemented */
|
---|
488 | } flags;
|
---|
489 | } confDRIBufferRec, *confDRIBufferPtr;
|
---|
490 |
|
---|
491 | typedef struct _confdrirec {
|
---|
492 | int group;
|
---|
493 | int mode;
|
---|
494 | int bufs_count;
|
---|
495 | confDRIBufferRec *bufs;
|
---|
496 | } confDRIRec, *confDRIPtr;
|
---|
497 |
|
---|
498 | /* These values should be adjusted when new fields are added to ScrnInfoRec */
|
---|
499 | #define NUM_RESERVED_INTS 16
|
---|
500 | #define NUM_RESERVED_POINTERS 14
|
---|
501 | #define NUM_RESERVED_FUNCS 10
|
---|
502 |
|
---|
503 | typedef pointer (*funcPointer)(void);
|
---|
504 |
|
---|
505 | /* flags for depth 24 pixmap options */
|
---|
506 | typedef enum {
|
---|
507 | Pix24DontCare = 0,
|
---|
508 | Pix24Use24,
|
---|
509 | Pix24Use32
|
---|
510 | } Pix24Flags;
|
---|
511 |
|
---|
512 | /* Power management events: so far we only support APM */
|
---|
513 |
|
---|
514 | typedef enum {
|
---|
515 | XF86_APM_UNKNOWN = -1,
|
---|
516 | XF86_APM_SYS_STANDBY,
|
---|
517 | XF86_APM_SYS_SUSPEND,
|
---|
518 | XF86_APM_CRITICAL_SUSPEND,
|
---|
519 | XF86_APM_USER_STANDBY,
|
---|
520 | XF86_APM_USER_SUSPEND,
|
---|
521 | XF86_APM_STANDBY_RESUME,
|
---|
522 | XF86_APM_NORMAL_RESUME,
|
---|
523 | XF86_APM_CRITICAL_RESUME,
|
---|
524 | XF86_APM_LOW_BATTERY,
|
---|
525 | XF86_APM_POWER_STATUS_CHANGE,
|
---|
526 | XF86_APM_UPDATE_TIME,
|
---|
527 | XF86_APM_CAPABILITY_CHANGED,
|
---|
528 | XF86_APM_STANDBY_FAILED,
|
---|
529 | XF86_APM_SUSPEND_FAILED
|
---|
530 | } pmEvent;
|
---|
531 |
|
---|
532 | typedef enum {
|
---|
533 | PM_WAIT,
|
---|
534 | PM_CONTINUE,
|
---|
535 | PM_FAILED,
|
---|
536 | PM_NONE
|
---|
537 | } pmWait;
|
---|
538 |
|
---|
539 | typedef struct _PciChipsets {
|
---|
540 | /**
|
---|
541 | * Key used to match this device with its name in an array of
|
---|
542 | * \c SymTabRec.
|
---|
543 | */
|
---|
544 | int numChipset;
|
---|
545 |
|
---|
546 | /**
|
---|
547 | * This value is quirky. Depending on the driver, it can take on one of
|
---|
548 | * three meanings. In drivers that have exactly one vendor ID (e.g.,
|
---|
549 | * radeon, mga, i810) the low 16-bits are the device ID.
|
---|
550 | *
|
---|
551 | * In drivers that can have multiple vendor IDs (e.g., the glint driver
|
---|
552 | * can have either 3dlabs' ID or TI's ID, the i740 driver can have either
|
---|
553 | * Intel's ID or Real3D's ID, etc.) the low 16-bits are the device ID and
|
---|
554 | * the high 16-bits are the vendor ID.
|
---|
555 | *
|
---|
556 | * In drivers that don't have a specific vendor (e.g., vga) contains the
|
---|
557 | * device ID for either the generic VGA or generic 8514 devices. This
|
---|
558 | * turns out to be the same as the subclass and programming interface
|
---|
559 | * value (e.g., the full 24-bit class for the VGA device is 0x030000 (or
|
---|
560 | * 0x000101) and for 8514 is 0x030001).
|
---|
561 | */
|
---|
562 | int PCIid;
|
---|
563 |
|
---|
564 | /* dummy place holders for drivers to build against old/new servers */
|
---|
565 | #define RES_UNDEFINED NULL
|
---|
566 | #define RES_EXCLUSIVE_VGA NULL
|
---|
567 | #define RES_SHARED_VGA NULL
|
---|
568 | void *dummy;
|
---|
569 | } PciChipsets;
|
---|
570 |
|
---|
571 |
|
---|
572 | /* Entity properties */
|
---|
573 | typedef void (*EntityProc)(int entityIndex,pointer private);
|
---|
574 |
|
---|
575 | typedef struct _entityInfo {
|
---|
576 | int index;
|
---|
577 | BusRec location;
|
---|
578 | int chipset;
|
---|
579 | Bool active;
|
---|
580 | GDevPtr device;
|
---|
581 | DriverPtr driver;
|
---|
582 | } EntityInfoRec, *EntityInfoPtr;
|
---|
583 |
|
---|
584 | /* DGA */
|
---|
585 |
|
---|
586 | typedef struct {
|
---|
587 | int num; /* A unique identifier for the mode (num > 0) */
|
---|
588 | DisplayModePtr mode;
|
---|
589 | int flags; /* DGA_CONCURRENT_ACCESS, etc... */
|
---|
590 | int imageWidth; /* linear accessible portion (pixels) */
|
---|
591 | int imageHeight;
|
---|
592 | int pixmapWidth; /* Xlib accessible portion (pixels) */
|
---|
593 | int pixmapHeight; /* both fields ignored if no concurrent access */
|
---|
594 | int bytesPerScanline;
|
---|
595 | int byteOrder; /* MSBFirst, LSBFirst */
|
---|
596 | int depth;
|
---|
597 | int bitsPerPixel;
|
---|
598 | unsigned long red_mask;
|
---|
599 | unsigned long green_mask;
|
---|
600 | unsigned long blue_mask;
|
---|
601 | short visualClass;
|
---|
602 | int viewportWidth;
|
---|
603 | int viewportHeight;
|
---|
604 | int xViewportStep; /* viewport position granularity */
|
---|
605 | int yViewportStep;
|
---|
606 | int maxViewportX; /* max viewport origin */
|
---|
607 | int maxViewportY;
|
---|
608 | int viewportFlags; /* types of page flipping possible */
|
---|
609 | int offset; /* offset into physical memory */
|
---|
610 | unsigned char *address; /* server's mapped framebuffer */
|
---|
611 | int reserved1;
|
---|
612 | int reserved2;
|
---|
613 | } DGAModeRec, *DGAModePtr;
|
---|
614 |
|
---|
615 | typedef struct {
|
---|
616 | DGAModePtr mode;
|
---|
617 | PixmapPtr pPix;
|
---|
618 | } DGADeviceRec, *DGADevicePtr;
|
---|
619 |
|
---|
620 | /*
|
---|
621 | * Flags for driver Probe() functions.
|
---|
622 | */
|
---|
623 | #define PROBE_DEFAULT 0x00
|
---|
624 | #define PROBE_DETECT 0x01
|
---|
625 | #define PROBE_TRYHARD 0x02
|
---|
626 |
|
---|
627 | /*
|
---|
628 | * Driver entry point types
|
---|
629 | */
|
---|
630 |
|
---|
631 | typedef Bool xf86ProbeProc (DriverPtr, int);
|
---|
632 | typedef Bool xf86PreInitProc (ScrnInfoPtr, int);
|
---|
633 | typedef Bool xf86ScreenInitProc (int, ScreenPtr, int, char**);
|
---|
634 | typedef Bool xf86SwitchModeProc (int, DisplayModePtr, int);
|
---|
635 | typedef void xf86AdjustFrameProc (int, int, int, int);
|
---|
636 | typedef Bool xf86EnterVTProc (int, int);
|
---|
637 | typedef void xf86LeaveVTProc (int, int);
|
---|
638 | typedef void xf86FreeScreenProc (int, int);
|
---|
639 | typedef ModeStatus xf86ValidModeProc (int, DisplayModePtr, Bool, int);
|
---|
640 | typedef void xf86EnableDisableFBAccessProc(int, Bool);
|
---|
641 | typedef int xf86SetDGAModeProc (int, int, DGADevicePtr);
|
---|
642 | typedef int xf86ChangeGammaProc (int, Gamma);
|
---|
643 | typedef void xf86PointerMovedProc (int, int, int);
|
---|
644 | typedef Bool xf86PMEventProc (int, pmEvent, Bool);
|
---|
645 | typedef void xf86DPMSSetProc (ScrnInfoPtr, int, int);
|
---|
646 | typedef void xf86LoadPaletteProc (ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
|
---|
647 | typedef void xf86SetOverscanProc (ScrnInfoPtr, int);
|
---|
648 | typedef void xf86ModeSetProc (ScrnInfoPtr);
|
---|
649 |
|
---|
650 |
|
---|
651 | /*
|
---|
652 | * ScrnInfoRec
|
---|
653 | *
|
---|
654 | * There is one of these for each screen, and it holds all the screen-specific
|
---|
655 | * information.
|
---|
656 | *
|
---|
657 | * Note: the size and layout must be kept the same across versions. New
|
---|
658 | * fields are to be added in place of the "reserved*" fields. No fields
|
---|
659 | * are to be dependent on compile-time defines.
|
---|
660 | */
|
---|
661 |
|
---|
662 |
|
---|
663 | typedef struct _ScrnInfoRec {
|
---|
664 | int driverVersion;
|
---|
665 | char * driverName; /* canonical name used in */
|
---|
666 | /* the config file */
|
---|
667 | ScreenPtr pScreen; /* Pointer to the ScreenRec */
|
---|
668 | int scrnIndex; /* Number of this screen */
|
---|
669 | Bool configured; /* Is this screen valid */
|
---|
670 | int origIndex; /* initial number assigned to
|
---|
671 | * this screen before
|
---|
672 | * finalising the number of
|
---|
673 | * available screens */
|
---|
674 |
|
---|
675 | /* Display-wide screenInfo values needed by this screen */
|
---|
676 | int imageByteOrder;
|
---|
677 | int bitmapScanlineUnit;
|
---|
678 | int bitmapScanlinePad;
|
---|
679 | int bitmapBitOrder;
|
---|
680 | int numFormats;
|
---|
681 | PixmapFormatRec formats[MAXFORMATS];
|
---|
682 | PixmapFormatRec fbFormat;
|
---|
683 |
|
---|
684 | int bitsPerPixel; /* fb bpp */
|
---|
685 | Pix24Flags pixmap24; /* pixmap pref for depth 24 */
|
---|
686 | int depth; /* depth of default visual */
|
---|
687 | MessageType depthFrom; /* set from config? */
|
---|
688 | MessageType bitsPerPixelFrom; /* set from config? */
|
---|
689 | rgb weight; /* r/g/b weights */
|
---|
690 | rgb mask; /* rgb masks */
|
---|
691 | rgb offset; /* rgb offsets */
|
---|
692 | int rgbBits; /* Number of bits in r/g/b */
|
---|
693 | Gamma gamma; /* Gamma of the monitor */
|
---|
694 | int defaultVisual; /* default visual class */
|
---|
695 | int maxHValue; /* max horizontal timing */
|
---|
696 | int maxVValue; /* max vertical timing value */
|
---|
697 | int virtualX; /* Virtual width */
|
---|
698 | int virtualY; /* Virtual height */
|
---|
699 | int xInc; /* Horizontal timing increment */
|
---|
700 | MessageType virtualFrom; /* set from config? */
|
---|
701 | int displayWidth; /* memory pitch */
|
---|
702 | int frameX0; /* viewport position */
|
---|
703 | int frameY0;
|
---|
704 | int frameX1;
|
---|
705 | int frameY1;
|
---|
706 | int zoomLocked; /* Disallow mode changes */
|
---|
707 | DisplayModePtr modePool; /* list of compatible modes */
|
---|
708 | DisplayModePtr modes; /* list of actual modes */
|
---|
709 | DisplayModePtr currentMode; /* current mode
|
---|
710 | * This was previously
|
---|
711 | * overloaded with the modes
|
---|
712 | * field, which is a pointer
|
---|
713 | * into a circular list */
|
---|
714 | confScreenPtr confScreen; /* Screen config info */
|
---|
715 | MonPtr monitor; /* Monitor information */
|
---|
716 | DispPtr display; /* Display information */
|
---|
717 | int * entityList; /* List of device entities */
|
---|
718 | int numEntities;
|
---|
719 | int widthmm; /* physical display dimensions
|
---|
720 | * in mm */
|
---|
721 | int heightmm;
|
---|
722 | int xDpi; /* width DPI */
|
---|
723 | int yDpi; /* height DPI */
|
---|
724 | char * name; /* Name to prefix messages */
|
---|
725 | pointer driverPrivate; /* Driver private area */
|
---|
726 | DevUnion * privates; /* Other privates can hook in
|
---|
727 | * here */
|
---|
728 | DriverPtr drv; /* xf86DriverList[] entry */
|
---|
729 | pointer module; /* Pointer to module head */
|
---|
730 | int colorKey;
|
---|
731 | int overlayFlags;
|
---|
732 |
|
---|
733 | /* Some of these may be moved out of here into the driver private area */
|
---|
734 |
|
---|
735 | char * chipset; /* chipset name */
|
---|
736 | char * ramdac; /* ramdac name */
|
---|
737 | char * clockchip; /* clock name */
|
---|
738 | Bool progClock; /* clock is programmable */
|
---|
739 | int numClocks; /* number of clocks */
|
---|
740 | int clock[MAXCLOCKS]; /* list of clock frequencies */
|
---|
741 | int videoRam; /* amount of video ram (kb) */
|
---|
742 | unsigned long biosBase; /* Base address of video BIOS */
|
---|
743 | unsigned long memPhysBase; /* Physical address of FB */
|
---|
744 | unsigned long fbOffset; /* Offset of FB in the above */
|
---|
745 | IOADDRESS domainIOBase; /* Domain I/O base address */
|
---|
746 | int memClk; /* memory clock */
|
---|
747 | int textClockFreq; /* clock of text mode */
|
---|
748 | Bool flipPixels; /* swap default black/white */
|
---|
749 | pointer options;
|
---|
750 |
|
---|
751 | int chipID;
|
---|
752 | int chipRev;
|
---|
753 |
|
---|
754 | /* Allow screens to be enabled/disabled individually */
|
---|
755 | Bool vtSema;
|
---|
756 |
|
---|
757 | /* hw cursor moves at SIGIO time */
|
---|
758 | Bool silkenMouse;
|
---|
759 |
|
---|
760 | /* Storage for clockRanges and adjustFlags for use with the VidMode ext */
|
---|
761 | ClockRangePtr clockRanges;
|
---|
762 | int adjustFlags;
|
---|
763 |
|
---|
764 | /*
|
---|
765 | * These can be used when the minor ABI version is incremented.
|
---|
766 | * The NUM_* parameters must be reduced appropriately to keep the
|
---|
767 | * structure size and alignment unchanged.
|
---|
768 | */
|
---|
769 | int reservedInt[NUM_RESERVED_INTS];
|
---|
770 |
|
---|
771 | int * entityInstanceList;
|
---|
772 | struct pci_device *vgaDev;
|
---|
773 |
|
---|
774 | pointer reservedPtr[NUM_RESERVED_POINTERS];
|
---|
775 |
|
---|
776 | /*
|
---|
777 | * Driver entry points.
|
---|
778 | *
|
---|
779 | */
|
---|
780 |
|
---|
781 | xf86ProbeProc *Probe;
|
---|
782 | xf86PreInitProc *PreInit;
|
---|
783 | xf86ScreenInitProc *ScreenInit;
|
---|
784 | xf86SwitchModeProc *SwitchMode;
|
---|
785 | xf86AdjustFrameProc *AdjustFrame;
|
---|
786 | xf86EnterVTProc *EnterVT;
|
---|
787 | xf86LeaveVTProc *LeaveVT;
|
---|
788 | xf86FreeScreenProc *FreeScreen;
|
---|
789 | xf86ValidModeProc *ValidMode;
|
---|
790 | xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
|
---|
791 | xf86SetDGAModeProc *SetDGAMode;
|
---|
792 | xf86ChangeGammaProc *ChangeGamma;
|
---|
793 | xf86PointerMovedProc *PointerMoved;
|
---|
794 | xf86PMEventProc *PMEvent;
|
---|
795 | xf86DPMSSetProc *DPMSSet;
|
---|
796 | xf86LoadPaletteProc *LoadPalette;
|
---|
797 | xf86SetOverscanProc *SetOverscan;
|
---|
798 | xorgDriverFuncProc *DriverFunc;
|
---|
799 | xf86ModeSetProc *ModeSet;
|
---|
800 |
|
---|
801 | /*
|
---|
802 | * This can be used when the minor ABI version is incremented.
|
---|
803 | * The NUM_* parameter must be reduced appropriately to keep the
|
---|
804 | * structure size and alignment unchanged.
|
---|
805 | */
|
---|
806 | funcPointer reservedFuncs[NUM_RESERVED_FUNCS];
|
---|
807 |
|
---|
808 | } ScrnInfoRec;
|
---|
809 |
|
---|
810 |
|
---|
811 | typedef struct {
|
---|
812 | Bool (*OpenFramebuffer)(
|
---|
813 | ScrnInfoPtr pScrn,
|
---|
814 | char **name,
|
---|
815 | unsigned char **mem,
|
---|
816 | int *size,
|
---|
817 | int *offset,
|
---|
818 | int *extra
|
---|
819 | );
|
---|
820 | void (*CloseFramebuffer)(ScrnInfoPtr pScrn);
|
---|
821 | Bool (*SetMode)(ScrnInfoPtr pScrn, DGAModePtr pMode);
|
---|
822 | void (*SetViewport)(ScrnInfoPtr pScrn, int x, int y, int flags);
|
---|
823 | int (*GetViewport)(ScrnInfoPtr pScrn);
|
---|
824 | void (*Sync)(ScrnInfoPtr);
|
---|
825 | void (*FillRect)(
|
---|
826 | ScrnInfoPtr pScrn,
|
---|
827 | int x, int y, int w, int h,
|
---|
828 | unsigned long color
|
---|
829 | );
|
---|
830 | void (*BlitRect)(
|
---|
831 | ScrnInfoPtr pScrn,
|
---|
832 | int srcx, int srcy,
|
---|
833 | int w, int h,
|
---|
834 | int dstx, int dsty
|
---|
835 | );
|
---|
836 | void (*BlitTransRect)(
|
---|
837 | ScrnInfoPtr pScrn,
|
---|
838 | int srcx, int srcy,
|
---|
839 | int w, int h,
|
---|
840 | int dstx, int dsty,
|
---|
841 | unsigned long color
|
---|
842 | );
|
---|
843 | } DGAFunctionRec, *DGAFunctionPtr;
|
---|
844 |
|
---|
845 | typedef struct _SymTabRec {
|
---|
846 | int token; /* id of the token */
|
---|
847 | const char * name; /* token name */
|
---|
848 | } SymTabRec, *SymTabPtr;
|
---|
849 |
|
---|
850 | /* flags for xf86LookupMode */
|
---|
851 | typedef enum {
|
---|
852 | LOOKUP_DEFAULT = 0, /* Use default mode lookup method */
|
---|
853 | LOOKUP_BEST_REFRESH, /* Pick modes with best refresh */
|
---|
854 | LOOKUP_CLOSEST_CLOCK, /* Pick modes with the closest clock */
|
---|
855 | LOOKUP_LIST_ORDER, /* Pick first useful mode in list */
|
---|
856 | LOOKUP_CLKDIV2 = 0x0100, /* Allow half clocks */
|
---|
857 | LOOKUP_OPTIONAL_TOLERANCES = 0x0200 /* Allow missing hsync/vrefresh */
|
---|
858 | } LookupModeFlags;
|
---|
859 |
|
---|
860 | #define NoDepth24Support 0x00
|
---|
861 | #define Support24bppFb 0x01 /* 24bpp framebuffer supported */
|
---|
862 | #define Support32bppFb 0x02 /* 32bpp framebuffer supported */
|
---|
863 | #define SupportConvert24to32 0x04 /* Can convert 24bpp pixmap to 32bpp */
|
---|
864 | #define SupportConvert32to24 0x08 /* Can convert 32bpp pixmap to 24bpp */
|
---|
865 | #define PreferConvert24to32 0x10 /* prefer 24bpp pixmap to 32bpp conv */
|
---|
866 | #define PreferConvert32to24 0x20 /* prefer 32bpp pixmap to 24bpp conv */
|
---|
867 |
|
---|
868 |
|
---|
869 | /* For DPMS */
|
---|
870 | typedef void (*DPMSSetProcPtr)(ScrnInfoPtr, int, int);
|
---|
871 |
|
---|
872 | /* Input handler proc */
|
---|
873 | typedef void (*InputHandlerProc)(int fd, pointer data);
|
---|
874 |
|
---|
875 | /* These are used by xf86GetClocks */
|
---|
876 | #define CLK_REG_SAVE -1
|
---|
877 | #define CLK_REG_RESTORE -2
|
---|
878 |
|
---|
879 | /*
|
---|
880 | * misc constants
|
---|
881 | */
|
---|
882 | #define INTERLACE_REFRESH_WEIGHT 1.5
|
---|
883 | #define SYNC_TOLERANCE 0.01 /* 1 percent */
|
---|
884 | #define CLOCK_TOLERANCE 2000 /* Clock matching tolerance (2MHz) */
|
---|
885 |
|
---|
886 |
|
---|
887 | #define OVERLAY_8_32_DUALFB 0x00000001
|
---|
888 | #define OVERLAY_8_24_DUALFB 0x00000002
|
---|
889 | #define OVERLAY_8_16_DUALFB 0x00000004
|
---|
890 | #define OVERLAY_8_32_PLANAR 0x00000008
|
---|
891 |
|
---|
892 | /* Values of xf86Info.mouseFlags */
|
---|
893 | #define MF_CLEAR_DTR 1
|
---|
894 | #define MF_CLEAR_RTS 2
|
---|
895 |
|
---|
896 | /* Action Events */
|
---|
897 | typedef enum {
|
---|
898 | ACTION_TERMINATE = 0, /* Terminate Server */
|
---|
899 | ACTION_NEXT_MODE = 10, /* Switch to next video mode */
|
---|
900 | ACTION_PREV_MODE,
|
---|
901 | ACTION_SWITCHSCREEN = 100, /* VT switch */
|
---|
902 | ACTION_SWITCHSCREEN_NEXT,
|
---|
903 | ACTION_SWITCHSCREEN_PREV,
|
---|
904 | } ActionEvent;
|
---|
905 |
|
---|
906 | #endif /* _XF86STR_H */
|
---|