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 | char * identifier;
|
---|
406 | char * driver;
|
---|
407 | pointer commonOptions;
|
---|
408 | pointer extraOptions;
|
---|
409 | InputAttributes *attrs;
|
---|
410 | } IDevRec, *IDevPtr;
|
---|
411 |
|
---|
412 | typedef struct {
|
---|
413 | int frameX0;
|
---|
414 | int frameY0;
|
---|
415 | int virtualX;
|
---|
416 | int virtualY;
|
---|
417 | int depth;
|
---|
418 | int fbbpp;
|
---|
419 | rgb weight;
|
---|
420 | rgb blackColour;
|
---|
421 | rgb whiteColour;
|
---|
422 | int defaultVisual;
|
---|
423 | char ** modes;
|
---|
424 | pointer options;
|
---|
425 | } DispRec, *DispPtr;
|
---|
426 |
|
---|
427 | typedef struct _confxvportrec {
|
---|
428 | char * identifier;
|
---|
429 | pointer options;
|
---|
430 | } confXvPortRec, *confXvPortPtr;
|
---|
431 |
|
---|
432 | typedef struct _confxvadaptrec {
|
---|
433 | char * identifier;
|
---|
434 | int numports;
|
---|
435 | confXvPortPtr ports;
|
---|
436 | pointer options;
|
---|
437 | } confXvAdaptorRec, *confXvAdaptorPtr;
|
---|
438 |
|
---|
439 | typedef struct _confscreenrec {
|
---|
440 | char * id;
|
---|
441 | int screennum;
|
---|
442 | int defaultdepth;
|
---|
443 | int defaultbpp;
|
---|
444 | int defaultfbbpp;
|
---|
445 | MonPtr monitor;
|
---|
446 | GDevPtr device;
|
---|
447 | int numdisplays;
|
---|
448 | DispPtr displays;
|
---|
449 | int numxvadaptors;
|
---|
450 | confXvAdaptorPtr xvadaptors;
|
---|
451 | pointer options;
|
---|
452 | } confScreenRec, *confScreenPtr;
|
---|
453 |
|
---|
454 | typedef enum {
|
---|
455 | PosObsolete = -1,
|
---|
456 | PosAbsolute = 0,
|
---|
457 | PosRightOf,
|
---|
458 | PosLeftOf,
|
---|
459 | PosAbove,
|
---|
460 | PosBelow,
|
---|
461 | PosRelative
|
---|
462 | } PositionType;
|
---|
463 |
|
---|
464 | typedef struct _screenlayoutrec {
|
---|
465 | confScreenPtr screen;
|
---|
466 | char * topname;
|
---|
467 | confScreenPtr top;
|
---|
468 | char * bottomname;
|
---|
469 | confScreenPtr bottom;
|
---|
470 | char * leftname;
|
---|
471 | confScreenPtr left;
|
---|
472 | char * rightname;
|
---|
473 | confScreenPtr right;
|
---|
474 | PositionType where;
|
---|
475 | int x;
|
---|
476 | int y;
|
---|
477 | char * refname;
|
---|
478 | confScreenPtr refscreen;
|
---|
479 | } screenLayoutRec, *screenLayoutPtr;
|
---|
480 |
|
---|
481 | typedef struct _serverlayoutrec {
|
---|
482 | char * id;
|
---|
483 | screenLayoutPtr screens;
|
---|
484 | GDevPtr inactives;
|
---|
485 | IDevPtr* inputs; /* NULL terminated */
|
---|
486 | pointer options;
|
---|
487 | } serverLayoutRec, *serverLayoutPtr;
|
---|
488 |
|
---|
489 | typedef struct _confdribufferrec {
|
---|
490 | int count;
|
---|
491 | int size;
|
---|
492 | enum {
|
---|
493 | XF86DRI_WC_HINT = 0x0001 /* Placeholder: not implemented */
|
---|
494 | } flags;
|
---|
495 | } confDRIBufferRec, *confDRIBufferPtr;
|
---|
496 |
|
---|
497 | typedef struct _confdrirec {
|
---|
498 | int group;
|
---|
499 | int mode;
|
---|
500 | int bufs_count;
|
---|
501 | confDRIBufferRec *bufs;
|
---|
502 | } confDRIRec, *confDRIPtr;
|
---|
503 |
|
---|
504 | /* These values should be adjusted when new fields are added to ScrnInfoRec */
|
---|
505 | #define NUM_RESERVED_INTS 16
|
---|
506 | #define NUM_RESERVED_POINTERS 14
|
---|
507 | #define NUM_RESERVED_FUNCS 11
|
---|
508 |
|
---|
509 | typedef pointer (*funcPointer)(void);
|
---|
510 |
|
---|
511 | /* flags for depth 24 pixmap options */
|
---|
512 | typedef enum {
|
---|
513 | Pix24DontCare = 0,
|
---|
514 | Pix24Use24,
|
---|
515 | Pix24Use32
|
---|
516 | } Pix24Flags;
|
---|
517 |
|
---|
518 | /* Power management events: so far we only support APM */
|
---|
519 |
|
---|
520 | typedef enum {
|
---|
521 | XF86_APM_UNKNOWN = -1,
|
---|
522 | XF86_APM_SYS_STANDBY,
|
---|
523 | XF86_APM_SYS_SUSPEND,
|
---|
524 | XF86_APM_CRITICAL_SUSPEND,
|
---|
525 | XF86_APM_USER_STANDBY,
|
---|
526 | XF86_APM_USER_SUSPEND,
|
---|
527 | XF86_APM_STANDBY_RESUME,
|
---|
528 | XF86_APM_NORMAL_RESUME,
|
---|
529 | XF86_APM_CRITICAL_RESUME,
|
---|
530 | XF86_APM_LOW_BATTERY,
|
---|
531 | XF86_APM_POWER_STATUS_CHANGE,
|
---|
532 | XF86_APM_UPDATE_TIME,
|
---|
533 | XF86_APM_CAPABILITY_CHANGED,
|
---|
534 | XF86_APM_STANDBY_FAILED,
|
---|
535 | XF86_APM_SUSPEND_FAILED
|
---|
536 | } pmEvent;
|
---|
537 |
|
---|
538 | typedef enum {
|
---|
539 | PM_WAIT,
|
---|
540 | PM_CONTINUE,
|
---|
541 | PM_FAILED,
|
---|
542 | PM_NONE
|
---|
543 | } pmWait;
|
---|
544 |
|
---|
545 | typedef struct _PciChipsets {
|
---|
546 | /**
|
---|
547 | * Key used to match this device with its name in an array of
|
---|
548 | * \c SymTabRec.
|
---|
549 | */
|
---|
550 | int numChipset;
|
---|
551 |
|
---|
552 | /**
|
---|
553 | * This value is quirky. Depending on the driver, it can take on one of
|
---|
554 | * three meanings. In drivers that have exactly one vendor ID (e.g.,
|
---|
555 | * radeon, mga, i810) the low 16-bits are the device ID.
|
---|
556 | *
|
---|
557 | * In drivers that can have multiple vendor IDs (e.g., the glint driver
|
---|
558 | * can have either 3dlabs' ID or TI's ID, the i740 driver can have either
|
---|
559 | * Intel's ID or Real3D's ID, etc.) the low 16-bits are the device ID and
|
---|
560 | * the high 16-bits are the vendor ID.
|
---|
561 | *
|
---|
562 | * In drivers that don't have a specific vendor (e.g., vga) contains the
|
---|
563 | * device ID for either the generic VGA or generic 8514 devices. This
|
---|
564 | * turns out to be the same as the subclass and programming interface
|
---|
565 | * value (e.g., the full 24-bit class for the VGA device is 0x030000 (or
|
---|
566 | * 0x000101) and for 8514 is 0x030001).
|
---|
567 | */
|
---|
568 | int PCIid;
|
---|
569 |
|
---|
570 | /* dummy place holders for drivers to build against old/new servers */
|
---|
571 | #define RES_UNDEFINED NULL
|
---|
572 | #define RES_EXCLUSIVE_VGA NULL
|
---|
573 | #define RES_SHARED_VGA NULL
|
---|
574 | void *dummy;
|
---|
575 | } PciChipsets;
|
---|
576 |
|
---|
577 |
|
---|
578 | /* Entity properties */
|
---|
579 | typedef void (*EntityProc)(int entityIndex,pointer private);
|
---|
580 |
|
---|
581 | typedef struct _entityInfo {
|
---|
582 | int index;
|
---|
583 | BusRec location;
|
---|
584 | int chipset;
|
---|
585 | Bool active;
|
---|
586 | GDevPtr device;
|
---|
587 | DriverPtr driver;
|
---|
588 | } EntityInfoRec, *EntityInfoPtr;
|
---|
589 |
|
---|
590 | /* server states */
|
---|
591 |
|
---|
592 | typedef enum {
|
---|
593 | SETUP,
|
---|
594 | OPERATING
|
---|
595 | } xf86State;
|
---|
596 |
|
---|
597 | /* DGA */
|
---|
598 |
|
---|
599 | typedef struct {
|
---|
600 | int num; /* A unique identifier for the mode (num > 0) */
|
---|
601 | DisplayModePtr mode;
|
---|
602 | int flags; /* DGA_CONCURRENT_ACCESS, etc... */
|
---|
603 | int imageWidth; /* linear accessible portion (pixels) */
|
---|
604 | int imageHeight;
|
---|
605 | int pixmapWidth; /* Xlib accessible portion (pixels) */
|
---|
606 | int pixmapHeight; /* both fields ignored if no concurrent access */
|
---|
607 | int bytesPerScanline;
|
---|
608 | int byteOrder; /* MSBFirst, LSBFirst */
|
---|
609 | int depth;
|
---|
610 | int bitsPerPixel;
|
---|
611 | unsigned long red_mask;
|
---|
612 | unsigned long green_mask;
|
---|
613 | unsigned long blue_mask;
|
---|
614 | short visualClass;
|
---|
615 | int viewportWidth;
|
---|
616 | int viewportHeight;
|
---|
617 | int xViewportStep; /* viewport position granularity */
|
---|
618 | int yViewportStep;
|
---|
619 | int maxViewportX; /* max viewport origin */
|
---|
620 | int maxViewportY;
|
---|
621 | int viewportFlags; /* types of page flipping possible */
|
---|
622 | int offset; /* offset into physical memory */
|
---|
623 | unsigned char *address; /* server's mapped framebuffer */
|
---|
624 | int reserved1;
|
---|
625 | int reserved2;
|
---|
626 | } DGAModeRec, *DGAModePtr;
|
---|
627 |
|
---|
628 | typedef struct {
|
---|
629 | DGAModePtr mode;
|
---|
630 | PixmapPtr pPix;
|
---|
631 | } DGADeviceRec, *DGADevicePtr;
|
---|
632 |
|
---|
633 | /*
|
---|
634 | * Flags for driver Probe() functions.
|
---|
635 | */
|
---|
636 | #define PROBE_DEFAULT 0x00
|
---|
637 | #define PROBE_DETECT 0x01
|
---|
638 | #define PROBE_TRYHARD 0x02
|
---|
639 |
|
---|
640 | /*
|
---|
641 | * Driver entry point types
|
---|
642 | */
|
---|
643 |
|
---|
644 | typedef Bool xf86ProbeProc (DriverPtr, int);
|
---|
645 | typedef Bool xf86PreInitProc (ScrnInfoPtr, int);
|
---|
646 | typedef Bool xf86ScreenInitProc (int, ScreenPtr, int, char**);
|
---|
647 | typedef Bool xf86SwitchModeProc (int, DisplayModePtr, int);
|
---|
648 | typedef void xf86AdjustFrameProc (int, int, int, int);
|
---|
649 | typedef Bool xf86EnterVTProc (int, int);
|
---|
650 | typedef void xf86LeaveVTProc (int, int);
|
---|
651 | typedef void xf86FreeScreenProc (int, int);
|
---|
652 | typedef ModeStatus xf86ValidModeProc (int, DisplayModePtr, Bool, int);
|
---|
653 | typedef void xf86EnableDisableFBAccessProc(int, Bool);
|
---|
654 | typedef int xf86SetDGAModeProc (int, int, DGADevicePtr);
|
---|
655 | typedef int xf86ChangeGammaProc (int, Gamma);
|
---|
656 | typedef void xf86PointerMovedProc (int, int, int);
|
---|
657 | typedef Bool xf86PMEventProc (int, pmEvent, Bool);
|
---|
658 | typedef void xf86DPMSSetProc (ScrnInfoPtr, int, int);
|
---|
659 | typedef void xf86LoadPaletteProc (ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
|
---|
660 | typedef void xf86SetOverscanProc (ScrnInfoPtr, int);
|
---|
661 |
|
---|
662 |
|
---|
663 | /*
|
---|
664 | * ScrnInfoRec
|
---|
665 | *
|
---|
666 | * There is one of these for each screen, and it holds all the screen-specific
|
---|
667 | * information.
|
---|
668 | *
|
---|
669 | * Note: the size and layout must be kept the same across versions. New
|
---|
670 | * fields are to be added in place of the "reserved*" fields. No fields
|
---|
671 | * are to be dependent on compile-time defines.
|
---|
672 | */
|
---|
673 |
|
---|
674 |
|
---|
675 | typedef struct _ScrnInfoRec {
|
---|
676 | int driverVersion;
|
---|
677 | char * driverName; /* canonical name used in */
|
---|
678 | /* the config file */
|
---|
679 | ScreenPtr pScreen; /* Pointer to the ScreenRec */
|
---|
680 | int scrnIndex; /* Number of this screen */
|
---|
681 | Bool configured; /* Is this screen valid */
|
---|
682 | int origIndex; /* initial number assigned to
|
---|
683 | * this screen before
|
---|
684 | * finalising the number of
|
---|
685 | * available screens */
|
---|
686 |
|
---|
687 | /* Display-wide screenInfo values needed by this screen */
|
---|
688 | int imageByteOrder;
|
---|
689 | int bitmapScanlineUnit;
|
---|
690 | int bitmapScanlinePad;
|
---|
691 | int bitmapBitOrder;
|
---|
692 | int numFormats;
|
---|
693 | PixmapFormatRec formats[MAXFORMATS];
|
---|
694 | PixmapFormatRec fbFormat;
|
---|
695 |
|
---|
696 | int bitsPerPixel; /* fb bpp */
|
---|
697 | Pix24Flags pixmap24; /* pixmap pref for depth 24 */
|
---|
698 | int depth; /* depth of default visual */
|
---|
699 | MessageType depthFrom; /* set from config? */
|
---|
700 | MessageType bitsPerPixelFrom; /* set from config? */
|
---|
701 | rgb weight; /* r/g/b weights */
|
---|
702 | rgb mask; /* rgb masks */
|
---|
703 | rgb offset; /* rgb offsets */
|
---|
704 | int rgbBits; /* Number of bits in r/g/b */
|
---|
705 | Gamma gamma; /* Gamma of the monitor */
|
---|
706 | int defaultVisual; /* default visual class */
|
---|
707 | int maxHValue; /* max horizontal timing */
|
---|
708 | int maxVValue; /* max vertical timing value */
|
---|
709 | int virtualX; /* Virtual width */
|
---|
710 | int virtualY; /* Virtual height */
|
---|
711 | int xInc; /* Horizontal timing increment */
|
---|
712 | MessageType virtualFrom; /* set from config? */
|
---|
713 | int displayWidth; /* memory pitch */
|
---|
714 | int frameX0; /* viewport position */
|
---|
715 | int frameY0;
|
---|
716 | int frameX1;
|
---|
717 | int frameY1;
|
---|
718 | int zoomLocked; /* Disallow mode changes */
|
---|
719 | DisplayModePtr modePool; /* list of compatible modes */
|
---|
720 | DisplayModePtr modes; /* list of actual modes */
|
---|
721 | DisplayModePtr currentMode; /* current mode
|
---|
722 | * This was previously
|
---|
723 | * overloaded with the modes
|
---|
724 | * field, which is a pointer
|
---|
725 | * into a circular list */
|
---|
726 | confScreenPtr confScreen; /* Screen config info */
|
---|
727 | MonPtr monitor; /* Monitor information */
|
---|
728 | DispPtr display; /* Display information */
|
---|
729 | int * entityList; /* List of device entities */
|
---|
730 | int numEntities;
|
---|
731 | int widthmm; /* physical display dimensions
|
---|
732 | * in mm */
|
---|
733 | int heightmm;
|
---|
734 | int xDpi; /* width DPI */
|
---|
735 | int yDpi; /* height DPI */
|
---|
736 | char * name; /* Name to prefix messages */
|
---|
737 | pointer driverPrivate; /* Driver private area */
|
---|
738 | DevUnion * privates; /* Other privates can hook in
|
---|
739 | * here */
|
---|
740 | DriverPtr drv; /* xf86DriverList[] entry */
|
---|
741 | pointer module; /* Pointer to module head */
|
---|
742 | int colorKey;
|
---|
743 | int overlayFlags;
|
---|
744 |
|
---|
745 | /* Some of these may be moved out of here into the driver private area */
|
---|
746 |
|
---|
747 | char * chipset; /* chipset name */
|
---|
748 | char * ramdac; /* ramdac name */
|
---|
749 | char * clockchip; /* clock name */
|
---|
750 | Bool progClock; /* clock is programmable */
|
---|
751 | int numClocks; /* number of clocks */
|
---|
752 | int clock[MAXCLOCKS]; /* list of clock frequencies */
|
---|
753 | int videoRam; /* amount of video ram (kb) */
|
---|
754 | unsigned long biosBase; /* Base address of video BIOS */
|
---|
755 | unsigned long memPhysBase; /* Physical address of FB */
|
---|
756 | unsigned long fbOffset; /* Offset of FB in the above */
|
---|
757 | IOADDRESS domainIOBase; /* Domain I/O base address */
|
---|
758 | int memClk; /* memory clock */
|
---|
759 | int textClockFreq; /* clock of text mode */
|
---|
760 | Bool flipPixels; /* swap default black/white */
|
---|
761 | pointer options;
|
---|
762 |
|
---|
763 | int chipID;
|
---|
764 | int chipRev;
|
---|
765 |
|
---|
766 | /* Allow screens to be enabled/disabled individually */
|
---|
767 | Bool vtSema;
|
---|
768 | DevUnion pixmapPrivate; /* saved devPrivate from pixmap */
|
---|
769 |
|
---|
770 | /* hw cursor moves at SIGIO time */
|
---|
771 | Bool silkenMouse;
|
---|
772 |
|
---|
773 | /* Storage for clockRanges and adjustFlags for use with the VidMode ext */
|
---|
774 | ClockRangePtr clockRanges;
|
---|
775 | int adjustFlags;
|
---|
776 |
|
---|
777 | /*
|
---|
778 | * These can be used when the minor ABI version is incremented.
|
---|
779 | * The NUM_* parameters must be reduced appropriately to keep the
|
---|
780 | * structure size and alignment unchanged.
|
---|
781 | */
|
---|
782 | int reservedInt[NUM_RESERVED_INTS];
|
---|
783 |
|
---|
784 | int * entityInstanceList;
|
---|
785 | struct pci_device *vgaDev;
|
---|
786 |
|
---|
787 | pointer reservedPtr[NUM_RESERVED_POINTERS];
|
---|
788 |
|
---|
789 | /*
|
---|
790 | * Driver entry points.
|
---|
791 | *
|
---|
792 | */
|
---|
793 |
|
---|
794 | xf86ProbeProc *Probe;
|
---|
795 | xf86PreInitProc *PreInit;
|
---|
796 | xf86ScreenInitProc *ScreenInit;
|
---|
797 | xf86SwitchModeProc *SwitchMode;
|
---|
798 | xf86AdjustFrameProc *AdjustFrame;
|
---|
799 | xf86EnterVTProc *EnterVT;
|
---|
800 | xf86LeaveVTProc *LeaveVT;
|
---|
801 | xf86FreeScreenProc *FreeScreen;
|
---|
802 | xf86ValidModeProc *ValidMode;
|
---|
803 | xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
|
---|
804 | xf86SetDGAModeProc *SetDGAMode;
|
---|
805 | xf86ChangeGammaProc *ChangeGamma;
|
---|
806 | xf86PointerMovedProc *PointerMoved;
|
---|
807 | xf86PMEventProc *PMEvent;
|
---|
808 | xf86DPMSSetProc *DPMSSet;
|
---|
809 | xf86LoadPaletteProc *LoadPalette;
|
---|
810 | xf86SetOverscanProc *SetOverscan;
|
---|
811 | xorgDriverFuncProc *DriverFunc;
|
---|
812 |
|
---|
813 | /*
|
---|
814 | * This can be used when the minor ABI version is incremented.
|
---|
815 | * The NUM_* parameter must be reduced appropriately to keep the
|
---|
816 | * structure size and alignment unchanged.
|
---|
817 | */
|
---|
818 | funcPointer reservedFuncs[NUM_RESERVED_FUNCS];
|
---|
819 |
|
---|
820 | } ScrnInfoRec;
|
---|
821 |
|
---|
822 |
|
---|
823 | typedef struct {
|
---|
824 | Bool (*OpenFramebuffer)(
|
---|
825 | ScrnInfoPtr pScrn,
|
---|
826 | char **name,
|
---|
827 | unsigned char **mem,
|
---|
828 | int *size,
|
---|
829 | int *offset,
|
---|
830 | int *extra
|
---|
831 | );
|
---|
832 | void (*CloseFramebuffer)(ScrnInfoPtr pScrn);
|
---|
833 | Bool (*SetMode)(ScrnInfoPtr pScrn, DGAModePtr pMode);
|
---|
834 | void (*SetViewport)(ScrnInfoPtr pScrn, int x, int y, int flags);
|
---|
835 | int (*GetViewport)(ScrnInfoPtr pScrn);
|
---|
836 | void (*Sync)(ScrnInfoPtr);
|
---|
837 | void (*FillRect)(
|
---|
838 | ScrnInfoPtr pScrn,
|
---|
839 | int x, int y, int w, int h,
|
---|
840 | unsigned long color
|
---|
841 | );
|
---|
842 | void (*BlitRect)(
|
---|
843 | ScrnInfoPtr pScrn,
|
---|
844 | int srcx, int srcy,
|
---|
845 | int w, int h,
|
---|
846 | int dstx, int dsty
|
---|
847 | );
|
---|
848 | void (*BlitTransRect)(
|
---|
849 | ScrnInfoPtr pScrn,
|
---|
850 | int srcx, int srcy,
|
---|
851 | int w, int h,
|
---|
852 | int dstx, int dsty,
|
---|
853 | unsigned long color
|
---|
854 | );
|
---|
855 | } DGAFunctionRec, *DGAFunctionPtr;
|
---|
856 |
|
---|
857 | typedef struct _SymTabRec {
|
---|
858 | int token; /* id of the token */
|
---|
859 | const char * name; /* token name */
|
---|
860 | } SymTabRec, *SymTabPtr;
|
---|
861 |
|
---|
862 | /* flags for xf86LookupMode */
|
---|
863 | typedef enum {
|
---|
864 | LOOKUP_DEFAULT = 0, /* Use default mode lookup method */
|
---|
865 | LOOKUP_BEST_REFRESH, /* Pick modes with best refresh */
|
---|
866 | LOOKUP_CLOSEST_CLOCK, /* Pick modes with the closest clock */
|
---|
867 | LOOKUP_LIST_ORDER, /* Pick first useful mode in list */
|
---|
868 | LOOKUP_CLKDIV2 = 0x0100, /* Allow half clocks */
|
---|
869 | LOOKUP_OPTIONAL_TOLERANCES = 0x0200 /* Allow missing hsync/vrefresh */
|
---|
870 | } LookupModeFlags;
|
---|
871 |
|
---|
872 | #define NoDepth24Support 0x00
|
---|
873 | #define Support24bppFb 0x01 /* 24bpp framebuffer supported */
|
---|
874 | #define Support32bppFb 0x02 /* 32bpp framebuffer supported */
|
---|
875 | #define SupportConvert24to32 0x04 /* Can convert 24bpp pixmap to 32bpp */
|
---|
876 | #define SupportConvert32to24 0x08 /* Can convert 32bpp pixmap to 24bpp */
|
---|
877 | #define PreferConvert24to32 0x10 /* prefer 24bpp pixmap to 32bpp conv */
|
---|
878 | #define PreferConvert32to24 0x20 /* prefer 32bpp pixmap to 24bpp conv */
|
---|
879 |
|
---|
880 |
|
---|
881 | /* For DPMS */
|
---|
882 | typedef void (*DPMSSetProcPtr)(ScrnInfoPtr, int, int);
|
---|
883 |
|
---|
884 | /* Input handler proc */
|
---|
885 | typedef void (*InputHandlerProc)(int fd, pointer data);
|
---|
886 |
|
---|
887 | /* These are used by xf86GetClocks */
|
---|
888 | #define CLK_REG_SAVE -1
|
---|
889 | #define CLK_REG_RESTORE -2
|
---|
890 |
|
---|
891 | /*
|
---|
892 | * misc constants
|
---|
893 | */
|
---|
894 | #define INTERLACE_REFRESH_WEIGHT 1.5
|
---|
895 | #define SYNC_TOLERANCE 0.01 /* 1 percent */
|
---|
896 | #define CLOCK_TOLERANCE 2000 /* Clock matching tolerance (2MHz) */
|
---|
897 |
|
---|
898 |
|
---|
899 | #define OVERLAY_8_32_DUALFB 0x00000001
|
---|
900 | #define OVERLAY_8_24_DUALFB 0x00000002
|
---|
901 | #define OVERLAY_8_16_DUALFB 0x00000004
|
---|
902 | #define OVERLAY_8_32_PLANAR 0x00000008
|
---|
903 |
|
---|
904 | /* Values of xf86Info.mouseFlags */
|
---|
905 | #define MF_CLEAR_DTR 1
|
---|
906 | #define MF_CLEAR_RTS 2
|
---|
907 |
|
---|
908 | /* Action Events */
|
---|
909 | typedef enum {
|
---|
910 | ACTION_TERMINATE = 0, /* Terminate Server */
|
---|
911 | ACTION_NEXT_MODE = 10, /* Switch to next video mode */
|
---|
912 | ACTION_PREV_MODE,
|
---|
913 | ACTION_SWITCHSCREEN = 100, /* VT switch */
|
---|
914 | ACTION_SWITCHSCREEN_NEXT,
|
---|
915 | ACTION_SWITCHSCREEN_PREV,
|
---|
916 | } ActionEvent;
|
---|
917 |
|
---|
918 | #endif /* _XF86STR_H */
|
---|