|
|
1.1 ! root 1: /******************************Module*Header*******************************\ ! 2: * Module Name: driver.h ! 3: * ! 4: * contains prototypes for the frame buffer driver. ! 5: * ! 6: * Copyright (c) 1992 Microsoft Corporation ! 7: \**************************************************************************/ ! 8: ! 9: #include "stddef.h" ! 10: #include "windows.h" ! 11: #include "winddi.h" ! 12: #include "devioctl.h" ! 13: #include "ntddvdeo.h" ! 14: #include "debug.h" ! 15: ! 16: #include "s3mem.h" ! 17: ! 18: // Cursor state flags ! 19: ! 20: #define CURSOR_EXCLUDED 0 // Cursor is not visible ! 21: #define CURSOR_VISIBLE 1 // Cursor is visible ! 22: ! 23: #define CURSOR_DISABLED 0 // No cursor set. ! 24: #define CURSOR_HARDWARE 1 // Cursor is handled in hardware ! 25: #define CURSOR_SOFTWARE 2 // Cursor is handled in software ! 26: ! 27: typedef struct _bank { ! 28: PVOID pvScan0; ! 29: UINT Bank; ! 30: RECTL rclClip; ! 31: } BANK; ! 32: ! 33: typedef BANK *PBANK; ! 34: ! 35: typedef struct { ! 36: BYTE red; ! 37: BYTE green; ! 38: BYTE blue; ! 39: } DACDATA; ! 40: ! 41: typedef DACDATA *PDACDATA; ! 42: ! 43: typedef struct _ClipNode { ! 44: struct _ClipNode *pcnNext; ! 45: RECTL rclClip; ! 46: } CLIPNODE; ! 47: ! 48: typedef CLIPNODE *PCLIPNODE; ! 49: ! 50: typedef struct { ! 51: LONG x; ! 52: LONG y; ! 53: LONG z; ! 54: } XYZPOINTL; ! 55: ! 56: typedef XYZPOINTL *PXYZPOINTL; ! 57: typedef XYZPOINTL XYZPOINT; ! 58: typedef XYZPOINT *PXYZPOINT; ! 59: ! 60: // Brush Stuff. ! 61: ! 62: typedef struct { ! 63: ULONG nSize; ! 64: ULONG iPatternID; ! 65: ULONG iBrushCacheID; ! 66: ULONG iExpansionCacheID; ! 67: ULONG fl; ! 68: ULONG iType; ! 69: ULONG iBitmapFormat; ! 70: ULONG ulForeColor; ! 71: ULONG ulBackColor; ! 72: SIZEL sizlPattern; ! 73: LONG lDeltaPattern; ! 74: BYTE ajPattern[1]; ! 75: } S3BRUSH; ! 76: ! 77: typedef S3BRUSH *PS3BRUSH; ! 78: ! 79: #define MAX_MONO_BRUSH_EXPANSION_SLOTS 8 ! 80: ! 81: // Save Screen Bits Stuff ! 82: ! 83: typedef struct _savedscrnbitshdr { ! 84: struct _savedscrnbits *pssbLink; // Link to next set of bits ! 85: ULONG iUniq; // Unique ID for these bits ! 86: INT x, // Screen x & y coordinates ! 87: y, ! 88: cx, // cx & cy of bit block. ! 89: cy; ! 90: } SAVEDSCRNBITSHDR; ! 91: ! 92: typedef SAVEDSCRNBITSHDR *PSAVEDSCRNBITSHDR; ! 93: ! 94: typedef struct _savedscrnbits { ! 95: SAVEDSCRNBITSHDR ssbh; ! 96: DWORD aBits[1]; ! 97: } SAVEDSCRNBITS; ! 98: ! 99: typedef SAVEDSCRNBITS *PSAVEDSCRNBITS; ! 100: ! 101: // Font & Text stuff ! 102: ! 103: typedef struct _cachedGlyph { ! 104: HGLYPH hg; ! 105: struct _cachedGlyph *pcgCollisionLink; ! 106: ULONG fl; ! 107: POINTL ptlOrigin; ! 108: SIZEL sizlBitmap; ! 109: ULONG BmPitchInPels; ! 110: ULONG BmPitchInBytes; ! 111: XYZPOINTL xyzGlyph; ! 112: } CACHEDGLYPH, *PCACHEDGLYPH; ! 113: ! 114: #define VALID_GLYPH 0x01 ! 115: ! 116: #define END_COLLISIONS 0 ! 117: ! 118: typedef struct _cachedFont { ! 119: struct _cachedFont *pcfNext; ! 120: ULONG iUniq; ! 121: ULONG cGlyphs; ! 122: ULONG cjMaxGlyph1; ! 123: PCACHEDGLYPH pCachedGlyphs; ! 124: } CACHEDFONT, *PCACHEDFONT; ! 125: ! 126: // The Physical Device data structure. ! 127: ! 128: typedef struct _PDEV ! 129: { ! 130: ! 131: // Enhanced mode register addresses. ! 132: ! 133: WORD cur_x, ! 134: cur_y, ! 135: dest_x, ! 136: dest_y, ! 137: axstp, ! 138: diastp, ! 139: rect_width, ! 140: line_max, ! 141: err_term, ! 142: gp_stat, ! 143: cmd, ! 144: short_stroke_reg, ! 145: multifunc_cntl, ! 146: bkgd_color, ! 147: frgd_color, ! 148: bkgd_mix, ! 149: frgd_mix, ! 150: wrt_mask, ! 151: rd_mask, ! 152: pixel_transfer; ! 153: ! 154: // ------------------------------------------------------------------- ! 155: // NOTE: Changes up to here in the PDEV structure must be reflected in ! 156: // i386\strucs.inc (assuming you're on an x86, of course)! ! 157: ! 158: HANDLE hDriver; // Handle to \Device\Screen ! 159: HDEV hdevEng; // Engine's handle to PDEV ! 160: HSURF hsurfEng; // Engine's handle to surface ! 161: HANDLE hsurfBm; // Handle to the "punt" surface ! 162: SURFOBJ *pSurfObj; // pointer to the locked "punt" surface ! 163: SURFOBJ *psoTemp; // pointer to the locked temp "punt" surface ! 164: ! 165: HPALETTE hpalDefault; // Handle to the default palette for device. ! 166: ! 167: PBYTE pjScreen; // This is pointer to base screen address ! 168: ! 169: ULONG cxScreen; // Visible screen width ! 170: ULONG cyScreen; // Visible screen height ! 171: ULONG cxMaxRam; // Width of Video RAM ! 172: ULONG cyMaxRam; // Height of Video RAM ! 173: ULONG ulMode; // Mode the mini-port driver is in. ! 174: LONG lDeltaScreen; // Distance from one scan to the next. ! 175: ! 176: PUCHAR pucCsrBase; // pointer to port 0, mapped into our address space ! 177: // USED FOR PORTING purposes ! 178: ! 179: FLONG flRed; // For bitfields device, Red Mask ! 180: FLONG flGreen; // For bitfields device, Green Mask ! 181: FLONG flBlue; // For bitfields device, Blue Mask ! 182: ULONG ulBitCount; // # of bits per pel 8,16,32 are only supported. ! 183: ! 184: POINTL ptlHotSpot; // Pointer hot spot ! 185: SIZEL szlPointer; // Extent of the pointer ! 186: POINTL ptlLastPosition; // Last position of pointer ! 187: ULONG flPointer; // Pointer specific flags. ! 188: BYTE CrtcIndex; // Crtc Index Value. ! 189: WORD MonoPointerData; // Index to Mono Pointer Data ! 190: ! 191: ULONG cPatterns; // Count of bitmap patterns created ! 192: HBITMAP ahbmPat[HS_DDI_MAX]; // Engine handles to standard patterns ! 193: ! 194: GDIINFO *pGdiInfo; // Pointer to temporary buffer for GDIINFO struct ! 195: DEVINFO *pDevInfo; // Pointer to temporary buffer for DEVINFO struct ! 196: PALETTEENTRY *pPal; // If this is pal managed, this is the pal ! 197: ! 198: // Off Screen Save Stuff. ! 199: ! 200: PWORD pOffScreenSaveBuffer; // Pointer to the Off Screen Save Buffer ! 201: PDACDATA pDacDataSaveBuffer; // Pointer to the Dac Data Save Buffer ! 202: ! 203: // Bank Manager Stuff ! 204: ! 205: INT MaxBanks, // Max number of banks for driver instance ! 206: BankSize, // size of each bank in bytes ! 207: ScansPerBank; // Number of scans per bank ! 208: ! 209: PRECT prclBanks; // defines S3-911's banks. ! 210: PBANK pBanks; // Bank control structures ! 211: UINT cBanks, // Number of banks to enumerate ! 212: iBank; // Bank currently enumerated ! 213: ! 214: PVOID pvOrgScan0; // Original pvScan0 ! 215: ! 216: RECTL rclOrgBounds; // Clip Object's original bounds ! 217: BYTE iOrgDComplexity; // Clip Object's original complexity ! 218: BYTE fjOptions; // Clip Object's original flags. ! 219: ! 220: BYTE jS3R5; // S3's S3R5 (need to preserve high bits) ! 221: ! 222: // Clip Acceleration Stuff ! 223: ! 224: PCLIPNODE pcnClipNodeRoot; // Clip Node List Root ! 225: PCLIPNODE pcnFirstClip; // First clip node in Y ! 226: PCLIPNODE pcnLastClip; // Last clip node in Y ! 227: ! 228: INT nClipNodes; // Number of Clip nodes. ! 229: ! 230: // Font Stuff ! 231: ! 232: BYTE ajGlyphAllocBitVector[CACHED_GLYPHS_ROWS][GLYPHS_PER_ROW]; ! 233: ! 234: // Strip drawing (long lines) stuff ! 235: ! 236: BYTE iFormat; // BMF_*, BMF_PHYSDEVICE ! 237: SIZE_T lNextScan; // Offset from scan n to n+1 ! 238: ! 239: // Clipping optimization stuff ! 240: ! 241: LONG ClipTop; // S3 clip states. ! 242: LONG ClipLeft; ! 243: LONG ClipRight; ! 244: LONG ClipBottom; ! 245: ! 246: // Default clip object ! 247: ! 248: CLIPOBJ *pcoDefault, // ptr to a default clip obj ! 249: *pcoFullRam; // Clip Object for the full RAM ! 250: ! 251: DDAOBJ *pdda; // DDA Oject used by traps ! 252: ! 253: // Registers shadows for the 911 ! 254: ! 255: WORD ForegroundMix, ! 256: BackgroundMix, ! 257: ForegroundColor, ! 258: BackgroundColor, ! 259: WriteMask, ! 260: ReadMask; ! 261: ! 262: // Brush optimization stuff ! 263: ! 264: ULONG gBrushUnique; // Unique Brush ID source. ! 265: INT iMaxCachedColorBrushes, ! 266: iNextColorBrushCacheSlot; ! 267: PULONG pulColorBrushCacheEntries; ! 268: ULONG ulColorExpansionCacheTag; ! 269: ! 270: INT iMaxCachedMonoBrushes, ! 271: iNextMonoBrushCacheSlot, ! 272: iNextMonoBrushExpansionSlot; ! 273: PULONG pulMonoBrushCacheEntries; ! 274: ULONG aulMonoExpansionCacheTag[MAX_MONO_BRUSH_EXPANSION_SLOTS]; ! 275: ! 276: // Host to Source copy optimization stuff. ! 277: ! 278: HSURF hsurfCachedBitmap; ! 279: ULONG iUniqCachedBitmap; ! 280: ULONG iUniqXlate; ! 281: ! 282: // 801/805/928 bank control stuff. ! 283: ! 284: WORD SysCnfg, // System Config register ! 285: LawCtl; // Linear Address Window Control register ! 286: BYTE ExtSysCtl2; // Extended System Control 2 Register ! 287: ! 288: // 928 / Bt485 control stuff; ! 289: ! 290: WORD ExtDacCtl; // Exteneded DAC control. ! 291: BYTE Bt485CmdReg0, // Bt485 Command Reg 0 ! 292: Bt485CmdReg1, // Bt485 Command Reg 1 ! 293: Bt485CmdReg2, // Bt485 Command Reg 2 ! 294: Bt485CmdReg3; // Bt485 Command Reg 3 ! 295: ! 296: BYTE s3ChipID; ! 297: BOOL bBt485Dac; // True if Bt485 is present. ! 298: BOOL bNewBankControl; ! 299: ! 300: // Pointer (Hardware Cursor Control) shadows. ! 301: ! 302: WORD HgcMode; // Hgc Register. ! 303: ! 304: // Save Screen Bits stuff. ! 305: ! 306: INT iUniqeSaveScreenBits; ! 307: ! 308: SAVEDSCRNBITSHDR SavedScreenBitsHeader; ! 309: ! 310: } PDEV, *PPDEV; ! 311: ! 312: ! 313: ! 314: #define BMF_PHYSDEVICE 0xff ! 315: ! 316: #define VALID_SAVE_BUFFER 0x1 ! 317: #define COLOR_POINTER 0x2 ! 318: #define TAKE_DOWN_POINTER 0X4 ! 319: #define ANIMATEUPDATE 0X8 ! 320: ! 321: BOOL bInitPDEV(PPDEV,PDEVMODEW); ! 322: BOOL bInitSURF(PPDEV,BOOL); ! 323: BOOL bInitPaletteInfo(PPDEV); ! 324: BOOL bInitPointer(PPDEV); ! 325: BOOL bInit256ColorPalette(PPDEV); ! 326: BOOL bInitPatterns(PPDEV, INT); ! 327: VOID vDisablePalette(PPDEV); ! 328: VOID vDisablePatterns(PPDEV); ! 329: VOID vDisableSURF(PPDEV); ! 330: DWORD getAvailableModes(HANDLE, PVIDEO_MODE_INFORMATION *, DWORD *); ! 331: ! 332: ! 333: // Blt punt stuff ! 334: ! 335: VOID vPuntGetBits(PPDEV ppdev, SURFOBJ *psoTrg, RECTL *prclTrg); ! 336: VOID vPuntPutBits(PPDEV ppdev, SURFOBJ *psoTrg, RECTL *prclTrg); ! 337: ! 338: ! 339: // Bank Manager Stuff ! 340: ! 341: BOOL bBankInit(PPDEV ppdev, BOOL fFirstTime); ! 342: BOOL bBankEnumStart(PPDEV ppdev, PRECTL prclScans, SURFOBJ *pso, CLIPOBJ *pco); ! 343: BOOL bSrcBankEnumStart(PPDEV ppdev, PRECTL prclScans, SURFOBJ *pso, CLIPOBJ *pco, RECTL *prclDest); ! 344: BOOL bBankEnum(PPDEV ppdev, PRECTL prclScans, SURFOBJ *pso, CLIPOBJ *pco); ! 345: BOOL bBankEnumEnd(PPDEV ppdev, SURFOBJ *pso, CLIPOBJ *pco); ! 346: ! 347: ! 348: // Pointer function prototypes ! 349: ! 350: VOID vMoveHardwarePointer(SURFOBJ *,LONG,LONG); ! 351: BOOL bSetHardwarePointerShape(SURFOBJ *,SURFOBJ *,SURFOBJ *, XLATEOBJ *, ! 352: LONG, LONG, LONG, LONG, FLONG); ! 353: ! 354: #define MAX_CLUT_SIZE (sizeof(VIDEO_CLUT) + (sizeof(ULONG) * 256)) ! 355: ! 356: // Size of the DrierExtra information in the DEVMODE structure for the S3 ! 357: ! 358: #define DRIVER_EXTRA_SIZE 0 ! 359: ! 360: #include "s3.h"
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.