ReactOS 0.4.15-dev-7918-g2a2556c
vgaddi.h
Go to the documentation of this file.
1#ifndef _VGADDI_PCH_
2#define _VGADDI_PCH_
3
4#define _WINBASE_
5#define _WINDOWS_H
6#include <stdarg.h>
7#include <windef.h>
8#include <wingdi.h>
9#include <winddi.h>
10#include <winioctl.h>
11#include <ntddvdeo.h>
12#include <ioaccess.h>
13
14#include "vgavideo/vgavideo.h"
15
16#ifndef NDEBUG
17#define DPRINT DbgPrint
18#else
19#define DPRINT
20#endif
21#define DPRINT1 DbgPrint
22
23/* FIXME - what a headers mess.... */
24
25#define DDKFASTAPI __fastcall
26#define FASTCALL __fastcall
27
29
30static __inline BOOLEAN
33{
34 PLIST_ENTRY OldFlink;
35 PLIST_ENTRY OldBlink;
36
37 OldFlink = Entry->Flink;
38 OldBlink = Entry->Blink;
39 OldFlink->Blink = OldBlink;
40 OldBlink->Flink = OldFlink;
41 return (OldFlink == OldBlink);
42}
43
44static __inline VOID
46 IN PLIST_ENTRY ListHead,
48{
49 PLIST_ENTRY OldFlink;
50 OldFlink = ListHead->Flink;
51 Entry->Flink = OldFlink;
52 Entry->Blink = ListHead;
53 OldFlink->Blink = Entry;
54 ListHead->Flink = Entry;
55}
56
57static __inline VOID
59 IN PLIST_ENTRY ListHead)
60{
61 ListHead->Flink = ListHead->Blink = ListHead;
62}
63
64/***********************************************************/
65
66#define DS_SOLIDBRUSH 0x00000001
67#define DS_GREYBRUSH 0x00000002
68#define DS_BRUSH 0x00000004
69#define DS_DIB 0x00000008
70
71#define POW2(stride) (!((stride) & ((stride)-1))) // TRUE if stride is power of 2
72#define BROKEN_RASTERS(stride,cy) ((!(POW2(stride))) && ((stride*cy) > 0x10000))
73
74#define ENUM_RECT_LIMIT 50
75
76typedef struct _RECT_ENUM
77{
81
82// Cursor coordinates
83typedef struct _XYPAIR
84{
88
89typedef struct _SAVED_SCREEN_BITS
90{
96
97// Cursor states
98#define CURSOR_COLOR 0x00000004
99#define CURSOR_HW 0x00000010
100#define CURSOR_HW_ACTIVE 0x00000020
101#define CURSOR_ANIMATE 0x00000040
102
103typedef struct _PDEV
104{
105 ULONG fl; // driver flags
106
107 // Handles
109 HDEV GDIDevHandle; // engine's handle to PDEV
110 HSURF SurfHandle; // engine's handle to surface
111 PVOID AssociatedSurf; // associated surface
112
113 // Cursor
114 XYPAIR xyHotSpot; // cursor hotspot
115
116 // Pointer
119 ULONG XorMaskStartOffset; // Start offset of hardware pointer
120 // XOR mask relative to AND mask for
121 // passing to HW pointer
122 DWORD PointerAttributes; // Size of buffer allocated
123 DWORD flPreallocSSBBufferInUse; // True if preallocated saved screen
124 // bits buffer is in use
125 PUCHAR pjPreallocSSBBuffer; // Pointer to preallocated saved screen
126 // bits buffer, if there is one
127 ULONG ulPreallocSSBSize; // Size of preallocated saved screen
128 // bits buffer
130 PUCHAR pucDIB4ToVGAConvBuffer; // DIB4->VGA conversion table buffer
131 PUCHAR pucDIB4ToVGAConvTables; // Pointer to DIB4->VGA conversion
132
133 // Misc
134 ULONG ModeNum; // mode index for current VGA mode
135
136 SIZEL sizeSurf; // displayed size of the surface
137 PBYTE fbScreen; // pointer to the frame buffer
138 RECTL SavedBitsRight; // invisible part right of screen
139 RECTL SavedBitsBottom; // invisible part at the bottom of the screen
140 BOOL BitsSaved; // TRUE if bits are currently saved
141 SIZEL sizeMem; // actual size (in pixels) of video memory
142 LONG NumScansUsedByPointer; // # scans of offscreen memory used by
143
145
146typedef struct {
147 RECTL BankBounds; // Pixels addressable in this bank
148 ULONG BankOffset; // Offset of bank start from bitmap start if linearly addressable
150
151typedef enum {
154} BANK_JUST;
155
156// bank control function vector
157//typedef VOID (*PFN_BankControl)(PDEVSURF, ULONG, BANK_JUST);
159
160// DEVSURF -- definition of a surface as seen and used by the various VGA
161// drivers
162
163typedef struct _DEVSURF
164{
165 IDENT ident; // Identifier for debugging ease
166 ULONG flSurf; // DS_ flags as defined below
167 BYTE Color; // Solid color surface if DS_SOLIDBRUSH
168
169// If DS_SOLIDBRUSH, the following fields are undefined and not guaranteed to
170// have been allocated!
171
172 BYTE Format; // BMF_*, BMF_PHYSDEVICE
173 BYTE jReserved1; // Reserved
174 BYTE jReserved2; // Reserved
175 PPDEV ppdev; // Pointer to associated PDEV
176 SIZEL sizeSurf; // Size of the surface
177 ULONG NextScan; // Offset from scan "n" to "n+1"
178 ULONG NextPlane; // Offset from plane "n" to "n+1"
179 PVOID Scan0; // Pointer to scan 0 of bitmap
180 // (actual address of start of bank, for banked VGA surface)
181 PVOID StartBmp; // Pointer to start of bitmap
182 PVOID Conv; // Pointer to DIB/Planer conversion buffer
183
184// Banking variables; used only for banked VGA surfaces
185
187 ULONG Bank2RWSkip; // Offset from one bank index to next to make two 32K banks appear to be
188 // one seamless 64K bank
191 ULONG BitmapSize; // Length of bitmap if there were no banking, in CPU addressable bytes
192 ULONG PtrBankScan; // Last scan line in pointer work bank
193 RECTL WindowClip1; // Single-window banking clip rect
194 RECTL WindowClip2[2]; // Double-window banking clip rects for
195 // windows 0 & 1
196 ULONG WindowBank[2]; // Current banks mapped into windows
197 // 0 & 1 (used in 2 window mode only)
198 PBANK_INFO BankInfo; // Pointer to array of bank clip info
199 ULONG BankInfoLength; // Length of pbiBankInfo, in entries
200 PBANK_INFO BankInfo2RW; // Same as above, but for 2RW window
202 PFN_BankControl pfnBankControl; // Pointer to bank control function
203 PFN_BankControl pfnBankControl2Window; // Pointer to double-window bank
204 // control function
205 PVOID BitmapStart; // Single-window bitmap start pointer (adjusted as
206 // necessary to make window map in at proper offset)
207 PVOID BitmapStart2Window[2]; // Double-window window 0 and 1 bitmap start
208 PVOID BankBufferPlane0; // Pointer to temp buffer capable of
209 // storing one full bank for plane 0 for 1
210 // R/W case; capable of storing one full
211 // bank height of edge bytes for all four
212 // planes for the 1R/1W case. Also used to
213 // point to text building buffer in all
214 // cases. This is the pointer used to
215 // dealloc bank working storage for all
216 // four planes
217
218 // The following 3 pointers used by 1 R/W banked devices
219 PVOID BankBufferPlane1; // Like above, but for plane 1
220 PVOID BankBufferPlane2; // Like above, but for plane 2
221 PVOID BankBufferPlane3; // Like above, but for plane 3
222 ULONG TempBufferSize; // Full size of temp buffer pointed to
223 // by pvBankBufferPlane0
224
225 ULONG ajBits[1]; // Bits will start here for device bitmaps
226 PSAVED_SCREEN_BITS ssbList; // Pointer to start of linked list of
227 // saved screen bit blocks
229
231
232// BMF_PHYSDEVICE format type
233
234#define BMF_PHYSDEVICE 0xFF
235#define BMF_DFB 0xFE
236
237// Identifiers used in debugging (DEVSURF.ident)
238
239#define PDEV_IDENT ('V' + ('P' << 8) + ('D' << 16) + ('V' << 24))
240#define DEVSURF_IDENT ('V' + ('S' << 8) + ('R' << 16) + ('F' << 24))
241
242BOOL InitVGA(PPDEV ppdev, BOOL bFirst); // screen.c: initialize VGA mode
243BOOL DeinitVGA(PPDEV ppdev); // screen.c: Free resources allocated in InitVGA
244
245#define DRIVER_EXTRA_SIZE 0
246#define ALLOC_TAG 'agvD' // Dvga tag
247#define DLL_NAME L"vga" // DLL name in Unicode
248
249#define MAX_SCAN_WIDTH 2048 // pixels
250#define DRIVER_OFFSCREEN_REFRESHED 0x04L // if not set, don't use offscreen memory
251#define PLANAR_PELS_PER_CPU_ADDRESS 8
252#define PACKED_PELS_PER_CPU_ADDRESS 2
253
255 SURFOBJ *Dest, SURFOBJ *Source, SURFOBJ *Mask, XLATEOBJ *ColorTranslation,
256 RECTL *DestRect, POINTL *SourcePoint);
257
258VOID
260 ULONG DestY,
262 ULONG SizeX,
263 ULONG SizeY);
264VOID
266 ULONG SourceX,
267 ULONG SourceY,
268 ULONG SizeX,
269 ULONG SizeY);
270VOID
274VOID
276
277BOOL InitPointer(PPDEV ppdev);
279 PVIDEO_MODE_INFORMATION *modeInformation,
280 DWORD *ModeSize);
281
283vgaReadScan(int x, int y, int w, void *b);
284
286vgaWriteScan(int x, int y, int w, void *b);
287
288#endif /* _VGADDI_PCH_ */
unsigned char BOOLEAN
#define VOID
Definition: acefi.h:82
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertHeadList(ListHead, Entry)
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned int Mask
Definition: fpcontrol.c:82
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define DbgPrint
Definition: hal.h:12
#define ENUM_RECT_LIMIT
Definition: inteng.h:5
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
CONST CHAR * PCCH
Definition: ntbasedef.h:392
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
enum _VIDEO_BANK_TYPE VIDEO_BANK_TYPE
BYTE * PBYTE
Definition: pedump.c:66
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
#define INT
Definition: polytest.cpp:20
struct RECTL * PRECTL
ULONG BankOffset
Definition: vgaddi.h:148
RECTL BankBounds
Definition: vgaddi.h:147
base of all file and directory entries
Definition: entries.h:83
ULONG TempBufferSize
Definition: vgaddi.h:222
PVOID BankBufferPlane3
Definition: vgaddi.h:221
BYTE jReserved2
Definition: vgaddi.h:174
ULONG BitmapSize
Definition: vgaddi.h:191
ULONG NextScan
Definition: vgaddi.h:177
PBANK_INFO BankInfo
Definition: vgaddi.h:198
RECTL WindowClip2[2]
Definition: vgaddi.h:194
PBANK_INFO BankInfo2RW
Definition: vgaddi.h:200
PPDEV ppdev
Definition: vgaddi.h:175
ULONG Bank2RWSkip
Definition: vgaddi.h:187
ULONG PtrBankScan
Definition: vgaddi.h:192
RECTL WindowClip1
Definition: vgaddi.h:193
BYTE Color
Definition: vgaddi.h:167
PVOID BankBufferPlane2
Definition: vgaddi.h:220
PVOID BankBufferPlane0
Definition: vgaddi.h:208
PVOID StartBmp
Definition: vgaddi.h:181
PSAVED_SCREEN_BITS ssbList
Definition: vgaddi.h:226
PVOID BitmapStart
Definition: vgaddi.h:205
PVOID BitmapStart2Window[2]
Definition: vgaddi.h:207
PVOID Scan0
Definition: vgaddi.h:179
PVOID BankBufferPlane1
Definition: vgaddi.h:219
ULONG NextPlane
Definition: vgaddi.h:178
ULONG WindowBank[2]
Definition: vgaddi.h:196
VIDEO_BANK_TYPE BankingType
Definition: vgaddi.h:190
PVIDEO_BANK_SELECT BankSelectInfo
Definition: vgaddi.h:186
BYTE Format
Definition: vgaddi.h:172
PFN_BankControl pfnBankControl2Window
Definition: vgaddi.h:203
ULONG BankInfoLength
Definition: vgaddi.h:199
PVOID Conv
Definition: vgaddi.h:182
ULONG ajBits[1]
Definition: vgaddi.h:225
SIZEL sizeSurf
Definition: vgaddi.h:176
ULONG BankInfo2RWLength
Definition: vgaddi.h:201
PFN_BankControl pfnBankControl
Definition: vgaddi.h:202
BYTE jReserved1
Definition: vgaddi.h:173
ULONG flSurf
Definition: vgaddi.h:166
PFN pfnBankSwitchCode
Definition: vgaddi.h:189
IDENT ident
Definition: vgaddi.h:165
Definition: typedefs.h:120
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: framebuf.h:34
VIDEO_POINTER_CAPABILITIES PointerCapabilities
Definition: vgaddi.h:129
ULONG XorMaskStartOffset
Definition: vgaddi.h:119
SIZEL sizeSurf
Definition: vgaddi.h:136
LONG NumScansUsedByPointer
Definition: vgaddi.h:142
HDEV GDIDevHandle
Definition: vgaddi.h:109
PBYTE fbScreen
Definition: vgaddi.h:137
PVIDEO_POINTER_ATTRIBUTES pPointerAttributes
Definition: vgaddi.h:117
ULONG ModeNum
Definition: vgaddi.h:134
RECTL SavedBitsRight
Definition: vgaddi.h:138
SIZEL sizeMem
Definition: vgaddi.h:141
PUCHAR pucDIB4ToVGAConvBuffer
Definition: vgaddi.h:130
PUCHAR pjPreallocSSBBuffer
Definition: vgaddi.h:125
PUCHAR pucDIB4ToVGAConvTables
Definition: vgaddi.h:131
PVOID AssociatedSurf
Definition: vgaddi.h:111
HSURF SurfHandle
Definition: vgaddi.h:110
BOOL BitsSaved
Definition: vgaddi.h:140
ULONG ulPreallocSSBSize
Definition: vgaddi.h:127
HANDLE KMDriver
Definition: vgaddi.h:108
ULONG fl
Definition: vgaddi.h:105
DWORD flPreallocSSBBufferInUse
Definition: vgaddi.h:123
PSAVED_SCREEN_BITS ImageBehindCursor
Definition: vgaddi.h:118
DWORD PointerAttributes
Definition: vgaddi.h:122
XYPAIR xyHotSpot
Definition: vgaddi.h:114
RECTL SavedBitsBottom
Definition: vgaddi.h:139
ULONG c
Definition: vgaddi.h:78
RECTL arcl[ENUM_RECT_LIMIT]
Definition: vgaddi.h:79
LIST_ENTRY ListEntry
Definition: vgaddi.h:94
Definition: vgaddi.h:84
USHORT x
Definition: vgaddi.h:85
USHORT y
Definition: vgaddi.h:86
void * PVOID
Definition: typedefs.h:50
#define IN
Definition: typedefs.h:39
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
@ Start
Definition: partlist.h:33
struct _PDEV PDEV
VOID FASTCALL vgaReadScan(int x, int y, int w, void *b)
Definition: vgavideo.c:579
BOOL InitPointer(PPDEV ppdev)
Definition: pointer.c:143
VOID(* PFN_ScreenToScreenBlt)(PDEVSURF, PRECTL, PPOINTL, INT)
Definition: vgaddi.h:230
BANK_JUST
Definition: vgaddi.h:151
@ JustifyBottom
Definition: vgaddi.h:153
@ JustifyTop
Definition: vgaddi.h:152
struct _RECT_ENUM RECT_ENUM
struct _DEVSURF DEVSURF
PSAVED_SCREEN_BITS VGADDI_AllocSavedScreenBits(ULONG Size)
Definition: offscreen.c:121
VOID VGADDI_FreeSavedScreenBits(PSAVED_SCREEN_BITS SavedBits)
Definition: offscreen.c:87
struct BANK_INFO * PBANK_INFO
struct _SAVED_SCREEN_BITS * PSAVED_SCREEN_BITS
#define FASTCALL
Definition: vgaddi.h:26
struct _SAVED_SCREEN_BITS SAVED_SCREEN_BITS
struct _XYPAIR XYPAIR
struct _PDEV * PPDEV
VOID(* PFN_BankControl)(PVOID, ULONG, BANK_JUST)
Definition: vgaddi.h:158
VOID VGADDI_InitializeOffScreenMem(ULONG Start, ULONG Length)
VOID VGADDI_BltFromSavedScreenBits(ULONG DestX, ULONG DestY, PSAVED_SCREEN_BITS Src, ULONG SizeX, ULONG SizeY)
struct _DEVSURF * PDEVSURF
VOID FASTCALL vgaWriteScan(int x, int y, int w, void *b)
Definition: vgavideo.c:655
DWORD getAvailableModes(HANDLE Driver, PVIDEO_MODE_INFORMATION *modeInformation, DWORD *ModeSize)
Definition: screen.c:651
BOOL InitVGA(PPDEV ppdev, BOOL bFirst)
Definition: screen.c:134
VOID VGADDI_BltToSavedScreenBits(PSAVED_SCREEN_BITS Dest, ULONG SourceX, ULONG SourceY, ULONG SizeX, ULONG SizeY)
BOOL DeinitVGA(PPDEV ppdev)
Definition: screen.c:112
BOOL VGAtoGDI(SURFOBJ *Dest, SURFOBJ *Source, SURFOBJ *Mask, XLATEOBJ *ColorTranslation, RECTL *DestRect, POINTL *SourcePoint)
_Must_inspect_result_ _In_ WDFDRIVER Driver
Definition: wdfcontrol.h:83
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
LONG_PTR(APIENTRY * PFN)()
Definition: winddi.h:133
ULONG IDENT
Definition: winddi.h:119
typedef HSURF(APIENTRY FN_DrvEnableSurface)(_In_ DHPDEV dhpdev)
struct _POINTL * PPOINTL
unsigned char BYTE
Definition: xxhash.c:193