VirtualBox

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

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

export to OSE

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

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