VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/7.0/xorg/xf86str.h@ 37801

最後變更 在這個檔案從37801是 17236,由 vboxsync 提交於 16 年 前

Additions/x11/x11include: blast! Reverted r43555 and r43556

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

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