1*c2c66affSColin Finck /* 2*c2c66affSColin Finck * PROJECT: ReactOS Framebuffer Display Driver 3*c2c66affSColin Finck * LICENSE: Microsoft NT4 DDK Sample Code License 4*c2c66affSColin Finck * FILE: win32ss/drivers/displays/vga_new/driver.h 5*c2c66affSColin Finck * PURPOSE: Main Driver Header File 6*c2c66affSColin Finck * PROGRAMMERS: Copyright (c) 1992-1995 Microsoft Corporation 7*c2c66affSColin Finck * ReactOS Portable Systems Group 8*c2c66affSColin Finck */ 9*c2c66affSColin Finck 10*c2c66affSColin Finck //#define DBG 1 11*c2c66affSColin Finck #include "stddef.h" 12*c2c66affSColin Finck #include <stdarg.h> 13*c2c66affSColin Finck #include "windef.h" 14*c2c66affSColin Finck #include "wingdi.h" 15*c2c66affSColin Finck #include "winddi.h" 16*c2c66affSColin Finck #include "devioctl.h" 17*c2c66affSColin Finck #include "ntddvdeo.h" 18*c2c66affSColin Finck #include "debug.h" 19*c2c66affSColin Finck 20*c2c66affSColin Finck typedef struct _PDEV 21*c2c66affSColin Finck { 22*c2c66affSColin Finck HANDLE hDriver; // Handle to \Device\Screen 23*c2c66affSColin Finck HDEV hdevEng; // Engine's handle to PDEV 24*c2c66affSColin Finck HSURF hsurfEng; // Engine's handle to surface 25*c2c66affSColin Finck HPALETTE hpalDefault; // Handle to the default palette for device. 26*c2c66affSColin Finck PBYTE pjScreen; // This is pointer to base screen address 27*c2c66affSColin Finck ULONG cxScreen; // Visible screen width 28*c2c66affSColin Finck ULONG cyScreen; // Visible screen height 29*c2c66affSColin Finck ULONG ulMode; // Mode the mini-port driver is in. 30*c2c66affSColin Finck LONG lDeltaScreen; // Distance from one scan to the next. 31*c2c66affSColin Finck ULONG cScreenSize; // size of video memory, including 32*c2c66affSColin Finck // offscreen memory. 33*c2c66affSColin Finck PVOID pOffscreenList; // linked list of DCI offscreen surfaces. 34*c2c66affSColin Finck FLONG flRed; // For bitfields device, Red Mask 35*c2c66affSColin Finck FLONG flGreen; // For bitfields device, Green Mask 36*c2c66affSColin Finck FLONG flBlue; // For bitfields device, Blue Mask 37*c2c66affSColin Finck ULONG cPaletteShift; // number of bits the 8-8-8 palette must 38*c2c66affSColin Finck // be shifted by to fit in the hardware 39*c2c66affSColin Finck // palette. 40*c2c66affSColin Finck ULONG ulBitCount; // # of bits per pel 8,16,24,32 are only supported. 41*c2c66affSColin Finck POINTL ptlHotSpot; // adjustment for pointer hot spot 42*c2c66affSColin Finck VIDEO_POINTER_CAPABILITIES PointerCapabilities; // HW pointer abilities 43*c2c66affSColin Finck PVIDEO_POINTER_ATTRIBUTES pPointerAttributes; // hardware pointer attributes 44*c2c66affSColin Finck DWORD cjPointerAttributes; // Size of buffer allocated 45*c2c66affSColin Finck BOOL fHwCursorActive; // Are we currently using the hw cursor 46*c2c66affSColin Finck PALETTEENTRY *pPal; // If this is pal managed, this is the pal 47*c2c66affSColin Finck BOOL bSupportDCI; // Does the miniport support DCI? 48*c2c66affSColin Finck // eVb: 3.1 [DDK Change] - Support new VGA Miniport behavior w.r.t updated framebuffer remapping 49*c2c66affSColin Finck LONG flHooks; 50*c2c66affSColin Finck // eVb: 3.1 [END] 51*c2c66affSColin Finck // eVb: 3.1 [VGARISC Change] - Add new fields for VGA support 52*c2c66affSColin Finck SURFOBJ* pso; 53*c2c66affSColin Finck UCHAR* pjBase; 54*c2c66affSColin Finck // eVb: 3.1 [END] 55*c2c66affSColin Finck } PDEV, *PPDEV; 56*c2c66affSColin Finck 57*c2c66affSColin Finck DWORD getAvailableModes(HANDLE, PVIDEO_MODE_INFORMATION *, DWORD *); 58*c2c66affSColin Finck BOOL bInitPDEV(PPDEV, PDEVMODEW, GDIINFO *, DEVINFO *); 59*c2c66affSColin Finck BOOL bInitSURF(PPDEV, BOOL); 60*c2c66affSColin Finck BOOL bInitPaletteInfo(PPDEV, DEVINFO *); 61*c2c66affSColin Finck BOOL bInitPointer(PPDEV, DEVINFO *); 62*c2c66affSColin Finck BOOL bInit256ColorPalette(PPDEV); 63*c2c66affSColin Finck VOID vDisablePalette(PPDEV); 64*c2c66affSColin Finck VOID vDisableSURF(PPDEV); 65*c2c66affSColin Finck 66*c2c66affSColin Finck #define MAX_CLUT_SIZE (sizeof(VIDEO_CLUT) + (sizeof(ULONG) * 256)) 67*c2c66affSColin Finck 68*c2c66affSColin Finck // 69*c2c66affSColin Finck // Determines the size of the DriverExtra information in the DEVMODE 70*c2c66affSColin Finck // structure passed to and from the display driver. 71*c2c66affSColin Finck // 72*c2c66affSColin Finck 73*c2c66affSColin Finck #define DRIVER_EXTRA_SIZE 0 74*c2c66affSColin Finck 75*c2c66affSColin Finck // eVb: 3.2 [VGARISC Change] - Transform into VGA driver 76*c2c66affSColin Finck #define DLL_NAME L"vga" // Name of the DLL in UNICODE 77*c2c66affSColin Finck #define STANDARD_DEBUG_PREFIX "Vga risc: " // All debug output is prefixed 78*c2c66affSColin Finck #define ALLOC_TAG 'rgvD' // Four byte tag (characters in 79*c2c66affSColin Finck // reverse order) used for memory 80*c2c66affSColin Finck // allocations 81*c2c66affSColin Finck // eVb: 3.2 [END] 82*c2c66affSColin Finck 83*c2c66affSColin Finck // eVb: 3.3 [VGARISC Change] - Add new macros for VGA usage 84*c2c66affSColin Finck // 85*c2c66affSColin Finck // Each pixel in 4BPP being a nibble, the color data for that pixel is thus 86*c2c66affSColin Finck // located at the xth bit within the nibble, where x is the plane number [0-3]. 87*c2c66affSColin Finck // Each nibble being 4 bytes, the color data is thus at the (nibble * 4 + x). 88*c2c66affSColin Finck // That color data is then taken from its linear position and shifted to the 89*c2c66affSColin Finck // correct position within the 16-bit planar buffer word. 90*c2c66affSColin Finck // 91*c2c66affSColin Finck #define VAL(data, px, pl, pos) ((data) >> (((px) * 4) + (pl)) & 1) << (pos) 92*c2c66affSColin Finck 93*c2c66affSColin Finck // 94*c2c66affSColin Finck // This figures out which pixel in the planar word data corresponds to which pixel 95*c2c66affSColin Finck // in the 4BPP linear data. 96*c2c66affSColin Finck // 97*c2c66affSColin Finck #define SET_PLANE_DATA(x, y, a, b) \ 98*c2c66affSColin Finck (x) |= VAL(y, (((-1 + ((((b) % 8) % 2) << 1) - (((b) % 8) + 1) + 8))), a, b) 99*c2c66affSColin Finck 100*c2c66affSColin Finck /* Alignment Macros */ 101*c2c66affSColin Finck #define ALIGN_DOWN_BY(size, align) \ 102*c2c66affSColin Finck ((ULONG_PTR)(size) & ~((ULONG_PTR)(align) - 1)) 103*c2c66affSColin Finck 104*c2c66affSColin Finck #define ALIGN_UP_BY(size, align) \ 105*c2c66affSColin Finck (ALIGN_DOWN_BY(((ULONG_PTR)(size) + align - 1), align)) 106*c2c66affSColin Finck // eVb: 3.3 [END] 107