1 | /******************************Module*Header*******************************\
|
---|
2 | *
|
---|
3 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
4 | *
|
---|
5 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
6 | * available from http://www.virtualbox.org. This file is free software;
|
---|
7 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
8 | * General Public License (GPL) as published by the Free Software
|
---|
9 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
10 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
11 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
12 | *
|
---|
13 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
14 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
15 | * additional information or have any questions.
|
---|
16 | */
|
---|
17 | /*
|
---|
18 | * Based in part on Microsoft DDK sample code
|
---|
19 | *
|
---|
20 | * *******************
|
---|
21 | * * GDI SAMPLE CODE *
|
---|
22 | * *******************
|
---|
23 | *
|
---|
24 | * Module Name: driver.h
|
---|
25 | *
|
---|
26 | * contains prototypes for the frame buffer driver.
|
---|
27 | *
|
---|
28 | * Copyright (c) 1992-1998 Microsoft Corporation
|
---|
29 | \**************************************************************************/
|
---|
30 |
|
---|
31 | #include "stddef.h"
|
---|
32 | #include <stdarg.h>
|
---|
33 | #include "windef.h"
|
---|
34 | #include "wingdi.h"
|
---|
35 | #include "winddi.h"
|
---|
36 | #include "devioctl.h"
|
---|
37 | #include "ntddvdeo.h"
|
---|
38 | #include "debug.h"
|
---|
39 |
|
---|
40 | #include "../Miniport/vboxioctl.h"
|
---|
41 |
|
---|
42 | #include <VBox/VBoxVideo.h>
|
---|
43 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
44 | #include <iprt/asm.h>
|
---|
45 | #endif
|
---|
46 |
|
---|
47 | /* Forward declaration. */
|
---|
48 | struct _PDEV;
|
---|
49 | typedef struct _PDEV PDEV;
|
---|
50 | typedef PDEV *PPDEV;
|
---|
51 |
|
---|
52 | typedef struct _VBOXDISPLAYINFO
|
---|
53 | {
|
---|
54 | VBOXVIDEOINFOHDR hdrLink;
|
---|
55 | VBOXVIDEOINFOLINK link;
|
---|
56 | VBOXVIDEOINFOHDR hdrScreen;
|
---|
57 | VBOXVIDEOINFOSCREEN screen;
|
---|
58 | VBOXVIDEOINFOHDR hdrHostEvents;
|
---|
59 | VBOXVIDEOINFOHOSTEVENTS hostEvents;
|
---|
60 | VBOXVIDEOINFOHDR hdrEnd;
|
---|
61 | } VBOXDISPLAYINFO;
|
---|
62 |
|
---|
63 | #include "vbvavrdp.h"
|
---|
64 | #include "vrdpbmp.h"
|
---|
65 |
|
---|
66 | /* Saved screen bits information. */
|
---|
67 | typedef struct _SSB
|
---|
68 | {
|
---|
69 | ULONG ident; /* 1 based index in the stack = the handle returned by DrvSaveScreenBits (SS_SAVE) */
|
---|
70 | BYTE *pBuffer; /* Buffer where screen bits are saved. */
|
---|
71 | } SSB;
|
---|
72 |
|
---|
73 | /* VRAM
|
---|
74 | * | | | | |
|
---|
75 | * 0+framebuffer+ddraw heap+VBVA buffer+displayinfo=cScreenSize
|
---|
76 | */
|
---|
77 | typedef struct _VRAMLAYOUT
|
---|
78 | {
|
---|
79 | ULONG cbVRAM;
|
---|
80 |
|
---|
81 | ULONG offFrameBuffer;
|
---|
82 | ULONG cbFrameBuffer;
|
---|
83 |
|
---|
84 | ULONG offDDRAWHeap; //@todo
|
---|
85 | ULONG cbDDRAWHeap;
|
---|
86 |
|
---|
87 | ULONG offVBVABuffer;
|
---|
88 | ULONG cbVBVABuffer;
|
---|
89 |
|
---|
90 | ULONG offDisplayInformation;
|
---|
91 | ULONG cbDisplayInformation;
|
---|
92 | } VRAMLAYOUT;
|
---|
93 |
|
---|
94 | typedef struct
|
---|
95 | {
|
---|
96 | PPDEV ppdev;
|
---|
97 | } VBOXSURF, *PVBOXSURF;
|
---|
98 |
|
---|
99 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
100 | typedef struct _VBOXVHWAREGION
|
---|
101 | {
|
---|
102 | RECTL Rect;
|
---|
103 | bool bValid;
|
---|
104 | }VBOXVHWAREGION, *PVBOXVHWAREGION;
|
---|
105 |
|
---|
106 | typedef struct _VBOXVHWASURFDESC
|
---|
107 | {
|
---|
108 | VBOXVHWA_SURFHANDLE hHostHandle;
|
---|
109 | volatile uint32_t cPendingBltsSrc;
|
---|
110 | volatile uint32_t cPendingBltsDst;
|
---|
111 | volatile uint32_t cPendingFlipsCurr;
|
---|
112 | volatile uint32_t cPendingFlipsTarg;
|
---|
113 | #ifdef DEBUG
|
---|
114 | volatile uint32_t cFlipsCurr;
|
---|
115 | volatile uint32_t cFlipsTarg;
|
---|
116 | #endif
|
---|
117 | // uint32_t cBitsPerPixel;
|
---|
118 | bool bVisible;
|
---|
119 | VBOXVHWAREGION UpdatedMemRegion;
|
---|
120 | VBOXVHWAREGION NonupdatedMemRegion;
|
---|
121 | }VBOXVHWASURFDESC, *PVBOXVHWASURFDESC;
|
---|
122 |
|
---|
123 | typedef struct _VBOXVHWAINFO
|
---|
124 | {
|
---|
125 | uint32_t caps;
|
---|
126 | uint32_t caps2;
|
---|
127 | uint32_t colorKeyCaps;
|
---|
128 | uint32_t stretchCaps;
|
---|
129 | uint32_t surfaceCaps;
|
---|
130 | uint32_t numOverlays;
|
---|
131 | uint32_t numFourCC;
|
---|
132 | HGSMIOFFSET FourCC;
|
---|
133 | BOOLEAN bVHWAEnabled;
|
---|
134 | } VBOXVHWAINFO;
|
---|
135 | #endif
|
---|
136 |
|
---|
137 | struct _PDEV
|
---|
138 | {
|
---|
139 | HANDLE hDriver; // Handle to \Device\Screen
|
---|
140 | HDEV hdevEng; // Engine's handle to PDEV
|
---|
141 | HSURF hsurfScreenBitmap; // Engine's handle to VRAM screen bitmap surface
|
---|
142 | SURFOBJ *psoScreenBitmap; // VRAM screen bitmap surface
|
---|
143 | HSURF hsurfScreen; // Engine's handle to VRAM screen device surface
|
---|
144 | ULONG ulBitmapType;
|
---|
145 | HPALETTE hpalDefault; // Handle to the default palette for device.
|
---|
146 | PBYTE pjScreen; // This is pointer to base screen address
|
---|
147 | ULONG cxScreen; // Visible screen width
|
---|
148 | ULONG cyScreen; // Visible screen height
|
---|
149 | POINTL ptlOrg; // Where this display is anchored in
|
---|
150 | // the virtual desktop.
|
---|
151 | POINTL ptlDevOrg; // Device origin for DualView (0,0 for primary view).
|
---|
152 | ULONG ulMode; // Mode the mini-port driver is in.
|
---|
153 | LONG lDeltaScreen; // Distance from one scan to the next.
|
---|
154 |
|
---|
155 | PVOID pOffscreenList; // linked list of DCI offscreen surfaces.
|
---|
156 | FLONG flRed; // For bitfields device, Red Mask
|
---|
157 | FLONG flGreen; // For bitfields device, Green Mask
|
---|
158 | FLONG flBlue; // For bitfields device, Blue Mask
|
---|
159 | ULONG cPaletteShift; // number of bits the 8-8-8 palette must
|
---|
160 | // be shifted by to fit in the hardware
|
---|
161 | // palette.
|
---|
162 | ULONG ulBitCount; // # of bits per pel 8,16,24,32 are only supported.
|
---|
163 | POINTL ptlHotSpot; // adjustment for pointer hot spot
|
---|
164 | VIDEO_POINTER_CAPABILITIES PointerCapabilities; // HW pointer abilities
|
---|
165 | PVIDEO_POINTER_ATTRIBUTES pPointerAttributes; // hardware pointer attributes
|
---|
166 | DWORD cjPointerAttributes; // Size of buffer allocated
|
---|
167 | BOOL fHwCursorActive; // Are we currently using the hw cursor
|
---|
168 | PALETTEENTRY *pPal; // If this is pal managed, this is the pal
|
---|
169 | BOOL bSupportDCI; // Does the miniport support DCI?
|
---|
170 | FLONG flHooks;
|
---|
171 |
|
---|
172 | #ifndef VBOX_WITH_HGSMI
|
---|
173 | VBVAENABLERESULT vbva;
|
---|
174 | uint32_t u32VRDPResetFlag;
|
---|
175 | #endif /* !VBOX_WITH_HGSMI */
|
---|
176 | BOOL fHwBufferOverflow;
|
---|
177 | VBVARECORD *pRecord;
|
---|
178 | VRDPBC cache;
|
---|
179 |
|
---|
180 | ULONG cSSB; // Number of active saved screen bits records in the following array.
|
---|
181 | SSB aSSB[4]; // LIFO type stack for saved screen areas.
|
---|
182 |
|
---|
183 | #ifndef VBOX_WITH_HGSMI
|
---|
184 | VBOXDISPLAYINFO *pInfo;
|
---|
185 | BOOLEAN bVBoxVideoSupported;
|
---|
186 | #endif /* !VBOX_WITH_HGSMI */
|
---|
187 | ULONG iDevice;
|
---|
188 | VRAMLAYOUT layout;
|
---|
189 |
|
---|
190 | PVBOXSURF pdsurfScreen;
|
---|
191 |
|
---|
192 | #ifdef VBOX_WITH_DDRAW
|
---|
193 | BOOL bDdExclusiveMode;
|
---|
194 | DWORD dwNewDDSurfaceOffset;
|
---|
195 | DWORD cHeaps;
|
---|
196 | VIDEOMEMORY* pvmList;
|
---|
197 | struct {
|
---|
198 | DWORD bLocked;
|
---|
199 | RECTL rArea;
|
---|
200 | } ddLock;
|
---|
201 | #endif /* VBOX_WITH_DDRAW */
|
---|
202 |
|
---|
203 | #ifdef VBOX_WITH_HGSMI
|
---|
204 | BOOLEAN bHGSMISupported;
|
---|
205 | HGSMIHEAP hgsmiDisplayHeap;
|
---|
206 | VBVABUFFER *pVBVA; /* Pointer to the pjScreen + layout->offVBVABuffer. NULL if VBVA is not enabled. */
|
---|
207 |
|
---|
208 | HVBOXVIDEOHGSMI hMpHGSMI; /* context handler passed to miniport HGSMI callbacks */
|
---|
209 | PFNVBOXVIDEOHGSMICOMPLETION pfnHGSMICommandComplete; /* called to complete the command we receive from the miniport */
|
---|
210 | PFNVBOXVIDEOHGSMICOMMANDS pfnHGSMIRequestCommands; /* called to requests the commands posted to us from the host */
|
---|
211 |
|
---|
212 | RTIOPORT IOPortGuestCommand;
|
---|
213 |
|
---|
214 | PVOID pVideoPortContext;
|
---|
215 | VBOXVIDEOPORTPROCS VideoPortProcs;
|
---|
216 | #endif /* VBOX_WITH_HGSMI */
|
---|
217 |
|
---|
218 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
219 | VBOXVHWAINFO vhwaInfo;
|
---|
220 | #endif
|
---|
221 | };
|
---|
222 |
|
---|
223 | #ifdef VBOX_WITH_OPENGL
|
---|
224 | typedef struct
|
---|
225 | {
|
---|
226 | DWORD dwVersion;
|
---|
227 | DWORD dwDriverVersion;
|
---|
228 | WCHAR szDriverName[256];
|
---|
229 | } OPENGL_INFO, *POPENGL_INFO;
|
---|
230 | #endif
|
---|
231 |
|
---|
232 | #ifndef VBOX_WITH_HGSMI
|
---|
233 | /* The global semaphore handle for all driver instances. */
|
---|
234 | extern HSEMAPHORE ghsemHwBuffer;
|
---|
235 | #endif /* !VBOX_WITH_HGSMI */
|
---|
236 |
|
---|
237 |
|
---|
238 | extern BOOL g_bOnNT40;
|
---|
239 |
|
---|
240 | DWORD getAvailableModes(HANDLE, PVIDEO_MODE_INFORMATION *, DWORD *);
|
---|
241 | BOOL bInitPDEV(PPDEV, PDEVMODEW, GDIINFO *, DEVINFO *);
|
---|
242 | BOOL bInitSURF(PPDEV, BOOL);
|
---|
243 | BOOL bInitPaletteInfo(PPDEV, DEVINFO *);
|
---|
244 | BOOL bInitPointer(PPDEV, DEVINFO *);
|
---|
245 | BOOL bInit256ColorPalette(PPDEV);
|
---|
246 | BOOL bInitNotificationThread(PPDEV);
|
---|
247 | VOID vStopNotificationThread (PPDEV);
|
---|
248 | VOID vDisablePalette(PPDEV);
|
---|
249 | VOID vDisableSURF(PPDEV);
|
---|
250 |
|
---|
251 | #define MAX_CLUT_SIZE (sizeof(VIDEO_CLUT) + (sizeof(ULONG) * 256))
|
---|
252 |
|
---|
253 | //
|
---|
254 | // Determines the size of the DriverExtra information in the DEVMODE
|
---|
255 | // structure passed to and from the display driver.
|
---|
256 | //
|
---|
257 |
|
---|
258 | #define DRIVER_EXTRA_SIZE 0
|
---|
259 |
|
---|
260 | #define DLL_NAME L"VBoxDisp" // Name of the DLL in UNICODE
|
---|
261 | #define STANDARD_DEBUG_PREFIX "VBOXDISP: " // All debug output is prefixed
|
---|
262 | #define ALLOC_TAG 'bvDD' // Four byte tag (characters in
|
---|
263 | // reverse order) used for memory
|
---|
264 | // allocations
|
---|
265 |
|
---|
266 | // VBOX
|
---|
267 | typedef struct _CLIPRECTS {
|
---|
268 | ULONG c;
|
---|
269 | RECTL arcl[64];
|
---|
270 | } CLIPRECTS;
|
---|
271 |
|
---|
272 | typedef struct _VRDPCLIPRECTS
|
---|
273 | {
|
---|
274 | RECTL rclDstOrig; /* Original bounding rectancle. */
|
---|
275 | RECTL rclDst; /* Bounding rectangle of all rects. */
|
---|
276 | CLIPRECTS rects; /* Rectangles to update. */
|
---|
277 | } VRDPCLIPRECTS;
|
---|
278 |
|
---|
279 |
|
---|
280 | BOOL vboxVbvaEnable (PPDEV ppdev);
|
---|
281 | void vboxVbvaDisable (PPDEV ppdev);
|
---|
282 |
|
---|
283 | BOOL vboxHwBufferBeginUpdate (PPDEV ppdev);
|
---|
284 | void vboxHwBufferEndUpdate (PPDEV ppdev);
|
---|
285 |
|
---|
286 | BOOL vboxWrite (PPDEV ppdev, const void *pv, uint32_t cb);
|
---|
287 |
|
---|
288 | BOOL vboxOrderSupported (PPDEV ppdev, unsigned code);
|
---|
289 |
|
---|
290 | void VBoxProcessDisplayInfo(PPDEV ppdev);
|
---|
291 | void VBoxUpdateDisplayInfo (PPDEV ppdev);
|
---|
292 |
|
---|
293 | void drvLoadEng (void);
|
---|
294 |
|
---|
295 | #ifdef VBOX_WITH_HGSMI
|
---|
296 | void vboxVBVAHostCommandComplete(PPDEV ppdev, VBVAHOSTCMD * pCmd);
|
---|
297 |
|
---|
298 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
299 |
|
---|
300 | #define VBOXDD_CHECKFLAG(_v, _f) ((_v) & (_f)) == (_f)
|
---|
301 |
|
---|
302 | typedef DECLCALLBACK(void) FNVBOXVHWACMDCOMPLETION(PPDEV ppdev, VBOXVHWACMD * pCmd, void * pContext);
|
---|
303 | typedef FNVBOXVHWACMDCOMPLETION *PFNVBOXVHWACMDCOMPLETION;
|
---|
304 |
|
---|
305 | void vboxVHWARectUnited(RECTL * pDst, RECTL * pRect1, RECTL * pRect2);
|
---|
306 | bool vboxVHWARectIsEmpty(RECTL * pRect);
|
---|
307 | bool vboxVHWARectIntersect(RECTL * pRect1, RECTL * pRect2);
|
---|
308 | bool vboxVHWARectInclude(RECTL * pRect1, RECTL * pRect2);
|
---|
309 | bool vboxVHWARegionIntersects(PVBOXVHWAREGION pReg, RECTL * pRect);
|
---|
310 | bool vboxVHWARegionIncludes(PVBOXVHWAREGION pReg, RECTL * pRect);
|
---|
311 | bool vboxVHWARegionIncluded(PVBOXVHWAREGION pReg, RECTL * pRect);
|
---|
312 | void vboxVHWARegionSet(PVBOXVHWAREGION pReg, RECTL * pRect);
|
---|
313 | void vboxVHWARegionAdd(PVBOXVHWAREGION pReg, RECTL * pRect);
|
---|
314 | void vboxVHWARegionInit(PVBOXVHWAREGION pReg);
|
---|
315 | void vboxVHWARegionClear(PVBOXVHWAREGION pReg);
|
---|
316 | bool vboxVHWARegionValid(PVBOXVHWAREGION pReg);
|
---|
317 | void vboxVHWARegionTrySubstitute(PVBOXVHWAREGION pReg, const RECTL *pRect);
|
---|
318 |
|
---|
319 | VBOXVHWACMD* vboxVHWACommandCreate (PPDEV ppdev, VBOXVHWACMD_TYPE enmCmd, VBOXVHWACMD_LENGTH cbCmd);
|
---|
320 | void vboxVHWACommandFree (PPDEV ppdev, VBOXVHWACMD* pCmd);
|
---|
321 | DECLINLINE(void) vbvaVHWACommandRelease (PPDEV ppdev, VBOXVHWACMD* pCmd)
|
---|
322 | {
|
---|
323 | uint32_t cRefs = ASMAtomicDecU32(&pCmd->cRefs);
|
---|
324 | Assert(cRefs < UINT32_MAX / 2);
|
---|
325 | if(!cRefs)
|
---|
326 | {
|
---|
327 | vboxVHWACommandFree(ppdev, pCmd);
|
---|
328 | }
|
---|
329 | }
|
---|
330 |
|
---|
331 | DECLINLINE(void) vbvaVHWACommandRetain (PPDEV ppdev, VBOXVHWACMD* pCmd)
|
---|
332 | {
|
---|
333 | ASMAtomicIncU32(&pCmd->cRefs);
|
---|
334 | }
|
---|
335 |
|
---|
336 | BOOL vboxVHWACommandSubmit (PPDEV ppdev, VBOXVHWACMD* pCmd);
|
---|
337 | void vboxVHWACommandSubmitAsynch (PPDEV ppdev, VBOXVHWACMD* pCmd, PFNVBOXVHWACMDCOMPLETION pfnCompletion, void * pContext);
|
---|
338 | void vboxVHWACommandSubmitAsynchByEvent (PPDEV ppdev, VBOXVHWACMD* pCmd, VBOXPEVENT pEvent);
|
---|
339 | void vboxVHWACommandCheckHostCmds(PPDEV ppdev);
|
---|
340 | void vboxVHWACommandSubmitAsynchAndComplete (PPDEV ppdev, VBOXVHWACMD* pCmd);
|
---|
341 |
|
---|
342 | int vboxVHWAInitHostInfo1(PPDEV ppdev);
|
---|
343 | int vboxVHWAInitHostInfo2(PPDEV ppdev, DWORD *pFourCC);
|
---|
344 |
|
---|
345 | VBOXVHWACMD_QUERYINFO1* vboxVHWAQueryHostInfo1(PPDEV ppdev);
|
---|
346 | void vboxVHWAFreeHostInfo1(PPDEV ppdev, VBOXVHWACMD_QUERYINFO1* pInfo);
|
---|
347 | VBOXVHWACMD_QUERYINFO2* vboxVHWAQueryHostInfo2(PPDEV ppdev, uint32_t numFourCC);
|
---|
348 | void vboxVHWAFreeHostInfo2(PPDEV ppdev, VBOXVHWACMD_QUERYINFO2* pInfo);
|
---|
349 |
|
---|
350 | void vboxVHWAInit();
|
---|
351 | void vboxVHWATerm();
|
---|
352 | uint32_t vboxVHWAUnsupportedDDCAPS(uint32_t caps);
|
---|
353 | uint32_t vboxVHWAUnsupportedDDSCAPS(uint32_t caps);
|
---|
354 | uint32_t vboxVHWAUnsupportedDDPFS(uint32_t caps);
|
---|
355 | uint32_t vboxVHWASupportedDDCAPS(uint32_t caps);
|
---|
356 | uint32_t vboxVHWASupportedDDSCAPS(uint32_t caps);
|
---|
357 | uint32_t vboxVHWASupportedDDPFS(uint32_t caps);
|
---|
358 |
|
---|
359 | uint32_t vboxVHWAUnsupportedDDCEYCAPS(uint32_t caps);
|
---|
360 | uint32_t vboxVHWASupportedDDCEYCAPS(uint32_t caps);
|
---|
361 |
|
---|
362 | uint32_t vboxVHWAToDDBLTs(uint32_t caps);
|
---|
363 | uint32_t vboxVHWAFromDDBLTs(uint32_t caps);
|
---|
364 |
|
---|
365 | uint32_t vboxVHWAFromDDCAPS2(uint32_t caps);
|
---|
366 | uint32_t vboxVHWAToDDCAPS2(uint32_t caps);
|
---|
367 |
|
---|
368 | void vboxVHWAFromDDBLTFX(VBOXVHWA_BLTFX *pVHWABlt, DDBLTFX *pDdBlt);
|
---|
369 |
|
---|
370 | void vboxVHWAFromDDCOLORKEY(VBOXVHWA_COLORKEY *pVHWACKey, DDCOLORKEY *pDdCKey);
|
---|
371 |
|
---|
372 | uint32_t vboxVHWAFromDDOVERs(uint32_t caps);
|
---|
373 | uint32_t vboxVHWAToDDOVERs(uint32_t caps);
|
---|
374 | uint32_t vboxVHWAFromDDCKEYs(uint32_t caps);
|
---|
375 | uint32_t vboxVHWAToDDCKEYs(uint32_t caps);
|
---|
376 |
|
---|
377 | void vboxVHWAFromDDOVERLAYFX(VBOXVHWA_OVERLAYFX *pVHWAOverlay, DDOVERLAYFX *pDdOverlay);
|
---|
378 |
|
---|
379 | uint32_t vboxVHWAFromDDCAPS(uint32_t caps);
|
---|
380 | uint32_t vboxVHWAToDDCAPS(uint32_t caps);
|
---|
381 | uint32_t vboxVHWAFromDDSCAPS(uint32_t caps);
|
---|
382 | uint32_t vboxVHWAToDDSCAPS(uint32_t caps);
|
---|
383 | uint32_t vboxVHWAFromDDPFS(uint32_t caps);
|
---|
384 | uint32_t vboxVHWAToDDPFS(uint32_t caps);
|
---|
385 | uint32_t vboxVHWAFromDDCKEYCAPS(uint32_t caps);
|
---|
386 | uint32_t vboxVHWAToDDCKEYCAPS(uint32_t caps);
|
---|
387 | int vboxVHWAFromDDPIXELFORMAT(VBOXVHWA_PIXELFORMAT *pVHWAFormat, DDPIXELFORMAT *pDdFormat);
|
---|
388 | int vboxVHWAFromDDSURFACEDESC(VBOXVHWA_SURFACEDESC *pVHWADesc, DDSURFACEDESC *pDdDesc);
|
---|
389 | void vboxVHWAFromRECTL(VBOXVHWA_RECTL *pDst, RECTL *pSrc);
|
---|
390 | PVBOXVHWASURFDESC vboxVHWASurfDescAlloc();
|
---|
391 | void vboxVHWASurfDescFree(PVBOXVHWASURFDESC pDesc);
|
---|
392 |
|
---|
393 | int vboxVHWAEnable(PPDEV ppdev);
|
---|
394 | int vboxVHWADisable(PPDEV ppdev);
|
---|
395 |
|
---|
396 | #endif
|
---|
397 | #endif
|
---|
398 |
|
---|
399 | BOOL bIsScreenSurface (SURFOBJ *pso);
|
---|
400 |
|
---|
401 | __inline SURFOBJ *getSurfObj (SURFOBJ *pso)
|
---|
402 | {
|
---|
403 | if (pso)
|
---|
404 | {
|
---|
405 | PPDEV ppdev = (PPDEV)pso->dhpdev;
|
---|
406 |
|
---|
407 | if (ppdev)
|
---|
408 | {
|
---|
409 | if (ppdev->psoScreenBitmap && pso->hsurf == ppdev->hsurfScreen)
|
---|
410 | {
|
---|
411 | /* Convert the device PSO to the bitmap PSO which can be passed to Eng*. */
|
---|
412 | pso = ppdev->psoScreenBitmap;
|
---|
413 | }
|
---|
414 | }
|
---|
415 | }
|
---|
416 |
|
---|
417 | return pso;
|
---|
418 | }
|
---|
419 |
|
---|
420 | #define CONV_SURF(_pso) getSurfObj (_pso)
|
---|
421 |
|
---|
422 | __inline int format2BytesPerPixel(const SURFOBJ *pso)
|
---|
423 | {
|
---|
424 | switch (pso->iBitmapFormat)
|
---|
425 | {
|
---|
426 | case BMF_16BPP: return 2;
|
---|
427 | case BMF_24BPP: return 3;
|
---|
428 | case BMF_32BPP: return 4;
|
---|
429 | }
|
---|
430 |
|
---|
431 | return 0;
|
---|
432 | }
|
---|
433 |
|
---|
434 | #ifdef VBOX_VBVA_ADJUST_RECT
|
---|
435 | void vrdpAdjustRect (SURFOBJ *pso, RECTL *prcl);
|
---|
436 | BOOL vbvaFindChangedRect (SURFOBJ *psoDest, SURFOBJ *psoSrc, RECTL *prclDest, POINTL *pptlSrc);
|
---|
437 | #endif /* VBOX_VBVA_ADJUST_RECT */
|
---|
438 |
|
---|
439 | void vrdpReportDirtyRect (PPDEV ppdev, RECTL *prcl);
|
---|
440 | void vbvaReportDirtyRect (PPDEV ppdev, RECTL *prcl);
|
---|
441 |
|
---|
442 | #define VRDP_TEXT_MAX_GLYPH_SIZE 0x100
|
---|
443 | #define VRDP_TEXT_MAX_GLYPHS 0xfe
|
---|
444 |
|
---|
445 | BOOL vboxReportText (PPDEV ppdev,
|
---|
446 | VRDPCLIPRECTS *pClipRects,
|
---|
447 | STROBJ *pstro,
|
---|
448 | FONTOBJ *pfo,
|
---|
449 | RECTL *prclOpaque,
|
---|
450 | ULONG ulForeRGB,
|
---|
451 | ULONG ulBackRGB
|
---|
452 | );
|
---|
453 |
|
---|
454 | BOOL vrdpReportOrderGeneric (PPDEV ppdev,
|
---|
455 | const VRDPCLIPRECTS *pClipRects,
|
---|
456 | const void *pvOrder,
|
---|
457 | unsigned cbOrder,
|
---|
458 | unsigned code);
|
---|
459 |
|
---|
460 |
|
---|
461 | #include <iprt/assert.h>
|
---|
462 |
|
---|
463 | #ifdef DEBUG
|
---|
464 | #define VBVA_ASSERT(expr) \
|
---|
465 | do { \
|
---|
466 | if (!(expr)) \
|
---|
467 | { \
|
---|
468 | RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
|
---|
469 | RTAssertMsg2Weak("!!!\n"); \
|
---|
470 | } \
|
---|
471 | } while (0)
|
---|
472 | #else
|
---|
473 | #define VBVA_ASSERT(expr) do {} while (0)
|
---|
474 | #endif
|
---|
475 |
|
---|
476 | #ifdef STAT_sunlover
|
---|
477 | extern ULONG gStatCopyBitsOffscreenToScreen;
|
---|
478 | extern ULONG gStatCopyBitsScreenToScreen;
|
---|
479 | extern ULONG gStatBitBltOffscreenToScreen;
|
---|
480 | extern ULONG gStatBitBltScreenToScreen;
|
---|
481 | extern ULONG gStatUnchangedOffscreenToScreen;
|
---|
482 | extern ULONG gStatUnchangedOffscreenToScreenCRC;
|
---|
483 | extern ULONG gStatNonTransientEngineBitmaps;
|
---|
484 | extern ULONG gStatTransientEngineBitmaps;
|
---|
485 | extern ULONG gStatUnchangedBitmapsCRC;
|
---|
486 | extern ULONG gStatUnchangedBitmapsDeviceCRC;
|
---|
487 | extern ULONG gStatBitmapsCRC;
|
---|
488 | extern ULONG gStatBitBltScreenPattern;
|
---|
489 | extern ULONG gStatBitBltScreenSquare;
|
---|
490 | extern ULONG gStatBitBltScreenPatternReported;
|
---|
491 | extern ULONG gStatBitBltScreenSquareReported;
|
---|
492 | extern ULONG gStatCopyBitsScreenSquare;
|
---|
493 |
|
---|
494 | extern ULONG gStatEnablePDEV;
|
---|
495 | extern ULONG gStatCompletePDEV;
|
---|
496 | extern ULONG gStatDisablePDEV;
|
---|
497 | extern ULONG gStatEnableSurface;
|
---|
498 | extern ULONG gStatDisableSurface;
|
---|
499 | extern ULONG gStatAssertMode;
|
---|
500 | extern ULONG gStatDisableDriver;
|
---|
501 | extern ULONG gStatCreateDeviceBitmap;
|
---|
502 | extern ULONG gStatDeleteDeviceBitmap;
|
---|
503 | extern ULONG gStatDitherColor;
|
---|
504 | extern ULONG gStatStrokePath;
|
---|
505 | extern ULONG gStatFillPath;
|
---|
506 | extern ULONG gStatStrokeAndFillPath;
|
---|
507 | extern ULONG gStatPaint;
|
---|
508 | extern ULONG gStatBitBlt;
|
---|
509 | extern ULONG gStatCopyBits;
|
---|
510 | extern ULONG gStatStretchBlt;
|
---|
511 | extern ULONG gStatSetPalette;
|
---|
512 | extern ULONG gStatTextOut;
|
---|
513 | extern ULONG gStatSetPointerShape;
|
---|
514 | extern ULONG gStatMovePointer;
|
---|
515 | extern ULONG gStatLineTo;
|
---|
516 | extern ULONG gStatSynchronize;
|
---|
517 | extern ULONG gStatGetModes;
|
---|
518 | extern ULONG gStatGradientFill;
|
---|
519 | extern ULONG gStatStretchBltROP;
|
---|
520 | extern ULONG gStatPlgBlt;
|
---|
521 | extern ULONG gStatAlphaBlend;
|
---|
522 | extern ULONG gStatTransparentBlt;
|
---|
523 |
|
---|
524 | void statPrint (void);
|
---|
525 |
|
---|
526 | #define STATDRVENTRY(a, b) do { if (bIsScreenSurface (b)) gStat##a++; } while (0)
|
---|
527 | #define STATPRINT do { statPrint (); } while (0)
|
---|
528 | #else
|
---|
529 | #define STATDRVENTRY(a, b)
|
---|
530 | #define STATPRINT
|
---|
531 | #endif /* STAT_sunlover */
|
---|