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