VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.1.0/xf86str.h@ 78293

Last change on this file since 78293 was 51223, checked in by vboxsync, 11 years ago

Additions/x11/x11include: added header files for X.Org Server 1.0 and 1.1.

  • Property svn:eol-style set to native
File size: 33.7 KB
Line 
1/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.97 2003/10/30 17:36:56 tsi Exp $ */
2
3/*
4 * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 *
24 * Except as contained in this notice, the name of the copyright holder(s)
25 * and author(s) shall not be used in advertising or otherwise to promote
26 * the sale, use or other dealings in this Software without prior written
27 * authorization from the copyright holder(s) and author(s).
28 */
29
30/*
31 * This file contains definitions of the public XFree86 data structures/types.
32 * Any data structures that video drivers need to access should go here.
33 */
34
35#ifndef _XF86STR_H
36#define _XF86STR_H
37
38#include "misc.h"
39#include "input.h"
40#include "scrnintstr.h"
41#include "pixmapstr.h"
42#include "colormapst.h"
43#include "xf86Module.h"
44#include "xf86Opt.h"
45#include "xf86Pci.h"
46
47/*
48 * memType is of the size of the addressable memory (machine size)
49 * usually unsigned long.
50 */
51typedef unsigned long memType;
52
53/* Video mode flags */
54
55typedef enum {
56 V_PHSYNC = 0x0001,
57 V_NHSYNC = 0x0002,
58 V_PVSYNC = 0x0004,
59 V_NVSYNC = 0x0008,
60 V_INTERLACE = 0x0010,
61 V_DBLSCAN = 0x0020,
62 V_CSYNC = 0x0040,
63 V_PCSYNC = 0x0080,
64 V_NCSYNC = 0x0100,
65 V_HSKEW = 0x0200, /* hskew provided */
66 V_BCAST = 0x0400,
67 V_PIXMUX = 0x1000,
68 V_DBLCLK = 0x2000,
69 V_CLKDIV2 = 0x4000
70} ModeFlags;
71
72typedef enum {
73 INTERLACE_HALVE_V = 0x0001 /* Halve V values for interlacing */
74} CrtcAdjustFlags;
75
76/* Flags passed to ChipValidMode() */
77typedef enum {
78 MODECHECK_INITIAL = 0,
79 MODECHECK_FINAL = 1
80} ModeCheckFlags;
81
82/* These are possible return values for xf86CheckMode() and ValidMode() */
83typedef enum {
84 MODE_OK = 0, /* Mode OK */
85 MODE_HSYNC, /* hsync out of range */
86 MODE_VSYNC, /* vsync out of range */
87 MODE_H_ILLEGAL, /* mode has illegal horizontal timings */
88 MODE_V_ILLEGAL, /* mode has illegal horizontal timings */
89 MODE_BAD_WIDTH, /* requires an unsupported linepitch */
90 MODE_NOMODE, /* no mode with a maching name */
91 MODE_NO_INTERLACE, /* interlaced mode not supported */
92 MODE_NO_DBLESCAN, /* doublescan mode not supported */
93 MODE_NO_VSCAN, /* multiscan mode not supported */
94 MODE_MEM, /* insufficient video memory */
95 MODE_VIRTUAL_X, /* mode width too large for specified virtual size */
96 MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */
97 MODE_MEM_VIRT, /* insufficient video memory given virtual size */
98 MODE_NOCLOCK, /* no fixed clock available */
99 MODE_CLOCK_HIGH, /* clock required is too high */
100 MODE_CLOCK_LOW, /* clock required is too low */
101 MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */
102 MODE_BAD_HVALUE, /* horizontal timing was out of range */
103 MODE_BAD_VVALUE, /* vertical timing was out of range */
104 MODE_BAD_VSCAN, /* VScan value out of range */
105 MODE_HSYNC_NARROW, /* horizontal sync too narrow */
106 MODE_HSYNC_WIDE, /* horizontal sync too wide */
107 MODE_HBLANK_NARROW, /* horizontal blanking too narrow */
108 MODE_HBLANK_WIDE, /* horizontal blanking too wide */
109 MODE_VSYNC_NARROW, /* vertical sync too narrow */
110 MODE_VSYNC_WIDE, /* vertical sync too wide */
111 MODE_VBLANK_NARROW, /* vertical blanking too narrow */
112 MODE_VBLANK_WIDE, /* vertical blanking too wide */
113 MODE_PANEL, /* exceeds panel dimensions */
114 MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */
115 MODE_ONE_WIDTH, /* only one width is supported */
116 MODE_ONE_HEIGHT, /* only one height is supported */
117 MODE_ONE_SIZE, /* only one resolution is supported */
118 MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */
119 MODE_BAD = -2, /* unspecified reason */
120 MODE_ERROR = -1 /* error condition */
121} ModeStatus;
122
123# define M_T_BUILTIN 0x01 /* built-in mode */
124# define M_T_CLOCK_C (0x02 | M_T_BUILTIN) /* built-in mode - configure clock */
125# define M_T_CRTC_C (0x04 | M_T_BUILTIN) /* built-in mode - configure CRTC */
126# define M_T_CLOCK_CRTC_C (M_T_CLOCK_C | M_T_CRTC_C)
127 /* built-in mode - configure CRTC and clock */
128# define M_T_DEFAULT 0x10 /* (VESA) default modes */
129# define M_T_USERDEF 0x20 /* One of the modes from the config file */
130
131/* Video mode */
132typedef struct _DisplayModeRec {
133 struct _DisplayModeRec * prev;
134 struct _DisplayModeRec * next;
135 char * name; /* identifier for the mode */
136 ModeStatus status;
137 int type;
138
139 /* These are the values that the user sees/provides */
140 int Clock; /* pixel clock freq (kHz) */
141 int HDisplay; /* horizontal timing */
142 int HSyncStart;
143 int HSyncEnd;
144 int HTotal;
145 int HSkew;
146 int VDisplay; /* vertical timing */
147 int VSyncStart;
148 int VSyncEnd;
149 int VTotal;
150 int VScan;
151 int Flags;
152
153 /* These are the values the hardware uses */
154 int ClockIndex;
155 int SynthClock; /* Actual clock freq to
156 * be programmed (kHz) */
157 int CrtcHDisplay;
158 int CrtcHBlankStart;
159 int CrtcHSyncStart;
160 int CrtcHSyncEnd;
161 int CrtcHBlankEnd;
162 int CrtcHTotal;
163 int CrtcHSkew;
164 int CrtcVDisplay;
165 int CrtcVBlankStart;
166 int CrtcVSyncStart;
167 int CrtcVSyncEnd;
168 int CrtcVBlankEnd;
169 int CrtcVTotal;
170 Bool CrtcHAdjusted;
171 Bool CrtcVAdjusted;
172 int PrivSize;
173 INT32 * Private;
174 int PrivFlags;
175
176 float HSync, VRefresh;
177} DisplayModeRec, *DisplayModePtr;
178
179/* The monitor description */
180
181#define MAX_HSYNC 8
182#define MAX_VREFRESH 8
183
184typedef struct { float hi, lo; } range;
185
186typedef struct { CARD32 red, green, blue; } rgb;
187
188typedef struct { float red, green, blue; } Gamma;
189
190/* The permitted gamma range is 1 / GAMMA_MAX <= g <= GAMMA_MAX */
191#define GAMMA_MAX 10.0
192#define GAMMA_MIN (1.0 / GAMMA_MAX)
193#define GAMMA_ZERO (GAMMA_MIN / 100.0)
194
195typedef struct {
196 char * id;
197 char * vendor;
198 char * model;
199 int nHsync;
200 range hsync[MAX_HSYNC];
201 int nVrefresh;
202 range vrefresh[MAX_VREFRESH];
203 DisplayModePtr Modes; /* Start of the monitor's mode list */
204 DisplayModePtr Last; /* End of the monitor's mode list */
205 Gamma gamma; /* Gamma of the monitor */
206 int widthmm;
207 int heightmm;
208 pointer options;
209 pointer DDC;
210 Bool reducedblanking; /* Allow CVT reduced blanking modes? */
211} MonRec, *MonPtr;
212
213/* the list of clock ranges */
214typedef struct x_ClockRange {
215 struct x_ClockRange *next;
216 int minClock; /* (kHz) */
217 int maxClock; /* (kHz) */
218 int clockIndex; /* -1 for programmable clocks */
219 Bool interlaceAllowed;
220 Bool doubleScanAllowed;
221 int ClockMulFactor;
222 int ClockDivFactor;
223 int PrivFlags;
224} ClockRange, *ClockRangePtr;
225
226/* Need to store the strategy with clockRange for VidMode extension */
227typedef struct x_ClockRanges {
228 struct x_ClockRanges *next;
229 int minClock;
230 int maxClock;
231 int clockIndex; /* -1 for programmable clocks */
232 Bool interlaceAllowed;
233 Bool doubleScanAllowed;
234 int ClockMulFactor;
235 int ClockDivFactor;
236 int PrivFlags;
237 int strategy;
238} ClockRanges, *ClockRangesPtr;
239
240/*
241 * The driverFunc. xorgDriverFuncOp specifies the action driver should
242 * perform. If requested option is not supported function should return
243 * FALSE. pointer can be used to pass arguments to the function or
244 * to return data to the caller.
245 */
246typedef struct _ScrnInfoRec *ScrnInfoPtr;
247
248/* do not change order */
249typedef enum {
250 RR_GET_INFO,
251 RR_SET_CONFIG,
252 RR_GET_MODE_MM,
253 GET_REQUIRED_HW_INTERFACES = 10
254} xorgDriverFuncOp;
255
256typedef Bool xorgDriverFuncProc (ScrnInfoPtr, xorgDriverFuncOp,
257 pointer);
258
259/* RR_GET_INFO, RR_SET_CONFIG */
260typedef struct {
261 int rotation;
262 int rate;
263 int width;
264 int height;
265} xorgRRConfig;
266
267typedef union {
268 short RRRotations;
269 xorgRRConfig RRConfig;
270} xorgRRRotation, *xorgRRRotationPtr;
271
272/* RR_GET_MODE_MM */
273typedef struct {
274 DisplayModePtr mode;
275 int virtX;
276 int virtY;
277 int mmWidth;
278 int mmHeight;
279} xorgRRModeMM, *xorgRRModeMMPtr;
280
281/* GET_REQUIRED_HW_INTERFACES */
282#define HW_IO 1
283#define HW_MMIO 2
284#define NEED_IO_ENABLED(x) (x & HW_IO)
285
286typedef CARD32 xorgHWFlags;
287
288/*
289 * The driver list struct. This contains the information required for each
290 * driver before a ScrnInfoRec has been allocated.
291 */
292struct _DriverRec;
293
294typedef struct {
295 int driverVersion;
296 char * driverName;
297 void (*Identify)(int flags);
298 Bool (*Probe)(struct _DriverRec *drv, int flags);
299 const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype);
300 pointer module;
301 int refCount;
302} DriverRec1;
303
304typedef struct _DriverRec {
305 int driverVersion;
306 char * driverName;
307 void (*Identify)(int flags);
308 Bool (*Probe)(struct _DriverRec *drv, int flags);
309 const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype);
310 pointer module;
311 int refCount;
312 xorgDriverFuncProc *driverFunc;
313} DriverRec, *DriverPtr;
314
315/*
316 * AddDriver flags
317 */
318#define HaveDriverFuncs 1
319
320
321#ifdef XFree86LOADER
322/*
323 * The optional module list struct. This allows modules exporting helping
324 * functions to configuration tools, the Xserver, or any other
325 * application/module interested in such information.
326 */
327typedef struct _ModuleInfoRec {
328 int moduleVersion;
329 char * moduleName;
330 pointer module;
331 int refCount;
332 const OptionInfoRec * (*AvailableOptions)(void *unused);
333 pointer unused[8]; /* leave some space for more fields */
334} ModuleInfoRec, *ModuleInfoPtr;
335#endif
336
337/*
338 * These are the private bus types. New types can be added here. Types
339 * required for the public interface should be added to xf86str.h, with
340 * function prototypes added to xf86.h.
341 */
342
343/* Tolerate prior #include <linux/input.h> */
344#if defined(linux) && defined(_INPUT_H)
345#undef BUS_NONE
346#undef BUS_ISA
347#undef BUS_PCI
348#undef BUS_SBUS
349#undef BUS_last
350#endif
351
352typedef enum {
353 BUS_NONE,
354 BUS_ISA,
355 BUS_PCI,
356 BUS_SBUS,
357 BUS_last /* Keep last */
358} BusType;
359
360typedef struct {
361 int bus;
362 int device;
363 int func;
364} PciBusId;
365
366typedef struct {
367 unsigned int dummy;
368} IsaBusId;
369
370typedef struct {
371 int fbNum;
372} SbusBusId;
373
374typedef struct _bus {
375 BusType type;
376 union {
377 IsaBusId isa;
378 PciBusId pci;
379 SbusBusId sbus;
380 } id;
381} BusRec, *BusPtr;
382
383#define MAXCLOCKS 128
384typedef enum {
385 DAC_BPP8 = 0,
386 DAC_BPP16,
387 DAC_BPP24,
388 DAC_BPP32,
389 MAXDACSPEEDS
390} DacSpeedIndex;
391
392typedef struct {
393 char * identifier;
394 char * vendor;
395 char * board;
396 char * chipset;
397 char * ramdac;
398 char * driver;
399 struct _confscreenrec * myScreenSection;
400 Bool claimed;
401 int dacSpeeds[MAXDACSPEEDS];
402 int numclocks;
403 int clock[MAXCLOCKS];
404 char * clockchip;
405 char * busID;
406 Bool active;
407 Bool inUse;
408 int videoRam;
409 int textClockFreq;
410 unsigned long BiosBase; /* Base address of video BIOS */
411 unsigned long MemBase; /* Frame buffer base address */
412 unsigned long IOBase;
413 int chipID;
414 int chipRev;
415 pointer options;
416 int irq;
417 int screen; /* For multi-CRTC cards */
418} GDevRec, *GDevPtr;
419
420typedef int (*FindIsaDevProc)(GDevPtr dev);
421
422typedef struct {
423 char * identifier;
424 char * driver;
425 pointer commonOptions;
426 pointer extraOptions;
427} IDevRec, *IDevPtr;
428
429typedef struct {
430 int vendor;
431 int chipType;
432 int chipRev;
433 int subsysVendor;
434 int subsysCard;
435 int bus;
436 int device;
437 int func;
438 int class;
439 int subclass;
440 int interface;
441 memType memBase[6];
442 memType ioBase[6];
443 int size[6];
444 unsigned char type[6];
445 memType biosBase;
446 int biosSize;
447 pointer thisCard;
448 Bool validSize;
449 Bool validate;
450} pciVideoRec, *pciVideoPtr;
451
452typedef struct {
453 int frameX0;
454 int frameY0;
455 int virtualX;
456 int virtualY;
457 int depth;
458 int fbbpp;
459 rgb weight;
460 rgb blackColour;
461 rgb whiteColour;
462 int defaultVisual;
463 char ** modes;
464 pointer options;
465} DispRec, *DispPtr;
466
467typedef struct _confxvportrec {
468 char * identifier;
469 pointer options;
470} confXvPortRec, *confXvPortPtr;
471
472typedef struct _confxvadaptrec {
473 char * identifier;
474 int numports;
475 confXvPortPtr ports;
476 pointer options;
477} confXvAdaptorRec, *confXvAdaptorPtr;
478
479typedef struct _confscreenrec {
480 char * id;
481 int screennum;
482 int defaultdepth;
483 int defaultbpp;
484 int defaultfbbpp;
485 MonPtr monitor;
486 GDevPtr device;
487 int numdisplays;
488 DispPtr displays;
489 int numxvadaptors;
490 confXvAdaptorPtr xvadaptors;
491 pointer options;
492} confScreenRec, *confScreenPtr;
493
494typedef enum {
495 PosObsolete = -1,
496 PosAbsolute = 0,
497 PosRightOf,
498 PosLeftOf,
499 PosAbove,
500 PosBelow,
501 PosRelative
502} PositionType;
503
504typedef struct _screenlayoutrec {
505 confScreenPtr screen;
506 char * topname;
507 confScreenPtr top;
508 char * bottomname;
509 confScreenPtr bottom;
510 char * leftname;
511 confScreenPtr left;
512 char * rightname;
513 confScreenPtr right;
514 PositionType where;
515 int x;
516 int y;
517 char * refname;
518 confScreenPtr refscreen;
519} screenLayoutRec, *screenLayoutPtr;
520
521typedef struct _serverlayoutrec {
522 char * id;
523 screenLayoutPtr screens;
524 GDevPtr inactives;
525 IDevPtr inputs;
526 pointer options;
527} serverLayoutRec, *serverLayoutPtr;
528
529typedef struct _confdribufferrec {
530 int count;
531 int size;
532 enum {
533 XF86DRI_WC_HINT = 0x0001 /* Placeholder: not implemented */
534 } flags;
535} confDRIBufferRec, *confDRIBufferPtr;
536
537typedef struct _confdrirec {
538 int group;
539 int mode;
540 int bufs_count;
541 confDRIBufferRec *bufs;
542} confDRIRec, *confDRIPtr;
543
544/* These values should be adjusted when new fields are added to ScrnInfoRec */
545#define NUM_RESERVED_INTS 16
546#define NUM_RESERVED_POINTERS 15
547#define NUM_RESERVED_FUNCS 11
548
549typedef pointer (*funcPointer)(void);
550
551/* flags for depth 24 pixmap options */
552typedef enum {
553 Pix24DontCare = 0,
554 Pix24Use24,
555 Pix24Use32
556} Pix24Flags;
557
558/* Power management events: so far we only support APM */
559
560typedef enum {
561 XF86_APM_UNKNOWN = -1,
562 XF86_APM_SYS_STANDBY,
563 XF86_APM_SYS_SUSPEND,
564 XF86_APM_CRITICAL_SUSPEND,
565 XF86_APM_USER_STANDBY,
566 XF86_APM_USER_SUSPEND,
567 XF86_APM_STANDBY_RESUME,
568 XF86_APM_NORMAL_RESUME,
569 XF86_APM_CRITICAL_RESUME,
570 XF86_APM_LOW_BATTERY,
571 XF86_APM_POWER_STATUS_CHANGE,
572 XF86_APM_UPDATE_TIME,
573 XF86_APM_CAPABILITY_CHANGED,
574 XF86_APM_STANDBY_FAILED,
575 XF86_APM_SUSPEND_FAILED
576} pmEvent;
577
578typedef enum {
579 PM_WAIT,
580 PM_CONTINUE,
581 PM_FAILED,
582 PM_NONE
583} pmWait;
584
585/*
586 * The IO access enabler struct. This contains the address for
587 * the IOEnable/IODisable funcs for their specific bus along
588 * with a pointer to data needed by them
589 */
590typedef struct _AccessRec {
591 void (*AccessDisable)(void *arg);
592 void (*AccessEnable)(void *arg);
593 void *arg;
594} xf86AccessRec, *xf86AccessPtr;
595
596typedef struct {
597 xf86AccessPtr mem;
598 xf86AccessPtr io;
599 xf86AccessPtr io_mem;
600} xf86SetAccessFuncRec, *xf86SetAccessFuncPtr;
601
602/* bus-access-related types */
603typedef enum {
604 NONE,
605 IO,
606 MEM_IO,
607 MEM
608} resType;
609
610typedef struct _EntityAccessRec {
611 xf86AccessPtr fallback;
612 xf86AccessPtr pAccess;
613 resType rt;
614 pointer busAcc;
615 struct _EntityAccessRec *next;
616} EntityAccessRec, *EntityAccessPtr;
617
618typedef struct _CurrAccRec {
619 EntityAccessPtr pMemAccess;
620 EntityAccessPtr pIoAccess;
621} xf86CurrentAccessRec, *xf86CurrentAccessPtr;
622
623/* new RAC */
624
625/* Resource Type values */
626#define ResNone ((unsigned long)(-1))
627
628#define ResMem 0x0001
629#define ResIo 0x0002
630#define ResIrq 0x0003
631#define ResDma 0x0004
632#define ResPciCfg 0x000e /* PCI Configuration space */
633#define ResPhysMask 0x000F
634
635#define ResExclusive 0x0010
636#define ResShared 0x0020
637#define ResAny 0x0040
638#define ResAccMask 0x0070
639#define ResUnused 0x0080
640
641#define ResUnusedOpr 0x0100
642#define ResDisableOpr 0x0200
643#define ResOprMask 0x0300
644
645#define ResBlock 0x0400
646#define ResSparse 0x0800
647#define ResExtMask 0x0C00
648
649#define ResEstimated 0x001000
650#define ResInit 0x002000
651#define ResBios 0x004000
652#define ResMiscMask 0x00F000
653
654#define ResBus 0x010000
655#define ResOverlap 0x020000
656
657#if defined(__alpha__) && defined(linux)
658# define ResDomain 0x1ff000000ul
659#else
660# define ResDomain 0xff000000ul
661#endif
662#define ResTypeMask (ResPhysMask | ResDomain) /* For conflict check */
663
664#define ResEnd ResNone
665
666#define ResExcMemBlock (ResMem | ResExclusive | ResBlock)
667#define ResExcIoBlock (ResIo | ResExclusive | ResBlock)
668#define ResShrMemBlock (ResMem | ResShared | ResBlock)
669#define ResShrIoBlock (ResIo | ResShared | ResBlock)
670#define ResExcUusdMemBlock (ResMem | ResExclusive | ResUnused | ResBlock)
671#define ResExcUusdIoBlock (ResIo | ResExclusive | ResUnused | ResBlock)
672#define ResShrUusdMemBlock (ResMem | ResShared | ResUnused | ResBlock)
673#define ResShrUusdIoBlock (ResIo | ResShared | ResUnused | ResBlock)
674#define ResExcUusdMemSparse (ResMem | ResExclusive | ResUnused | ResSparse)
675#define ResExcUusdIoSparse (ResIo | ResExclusive | ResUnused | ResSparse)
676#define ResShrUusdMemSparse (ResMem | ResShared | ResUnused | ResSparse)
677#define ResShrUusdIoSparse (ResIo | ResShared | ResUnused | ResSparse)
678
679#define ResExcMemSparse (ResMem | ResExclusive | ResSparse)
680#define ResExcIoSparse (ResIo | ResExclusive | ResSparse)
681#define ResShrMemSparse (ResMem | ResShared | ResSparse)
682#define ResShrIoSparse (ResIo | ResShared | ResSparse)
683#define ResUusdMemSparse (ResMem | ResUnused | ResSparse)
684#define ResUusdIoSparse (ResIo | ResUnused | ResSparse)
685
686#define ResIsMem(r) (((r)->type & ResPhysMask) == ResMem)
687#define ResIsIo(r) (((r)->type & ResPhysMask) == ResIo)
688#define ResIsExclusive(r) (((r)->type & ResAccMask) == ResExclusive)
689#define ResIsShared(r) (((r)->type & ResAccMask) == ResShared)
690#define ResIsUnused(r) (((r)->type & ResAccMask) == ResUnused)
691#define ResIsBlock(r) (((r)->type & ResExtMask) == ResBlock)
692#define ResIsSparse(r) (((r)->type & ResExtMask) == ResSparse)
693#define ResIsEstimated(r) (((r)->type & ResMiscMask) == ResEstimated)
694#define ResCanOverlap(r) (ResIsEstimated(r) || ((r)->type & ResOverlap))
695
696typedef struct {
697 unsigned long type; /* shared, exclusive, unused etc. */
698 memType a;
699 memType b;
700} resRange, *resList;
701
702#define RANGE_TYPE(type, domain) \
703 (((unsigned long)(domain) << 24) | ((type) & ~ResBus))
704#define RANGE(r,u,v,t) {\
705 (r).a = (u);\
706 (r).b = (v);\
707 (r).type = (t);\
708 }
709
710#define rBase a
711#define rMask b
712#define rBegin a
713#define rEnd b
714
715/* resource record */
716typedef struct _resRec *resPtr;
717typedef struct _resRec {
718 resRange val;
719 int entityIndex; /* who owns the resource */
720 resPtr next;
721} resRec;
722
723#define sparse_base val.rBase
724#define sparse_mask val.rMask
725#define block_begin val.rBegin
726#define block_end val.rEnd
727#define res_type val.type
728
729typedef struct {
730 int numChipset;
731 resRange *resList;
732} IsaChipsets;
733
734typedef struct {
735 /**
736 * Key used to match this device with its name in an array of
737 * \c SymTabRec.
738 */
739 int numChipset;
740
741 /**
742 * This value is quirky. Depending on the driver, it can take on one of
743 * three meanings. In drivers that have exactly one vendor ID (e.g.,
744 * radeon, mga, i810) the low 16-bits are the device ID.
745 *
746 * In drivers that can have multiple vendor IDs (e.g., the glint driver
747 * can have either 3dlabs' ID or TI's ID, the i740 driver can have either
748 * Intel's ID or Real3D's ID, etc.) the low 16-bits are the device ID and
749 * the high 16-bits are the vendor ID.
750 *
751 * In drivers that don't have a specific vendor (e.g., vga) contains the
752 * device ID for either the generic VGA or generic 8514 devices. This
753 * turns out to be the same as the subclass and programming interface
754 * value (e.g., the full 24-bit class for the VGA device is 0x030000 (or
755 * 0x000101) and for 8514 is 0x030001).
756 */
757 int PCIid;
758
759 /**
760 * Resources associated with this type of device.
761 */
762 resRange *resList;
763} PciChipsets;
764
765/* Entity properties */
766typedef void (*EntityProc)(int entityIndex,pointer private);
767
768typedef struct _entityInfo {
769 int index;
770 BusRec location;
771 int chipset;
772 Bool active;
773 resPtr resources;
774 GDevPtr device;
775 DriverPtr driver;
776} EntityInfoRec, *EntityInfoPtr;
777
778/* server states */
779
780typedef enum {
781 SETUP,
782 OPERATING
783} xf86State;
784
785typedef enum {
786 NOTIFY_SETUP_TRANSITION,
787 NOTIFY_SETUP,
788 NOTIFY_OPERATING,
789 NOTIFY_OPERATING_TRANSITION,
790 NOTIFY_ENABLE,
791 NOTIFY_ENTER,
792 NOTIFY_LEAVE
793} xf86NotifyState;
794
795typedef void (*xf86StateChangeNotificationCallbackFunc)(xf86NotifyState state,pointer);
796
797/* DGA */
798
799typedef struct {
800 int num; /* A unique identifier for the mode (num > 0) */
801 DisplayModePtr mode;
802 int flags; /* DGA_CONCURRENT_ACCESS, etc... */
803 int imageWidth; /* linear accessible portion (pixels) */
804 int imageHeight;
805 int pixmapWidth; /* Xlib accessible portion (pixels) */
806 int pixmapHeight; /* both fields ignored if no concurrent access */
807 int bytesPerScanline;
808 int byteOrder; /* MSBFirst, LSBFirst */
809 int depth;
810 int bitsPerPixel;
811 unsigned long red_mask;
812 unsigned long green_mask;
813 unsigned long blue_mask;
814 short visualClass;
815 int viewportWidth;
816 int viewportHeight;
817 int xViewportStep; /* viewport position granularity */
818 int yViewportStep;
819 int maxViewportX; /* max viewport origin */
820 int maxViewportY;
821 int viewportFlags; /* types of page flipping possible */
822 int offset; /* offset into physical memory */
823 unsigned char *address; /* server's mapped framebuffer */
824 int reserved1;
825 int reserved2;
826} DGAModeRec, *DGAModePtr;
827
828typedef struct {
829 DGAModePtr mode;
830 PixmapPtr pPix;
831} DGADeviceRec, *DGADevicePtr;
832
833/*
834 * Flags for driver Probe() functions.
835 */
836#define PROBE_DEFAULT 0x00
837#define PROBE_DETECT 0x01
838#define PROBE_TRYHARD 0x02
839
840/*
841 * Driver entry point types
842 */
843
844typedef Bool xf86ProbeProc (DriverPtr, int);
845typedef Bool xf86PreInitProc (ScrnInfoPtr, int);
846typedef Bool xf86ScreenInitProc (int, ScreenPtr, int, char**);
847typedef Bool xf86SwitchModeProc (int, DisplayModePtr, int);
848typedef void xf86AdjustFrameProc (int, int, int, int);
849typedef Bool xf86EnterVTProc (int, int);
850typedef void xf86LeaveVTProc (int, int);
851typedef void xf86FreeScreenProc (int, int);
852typedef ModeStatus xf86ValidModeProc (int, DisplayModePtr, Bool, int);
853typedef void xf86EnableDisableFBAccessProc(int, Bool);
854typedef int xf86SetDGAModeProc (int, int, DGADevicePtr);
855typedef int xf86ChangeGammaProc (int, Gamma);
856typedef void xf86PointerMovedProc (int, int, int);
857typedef Bool xf86PMEventProc (int, pmEvent, Bool);
858typedef int xf86HandleMessageProc (int, const char*, const char*, char**);
859typedef void xf86DPMSSetProc (ScrnInfoPtr, int, int);
860typedef void xf86LoadPaletteProc (ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
861typedef void xf86SetOverscanProc (ScrnInfoPtr, int);
862
863
864/*
865 * ScrnInfoRec
866 *
867 * There is one of these for each screen, and it holds all the screen-specific
868 * information.
869 *
870 * Note: the size and layout must be kept the same across versions. New
871 * fields are to be added in place of the "reserved*" fields. No fields
872 * are to be dependent on compile-time defines.
873 */
874
875
876typedef struct _ScrnInfoRec {
877 int driverVersion;
878 char * driverName; /* canonical name used in */
879 /* the config file */
880 ScreenPtr pScreen; /* Pointer to the ScreenRec */
881 int scrnIndex; /* Number of this screen */
882 Bool configured; /* Is this screen valid */
883 int origIndex; /* initial number assigned to
884 * this screen before
885 * finalising the number of
886 * available screens */
887
888 /* Display-wide screenInfo values needed by this screen */
889 int imageByteOrder;
890 int bitmapScanlineUnit;
891 int bitmapScanlinePad;
892 int bitmapBitOrder;
893 int numFormats;
894 PixmapFormatRec formats[MAXFORMATS];
895 PixmapFormatRec fbFormat;
896
897 int bitsPerPixel; /* fb bpp */
898 Pix24Flags pixmap24; /* pixmap pref for depth 24 */
899 int depth; /* depth of default visual */
900 MessageType depthFrom; /* set from config? */
901 MessageType bitsPerPixelFrom; /* set from config? */
902 rgb weight; /* r/g/b weights */
903 rgb mask; /* rgb masks */
904 rgb offset; /* rgb offsets */
905 int rgbBits; /* Number of bits in r/g/b */
906 Gamma gamma; /* Gamma of the monitor */
907 int defaultVisual; /* default visual class */
908 int maxHValue; /* max horizontal timing */
909 int maxVValue; /* max vertical timing value */
910 int virtualX; /* Virtual width */
911 int virtualY; /* Virtual height */
912 int xInc; /* Horizontal timing increment */
913 MessageType virtualFrom; /* set from config? */
914 int displayWidth; /* memory pitch */
915 int frameX0; /* viewport position */
916 int frameY0;
917 int frameX1;
918 int frameY1;
919 int zoomLocked; /* Disallow mode changes */
920 DisplayModePtr modePool; /* list of compatible modes */
921 DisplayModePtr modes; /* list of actual modes */
922 DisplayModePtr currentMode; /* current mode
923 * This was previously
924 * overloaded with the modes
925 * field, which is a pointer
926 * into a circular list */
927 confScreenPtr confScreen; /* Screen config info */
928 MonPtr monitor; /* Monitor information */
929 DispPtr display; /* Display information */
930 int * entityList; /* List of device entities */
931 int numEntities;
932 int widthmm; /* physical display dimensions
933 * in mm */
934 int heightmm;
935 int xDpi; /* width DPI */
936 int yDpi; /* height DPI */
937 char * name; /* Name to prefix messages */
938 pointer driverPrivate; /* Driver private area */
939 DevUnion * privates; /* Other privates can hook in
940 * here */
941 DriverPtr drv; /* xf86DriverList[] entry */
942 pointer module; /* Pointer to module head */
943 int colorKey;
944 int overlayFlags;
945
946 /* Some of these may be moved out of here into the driver private area */
947
948 char * chipset; /* chipset name */
949 char * ramdac; /* ramdac name */
950 char * clockchip; /* clock name */
951 Bool progClock; /* clock is programmable */
952 int numClocks; /* number of clocks */
953 int clock[MAXCLOCKS]; /* list of clock frequencies */
954 int videoRam; /* amount of video ram (kb) */
955 unsigned long biosBase; /* Base address of video BIOS */
956 unsigned long memPhysBase; /* Physical address of FB */
957 unsigned long fbOffset; /* Offset of FB in the above */
958 IOADDRESS domainIOBase; /* Domain I/O base address */
959 int memClk; /* memory clock */
960 int textClockFreq; /* clock of text mode */
961 Bool flipPixels; /* swap default black/white */
962 pointer options;
963
964 int chipID;
965 int chipRev;
966 int racMemFlags;
967 int racIoFlags;
968 pointer access;
969 xf86CurrentAccessPtr CurrentAccess;
970 resType resourceType;
971 pointer busAccess;
972
973 /* Allow screens to be enabled/disabled individually */
974 Bool vtSema;
975 DevUnion pixmapPrivate; /* saved devPrivate from pixmap */
976
977 /* hw cursor moves at SIGIO time */
978 Bool silkenMouse;
979
980 /* Storage for clockRanges and adjustFlags for use with the VidMode ext */
981 ClockRangesPtr clockRanges;
982 int adjustFlags;
983
984 /*
985 * These can be used when the minor ABI version is incremented.
986 * The NUM_* parameters must be reduced appropriately to keep the
987 * structure size and alignment unchanged.
988 */
989 int reservedInt[NUM_RESERVED_INTS];
990
991 int * entityInstanceList;
992 pointer reservedPtr[NUM_RESERVED_POINTERS];
993
994 /*
995 * Driver entry points.
996 *
997 */
998
999 xf86ProbeProc *Probe;
1000 xf86PreInitProc *PreInit;
1001 xf86ScreenInitProc *ScreenInit;
1002 xf86SwitchModeProc *SwitchMode;
1003 xf86AdjustFrameProc *AdjustFrame;
1004 xf86EnterVTProc *EnterVT;
1005 xf86LeaveVTProc *LeaveVT;
1006 xf86FreeScreenProc *FreeScreen;
1007 xf86ValidModeProc *ValidMode;
1008 xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
1009 xf86SetDGAModeProc *SetDGAMode;
1010 xf86ChangeGammaProc *ChangeGamma;
1011 xf86PointerMovedProc *PointerMoved;
1012 xf86PMEventProc *PMEvent;
1013 xf86HandleMessageProc *HandleMessage;
1014 xf86DPMSSetProc *DPMSSet;
1015 xf86LoadPaletteProc *LoadPalette;
1016 xf86SetOverscanProc *SetOverscan;
1017 xorgDriverFuncProc *DriverFunc;
1018
1019 /*
1020 * This can be used when the minor ABI version is incremented.
1021 * The NUM_* parameter must be reduced appropriately to keep the
1022 * structure size and alignment unchanged.
1023 */
1024 funcPointer reservedFuncs[NUM_RESERVED_FUNCS];
1025
1026} ScrnInfoRec;
1027
1028
1029typedef struct {
1030 Bool (*OpenFramebuffer)(
1031 ScrnInfoPtr pScrn,
1032 char **name,
1033 unsigned char **mem,
1034 int *size,
1035 int *offset,
1036 int *extra
1037 );
1038 void (*CloseFramebuffer)(ScrnInfoPtr pScrn);
1039 Bool (*SetMode)(ScrnInfoPtr pScrn, DGAModePtr pMode);
1040 void (*SetViewport)(ScrnInfoPtr pScrn, int x, int y, int flags);
1041 int (*GetViewport)(ScrnInfoPtr pScrn);
1042 void (*Sync)(ScrnInfoPtr);
1043 void (*FillRect)(
1044 ScrnInfoPtr pScrn,
1045 int x, int y, int w, int h,
1046 unsigned long color
1047 );
1048 void (*BlitRect)(
1049 ScrnInfoPtr pScrn,
1050 int srcx, int srcy,
1051 int w, int h,
1052 int dstx, int dsty
1053 );
1054 void (*BlitTransRect)(
1055 ScrnInfoPtr pScrn,
1056 int srcx, int srcy,
1057 int w, int h,
1058 int dstx, int dsty,
1059 unsigned long color
1060 );
1061} DGAFunctionRec, *DGAFunctionPtr;
1062
1063typedef struct {
1064 int token; /* id of the token */
1065 const char * name; /* token name */
1066} SymTabRec, *SymTabPtr;
1067
1068/* flags for xf86LookupMode */
1069typedef enum {
1070 LOOKUP_DEFAULT = 0, /* Use default mode lookup method */
1071 LOOKUP_BEST_REFRESH, /* Pick modes with best refresh */
1072 LOOKUP_CLOSEST_CLOCK, /* Pick modes with the closest clock */
1073 LOOKUP_LIST_ORDER, /* Pick first useful mode in list */
1074 LOOKUP_CLKDIV2 = 0x0100, /* Allow half clocks */
1075 LOOKUP_OPTIONAL_TOLERANCES = 0x0200 /* Allow missing hsync/vrefresh */
1076} LookupModeFlags;
1077
1078#define NoDepth24Support 0x00
1079#define Support24bppFb 0x01 /* 24bpp framebuffer supported */
1080#define Support32bppFb 0x02 /* 32bpp framebuffer supported */
1081#define SupportConvert24to32 0x04 /* Can convert 24bpp pixmap to 32bpp */
1082#define SupportConvert32to24 0x08 /* Can convert 32bpp pixmap to 24bpp */
1083#define PreferConvert24to32 0x10 /* prefer 24bpp pixmap to 32bpp conv */
1084#define PreferConvert32to24 0x20 /* prefer 32bpp pixmap to 24bpp conv */
1085
1086
1087/* For DPMS */
1088typedef void (*DPMSSetProcPtr)(ScrnInfoPtr, int, int);
1089
1090/* Input handler proc */
1091typedef void (*InputHandlerProc)(int fd, pointer data);
1092
1093/* These are used by xf86GetClocks */
1094#define CLK_REG_SAVE -1
1095#define CLK_REG_RESTORE -2
1096
1097/* xf86Debug.c */
1098#ifdef BUILDDEBUG
1099typedef struct {
1100 long sec;
1101 long usec;
1102} xf86TsRec, *xf86TsPtr;
1103#endif
1104
1105/*
1106 * misc constants
1107 */
1108#define INTERLACE_REFRESH_WEIGHT 1.5
1109#define SYNC_TOLERANCE 0.01 /* 1 percent */
1110#define CLOCK_TOLERANCE 2000 /* Clock matching tolerance (2MHz) */
1111
1112
1113#define OVERLAY_8_32_DUALFB 0x00000001
1114#define OVERLAY_8_24_DUALFB 0x00000002
1115#define OVERLAY_8_16_DUALFB 0x00000004
1116#define OVERLAY_8_32_PLANAR 0x00000008
1117
1118#if 0
1119#define LD_RESOLV_IFDONE 0 /* only check if no more
1120 delays pending */
1121#define LD_RESOLV_NOW 1 /* finish one delay step */
1122#define LD_RESOLV_FORCE 2 /* force checking... */
1123#endif
1124
1125/* Values of xf86Info.mouseFlags */
1126#define MF_CLEAR_DTR 1
1127#define MF_CLEAR_RTS 2
1128
1129/* Action Events */
1130typedef enum {
1131 ACTION_TERMINATE = 0, /* Terminate Server */
1132 ACTION_NEXT_MODE = 10, /* Switch to next video mode */
1133 ACTION_PREV_MODE,
1134 ACTION_DISABLEGRAB = 20, /* Cancel server/pointer/kbd grabs */
1135 ACTION_CLOSECLIENT, /* Kill client holding grab */
1136 ACTION_SWITCHSCREEN = 100, /* VT switch */
1137 ACTION_SWITCHSCREEN_NEXT,
1138 ACTION_SWITCHSCREEN_PREV,
1139 ACTION_MESSAGE = 9999 /* Generic message passing */
1140} ActionEvent;
1141
1142/* xf86Versions.c */
1143/*
1144 * Never change existing values, and always assign values explicitly.
1145 * NUM_BUILTIN_IFS must always be the last entry.
1146 */
1147typedef enum {
1148 BUILTIN_IF_OSMOUSE = 0,
1149 BUILTIN_IF_OSKBD = 1,
1150 NUM_BUILTIN_IFS
1151} BuiltinInterface;
1152
1153/*
1154 * These are intentionally the same as the module version macros.
1155 * It is possible to register a module as providing a specific interface,
1156 * in which case the module's version is used. This feature isn't
1157 * really ready for use yet though.
1158 */
1159
1160#define BUILTIN_INTERFACE_VERSION_NUMERIC(maj, min, patch) \
1161 ((((maj) & 0xFF) << 24) | (((min) & 0xFF) << 16) | (patch & 0xFFFF))
1162#define GET_BUILTIN_INTERFACE_MAJOR_VERSION(vers) (((vers) >> 24) & 0xFF)
1163#define GET_BUILTIN_INTERFACE_MINOR_VERSION(vers) (((vers) >> 16) & 0xFF)
1164#define GET_BUILTIN_INTERFACE_PATCH_VERSION(vers) ((vers) & 0xFFFF)
1165
1166#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