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