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