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