xf86str.h revision 66a34d92
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/* 245 * The driverFunc. xorgDriverFuncOp specifies the action driver should 246 * perform. If requested option is not supported function should return 247 * FALSE. pointer can be used to pass arguments to the function or 248 * to return data to the caller. 249 */ 250typedef struct _ScrnInfoRec *ScrnInfoPtr; 251 252/* do not change order */ 253typedef enum { 254 RR_GET_INFO, 255 RR_SET_CONFIG, 256 RR_GET_MODE_MM, 257 GET_REQUIRED_HW_INTERFACES = 10 258} xorgDriverFuncOp; 259 260typedef Bool xorgDriverFuncProc (ScrnInfoPtr, xorgDriverFuncOp, 261 pointer); 262 263/* RR_GET_INFO, RR_SET_CONFIG */ 264typedef struct { 265 int rotation; 266 int rate; 267 int width; 268 int height; 269} xorgRRConfig; 270 271typedef union { 272 short RRRotations; 273 xorgRRConfig RRConfig; 274} xorgRRRotation, *xorgRRRotationPtr; 275 276/* RR_GET_MODE_MM */ 277typedef struct { 278 DisplayModePtr mode; 279 int virtX; 280 int virtY; 281 int mmWidth; 282 int mmHeight; 283} xorgRRModeMM, *xorgRRModeMMPtr; 284 285/* GET_REQUIRED_HW_INTERFACES */ 286#define HW_IO 1 287#define HW_MMIO 2 288#define HW_SKIP_CONSOLE 4 289#define NEED_IO_ENABLED(x) (x & HW_IO) 290 291typedef CARD32 xorgHWFlags; 292 293/* 294 * The driver list struct. This contains the information required for each 295 * driver before a ScrnInfoRec has been allocated. 296 */ 297struct _DriverRec; 298 299typedef struct { 300 int driverVersion; 301 char * driverName; 302 void (*Identify)(int flags); 303 Bool (*Probe)(struct _DriverRec *drv, int flags); 304 const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype); 305 pointer module; 306 int refCount; 307} DriverRec1; 308 309struct _SymTabRec; 310struct _PciChipsets; 311 312typedef struct _DriverRec { 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 xorgDriverFuncProc *driverFunc; 321 322 const struct pci_id_match * supported_devices; 323 Bool (*PciProbe)( struct _DriverRec * drv, int entity_num, 324 struct pci_device * dev, intptr_t match_data ); 325} DriverRec, *DriverPtr; 326 327/* 328 * AddDriver flags 329 */ 330#define HaveDriverFuncs 1 331 332/* 333 * These are the private bus types. New types can be added here. Types 334 * required for the public interface should be added to xf86str.h, with 335 * function prototypes added to xf86.h. 336 */ 337 338/* Tolerate prior #include <linux/input.h> */ 339#if defined(linux) && defined(_INPUT_H) 340#undef BUS_NONE 341#undef BUS_PCI 342#undef BUS_SBUS 343#undef BUS_last 344#endif 345 346typedef enum { 347 BUS_NONE, 348 BUS_PCI, 349 BUS_SBUS, 350 BUS_ISA, 351 BUS_last /* Keep last */ 352} BusType; 353 354struct pci_device; 355 356typedef struct { 357 int fbNum; 358} SbusBusId; 359 360typedef struct _bus { 361 BusType type; 362 union { 363 struct pci_device *pci; 364 SbusBusId sbus; 365 } id; 366} BusRec, *BusPtr; 367 368#define MAXCLOCKS 128 369typedef enum { 370 DAC_BPP8 = 0, 371 DAC_BPP16, 372 DAC_BPP24, 373 DAC_BPP32, 374 MAXDACSPEEDS 375} DacSpeedIndex; 376 377typedef struct { 378 char * identifier; 379 char * vendor; 380 char * board; 381 char * chipset; 382 char * ramdac; 383 char * driver; 384 struct _confscreenrec * myScreenSection; 385 Bool claimed; 386 int dacSpeeds[MAXDACSPEEDS]; 387 int numclocks; 388 int clock[MAXCLOCKS]; 389 char * clockchip; 390 char * busID; 391 Bool active; 392 Bool inUse; 393 int videoRam; 394 int textClockFreq; 395 unsigned long BiosBase; /* Base address of video BIOS */ 396 unsigned long MemBase; /* Frame buffer base address */ 397 unsigned long IOBase; 398 int chipID; 399 int chipRev; 400 pointer options; 401 int irq; 402 int screen; /* For multi-CRTC cards */ 403} GDevRec, *GDevPtr; 404 405typedef struct { 406 int frameX0; 407 int frameY0; 408 int virtualX; 409 int virtualY; 410 int depth; 411 int fbbpp; 412 rgb weight; 413 rgb blackColour; 414 rgb whiteColour; 415 int defaultVisual; 416 const char ** modes; 417 pointer options; 418} DispRec, *DispPtr; 419 420typedef struct _confxvportrec { 421 char * identifier; 422 pointer options; 423} confXvPortRec, *confXvPortPtr; 424 425typedef struct _confxvadaptrec { 426 char * identifier; 427 int numports; 428 confXvPortPtr ports; 429 pointer options; 430} confXvAdaptorRec, *confXvAdaptorPtr; 431 432typedef struct _confscreenrec { 433 char * id; 434 int screennum; 435 int defaultdepth; 436 int defaultbpp; 437 int defaultfbbpp; 438 MonPtr monitor; 439 GDevPtr device; 440 int numdisplays; 441 DispPtr displays; 442 int numxvadaptors; 443 confXvAdaptorPtr xvadaptors; 444 pointer options; 445} confScreenRec, *confScreenPtr; 446 447typedef enum { 448 PosObsolete = -1, 449 PosAbsolute = 0, 450 PosRightOf, 451 PosLeftOf, 452 PosAbove, 453 PosBelow, 454 PosRelative 455} PositionType; 456 457typedef struct _screenlayoutrec { 458 confScreenPtr screen; 459 char * topname; 460 confScreenPtr top; 461 char * bottomname; 462 confScreenPtr bottom; 463 char * leftname; 464 confScreenPtr left; 465 char * rightname; 466 confScreenPtr right; 467 PositionType where; 468 int x; 469 int y; 470 char * refname; 471 confScreenPtr refscreen; 472} screenLayoutRec, *screenLayoutPtr; 473 474typedef struct _InputInfoRec InputInfoRec; 475 476typedef struct _serverlayoutrec { 477 char * id; 478 screenLayoutPtr screens; 479 GDevPtr inactives; 480 InputInfoRec** inputs; /* NULL terminated */ 481 pointer options; 482} serverLayoutRec, *serverLayoutPtr; 483 484typedef struct _confdribufferrec { 485 int count; 486 int size; 487 enum { 488 XF86DRI_WC_HINT = 0x0001 /* Placeholder: not implemented */ 489 } flags; 490} confDRIBufferRec, *confDRIBufferPtr; 491 492typedef struct _confdrirec { 493 int group; 494 int mode; 495 int bufs_count; 496 confDRIBufferRec *bufs; 497} confDRIRec, *confDRIPtr; 498 499/* These values should be adjusted when new fields are added to ScrnInfoRec */ 500#define NUM_RESERVED_INTS 16 501#define NUM_RESERVED_POINTERS 14 502#define NUM_RESERVED_FUNCS 10 503 504typedef pointer (*funcPointer)(void); 505 506/* flags for depth 24 pixmap options */ 507typedef enum { 508 Pix24DontCare = 0, 509 Pix24Use24, 510 Pix24Use32 511} Pix24Flags; 512 513/* Power management events: so far we only support APM */ 514 515typedef enum { 516 XF86_APM_UNKNOWN = -1, 517 XF86_APM_SYS_STANDBY, 518 XF86_APM_SYS_SUSPEND, 519 XF86_APM_CRITICAL_SUSPEND, 520 XF86_APM_USER_STANDBY, 521 XF86_APM_USER_SUSPEND, 522 XF86_APM_STANDBY_RESUME, 523 XF86_APM_NORMAL_RESUME, 524 XF86_APM_CRITICAL_RESUME, 525 XF86_APM_LOW_BATTERY, 526 XF86_APM_POWER_STATUS_CHANGE, 527 XF86_APM_UPDATE_TIME, 528 XF86_APM_CAPABILITY_CHANGED, 529 XF86_APM_STANDBY_FAILED, 530 XF86_APM_SUSPEND_FAILED 531} pmEvent; 532 533typedef enum { 534 PM_WAIT, 535 PM_CONTINUE, 536 PM_FAILED, 537 PM_NONE 538} pmWait; 539 540typedef struct _PciChipsets { 541 /** 542 * Key used to match this device with its name in an array of 543 * \c SymTabRec. 544 */ 545 int numChipset; 546 547 /** 548 * This value is quirky. Depending on the driver, it can take on one of 549 * three meanings. In drivers that have exactly one vendor ID (e.g., 550 * radeon, mga, i810) the low 16-bits are the device ID. 551 * 552 * In drivers that can have multiple vendor IDs (e.g., the glint driver 553 * can have either 3dlabs' ID or TI's ID, the i740 driver can have either 554 * Intel's ID or Real3D's ID, etc.) the low 16-bits are the device ID and 555 * the high 16-bits are the vendor ID. 556 * 557 * In drivers that don't have a specific vendor (e.g., vga) contains the 558 * device ID for either the generic VGA or generic 8514 devices. This 559 * turns out to be the same as the subclass and programming interface 560 * value (e.g., the full 24-bit class for the VGA device is 0x030000 (or 561 * 0x000101) and for 8514 is 0x030001). 562 */ 563 int PCIid; 564 565/* dummy place holders for drivers to build against old/new servers */ 566#define RES_UNDEFINED NULL 567#define RES_EXCLUSIVE_VGA NULL 568#define RES_SHARED_VGA NULL 569 void *dummy; 570} PciChipsets; 571 572 573/* Entity properties */ 574typedef void (*EntityProc)(int entityIndex,pointer private); 575 576typedef struct _entityInfo { 577 int index; 578 BusRec location; 579 int chipset; 580 Bool active; 581 GDevPtr device; 582 DriverPtr driver; 583} EntityInfoRec, *EntityInfoPtr; 584 585/* DGA */ 586 587typedef struct { 588 int num; /* A unique identifier for the mode (num > 0) */ 589 DisplayModePtr mode; 590 int flags; /* DGA_CONCURRENT_ACCESS, etc... */ 591 int imageWidth; /* linear accessible portion (pixels) */ 592 int imageHeight; 593 int pixmapWidth; /* Xlib accessible portion (pixels) */ 594 int pixmapHeight; /* both fields ignored if no concurrent access */ 595 int bytesPerScanline; 596 int byteOrder; /* MSBFirst, LSBFirst */ 597 int depth; 598 int bitsPerPixel; 599 unsigned long red_mask; 600 unsigned long green_mask; 601 unsigned long blue_mask; 602 short visualClass; 603 int viewportWidth; 604 int viewportHeight; 605 int xViewportStep; /* viewport position granularity */ 606 int yViewportStep; 607 int maxViewportX; /* max viewport origin */ 608 int maxViewportY; 609 int viewportFlags; /* types of page flipping possible */ 610 int offset; /* offset into physical memory */ 611 unsigned char *address; /* server's mapped framebuffer */ 612 int reserved1; 613 int reserved2; 614} DGAModeRec, *DGAModePtr; 615 616typedef struct { 617 DGAModePtr mode; 618 PixmapPtr pPix; 619} DGADeviceRec, *DGADevicePtr; 620 621/* 622 * Flags for driver Probe() functions. 623 */ 624#define PROBE_DEFAULT 0x00 625#define PROBE_DETECT 0x01 626#define PROBE_TRYHARD 0x02 627 628/* 629 * Driver entry point types 630 */ 631 632typedef Bool xf86ProbeProc (DriverPtr, int); 633typedef Bool xf86PreInitProc (ScrnInfoPtr, int); 634typedef Bool xf86ScreenInitProc (int, ScreenPtr, int, char**); 635typedef Bool xf86SwitchModeProc (int, DisplayModePtr, int); 636typedef void xf86AdjustFrameProc (int, int, int, int); 637typedef Bool xf86EnterVTProc (int, int); 638typedef void xf86LeaveVTProc (int, int); 639typedef void xf86FreeScreenProc (int, int); 640typedef ModeStatus xf86ValidModeProc (int, DisplayModePtr, Bool, int); 641typedef void xf86EnableDisableFBAccessProc(int, Bool); 642typedef int xf86SetDGAModeProc (int, int, DGADevicePtr); 643typedef int xf86ChangeGammaProc (int, Gamma); 644typedef void xf86PointerMovedProc (int, int, int); 645typedef Bool xf86PMEventProc (int, pmEvent, Bool); 646typedef void xf86DPMSSetProc (ScrnInfoPtr, int, int); 647typedef void xf86LoadPaletteProc (ScrnInfoPtr, int, int *, LOCO *, VisualPtr); 648typedef void xf86SetOverscanProc (ScrnInfoPtr, int); 649typedef void xf86ModeSetProc (ScrnInfoPtr); 650 651 652/* 653 * ScrnInfoRec 654 * 655 * There is one of these for each screen, and it holds all the screen-specific 656 * information. 657 * 658 * Note: the size and layout must be kept the same across versions. New 659 * fields are to be added in place of the "reserved*" fields. No fields 660 * are to be dependent on compile-time defines. 661 */ 662 663 664typedef struct _ScrnInfoRec { 665 int driverVersion; 666 char * driverName; /* canonical name used in */ 667 /* the config file */ 668 ScreenPtr pScreen; /* Pointer to the ScreenRec */ 669 int scrnIndex; /* Number of this screen */ 670 Bool configured; /* Is this screen valid */ 671 int origIndex; /* initial number assigned to 672 * this screen before 673 * finalising the number of 674 * available screens */ 675 676 /* Display-wide screenInfo values needed by this screen */ 677 int imageByteOrder; 678 int bitmapScanlineUnit; 679 int bitmapScanlinePad; 680 int bitmapBitOrder; 681 int numFormats; 682 PixmapFormatRec formats[MAXFORMATS]; 683 PixmapFormatRec fbFormat; 684 685 int bitsPerPixel; /* fb bpp */ 686 Pix24Flags pixmap24; /* pixmap pref for depth 24 */ 687 int depth; /* depth of default visual */ 688 MessageType depthFrom; /* set from config? */ 689 MessageType bitsPerPixelFrom; /* set from config? */ 690 rgb weight; /* r/g/b weights */ 691 rgb mask; /* rgb masks */ 692 rgb offset; /* rgb offsets */ 693 int rgbBits; /* Number of bits in r/g/b */ 694 Gamma gamma; /* Gamma of the monitor */ 695 int defaultVisual; /* default visual class */ 696 int maxHValue; /* max horizontal timing */ 697 int maxVValue; /* max vertical timing value */ 698 int virtualX; /* Virtual width */ 699 int virtualY; /* Virtual height */ 700 int xInc; /* Horizontal timing increment */ 701 MessageType virtualFrom; /* set from config? */ 702 int displayWidth; /* memory pitch */ 703 int frameX0; /* viewport position */ 704 int frameY0; 705 int frameX1; 706 int frameY1; 707 int zoomLocked; /* Disallow mode changes */ 708 DisplayModePtr modePool; /* list of compatible modes */ 709 DisplayModePtr modes; /* list of actual modes */ 710 DisplayModePtr currentMode; /* current mode 711 * This was previously 712 * overloaded with the modes 713 * field, which is a pointer 714 * into a circular list */ 715 confScreenPtr confScreen; /* Screen config info */ 716 MonPtr monitor; /* Monitor information */ 717 DispPtr display; /* Display information */ 718 int * entityList; /* List of device entities */ 719 int numEntities; 720 int widthmm; /* physical display dimensions 721 * in mm */ 722 int heightmm; 723 int xDpi; /* width DPI */ 724 int yDpi; /* height DPI */ 725 char * name; /* Name to prefix messages */ 726 pointer driverPrivate; /* Driver private area */ 727 DevUnion * privates; /* Other privates can hook in 728 * here */ 729 DriverPtr drv; /* xf86DriverList[] entry */ 730 pointer module; /* Pointer to module head */ 731 int colorKey; 732 int overlayFlags; 733 734 /* Some of these may be moved out of here into the driver private area */ 735 736 char * chipset; /* chipset name */ 737 char * ramdac; /* ramdac name */ 738 char * clockchip; /* clock name */ 739 Bool progClock; /* clock is programmable */ 740 int numClocks; /* number of clocks */ 741 int clock[MAXCLOCKS]; /* list of clock frequencies */ 742 int videoRam; /* amount of video ram (kb) */ 743 unsigned long biosBase; /* Base address of video BIOS */ 744 unsigned long memPhysBase; /* Physical address of FB */ 745 unsigned long fbOffset; /* Offset of FB in the above */ 746 IOADDRESS domainIOBase; /* Domain I/O base address */ 747 int memClk; /* memory clock */ 748 int textClockFreq; /* clock of text mode */ 749 Bool flipPixels; /* swap default black/white */ 750 pointer options; 751 752 int chipID; 753 int chipRev; 754 755 /* Allow screens to be enabled/disabled individually */ 756 Bool vtSema; 757 758 /* hw cursor moves at SIGIO time */ 759 Bool silkenMouse; 760 761 /* Storage for clockRanges and adjustFlags for use with the VidMode ext */ 762 ClockRangePtr clockRanges; 763 int adjustFlags; 764 765 /* 766 * These can be used when the minor ABI version is incremented. 767 * The NUM_* parameters must be reduced appropriately to keep the 768 * structure size and alignment unchanged. 769 */ 770 int reservedInt[NUM_RESERVED_INTS]; 771 772 int * entityInstanceList; 773 struct pci_device *vgaDev; 774 775 pointer reservedPtr[NUM_RESERVED_POINTERS]; 776 777 /* 778 * Driver entry points. 779 * 780 */ 781 782 xf86ProbeProc *Probe; 783 xf86PreInitProc *PreInit; 784 xf86ScreenInitProc *ScreenInit; 785 xf86SwitchModeProc *SwitchMode; 786 xf86AdjustFrameProc *AdjustFrame; 787 xf86EnterVTProc *EnterVT; 788 xf86LeaveVTProc *LeaveVT; 789 xf86FreeScreenProc *FreeScreen; 790 xf86ValidModeProc *ValidMode; 791 xf86EnableDisableFBAccessProc *EnableDisableFBAccess; 792 xf86SetDGAModeProc *SetDGAMode; 793 xf86ChangeGammaProc *ChangeGamma; 794 xf86PointerMovedProc *PointerMoved; 795 xf86PMEventProc *PMEvent; 796 xf86DPMSSetProc *DPMSSet; 797 xf86LoadPaletteProc *LoadPalette; 798 xf86SetOverscanProc *SetOverscan; 799 xorgDriverFuncProc *DriverFunc; 800 xf86ModeSetProc *ModeSet; 801 802 /* 803 * This can be used when the minor ABI version is incremented. 804 * The NUM_* parameter must be reduced appropriately to keep the 805 * structure size and alignment unchanged. 806 */ 807 funcPointer reservedFuncs[NUM_RESERVED_FUNCS]; 808 809} ScrnInfoRec; 810 811 812typedef struct { 813 Bool (*OpenFramebuffer)( 814 ScrnInfoPtr pScrn, 815 char **name, 816 unsigned char **mem, 817 int *size, 818 int *offset, 819 int *extra 820 ); 821 void (*CloseFramebuffer)(ScrnInfoPtr pScrn); 822 Bool (*SetMode)(ScrnInfoPtr pScrn, DGAModePtr pMode); 823 void (*SetViewport)(ScrnInfoPtr pScrn, int x, int y, int flags); 824 int (*GetViewport)(ScrnInfoPtr pScrn); 825 void (*Sync)(ScrnInfoPtr); 826 void (*FillRect)( 827 ScrnInfoPtr pScrn, 828 int x, int y, int w, int h, 829 unsigned long color 830 ); 831 void (*BlitRect)( 832 ScrnInfoPtr pScrn, 833 int srcx, int srcy, 834 int w, int h, 835 int dstx, int dsty 836 ); 837 void (*BlitTransRect)( 838 ScrnInfoPtr pScrn, 839 int srcx, int srcy, 840 int w, int h, 841 int dstx, int dsty, 842 unsigned long color 843 ); 844} DGAFunctionRec, *DGAFunctionPtr; 845 846typedef struct _SymTabRec { 847 int token; /* id of the token */ 848 const char * name; /* token name */ 849} SymTabRec, *SymTabPtr; 850 851/* flags for xf86LookupMode */ 852typedef enum { 853 LOOKUP_DEFAULT = 0, /* Use default mode lookup method */ 854 LOOKUP_BEST_REFRESH, /* Pick modes with best refresh */ 855 LOOKUP_CLOSEST_CLOCK, /* Pick modes with the closest clock */ 856 LOOKUP_LIST_ORDER, /* Pick first useful mode in list */ 857 LOOKUP_CLKDIV2 = 0x0100, /* Allow half clocks */ 858 LOOKUP_OPTIONAL_TOLERANCES = 0x0200 /* Allow missing hsync/vrefresh */ 859} LookupModeFlags; 860 861#define NoDepth24Support 0x00 862#define Support24bppFb 0x01 /* 24bpp framebuffer supported */ 863#define Support32bppFb 0x02 /* 32bpp framebuffer supported */ 864#define SupportConvert24to32 0x04 /* Can convert 24bpp pixmap to 32bpp */ 865#define SupportConvert32to24 0x08 /* Can convert 32bpp pixmap to 24bpp */ 866#define PreferConvert24to32 0x10 /* prefer 24bpp pixmap to 32bpp conv */ 867#define PreferConvert32to24 0x20 /* prefer 32bpp pixmap to 24bpp conv */ 868 869 870/* For DPMS */ 871typedef void (*DPMSSetProcPtr)(ScrnInfoPtr, int, int); 872 873/* Input handler proc */ 874typedef void (*InputHandlerProc)(int fd, pointer data); 875 876/* These are used by xf86GetClocks */ 877#define CLK_REG_SAVE -1 878#define CLK_REG_RESTORE -2 879 880/* 881 * misc constants 882 */ 883#define INTERLACE_REFRESH_WEIGHT 1.5 884#define SYNC_TOLERANCE 0.01 /* 1 percent */ 885#define CLOCK_TOLERANCE 2000 /* Clock matching tolerance (2MHz) */ 886 887 888#define OVERLAY_8_32_DUALFB 0x00000001 889#define OVERLAY_8_24_DUALFB 0x00000002 890#define OVERLAY_8_16_DUALFB 0x00000004 891#define OVERLAY_8_32_PLANAR 0x00000008 892 893/* Values of xf86Info.mouseFlags */ 894#define MF_CLEAR_DTR 1 895#define MF_CLEAR_RTS 2 896 897/* Action Events */ 898typedef enum { 899 ACTION_TERMINATE = 0, /* Terminate Server */ 900 ACTION_NEXT_MODE = 10, /* Switch to next video mode */ 901 ACTION_PREV_MODE, 902 ACTION_SWITCHSCREEN = 100, /* VT switch */ 903 ACTION_SWITCHSCREEN_NEXT, 904 ACTION_SWITCHSCREEN_PREV, 905} ActionEvent; 906 907#endif /* _XF86STR_H */ 908