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