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 | 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 | char *id;
|
---|
216 | char *vendor;
|
---|
217 | 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 | pointer options;
|
---|
228 | pointer 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 | } xorgDriverFuncOp;
|
---|
261 |
|
---|
262 | typedef Bool xorgDriverFuncProc(ScrnInfoPtr, xorgDriverFuncOp, pointer);
|
---|
263 |
|
---|
264 | /* RR_GET_INFO, RR_SET_CONFIG */
|
---|
265 | typedef struct {
|
---|
266 | int rotation;
|
---|
267 | int rate;
|
---|
268 | int width;
|
---|
269 | int height;
|
---|
270 | } xorgRRConfig;
|
---|
271 |
|
---|
272 | typedef union {
|
---|
273 | short RRRotations;
|
---|
274 | xorgRRConfig RRConfig;
|
---|
275 | } xorgRRRotation, *xorgRRRotationPtr;
|
---|
276 |
|
---|
277 | /* RR_GET_MODE_MM */
|
---|
278 | typedef struct {
|
---|
279 | DisplayModePtr mode;
|
---|
280 | int virtX;
|
---|
281 | int virtY;
|
---|
282 | int mmWidth;
|
---|
283 | int mmHeight;
|
---|
284 | } xorgRRModeMM, *xorgRRModeMMPtr;
|
---|
285 |
|
---|
286 | /* GET_REQUIRED_HW_INTERFACES */
|
---|
287 | #define HW_IO 1
|
---|
288 | #define HW_MMIO 2
|
---|
289 | #define HW_SKIP_CONSOLE 4
|
---|
290 | #define NEED_IO_ENABLED(x) (x & HW_IO)
|
---|
291 |
|
---|
292 | typedef CARD32 xorgHWFlags;
|
---|
293 |
|
---|
294 | /*
|
---|
295 | * The driver list struct. This contains the information required for each
|
---|
296 | * driver before a ScrnInfoRec has been allocated.
|
---|
297 | */
|
---|
298 | struct _DriverRec;
|
---|
299 |
|
---|
300 | typedef struct {
|
---|
301 | int driverVersion;
|
---|
302 | char *driverName;
|
---|
303 | void (*Identify) (int flags);
|
---|
304 | Bool (*Probe) (struct _DriverRec * drv, int flags);
|
---|
305 | const OptionInfoRec *(*AvailableOptions) (int chipid, int bustype);
|
---|
306 | pointer module;
|
---|
307 | int refCount;
|
---|
308 | } DriverRec1;
|
---|
309 |
|
---|
310 | struct _SymTabRec;
|
---|
311 | struct _PciChipsets;
|
---|
312 |
|
---|
313 | struct pci_device;
|
---|
314 | struct xf86_platform_device;
|
---|
315 |
|
---|
316 | typedef struct _DriverRec {
|
---|
317 | int driverVersion;
|
---|
318 | char *driverName;
|
---|
319 | void (*Identify) (int flags);
|
---|
320 | Bool (*Probe) (struct _DriverRec * drv, int flags);
|
---|
321 | const OptionInfoRec *(*AvailableOptions) (int chipid, int bustype);
|
---|
322 | pointer module;
|
---|
323 | int refCount;
|
---|
324 | xorgDriverFuncProc *driverFunc;
|
---|
325 |
|
---|
326 | const struct pci_id_match *supported_devices;
|
---|
327 | Bool (*PciProbe) (struct _DriverRec * drv, int entity_num,
|
---|
328 | struct pci_device * dev, intptr_t match_data);
|
---|
329 | Bool (*platformProbe) (struct _DriverRec * drv, int entity_num, int flags,
|
---|
330 | struct xf86_platform_device * dev, intptr_t match_data);
|
---|
331 | } DriverRec, *DriverPtr;
|
---|
332 |
|
---|
333 | /*
|
---|
334 | * platform probe flags
|
---|
335 | */
|
---|
336 | #define PLATFORM_PROBE_GPU_SCREEN 1
|
---|
337 |
|
---|
338 | /*
|
---|
339 | * AddDriver flags
|
---|
340 | */
|
---|
341 | #define HaveDriverFuncs 1
|
---|
342 |
|
---|
343 | /*
|
---|
344 | * These are the private bus types. New types can be added here. Types
|
---|
345 | * required for the public interface should be added to xf86str.h, with
|
---|
346 | * function prototypes added to xf86.h.
|
---|
347 | */
|
---|
348 |
|
---|
349 | /* Tolerate prior #include <linux/input.h> */
|
---|
350 | #if defined(linux)
|
---|
351 | #undef BUS_NONE
|
---|
352 | #undef BUS_PCI
|
---|
353 | #undef BUS_SBUS
|
---|
354 | #undef BUS_PLATFORM
|
---|
355 | #undef BUS_last
|
---|
356 | #endif
|
---|
357 |
|
---|
358 | typedef enum {
|
---|
359 | BUS_NONE,
|
---|
360 | BUS_PCI,
|
---|
361 | BUS_SBUS,
|
---|
362 | BUS_PLATFORM,
|
---|
363 | BUS_last /* Keep last */
|
---|
364 | } BusType;
|
---|
365 |
|
---|
366 | typedef struct {
|
---|
367 | int fbNum;
|
---|
368 | } SbusBusId;
|
---|
369 |
|
---|
370 | typedef struct _bus {
|
---|
371 | BusType type;
|
---|
372 | union {
|
---|
373 | struct pci_device *pci;
|
---|
374 | SbusBusId sbus;
|
---|
375 | struct xf86_platform_device *plat;
|
---|
376 | } id;
|
---|
377 | } BusRec, *BusPtr;
|
---|
378 |
|
---|
379 | #define MAXCLOCKS 128
|
---|
380 | typedef enum {
|
---|
381 | DAC_BPP8 = 0,
|
---|
382 | DAC_BPP16,
|
---|
383 | DAC_BPP24,
|
---|
384 | DAC_BPP32,
|
---|
385 | MAXDACSPEEDS
|
---|
386 | } DacSpeedIndex;
|
---|
387 |
|
---|
388 | typedef struct {
|
---|
389 | char *identifier;
|
---|
390 | char *vendor;
|
---|
391 | char *board;
|
---|
392 | char *chipset;
|
---|
393 | char *ramdac;
|
---|
394 | char *driver;
|
---|
395 | struct _confscreenrec *myScreenSection;
|
---|
396 | Bool claimed;
|
---|
397 | int dacSpeeds[MAXDACSPEEDS];
|
---|
398 | int numclocks;
|
---|
399 | int clock[MAXCLOCKS];
|
---|
400 | char *clockchip;
|
---|
401 | char *busID;
|
---|
402 | Bool active;
|
---|
403 | Bool inUse;
|
---|
404 | int videoRam;
|
---|
405 | int textClockFreq;
|
---|
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 | pointer 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 | char **modes;
|
---|
428 | pointer options;
|
---|
429 | } DispRec, *DispPtr;
|
---|
430 |
|
---|
431 | typedef struct _confxvportrec {
|
---|
432 | char *identifier;
|
---|
433 | pointer options;
|
---|
434 | } confXvPortRec, *confXvPortPtr;
|
---|
435 |
|
---|
436 | typedef struct _confxvadaptrec {
|
---|
437 | char *identifier;
|
---|
438 | int numports;
|
---|
439 | confXvPortPtr ports;
|
---|
440 | pointer options;
|
---|
441 | } confXvAdaptorRec, *confXvAdaptorPtr;
|
---|
442 |
|
---|
443 | typedef struct _confscreenrec {
|
---|
444 | char *id;
|
---|
445 | int screennum;
|
---|
446 | int defaultdepth;
|
---|
447 | int defaultbpp;
|
---|
448 | int defaultfbbpp;
|
---|
449 | MonPtr monitor;
|
---|
450 | GDevPtr device;
|
---|
451 | int numdisplays;
|
---|
452 | DispPtr displays;
|
---|
453 | int numxvadaptors;
|
---|
454 | confXvAdaptorPtr xvadaptors;
|
---|
455 | pointer options;
|
---|
456 | } confScreenRec, *confScreenPtr;
|
---|
457 |
|
---|
458 | typedef enum {
|
---|
459 | PosObsolete = -1,
|
---|
460 | PosAbsolute = 0,
|
---|
461 | PosRightOf,
|
---|
462 | PosLeftOf,
|
---|
463 | PosAbove,
|
---|
464 | PosBelow,
|
---|
465 | PosRelative
|
---|
466 | } PositionType;
|
---|
467 |
|
---|
468 | typedef struct _screenlayoutrec {
|
---|
469 | confScreenPtr screen;
|
---|
470 | char *topname;
|
---|
471 | confScreenPtr top;
|
---|
472 | char *bottomname;
|
---|
473 | confScreenPtr bottom;
|
---|
474 | char *leftname;
|
---|
475 | confScreenPtr left;
|
---|
476 | char *rightname;
|
---|
477 | confScreenPtr right;
|
---|
478 | PositionType where;
|
---|
479 | int x;
|
---|
480 | int y;
|
---|
481 | char *refname;
|
---|
482 | confScreenPtr refscreen;
|
---|
483 | } screenLayoutRec, *screenLayoutPtr;
|
---|
484 |
|
---|
485 | typedef struct _InputInfoRec InputInfoRec;
|
---|
486 |
|
---|
487 | typedef struct _serverlayoutrec {
|
---|
488 | char *id;
|
---|
489 | screenLayoutPtr screens;
|
---|
490 | GDevPtr inactives;
|
---|
491 | InputInfoRec **inputs; /* NULL terminated */
|
---|
492 | pointer options;
|
---|
493 | } serverLayoutRec, *serverLayoutPtr;
|
---|
494 |
|
---|
495 | typedef struct _confdribufferrec {
|
---|
496 | int count;
|
---|
497 | int size;
|
---|
498 | enum {
|
---|
499 | XF86DRI_WC_HINT = 0x0001 /* Placeholder: not implemented */
|
---|
500 | } flags;
|
---|
501 | } confDRIBufferRec, *confDRIBufferPtr;
|
---|
502 |
|
---|
503 | typedef struct _confdrirec {
|
---|
504 | int group;
|
---|
505 | int mode;
|
---|
506 | int bufs_count;
|
---|
507 | confDRIBufferRec *bufs;
|
---|
508 | } confDRIRec, *confDRIPtr;
|
---|
509 |
|
---|
510 | /* These values should be adjusted when new fields are added to ScrnInfoRec */
|
---|
511 | #define NUM_RESERVED_INTS 16
|
---|
512 | #define NUM_RESERVED_POINTERS 14
|
---|
513 | #define NUM_RESERVED_FUNCS 10
|
---|
514 |
|
---|
515 | typedef pointer (*funcPointer) (void);
|
---|
516 |
|
---|
517 | /* flags for depth 24 pixmap options */
|
---|
518 | typedef enum {
|
---|
519 | Pix24DontCare = 0,
|
---|
520 | Pix24Use24,
|
---|
521 | Pix24Use32
|
---|
522 | } Pix24Flags;
|
---|
523 |
|
---|
524 | /* Power management events: so far we only support APM */
|
---|
525 |
|
---|
526 | typedef enum {
|
---|
527 | XF86_APM_UNKNOWN = -1,
|
---|
528 | XF86_APM_SYS_STANDBY,
|
---|
529 | XF86_APM_SYS_SUSPEND,
|
---|
530 | XF86_APM_CRITICAL_SUSPEND,
|
---|
531 | XF86_APM_USER_STANDBY,
|
---|
532 | XF86_APM_USER_SUSPEND,
|
---|
533 | XF86_APM_STANDBY_RESUME,
|
---|
534 | XF86_APM_NORMAL_RESUME,
|
---|
535 | XF86_APM_CRITICAL_RESUME,
|
---|
536 | XF86_APM_LOW_BATTERY,
|
---|
537 | XF86_APM_POWER_STATUS_CHANGE,
|
---|
538 | XF86_APM_UPDATE_TIME,
|
---|
539 | XF86_APM_CAPABILITY_CHANGED,
|
---|
540 | XF86_APM_STANDBY_FAILED,
|
---|
541 | XF86_APM_SUSPEND_FAILED
|
---|
542 | } pmEvent;
|
---|
543 |
|
---|
544 | typedef enum {
|
---|
545 | PM_WAIT,
|
---|
546 | PM_CONTINUE,
|
---|
547 | PM_FAILED,
|
---|
548 | PM_NONE
|
---|
549 | } pmWait;
|
---|
550 |
|
---|
551 | typedef struct _PciChipsets {
|
---|
552 | /**
|
---|
553 | * Key used to match this device with its name in an array of
|
---|
554 | * \c SymTabRec.
|
---|
555 | */
|
---|
556 | int numChipset;
|
---|
557 |
|
---|
558 | /**
|
---|
559 | * This value is quirky. Depending on the driver, it can take on one of
|
---|
560 | * three meanings. In drivers that have exactly one vendor ID (e.g.,
|
---|
561 | * radeon, mga, i810) the low 16-bits are the device ID.
|
---|
562 | *
|
---|
563 | * In drivers that can have multiple vendor IDs (e.g., the glint driver
|
---|
564 | * can have either 3dlabs' ID or TI's ID, the i740 driver can have either
|
---|
565 | * Intel's ID or Real3D's ID, etc.) the low 16-bits are the device ID and
|
---|
566 | * the high 16-bits are the vendor ID.
|
---|
567 | *
|
---|
568 | * In drivers that don't have a specific vendor (e.g., vga) contains the
|
---|
569 | * device ID for either the generic VGA or generic 8514 devices. This
|
---|
570 | * turns out to be the same as the subclass and programming interface
|
---|
571 | * value (e.g., the full 24-bit class for the VGA device is 0x030000 (or
|
---|
572 | * 0x000101) and for 8514 is 0x030001).
|
---|
573 | */
|
---|
574 | int PCIid;
|
---|
575 |
|
---|
576 | /* dummy place holders for drivers to build against old/new servers */
|
---|
577 | #define RES_UNDEFINED NULL
|
---|
578 | #define RES_EXCLUSIVE_VGA NULL
|
---|
579 | #define RES_SHARED_VGA NULL
|
---|
580 | void *dummy;
|
---|
581 | } PciChipsets;
|
---|
582 |
|
---|
583 | /* Entity properties */
|
---|
584 | typedef void (*EntityProc) (int entityIndex, pointer private);
|
---|
585 |
|
---|
586 | typedef struct _entityInfo {
|
---|
587 | int index;
|
---|
588 | BusRec location;
|
---|
589 | int chipset;
|
---|
590 | Bool active;
|
---|
591 | GDevPtr device;
|
---|
592 | DriverPtr driver;
|
---|
593 | } EntityInfoRec, *EntityInfoPtr;
|
---|
594 |
|
---|
595 | /* DGA */
|
---|
596 |
|
---|
597 | typedef struct {
|
---|
598 | int num; /* A unique identifier for the mode (num > 0) */
|
---|
599 | DisplayModePtr mode;
|
---|
600 | int flags; /* DGA_CONCURRENT_ACCESS, etc... */
|
---|
601 | int imageWidth; /* linear accessible portion (pixels) */
|
---|
602 | int imageHeight;
|
---|
603 | int pixmapWidth; /* Xlib accessible portion (pixels) */
|
---|
604 | int pixmapHeight; /* both fields ignored if no concurrent access */
|
---|
605 | int bytesPerScanline;
|
---|
606 | int byteOrder; /* MSBFirst, LSBFirst */
|
---|
607 | int depth;
|
---|
608 | int bitsPerPixel;
|
---|
609 | unsigned long red_mask;
|
---|
610 | unsigned long green_mask;
|
---|
611 | unsigned long blue_mask;
|
---|
612 | short visualClass;
|
---|
613 | int viewportWidth;
|
---|
614 | int viewportHeight;
|
---|
615 | int xViewportStep; /* viewport position granularity */
|
---|
616 | int yViewportStep;
|
---|
617 | int maxViewportX; /* max viewport origin */
|
---|
618 | int maxViewportY;
|
---|
619 | int viewportFlags; /* types of page flipping possible */
|
---|
620 | int offset; /* offset into physical memory */
|
---|
621 | unsigned char *address; /* server's mapped framebuffer */
|
---|
622 | int reserved1;
|
---|
623 | int reserved2;
|
---|
624 | } DGAModeRec, *DGAModePtr;
|
---|
625 |
|
---|
626 | typedef struct {
|
---|
627 | DGAModePtr mode;
|
---|
628 | PixmapPtr pPix;
|
---|
629 | } DGADeviceRec, *DGADevicePtr;
|
---|
630 |
|
---|
631 | /*
|
---|
632 | * Flags for driver Probe() functions.
|
---|
633 | */
|
---|
634 | #define PROBE_DEFAULT 0x00
|
---|
635 | #define PROBE_DETECT 0x01
|
---|
636 | #define PROBE_TRYHARD 0x02
|
---|
637 |
|
---|
638 | /*
|
---|
639 | * Driver entry point types
|
---|
640 | */
|
---|
641 |
|
---|
642 | typedef Bool xf86ProbeProc(DriverPtr, int);
|
---|
643 | typedef Bool xf86PreInitProc(ScrnInfoPtr, int);
|
---|
644 | typedef Bool xf86ScreenInitProc(ScreenPtr, int, char **);
|
---|
645 | typedef Bool xf86SwitchModeProc(ScrnInfoPtr, DisplayModePtr);
|
---|
646 | typedef void xf86AdjustFrameProc(ScrnInfoPtr, int, int);
|
---|
647 | typedef Bool xf86EnterVTProc(ScrnInfoPtr);
|
---|
648 | typedef void xf86LeaveVTProc(ScrnInfoPtr);
|
---|
649 | typedef void xf86FreeScreenProc(ScrnInfoPtr);
|
---|
650 | typedef ModeStatus xf86ValidModeProc(ScrnInfoPtr, DisplayModePtr, Bool, int);
|
---|
651 | typedef void xf86EnableDisableFBAccessProc(ScrnInfoPtr, Bool);
|
---|
652 | typedef int xf86SetDGAModeProc(ScrnInfoPtr, int, DGADevicePtr);
|
---|
653 | typedef int xf86ChangeGammaProc(ScrnInfoPtr, Gamma);
|
---|
654 | typedef void xf86PointerMovedProc(ScrnInfoPtr, int, int);
|
---|
655 | typedef Bool xf86PMEventProc(ScrnInfoPtr, pmEvent, Bool);
|
---|
656 | typedef void xf86DPMSSetProc(ScrnInfoPtr, int, int);
|
---|
657 | typedef void xf86LoadPaletteProc(ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
|
---|
658 | typedef void xf86SetOverscanProc(ScrnInfoPtr, int);
|
---|
659 | typedef void xf86ModeSetProc(ScrnInfoPtr);
|
---|
660 |
|
---|
661 | /*
|
---|
662 | * ScrnInfoRec
|
---|
663 | *
|
---|
664 | * There is one of these for each screen, and it holds all the screen-specific
|
---|
665 | * information.
|
---|
666 | *
|
---|
667 | * Note: the size and layout must be kept the same across versions. New
|
---|
668 | * fields are to be added in place of the "reserved*" fields. No fields
|
---|
669 | * are to be dependent on compile-time defines.
|
---|
670 | */
|
---|
671 |
|
---|
672 | typedef struct _ScrnInfoRec {
|
---|
673 | int driverVersion;
|
---|
674 | char *driverName; /* canonical name used in */
|
---|
675 | /* the config file */
|
---|
676 | ScreenPtr pScreen; /* Pointer to the ScreenRec */
|
---|
677 | int scrnIndex; /* Number of this screen */
|
---|
678 | Bool configured; /* Is this screen valid */
|
---|
679 | int origIndex; /* initial number assigned to
|
---|
680 | * this screen before
|
---|
681 | * finalising the number of
|
---|
682 | * available screens */
|
---|
683 |
|
---|
684 | /* Display-wide screenInfo values needed by this screen */
|
---|
685 | int imageByteOrder;
|
---|
686 | int bitmapScanlineUnit;
|
---|
687 | int bitmapScanlinePad;
|
---|
688 | int bitmapBitOrder;
|
---|
689 | int numFormats;
|
---|
690 | PixmapFormatRec formats[MAXFORMATS];
|
---|
691 | PixmapFormatRec fbFormat;
|
---|
692 |
|
---|
693 | int bitsPerPixel; /* fb bpp */
|
---|
694 | Pix24Flags pixmap24; /* pixmap pref for depth 24 */
|
---|
695 | int depth; /* depth of default visual */
|
---|
696 | MessageType depthFrom; /* set from config? */
|
---|
697 | MessageType bitsPerPixelFrom; /* set from config? */
|
---|
698 | rgb weight; /* r/g/b weights */
|
---|
699 | rgb mask; /* rgb masks */
|
---|
700 | rgb offset; /* rgb offsets */
|
---|
701 | int rgbBits; /* Number of bits in r/g/b */
|
---|
702 | Gamma gamma; /* Gamma of the monitor */
|
---|
703 | int defaultVisual; /* default visual class */
|
---|
704 | int maxHValue; /* max horizontal timing */
|
---|
705 | int maxVValue; /* max vertical timing value */
|
---|
706 | int virtualX; /* Virtual width */
|
---|
707 | int virtualY; /* Virtual height */
|
---|
708 | int xInc; /* Horizontal timing increment */
|
---|
709 | MessageType virtualFrom; /* set from config? */
|
---|
710 | int displayWidth; /* memory pitch */
|
---|
711 | int frameX0; /* viewport position */
|
---|
712 | int frameY0;
|
---|
713 | int frameX1;
|
---|
714 | int frameY1;
|
---|
715 | int zoomLocked; /* Disallow mode changes */
|
---|
716 | DisplayModePtr modePool; /* list of compatible modes */
|
---|
717 | DisplayModePtr modes; /* list of actual modes */
|
---|
718 | DisplayModePtr currentMode; /* current mode
|
---|
719 | * This was previously
|
---|
720 | * overloaded with the modes
|
---|
721 | * field, which is a pointer
|
---|
722 | * into a circular list */
|
---|
723 | confScreenPtr confScreen; /* Screen config info */
|
---|
724 | MonPtr monitor; /* Monitor information */
|
---|
725 | DispPtr display; /* Display information */
|
---|
726 | int *entityList; /* List of device entities */
|
---|
727 | int numEntities;
|
---|
728 | int widthmm; /* physical display dimensions
|
---|
729 | * in mm */
|
---|
730 | int heightmm;
|
---|
731 | int xDpi; /* width DPI */
|
---|
732 | int yDpi; /* height DPI */
|
---|
733 | char *name; /* Name to prefix messages */
|
---|
734 | pointer driverPrivate; /* Driver private area */
|
---|
735 | DevUnion *privates; /* Other privates can hook in
|
---|
736 | * here */
|
---|
737 | DriverPtr drv; /* xf86DriverList[] entry */
|
---|
738 | pointer module; /* Pointer to module head */
|
---|
739 | int colorKey;
|
---|
740 | int overlayFlags;
|
---|
741 |
|
---|
742 | /* Some of these may be moved out of here into the driver private area */
|
---|
743 |
|
---|
744 | char *chipset; /* chipset name */
|
---|
745 | char *ramdac; /* ramdac name */
|
---|
746 | char *clockchip; /* clock name */
|
---|
747 | Bool progClock; /* clock is programmable */
|
---|
748 | int numClocks; /* number of clocks */
|
---|
749 | int clock[MAXCLOCKS]; /* list of clock frequencies */
|
---|
750 | int videoRam; /* amount of video ram (kb) */
|
---|
751 | unsigned long biosBase; /* Base address of video BIOS */
|
---|
752 | unsigned long memPhysBase; /* Physical address of FB */
|
---|
753 | unsigned long fbOffset; /* Offset of FB in the above */
|
---|
754 | int memClk; /* memory clock */
|
---|
755 | int textClockFreq; /* clock of text mode */
|
---|
756 | Bool flipPixels; /* swap default black/white */
|
---|
757 | pointer options;
|
---|
758 |
|
---|
759 | int chipID;
|
---|
760 | int chipRev;
|
---|
761 |
|
---|
762 | /* Allow screens to be enabled/disabled individually */
|
---|
763 | Bool vtSema;
|
---|
764 |
|
---|
765 | /* hw cursor moves at SIGIO time */
|
---|
766 | Bool silkenMouse;
|
---|
767 |
|
---|
768 | /* Storage for clockRanges and adjustFlags for use with the VidMode ext */
|
---|
769 | ClockRangePtr clockRanges;
|
---|
770 | int adjustFlags;
|
---|
771 |
|
---|
772 | /*
|
---|
773 | * These can be used when the minor ABI version is incremented.
|
---|
774 | * The NUM_* parameters must be reduced appropriately to keep the
|
---|
775 | * structure size and alignment unchanged.
|
---|
776 | */
|
---|
777 | int reservedInt[NUM_RESERVED_INTS];
|
---|
778 |
|
---|
779 | int *entityInstanceList;
|
---|
780 | struct pci_device *vgaDev;
|
---|
781 |
|
---|
782 | pointer reservedPtr[NUM_RESERVED_POINTERS];
|
---|
783 |
|
---|
784 | /*
|
---|
785 | * Driver entry points.
|
---|
786 | *
|
---|
787 | */
|
---|
788 |
|
---|
789 | xf86ProbeProc *Probe;
|
---|
790 | xf86PreInitProc *PreInit;
|
---|
791 | xf86ScreenInitProc *ScreenInit;
|
---|
792 | xf86SwitchModeProc *SwitchMode;
|
---|
793 | xf86AdjustFrameProc *AdjustFrame;
|
---|
794 | xf86EnterVTProc *EnterVT;
|
---|
795 | xf86LeaveVTProc *LeaveVT;
|
---|
796 | xf86FreeScreenProc *FreeScreen;
|
---|
797 | xf86ValidModeProc *ValidMode;
|
---|
798 | xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
|
---|
799 | xf86SetDGAModeProc *SetDGAMode;
|
---|
800 | xf86ChangeGammaProc *ChangeGamma;
|
---|
801 | xf86PointerMovedProc *PointerMoved;
|
---|
802 | xf86PMEventProc *PMEvent;
|
---|
803 | xf86DPMSSetProc *DPMSSet;
|
---|
804 | xf86LoadPaletteProc *LoadPalette;
|
---|
805 | xf86SetOverscanProc *SetOverscan;
|
---|
806 | xorgDriverFuncProc *DriverFunc;
|
---|
807 | xf86ModeSetProc *ModeSet;
|
---|
808 |
|
---|
809 | /*
|
---|
810 | * This can be used when the minor ABI version is incremented.
|
---|
811 | * The NUM_* parameter must be reduced appropriately to keep the
|
---|
812 | * structure size and alignment unchanged.
|
---|
813 | */
|
---|
814 | funcPointer reservedFuncs[NUM_RESERVED_FUNCS];
|
---|
815 |
|
---|
816 | Bool is_gpu;
|
---|
817 | uint32_t capabilities;
|
---|
818 | } ScrnInfoRec;
|
---|
819 |
|
---|
820 | typedef struct {
|
---|
821 | Bool (*OpenFramebuffer) (ScrnInfoPtr pScrn,
|
---|
822 | char **name,
|
---|
823 | unsigned char **mem,
|
---|
824 | int *size, int *offset, int *extra);
|
---|
825 | void (*CloseFramebuffer) (ScrnInfoPtr pScrn);
|
---|
826 | Bool (*SetMode) (ScrnInfoPtr pScrn, DGAModePtr pMode);
|
---|
827 | void (*SetViewport) (ScrnInfoPtr pScrn, int x, int y, int flags);
|
---|
828 | int (*GetViewport) (ScrnInfoPtr pScrn);
|
---|
829 | void (*Sync) (ScrnInfoPtr);
|
---|
830 | void (*FillRect) (ScrnInfoPtr pScrn,
|
---|
831 | int x, int y, int w, int h, unsigned long color);
|
---|
832 | void (*BlitRect) (ScrnInfoPtr pScrn,
|
---|
833 | int srcx, int srcy, int w, int h, int dstx, int dsty);
|
---|
834 | void (*BlitTransRect) (ScrnInfoPtr pScrn,
|
---|
835 | int srcx, int srcy,
|
---|
836 | int w, int h,
|
---|
837 | int dstx, int dsty, unsigned long color);
|
---|
838 | } DGAFunctionRec, *DGAFunctionPtr;
|
---|
839 |
|
---|
840 | typedef struct _SymTabRec {
|
---|
841 | int token; /* id of the token */
|
---|
842 | const char *name; /* token name */
|
---|
843 | } SymTabRec, *SymTabPtr;
|
---|
844 |
|
---|
845 | /* flags for xf86LookupMode */
|
---|
846 | typedef enum {
|
---|
847 | LOOKUP_DEFAULT = 0, /* Use default mode lookup method */
|
---|
848 | LOOKUP_BEST_REFRESH, /* Pick modes with best refresh */
|
---|
849 | LOOKUP_CLOSEST_CLOCK, /* Pick modes with the closest clock */
|
---|
850 | LOOKUP_LIST_ORDER, /* Pick first useful mode in list */
|
---|
851 | LOOKUP_CLKDIV2 = 0x0100, /* Allow half clocks */
|
---|
852 | LOOKUP_OPTIONAL_TOLERANCES = 0x0200 /* Allow missing hsync/vrefresh */
|
---|
853 | } LookupModeFlags;
|
---|
854 |
|
---|
855 | #define NoDepth24Support 0x00
|
---|
856 | #define Support24bppFb 0x01 /* 24bpp framebuffer supported */
|
---|
857 | #define Support32bppFb 0x02 /* 32bpp framebuffer supported */
|
---|
858 | #define SupportConvert24to32 0x04 /* Can convert 24bpp pixmap to 32bpp */
|
---|
859 | #define SupportConvert32to24 0x08 /* Can convert 32bpp pixmap to 24bpp */
|
---|
860 | #define PreferConvert24to32 0x10 /* prefer 24bpp pixmap to 32bpp conv */
|
---|
861 | #define PreferConvert32to24 0x20 /* prefer 32bpp pixmap to 24bpp conv */
|
---|
862 |
|
---|
863 | /* For DPMS */
|
---|
864 | typedef void (*DPMSSetProcPtr) (ScrnInfoPtr, int, int);
|
---|
865 |
|
---|
866 | /* Input handler proc */
|
---|
867 | typedef void (*InputHandlerProc) (int fd, pointer data);
|
---|
868 |
|
---|
869 | /* These are used by xf86GetClocks */
|
---|
870 | #define CLK_REG_SAVE -1
|
---|
871 | #define CLK_REG_RESTORE -2
|
---|
872 |
|
---|
873 | /*
|
---|
874 | * misc constants
|
---|
875 | */
|
---|
876 | #define INTERLACE_REFRESH_WEIGHT 1.5
|
---|
877 | #define SYNC_TOLERANCE 0.01 /* 1 percent */
|
---|
878 | #define CLOCK_TOLERANCE 2000 /* Clock matching tolerance (2MHz) */
|
---|
879 |
|
---|
880 | #define OVERLAY_8_32_DUALFB 0x00000001
|
---|
881 | #define OVERLAY_8_24_DUALFB 0x00000002
|
---|
882 | #define OVERLAY_8_16_DUALFB 0x00000004
|
---|
883 | #define OVERLAY_8_32_PLANAR 0x00000008
|
---|
884 |
|
---|
885 | /* Values of xf86Info.mouseFlags */
|
---|
886 | #define MF_CLEAR_DTR 1
|
---|
887 | #define MF_CLEAR_RTS 2
|
---|
888 |
|
---|
889 | /* Action Events */
|
---|
890 | typedef enum {
|
---|
891 | ACTION_TERMINATE = 0, /* Terminate Server */
|
---|
892 | ACTION_NEXT_MODE = 10, /* Switch to next video mode */
|
---|
893 | ACTION_PREV_MODE,
|
---|
894 | ACTION_SWITCHSCREEN = 100, /* VT switch */
|
---|
895 | ACTION_SWITCHSCREEN_NEXT,
|
---|
896 | ACTION_SWITCHSCREEN_PREV,
|
---|
897 | } ActionEvent;
|
---|
898 |
|
---|
899 | #endif /* _XF86STR_H */
|
---|