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