VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Display/driver.h@ 3394

Last change on this file since 3394 was 3394, checked in by vboxsync, 17 years ago

ddraw updates

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.3 KB
Line 
1/******************************Module*Header*******************************\
2*
3* *******************
4* * GDI SAMPLE CODE *
5* *******************
6*
7* Module Name: driver.h
8*
9* contains prototypes for the frame buffer driver.
10*
11* Copyright (c) 1992-1998 Microsoft Corporation
12\**************************************************************************/
13
14#include "stddef.h"
15#include <stdarg.h>
16#include "windef.h"
17#include "wingdi.h"
18#include "winddi.h"
19#include "devioctl.h"
20#include "ntddvdeo.h"
21#include "debug.h"
22
23#include "../Miniport/vboxioctl.h"
24
25#include <VBox/VBoxVideo.h>
26
27/* Forward declaration. */
28struct _PDEV;
29typedef struct _PDEV PDEV;
30typedef PDEV *PPDEV;
31
32typedef struct _VBOXDISPLAYINFO
33{
34 VBOXVIDEOINFOHDR hdrLink;
35 VBOXVIDEOINFOLINK link;
36 VBOXVIDEOINFOHDR hdrScreen;
37 VBOXVIDEOINFOSCREEN screen;
38 VBOXVIDEOINFOHDR hdrHostEvents;
39 VBOXVIDEOINFOHOSTEVENTS hostEvents;
40 VBOXVIDEOINFOHDR hdrEnd;
41} VBOXDISPLAYINFO;
42
43#include "vbvavrdp.h"
44#include "vrdpbmp.h"
45
46/* Saved screen bits information. */
47typedef struct _SSB
48{
49 ULONG ident; /* 1 based index in the stack = the handle returned by DrvSaveScreenBits (SS_SAVE) */
50 BYTE *pBuffer; /* Buffer where screen bits are saved. */
51} SSB;
52
53struct _PDEV
54{
55 HANDLE hDriver; // Handle to \Device\Screen
56 HDEV hdevEng; // Engine's handle to PDEV
57 HSURF hsurfScreenBitmap; // Engine's handle to VRAM screen bitmap surface
58 SURFOBJ *psoScreenBitmap; // VRAM screen bitmap surface
59 HSURF hsurfScreen; // Engine's handle to VRAM screen device surface
60 ULONG ulBitmapType;
61 HPALETTE hpalDefault; // Handle to the default palette for device.
62 PBYTE pjScreen; // This is pointer to base screen address
63 ULONG cxScreen; // Visible screen width
64 ULONG cyScreen; // Visible screen height
65 POINTL ptlOrg; // Where this display is anchored in
66 // the virtual desktop.
67 POINTL ptlDevOrg; // Device origin for DualView (0,0 for primary view).
68 ULONG ulMode; // Mode the mini-port driver is in.
69 LONG lDeltaScreen; // Distance from one scan to the next.
70 ULONG cScreenSize; // size of video memory, including
71 // offscreen memory.
72 PVOID pOffscreenList; // linked list of DCI offscreen surfaces.
73 FLONG flRed; // For bitfields device, Red Mask
74 FLONG flGreen; // For bitfields device, Green Mask
75 FLONG flBlue; // For bitfields device, Blue Mask
76 ULONG cPaletteShift; // number of bits the 8-8-8 palette must
77 // be shifted by to fit in the hardware
78 // palette.
79 ULONG ulBitCount; // # of bits per pel 8,16,24,32 are only supported.
80 POINTL ptlHotSpot; // adjustment for pointer hot spot
81 VIDEO_POINTER_CAPABILITIES PointerCapabilities; // HW pointer abilities
82 PVIDEO_POINTER_ATTRIBUTES pPointerAttributes; // hardware pointer attributes
83 DWORD cjPointerAttributes; // Size of buffer allocated
84 BOOL fHwCursorActive; // Are we currently using the hw cursor
85 PALETTEENTRY *pPal; // If this is pal managed, this is the pal
86 BOOL bSupportDCI; // Does the miniport support DCI?
87 FLONG flHooks;
88
89 VBVAENABLERESULT vbva;
90 uint32_t u32VRDPResetFlag;
91 BOOL fHwBufferOverflow;
92 VBVARECORD *pRecord;
93 VRDPBC cache;
94
95 ULONG cSSB; // Number of active saved screen bits records in the following array.
96 SSB aSSB[4]; // LIFO type stack for saved screen areas.
97
98 VBOXDISPLAYINFO *pInfo;
99 ULONG iDevice;
100#ifdef VBOX_WITH_DDRAW
101 BOOL bDdExclusiveMode;
102 DWORD dwNewDDSurfaceOffset;
103#endif
104};
105
106/* The global semaphore handle for all driver instances. */
107extern HSEMAPHORE ghsemHwBuffer;
108
109
110DWORD getAvailableModes(HANDLE, PVIDEO_MODE_INFORMATION *, DWORD *);
111BOOL bInitPDEV(PPDEV, PDEVMODEW, GDIINFO *, DEVINFO *);
112BOOL bInitSURF(PPDEV, BOOL);
113BOOL bInitPaletteInfo(PPDEV, DEVINFO *);
114BOOL bInitPointer(PPDEV, DEVINFO *);
115BOOL bInit256ColorPalette(PPDEV);
116BOOL bInitNotificationThread(PPDEV);
117VOID vStopNotificationThread (PPDEV);
118VOID vDisablePalette(PPDEV);
119VOID vDisableSURF(PPDEV);
120
121#define MAX_CLUT_SIZE (sizeof(VIDEO_CLUT) + (sizeof(ULONG) * 256))
122
123//
124// Determines the size of the DriverExtra information in the DEVMODE
125// structure passed to and from the display driver.
126//
127
128#define DRIVER_EXTRA_SIZE 0
129
130#define DLL_NAME L"VBoxDisp" // Name of the DLL in UNICODE
131#define STANDARD_DEBUG_PREFIX "VBOXDISP: " // All debug output is prefixed
132#define ALLOC_TAG 'bvDD' // Four byte tag (characters in
133 // reverse order) used for memory
134 // allocations
135
136// VBOX
137typedef struct _CLIPRECTS {
138 ULONG c;
139 RECTL arcl[64];
140} CLIPRECTS;
141
142
143BOOL vboxVbvaEnable (PPDEV ppdev);
144void vboxVbvaDisable (PPDEV ppdev);
145
146BOOL vboxHwBufferBeginUpdate (PPDEV ppdev);
147void vboxHwBufferEndUpdate (PPDEV ppdev);
148
149BOOL vboxWrite (PPDEV ppdev, const void *pv, uint32_t cb);
150
151BOOL vboxOrderSupported (PPDEV ppdev, unsigned code);
152
153void VBoxProcessDisplayInfo(PPDEV ppdev);
154void VBoxUpdateDisplayInfo (PPDEV ppdev);
155
156void drvLoadEng (void);
157
158BOOL bIsScreenSurface (SURFOBJ *pso);
159
160__inline SURFOBJ *getSurfObj (SURFOBJ *pso)
161{
162 if (pso)
163 {
164 PPDEV ppdev = (PPDEV)pso->dhpdev;
165
166 if (ppdev)
167 {
168 if (bIsScreenSurface(pso))
169 {
170 pso = ppdev->psoScreenBitmap;
171 }
172 }
173 }
174
175 return pso;
176}
177
178#define CONV_SURF(_pso) getSurfObj (_pso)
179
180__inline int format2BytesPerPixel(const SURFOBJ *pso)
181{
182 switch (pso->iBitmapFormat)
183 {
184 case BMF_16BPP: return 2;
185 case BMF_24BPP: return 3;
186 case BMF_32BPP: return 4;
187 }
188
189 return 0;
190}
191
192#include <iprt/assert.h>
193
194#define VBVA_ASSERT(expr) \
195 do { \
196 if (!(expr)) \
197 { \
198 AssertMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
199 AssertMsg2("!!!\n"); \
200 } \
201 } while (0)
202
203#ifdef STAT_sunlover
204extern ULONG gStatCopyBitsOffscreenToScreen;
205extern ULONG gStatCopyBitsScreenToScreen;
206extern ULONG gStatBitBltOffscreenToScreen;
207extern ULONG gStatBitBltScreenToScreen;
208extern ULONG gStatUnchangedOffscreenToScreen;
209extern ULONG gStatUnchangedOffscreenToScreenCRC;
210extern ULONG gStatNonTransientEngineBitmaps;
211extern ULONG gStatTransientEngineBitmaps;
212extern ULONG gStatUnchangedBitmapsCRC;
213extern ULONG gStatUnchangedBitmapsDeviceCRC;
214extern ULONG gStatBitmapsCRC;
215extern ULONG gStatBitBltScreenPattern;
216extern ULONG gStatBitBltScreenSquare;
217extern ULONG gStatBitBltScreenPatternReported;
218extern ULONG gStatBitBltScreenSquareReported;
219extern ULONG gStatCopyBitsScreenSquare;
220
221extern ULONG gStatEnablePDEV;
222extern ULONG gStatCompletePDEV;
223extern ULONG gStatDisablePDEV;
224extern ULONG gStatEnableSurface;
225extern ULONG gStatDisableSurface;
226extern ULONG gStatAssertMode;
227extern ULONG gStatDisableDriver;
228extern ULONG gStatCreateDeviceBitmap;
229extern ULONG gStatDeleteDeviceBitmap;
230extern ULONG gStatDitherColor;
231extern ULONG gStatStrokePath;
232extern ULONG gStatFillPath;
233extern ULONG gStatStrokeAndFillPath;
234extern ULONG gStatPaint;
235extern ULONG gStatBitBlt;
236extern ULONG gStatCopyBits;
237extern ULONG gStatStretchBlt;
238extern ULONG gStatSetPalette;
239extern ULONG gStatTextOut;
240extern ULONG gStatSetPointerShape;
241extern ULONG gStatMovePointer;
242extern ULONG gStatLineTo;
243extern ULONG gStatSynchronize;
244extern ULONG gStatGetModes;
245extern ULONG gStatGradientFill;
246extern ULONG gStatStretchBltROP;
247extern ULONG gStatPlgBlt;
248extern ULONG gStatAlphaBlend;
249extern ULONG gStatTransparentBlt;
250
251void statPrint (void);
252
253#define STATDRVENTRY(a, b) do { if (bIsScreenSurface (b)) gStat##a++; } while (0)
254#define STATPRINT do { statPrint (); } while (0)
255#else
256#define STATDRVENTRY(a, b)
257#define STATPRINT
258#endif /* STAT_sunlover */
Note: See TracBrowser for help on using the repository browser.

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