VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/1.5/xorg/xf86str.h@ 9233

Last change on this file since 9233 was 9233, checked in by vboxsync, 17 years ago

Additions/x11: added header files for X.org server 1.5

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 34.0 KB
Line 
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__)
56typedef uint64_t memType;
57#else
58typedef uintptr_t memType;
59#endif
60
61
62/* Video mode flags */
63
64typedef 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
81typedef enum {
82 INTERLACE_HALVE_V = 0x0001 /* Halve V values for interlacing */
83} CrtcAdjustFlags;
84
85/* Flags passed to ChipValidMode() */
86typedef enum {
87 MODECHECK_INITIAL = 0,
88 MODECHECK_FINAL = 1
89} ModeCheckFlags;
90
91/* These are possible return values for xf86CheckMode() and ValidMode() */
92typedef 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 */
149typedef 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
201typedef struct { float hi, lo; } range;
202
203typedef struct { CARD32 red, green, blue; } rgb;
204
205typedef 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
212typedef 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 */
232typedef 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 */
245typedef 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 */
264typedef struct _ScrnInfoRec *ScrnInfoPtr;
265
266/* do not change order */
267typedef enum {
268 RR_GET_INFO,
269 RR_SET_CONFIG,
270 RR_GET_MODE_MM,
271 GET_REQUIRED_HW_INTERFACES = 10
272} xorgDriverFuncOp;
273
274typedef Bool xorgDriverFuncProc (ScrnInfoPtr, xorgDriverFuncOp,
275 pointer);
276
277/* RR_GET_INFO, RR_SET_CONFIG */
278typedef struct {
279 int rotation;
280 int rate;
281 int width;
282 int height;
283} xorgRRConfig;
284
285typedef union {
286 short RRRotations;
287 xorgRRConfig RRConfig;
288} xorgRRRotation, *xorgRRRotationPtr;
289
290/* RR_GET_MODE_MM */
291typedef 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
304typedef 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 */
310struct _DriverRec;
311
312typedef 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
322struct _SymTabRec;
323struct _PciChipsets;
324
325typedef 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/*
347 * The optional module list struct. This allows modules exporting helping
348 * functions to configuration tools, the Xserver, or any other
349 * application/module interested in such information.
350 */
351_X_DEPRECATED typedef struct _ModuleInfoRec {
352 int moduleVersion;
353 char * moduleName;
354 pointer module;
355 int refCount;
356 const OptionInfoRec * (*AvailableOptions)(void *unused);
357 pointer unused[8]; /* leave some space for more fields */
358} ModuleInfoRec, *ModuleInfoPtr;
359
360/*
361 * These are the private bus types. New types can be added here. Types
362 * required for the public interface should be added to xf86str.h, with
363 * function prototypes added to xf86.h.
364 */
365
366/* Tolerate prior #include <linux/input.h> */
367#if defined(linux) && defined(_INPUT_H)
368#undef BUS_NONE
369#undef BUS_ISA
370#undef BUS_PCI
371#undef BUS_SBUS
372#undef BUS_last
373#endif
374
375typedef enum {
376 BUS_NONE,
377 BUS_ISA,
378 BUS_PCI,
379 BUS_SBUS,
380 BUS_last /* Keep last */
381} BusType;
382
383struct pci_device;
384
385typedef struct {
386 unsigned int dummy;
387} IsaBusId;
388
389typedef struct {
390 int fbNum;
391} SbusBusId;
392
393typedef struct _bus {
394 BusType type;
395 union {
396 IsaBusId isa;
397 struct pci_device *pci;
398 SbusBusId sbus;
399 } id;
400} BusRec, *BusPtr;
401
402#define MAXCLOCKS 128
403typedef enum {
404 DAC_BPP8 = 0,
405 DAC_BPP16,
406 DAC_BPP24,
407 DAC_BPP32,
408 MAXDACSPEEDS
409} DacSpeedIndex;
410
411typedef struct {
412 char * identifier;
413 char * vendor;
414 char * board;
415 char * chipset;
416 char * ramdac;
417 char * driver;
418 struct _confscreenrec * myScreenSection;
419 Bool claimed;
420 int dacSpeeds[MAXDACSPEEDS];
421 int numclocks;
422 int clock[MAXCLOCKS];
423 char * clockchip;
424 char * busID;
425 Bool active;
426 Bool inUse;
427 int videoRam;
428 int textClockFreq;
429 unsigned long BiosBase; /* Base address of video BIOS */
430 unsigned long MemBase; /* Frame buffer base address */
431 unsigned long IOBase;
432 int chipID;
433 int chipRev;
434 pointer options;
435 int irq;
436 int screen; /* For multi-CRTC cards */
437} GDevRec, *GDevPtr;
438
439typedef int (*FindIsaDevProc)(GDevPtr dev);
440
441typedef struct {
442 char * identifier;
443 char * driver;
444 pointer commonOptions;
445 pointer extraOptions;
446} IDevRec, *IDevPtr;
447
448typedef struct {
449 int frameX0;
450 int frameY0;
451 int virtualX;
452 int virtualY;
453 int depth;
454 int fbbpp;
455 rgb weight;
456 rgb blackColour;
457 rgb whiteColour;
458 int defaultVisual;
459 char ** modes;
460 pointer options;
461} DispRec, *DispPtr;
462
463typedef struct _confxvportrec {
464 char * identifier;
465 pointer options;
466} confXvPortRec, *confXvPortPtr;
467
468typedef struct _confxvadaptrec {
469 char * identifier;
470 int numports;
471 confXvPortPtr ports;
472 pointer options;
473} confXvAdaptorRec, *confXvAdaptorPtr;
474
475typedef struct _confscreenrec {
476 char * id;
477 int screennum;
478 int defaultdepth;
479 int defaultbpp;
480 int defaultfbbpp;
481 MonPtr monitor;
482 GDevPtr device;
483 int numdisplays;
484 DispPtr displays;
485 int numxvadaptors;
486 confXvAdaptorPtr xvadaptors;
487 pointer options;
488} confScreenRec, *confScreenPtr;
489
490typedef enum {
491 PosObsolete = -1,
492 PosAbsolute = 0,
493 PosRightOf,
494 PosLeftOf,
495 PosAbove,
496 PosBelow,
497 PosRelative
498} PositionType;
499
500typedef struct _screenlayoutrec {
501 confScreenPtr screen;
502 char * topname;
503 confScreenPtr top;
504 char * bottomname;
505 confScreenPtr bottom;
506 char * leftname;
507 confScreenPtr left;
508 char * rightname;
509 confScreenPtr right;
510 PositionType where;
511 int x;
512 int y;
513 char * refname;
514 confScreenPtr refscreen;
515} screenLayoutRec, *screenLayoutPtr;
516
517typedef struct _serverlayoutrec {
518 char * id;
519 screenLayoutPtr screens;
520 GDevPtr inactives;
521 IDevPtr* inputs; /* NULL terminated */
522 pointer options;
523} serverLayoutRec, *serverLayoutPtr;
524
525typedef struct _confdribufferrec {
526 int count;
527 int size;
528 enum {
529 XF86DRI_WC_HINT = 0x0001 /* Placeholder: not implemented */
530 } flags;
531} confDRIBufferRec, *confDRIBufferPtr;
532
533typedef struct _confdrirec {
534 int group;
535 int mode;
536 int bufs_count;
537 confDRIBufferRec *bufs;
538} confDRIRec, *confDRIPtr;
539
540/* These values should be adjusted when new fields are added to ScrnInfoRec */
541#define NUM_RESERVED_INTS 16
542#define NUM_RESERVED_POINTERS 15
543#define NUM_RESERVED_FUNCS 11
544
545typedef pointer (*funcPointer)(void);
546
547/* flags for depth 24 pixmap options */
548typedef enum {
549 Pix24DontCare = 0,
550 Pix24Use24,
551 Pix24Use32
552} Pix24Flags;
553
554/* Power management events: so far we only support APM */
555
556typedef enum {
557 XF86_APM_UNKNOWN = -1,
558 XF86_APM_SYS_STANDBY,
559 XF86_APM_SYS_SUSPEND,
560 XF86_APM_CRITICAL_SUSPEND,
561 XF86_APM_USER_STANDBY,
562 XF86_APM_USER_SUSPEND,
563 XF86_APM_STANDBY_RESUME,
564 XF86_APM_NORMAL_RESUME,
565 XF86_APM_CRITICAL_RESUME,
566 XF86_APM_LOW_BATTERY,
567 XF86_APM_POWER_STATUS_CHANGE,
568 XF86_APM_UPDATE_TIME,
569 XF86_APM_CAPABILITY_CHANGED,
570 XF86_APM_STANDBY_FAILED,
571 XF86_APM_SUSPEND_FAILED
572} pmEvent;
573
574typedef enum {
575 PM_WAIT,
576 PM_CONTINUE,
577 PM_FAILED,
578 PM_NONE
579} pmWait;
580
581/*
582 * The IO access enabler struct. This contains the address for
583 * the IOEnable/IODisable funcs for their specific bus along
584 * with a pointer to data needed by them
585 */
586typedef struct _AccessRec {
587 void (*AccessDisable)(void *arg);
588 void (*AccessEnable)(void *arg);
589 void *arg;
590} xf86AccessRec, *xf86AccessPtr;
591
592typedef struct {
593 xf86AccessPtr mem;
594 xf86AccessPtr io;
595 xf86AccessPtr io_mem;
596} xf86SetAccessFuncRec, *xf86SetAccessFuncPtr;
597
598/* bus-access-related types */
599typedef enum {
600 NONE,
601 IO,
602 MEM_IO,
603 MEM
604} resType;
605
606typedef struct _EntityAccessRec {
607 xf86AccessPtr fallback;
608 xf86AccessPtr pAccess;
609 resType rt;
610 pointer busAcc;
611 struct _EntityAccessRec *next;
612} EntityAccessRec, *EntityAccessPtr;
613
614typedef struct _CurrAccRec {
615 EntityAccessPtr pMemAccess;
616 EntityAccessPtr pIoAccess;
617} xf86CurrentAccessRec, *xf86CurrentAccessPtr;
618
619/* new RAC */
620
621/* Resource Type values */
622#define ResNone ((unsigned long)(-1))
623
624#define ResMem 0x0001
625#define ResIo 0x0002
626#define ResIrq 0x0003
627#define ResDma 0x0004
628#define ResPciCfg 0x000e /* PCI Configuration space */
629#define ResPhysMask 0x000F
630
631#define ResExclusive 0x0010
632#define ResShared 0x0020
633#define ResAny 0x0040
634#define ResAccMask 0x0070
635#define ResUnused 0x0080
636
637#define ResUnusedOpr 0x0100
638#define ResDisableOpr 0x0200
639#define ResOprMask 0x0300
640
641#define ResBlock 0x0400
642#define ResSparse 0x0800
643#define ResExtMask 0x0C00
644
645#define ResEstimated 0x001000
646#define ResInit 0x002000
647#define ResBios 0x004000
648#define ResMiscMask 0x00F000
649
650#define ResBus 0x010000
651#define ResOverlap 0x020000
652
653#if defined(__alpha__) && defined(linux)
654# define ResDomain 0x1ff000000ul
655#else
656# define ResDomain 0xff000000ul
657#endif
658#define ResTypeMask (ResPhysMask | ResDomain) /* For conflict check */
659
660#define ResEnd ResNone
661
662#define ResExcMemBlock (ResMem | ResExclusive | ResBlock)
663#define ResExcIoBlock (ResIo | ResExclusive | ResBlock)
664#define ResShrMemBlock (ResMem | ResShared | ResBlock)
665#define ResShrIoBlock (ResIo | ResShared | ResBlock)
666#define ResExcUusdMemBlock (ResMem | ResExclusive | ResUnused | ResBlock)
667#define ResExcUusdIoBlock (ResIo | ResExclusive | ResUnused | ResBlock)
668#define ResShrUusdMemBlock (ResMem | ResShared | ResUnused | ResBlock)
669#define ResShrUusdIoBlock (ResIo | ResShared | ResUnused | ResBlock)
670#define ResExcUusdMemSparse (ResMem | ResExclusive | ResUnused | ResSparse)
671#define ResExcUusdIoSparse (ResIo | ResExclusive | ResUnused | ResSparse)
672#define ResShrUusdMemSparse (ResMem | ResShared | ResUnused | ResSparse)
673#define ResShrUusdIoSparse (ResIo | ResShared | ResUnused | ResSparse)
674
675#define ResExcMemSparse (ResMem | ResExclusive | ResSparse)
676#define ResExcIoSparse (ResIo | ResExclusive | ResSparse)
677#define ResShrMemSparse (ResMem | ResShared | ResSparse)
678#define ResShrIoSparse (ResIo | ResShared | ResSparse)
679#define ResUusdMemSparse (ResMem | ResUnused | ResSparse)
680#define ResUusdIoSparse (ResIo | ResUnused | ResSparse)
681
682#define ResIsMem(r) (((r)->type & ResPhysMask) == ResMem)
683#define ResIsIo(r) (((r)->type & ResPhysMask) == ResIo)
684#define ResIsExclusive(r) (((r)->type & ResAccMask) == ResExclusive)
685#define ResIsShared(r) (((r)->type & ResAccMask) == ResShared)
686#define ResIsUnused(r) (((r)->type & ResAccMask) == ResUnused)
687#define ResIsBlock(r) (((r)->type & ResExtMask) == ResBlock)
688#define ResIsSparse(r) (((r)->type & ResExtMask) == ResSparse)
689#define ResIsEstimated(r) (((r)->type & ResMiscMask) == ResEstimated)
690#define ResCanOverlap(r) (ResIsEstimated(r) || ((r)->type & ResOverlap))
691
692typedef struct {
693 unsigned long type; /* shared, exclusive, unused etc. */
694 memType a;
695 memType b;
696} resRange, *resList;
697
698#define RANGE_TYPE(type, domain) \
699 (((unsigned long)(domain) << 24) | ((type) & ~ResBus))
700#define RANGE(r,u,v,t) {\
701 (r).a = (u);\
702 (r).b = (v);\
703 (r).type = (t);\
704 }
705
706#define rBase a
707#define rMask b
708#define rBegin a
709#define rEnd b
710
711/* resource record */
712typedef struct _resRec *resPtr;
713typedef struct _resRec {
714 resRange val;
715 int entityIndex; /* who owns the resource */
716 resPtr next;
717} resRec;
718
719#define sparse_base val.rBase
720#define sparse_mask val.rMask
721#define block_begin val.rBegin
722#define block_end val.rEnd
723#define res_type val.type
724
725typedef struct {
726 int numChipset;
727 resRange *resList;
728} IsaChipsets;
729
730typedef struct _PciChipsets {
731 /**
732 * Key used to match this device with its name in an array of
733 * \c SymTabRec.
734 */
735 int numChipset;
736
737 /**
738 * This value is quirky. Depending on the driver, it can take on one of
739 * three meanings. In drivers that have exactly one vendor ID (e.g.,
740 * radeon, mga, i810) the low 16-bits are the device ID.
741 *
742 * In drivers that can have multiple vendor IDs (e.g., the glint driver
743 * can have either 3dlabs' ID or TI's ID, the i740 driver can have either
744 * Intel's ID or Real3D's ID, etc.) the low 16-bits are the device ID and
745 * the high 16-bits are the vendor ID.
746 *
747 * In drivers that don't have a specific vendor (e.g., vga) contains the
748 * device ID for either the generic VGA or generic 8514 devices. This
749 * turns out to be the same as the subclass and programming interface
750 * value (e.g., the full 24-bit class for the VGA device is 0x030000 (or
751 * 0x000101) and for 8514 is 0x030001).
752 */
753 int PCIid;
754
755 /**
756 * Resources associated with this type of device.
757 */
758 resRange *resList;
759} PciChipsets;
760
761/* Entity properties */
762typedef void (*EntityProc)(int entityIndex,pointer private);
763
764typedef struct _entityInfo {
765 int index;
766 BusRec location;
767 int chipset;
768 Bool active;
769 resPtr resources;
770 GDevPtr device;
771 DriverPtr driver;
772} EntityInfoRec, *EntityInfoPtr;
773
774/* server states */
775
776typedef enum {
777 SETUP,
778 OPERATING
779} xf86State;
780
781typedef enum {
782 NOTIFY_SETUP_TRANSITION,
783 NOTIFY_SETUP,
784 NOTIFY_OPERATING,
785 NOTIFY_OPERATING_TRANSITION,
786 NOTIFY_ENABLE,
787 NOTIFY_ENTER,
788 NOTIFY_LEAVE
789} xf86NotifyState;
790
791typedef void (*xf86StateChangeNotificationCallbackFunc)(xf86NotifyState state,pointer);
792
793/* DGA */
794
795typedef struct {
796 int num; /* A unique identifier for the mode (num > 0) */
797 DisplayModePtr mode;
798 int flags; /* DGA_CONCURRENT_ACCESS, etc... */
799 int imageWidth; /* linear accessible portion (pixels) */
800 int imageHeight;
801 int pixmapWidth; /* Xlib accessible portion (pixels) */
802 int pixmapHeight; /* both fields ignored if no concurrent access */
803 int bytesPerScanline;
804 int byteOrder; /* MSBFirst, LSBFirst */
805 int depth;
806 int bitsPerPixel;
807 unsigned long red_mask;
808 unsigned long green_mask;
809 unsigned long blue_mask;
810 short visualClass;
811 int viewportWidth;
812 int viewportHeight;
813 int xViewportStep; /* viewport position granularity */
814 int yViewportStep;
815 int maxViewportX; /* max viewport origin */
816 int maxViewportY;
817 int viewportFlags; /* types of page flipping possible */
818 int offset; /* offset into physical memory */
819 unsigned char *address; /* server's mapped framebuffer */
820 int reserved1;
821 int reserved2;
822} DGAModeRec, *DGAModePtr;
823
824typedef struct {
825 DGAModePtr mode;
826 PixmapPtr pPix;
827} DGADeviceRec, *DGADevicePtr;
828
829/*
830 * Flags for driver Probe() functions.
831 */
832#define PROBE_DEFAULT 0x00
833#define PROBE_DETECT 0x01
834#define PROBE_TRYHARD 0x02
835
836/*
837 * Driver entry point types
838 */
839
840typedef Bool xf86ProbeProc (DriverPtr, int);
841typedef Bool xf86PreInitProc (ScrnInfoPtr, int);
842typedef Bool xf86ScreenInitProc (int, ScreenPtr, int, char**);
843typedef Bool xf86SwitchModeProc (int, DisplayModePtr, int);
844typedef void xf86AdjustFrameProc (int, int, int, int);
845typedef Bool xf86EnterVTProc (int, int);
846typedef void xf86LeaveVTProc (int, int);
847typedef void xf86FreeScreenProc (int, int);
848typedef ModeStatus xf86ValidModeProc (int, DisplayModePtr, Bool, int);
849typedef void xf86EnableDisableFBAccessProc(int, Bool);
850typedef int xf86SetDGAModeProc (int, int, DGADevicePtr);
851typedef int xf86ChangeGammaProc (int, Gamma);
852typedef void xf86PointerMovedProc (int, int, int);
853typedef Bool xf86PMEventProc (int, pmEvent, Bool);
854typedef int xf86HandleMessageProc (int, const char*, const char*, char**);
855typedef void xf86DPMSSetProc (ScrnInfoPtr, int, int);
856typedef void xf86LoadPaletteProc (ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
857typedef void xf86SetOverscanProc (ScrnInfoPtr, int);
858
859
860/*
861 * ScrnInfoRec
862 *
863 * There is one of these for each screen, and it holds all the screen-specific
864 * information.
865 *
866 * Note: the size and layout must be kept the same across versions. New
867 * fields are to be added in place of the "reserved*" fields. No fields
868 * are to be dependent on compile-time defines.
869 */
870
871
872typedef struct _ScrnInfoRec {
873 int driverVersion;
874 char * driverName; /* canonical name used in */
875 /* the config file */
876 ScreenPtr pScreen; /* Pointer to the ScreenRec */
877 int scrnIndex; /* Number of this screen */
878 Bool configured; /* Is this screen valid */
879 int origIndex; /* initial number assigned to
880 * this screen before
881 * finalising the number of
882 * available screens */
883
884 /* Display-wide screenInfo values needed by this screen */
885 int imageByteOrder;
886 int bitmapScanlineUnit;
887 int bitmapScanlinePad;
888 int bitmapBitOrder;
889 int numFormats;
890 PixmapFormatRec formats[MAXFORMATS];
891 PixmapFormatRec fbFormat;
892
893 int bitsPerPixel; /* fb bpp */
894 Pix24Flags pixmap24; /* pixmap pref for depth 24 */
895 int depth; /* depth of default visual */
896 MessageType depthFrom; /* set from config? */
897 MessageType bitsPerPixelFrom; /* set from config? */
898 rgb weight; /* r/g/b weights */
899 rgb mask; /* rgb masks */
900 rgb offset; /* rgb offsets */
901 int rgbBits; /* Number of bits in r/g/b */
902 Gamma gamma; /* Gamma of the monitor */
903 int defaultVisual; /* default visual class */
904 int maxHValue; /* max horizontal timing */
905 int maxVValue; /* max vertical timing value */
906 int virtualX; /* Virtual width */
907 int virtualY; /* Virtual height */
908 int xInc; /* Horizontal timing increment */
909 MessageType virtualFrom; /* set from config? */
910 int displayWidth; /* memory pitch */
911 int frameX0; /* viewport position */
912 int frameY0;
913 int frameX1;
914 int frameY1;
915 int zoomLocked; /* Disallow mode changes */
916 DisplayModePtr modePool; /* list of compatible modes */
917 DisplayModePtr modes; /* list of actual modes */
918 DisplayModePtr currentMode; /* current mode
919 * This was previously
920 * overloaded with the modes
921 * field, which is a pointer
922 * into a circular list */
923 confScreenPtr confScreen; /* Screen config info */
924 MonPtr monitor; /* Monitor information */
925 DispPtr display; /* Display information */
926 int * entityList; /* List of device entities */
927 int numEntities;
928 int widthmm; /* physical display dimensions
929 * in mm */
930 int heightmm;
931 int xDpi; /* width DPI */
932 int yDpi; /* height DPI */
933 char * name; /* Name to prefix messages */
934 pointer driverPrivate; /* Driver private area */
935 DevUnion * privates; /* Other privates can hook in
936 * here */
937 DriverPtr drv; /* xf86DriverList[] entry */
938 pointer module; /* Pointer to module head */
939 int colorKey;
940 int overlayFlags;
941
942 /* Some of these may be moved out of here into the driver private area */
943
944 char * chipset; /* chipset name */
945 char * ramdac; /* ramdac name */
946 char * clockchip; /* clock name */
947 Bool progClock; /* clock is programmable */
948 int numClocks; /* number of clocks */
949 int clock[MAXCLOCKS]; /* list of clock frequencies */
950 int videoRam; /* amount of video ram (kb) */
951 unsigned long biosBase; /* Base address of video BIOS */
952 unsigned long memPhysBase; /* Physical address of FB */
953 unsigned long fbOffset; /* Offset of FB in the above */
954 IOADDRESS domainIOBase; /* Domain I/O base address */
955 int memClk; /* memory clock */
956 int textClockFreq; /* clock of text mode */
957 Bool flipPixels; /* swap default black/white */
958 pointer options;
959
960 int chipID;
961 int chipRev;
962 int racMemFlags;
963 int racIoFlags;
964 pointer access;
965 xf86CurrentAccessPtr CurrentAccess;
966 resType resourceType;
967 pointer busAccess;
968
969 /* Allow screens to be enabled/disabled individually */
970 Bool vtSema;
971 DevUnion pixmapPrivate; /* saved devPrivate from pixmap */
972
973 /* hw cursor moves at SIGIO time */
974 Bool silkenMouse;
975
976 /* Storage for clockRanges and adjustFlags for use with the VidMode ext */
977 ClockRangesPtr clockRanges;
978 int adjustFlags;
979
980 /*
981 * These can be used when the minor ABI version is incremented.
982 * The NUM_* parameters must be reduced appropriately to keep the
983 * structure size and alignment unchanged.
984 */
985 int reservedInt[NUM_RESERVED_INTS];
986
987 int * entityInstanceList;
988 pointer reservedPtr[NUM_RESERVED_POINTERS];
989
990 /*
991 * Driver entry points.
992 *
993 */
994
995 xf86ProbeProc *Probe;
996 xf86PreInitProc *PreInit;
997 xf86ScreenInitProc *ScreenInit;
998 xf86SwitchModeProc *SwitchMode;
999 xf86AdjustFrameProc *AdjustFrame;
1000 xf86EnterVTProc *EnterVT;
1001 xf86LeaveVTProc *LeaveVT;
1002 xf86FreeScreenProc *FreeScreen;
1003 xf86ValidModeProc *ValidMode;
1004 xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
1005 xf86SetDGAModeProc *SetDGAMode;
1006 xf86ChangeGammaProc *ChangeGamma;
1007 xf86PointerMovedProc *PointerMoved;
1008 xf86PMEventProc *PMEvent;
1009 xf86HandleMessageProc *HandleMessage;
1010 xf86DPMSSetProc *DPMSSet;
1011 xf86LoadPaletteProc *LoadPalette;
1012 xf86SetOverscanProc *SetOverscan;
1013 xorgDriverFuncProc *DriverFunc;
1014
1015 /*
1016 * This can be used when the minor ABI version is incremented.
1017 * The NUM_* parameter must be reduced appropriately to keep the
1018 * structure size and alignment unchanged.
1019 */
1020 funcPointer reservedFuncs[NUM_RESERVED_FUNCS];
1021
1022} ScrnInfoRec;
1023
1024
1025typedef struct {
1026 Bool (*OpenFramebuffer)(
1027 ScrnInfoPtr pScrn,
1028 char **name,
1029 unsigned char **mem,
1030 int *size,
1031 int *offset,
1032 int *extra
1033 );
1034 void (*CloseFramebuffer)(ScrnInfoPtr pScrn);
1035 Bool (*SetMode)(ScrnInfoPtr pScrn, DGAModePtr pMode);
1036 void (*SetViewport)(ScrnInfoPtr pScrn, int x, int y, int flags);
1037 int (*GetViewport)(ScrnInfoPtr pScrn);
1038 void (*Sync)(ScrnInfoPtr);
1039 void (*FillRect)(
1040 ScrnInfoPtr pScrn,
1041 int x, int y, int w, int h,
1042 unsigned long color
1043 );
1044 void (*BlitRect)(
1045 ScrnInfoPtr pScrn,
1046 int srcx, int srcy,
1047 int w, int h,
1048 int dstx, int dsty
1049 );
1050 void (*BlitTransRect)(
1051 ScrnInfoPtr pScrn,
1052 int srcx, int srcy,
1053 int w, int h,
1054 int dstx, int dsty,
1055 unsigned long color
1056 );
1057} DGAFunctionRec, *DGAFunctionPtr;
1058
1059typedef struct _SymTabRec {
1060 int token; /* id of the token */
1061 const char * name; /* token name */
1062} SymTabRec, *SymTabPtr;
1063
1064/* flags for xf86LookupMode */
1065typedef enum {
1066 LOOKUP_DEFAULT = 0, /* Use default mode lookup method */
1067 LOOKUP_BEST_REFRESH, /* Pick modes with best refresh */
1068 LOOKUP_CLOSEST_CLOCK, /* Pick modes with the closest clock */
1069 LOOKUP_LIST_ORDER, /* Pick first useful mode in list */
1070 LOOKUP_CLKDIV2 = 0x0100, /* Allow half clocks */
1071 LOOKUP_OPTIONAL_TOLERANCES = 0x0200 /* Allow missing hsync/vrefresh */
1072} LookupModeFlags;
1073
1074#define NoDepth24Support 0x00
1075#define Support24bppFb 0x01 /* 24bpp framebuffer supported */
1076#define Support32bppFb 0x02 /* 32bpp framebuffer supported */
1077#define SupportConvert24to32 0x04 /* Can convert 24bpp pixmap to 32bpp */
1078#define SupportConvert32to24 0x08 /* Can convert 32bpp pixmap to 24bpp */
1079#define PreferConvert24to32 0x10 /* prefer 24bpp pixmap to 32bpp conv */
1080#define PreferConvert32to24 0x20 /* prefer 32bpp pixmap to 24bpp conv */
1081
1082
1083/* For DPMS */
1084typedef void (*DPMSSetProcPtr)(ScrnInfoPtr, int, int);
1085
1086/* Input handler proc */
1087typedef void (*InputHandlerProc)(int fd, pointer data);
1088
1089/* These are used by xf86GetClocks */
1090#define CLK_REG_SAVE -1
1091#define CLK_REG_RESTORE -2
1092
1093/* xf86Debug.c */
1094#ifdef BUILDDEBUG
1095typedef struct {
1096 long sec;
1097 long usec;
1098} xf86TsRec, *xf86TsPtr;
1099#endif
1100
1101/*
1102 * misc constants
1103 */
1104#define INTERLACE_REFRESH_WEIGHT 1.5
1105#define SYNC_TOLERANCE 0.01 /* 1 percent */
1106#define CLOCK_TOLERANCE 2000 /* Clock matching tolerance (2MHz) */
1107
1108
1109#define OVERLAY_8_32_DUALFB 0x00000001
1110#define OVERLAY_8_24_DUALFB 0x00000002
1111#define OVERLAY_8_16_DUALFB 0x00000004
1112#define OVERLAY_8_32_PLANAR 0x00000008
1113
1114#if 0
1115#define LD_RESOLV_IFDONE 0 /* only check if no more
1116 delays pending */
1117#define LD_RESOLV_NOW 1 /* finish one delay step */
1118#define LD_RESOLV_FORCE 2 /* force checking... */
1119#endif
1120
1121/* Values of xf86Info.mouseFlags */
1122#define MF_CLEAR_DTR 1
1123#define MF_CLEAR_RTS 2
1124
1125/* Action Events */
1126typedef enum {
1127 ACTION_TERMINATE = 0, /* Terminate Server */
1128 ACTION_NEXT_MODE = 10, /* Switch to next video mode */
1129 ACTION_PREV_MODE,
1130 ACTION_DISABLEGRAB = 20, /* Cancel server/pointer/kbd grabs */
1131 ACTION_CLOSECLIENT, /* Kill client holding grab */
1132 ACTION_SWITCHSCREEN = 100, /* VT switch */
1133 ACTION_SWITCHSCREEN_NEXT,
1134 ACTION_SWITCHSCREEN_PREV,
1135 ACTION_MESSAGE = 9999 /* Generic message passing */
1136} ActionEvent;
1137
1138/* xf86Versions.c */
1139/*
1140 * Never change existing values, and always assign values explicitly.
1141 * NUM_BUILTIN_IFS must always be the last entry.
1142 */
1143typedef enum {
1144 BUILTIN_IF_OSMOUSE = 0,
1145 BUILTIN_IF_OSKBD = 1,
1146 NUM_BUILTIN_IFS
1147} BuiltinInterface;
1148
1149/*
1150 * These are intentionally the same as the module version macros.
1151 * It is possible to register a module as providing a specific interface,
1152 * in which case the module's version is used. This feature isn't
1153 * really ready for use yet though.
1154 */
1155
1156#define BUILTIN_INTERFACE_VERSION_NUMERIC(maj, min, patch) \
1157 ((((maj) & 0xFF) << 24) | (((min) & 0xFF) << 16) | (patch & 0xFFFF))
1158#define GET_BUILTIN_INTERFACE_MAJOR_VERSION(vers) (((vers) >> 24) & 0xFF)
1159#define GET_BUILTIN_INTERFACE_MINOR_VERSION(vers) (((vers) >> 16) & 0xFF)
1160#define GET_BUILTIN_INTERFACE_PATCH_VERSION(vers) ((vers) & 0xFFFF)
1161
1162#endif /* _XF86STR_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette