VirtualBox

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

Last change on this file since 33428 was 25078, checked in by vboxsync, 15 years ago

Additions/x11/x11include: exported and set eol-style on new headers

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