1 | /* $Id: DisplayImpl.h 52667 2014-09-10 08:40:37Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox COM class implementation
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2014 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.alldomusa.eu.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ____H_DISPLAYIMPL
|
---|
19 | #define ____H_DISPLAYIMPL
|
---|
20 |
|
---|
21 | #include "SchemaDefs.h"
|
---|
22 |
|
---|
23 | #include <iprt/semaphore.h>
|
---|
24 | #include <VBox/vmm/pdmdrv.h>
|
---|
25 | #include <VBox/VMMDev.h>
|
---|
26 | #include <VBox/VBoxVideo.h>
|
---|
27 | #include <VBox/vmm/pdmifs.h>
|
---|
28 | #include "DisplayWrap.h"
|
---|
29 |
|
---|
30 | #ifdef VBOX_WITH_CROGL
|
---|
31 | # include <VBox/HostServices/VBoxCrOpenGLSvc.h>
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include "DisplaySourceBitmapWrap.h"
|
---|
35 |
|
---|
36 | class Console;
|
---|
37 | struct VIDEORECCONTEXT;
|
---|
38 |
|
---|
39 | typedef struct _DISPLAYFBINFO
|
---|
40 | {
|
---|
41 | uint32_t u32Offset;
|
---|
42 | uint32_t u32MaxFramebufferSize;
|
---|
43 | uint32_t u32InformationSize;
|
---|
44 |
|
---|
45 | ComPtr<IFramebuffer> pFramebuffer;
|
---|
46 | ComPtr<IDisplaySourceBitmap> pSourceBitmap;
|
---|
47 | bool fDisabled;
|
---|
48 |
|
---|
49 | uint32_t u32Caps;
|
---|
50 |
|
---|
51 | struct
|
---|
52 | {
|
---|
53 | ComPtr<IDisplaySourceBitmap> pSourceBitmap;
|
---|
54 | uint8_t *pu8Address;
|
---|
55 | uint32_t cbLine;
|
---|
56 | } updateImage;
|
---|
57 |
|
---|
58 | LONG xOrigin;
|
---|
59 | LONG yOrigin;
|
---|
60 |
|
---|
61 | ULONG w;
|
---|
62 | ULONG h;
|
---|
63 |
|
---|
64 | uint16_t u16BitsPerPixel;
|
---|
65 | uint8_t *pu8FramebufferVRAM;
|
---|
66 | uint32_t u32LineSize;
|
---|
67 |
|
---|
68 | uint16_t flags;
|
---|
69 |
|
---|
70 | VBOXVIDEOINFOHOSTEVENTS *pHostEvents;
|
---|
71 |
|
---|
72 | /** The framebuffer has default format and must be updates immediately. */
|
---|
73 | bool fDefaultFormat;
|
---|
74 |
|
---|
75 | struct
|
---|
76 | {
|
---|
77 | /* The rectangle that includes all dirty rectangles. */
|
---|
78 | int32_t xLeft;
|
---|
79 | int32_t xRight;
|
---|
80 | int32_t yTop;
|
---|
81 | int32_t yBottom;
|
---|
82 | } dirtyRect;
|
---|
83 |
|
---|
84 | #ifdef VBOX_WITH_HGSMI
|
---|
85 | bool fVBVAEnabled;
|
---|
86 | bool fVBVAForceResize;
|
---|
87 | bool fRenderThreadMode;
|
---|
88 | PVBVAHOSTFLAGS pVBVAHostFlags;
|
---|
89 | #endif /* VBOX_WITH_HGSMI */
|
---|
90 |
|
---|
91 | #ifdef VBOX_WITH_CROGL
|
---|
92 | struct
|
---|
93 | {
|
---|
94 | bool fPending;
|
---|
95 | ULONG x;
|
---|
96 | ULONG y;
|
---|
97 | ULONG width;
|
---|
98 | ULONG height;
|
---|
99 | } pendingViewportInfo;
|
---|
100 | #endif /* VBOX_WITH_CROGL */
|
---|
101 | } DISPLAYFBINFO;
|
---|
102 |
|
---|
103 | class DisplayMouseInterface
|
---|
104 | {
|
---|
105 | public:
|
---|
106 | virtual HRESULT i_getScreenResolution(ULONG cScreen, ULONG *pcx,
|
---|
107 | ULONG *pcy, ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin) = 0;
|
---|
108 | virtual void i_getFramebufferDimensions(int32_t *px1, int32_t *py1,
|
---|
109 | int32_t *px2, int32_t *py2) = 0;
|
---|
110 | };
|
---|
111 |
|
---|
112 | class VMMDev;
|
---|
113 |
|
---|
114 | class ATL_NO_VTABLE Display :
|
---|
115 | public DisplayWrap,
|
---|
116 | public DisplayMouseInterface
|
---|
117 | {
|
---|
118 | public:
|
---|
119 |
|
---|
120 | DECLARE_EMPTY_CTOR_DTOR(Display)
|
---|
121 |
|
---|
122 | HRESULT FinalConstruct();
|
---|
123 | void FinalRelease();
|
---|
124 |
|
---|
125 | // public initializer/uninitializer for internal purposes only
|
---|
126 | HRESULT init(Console *aParent);
|
---|
127 | void uninit();
|
---|
128 | int i_registerSSM(PUVM pUVM);
|
---|
129 |
|
---|
130 | // public methods only for internal purposes
|
---|
131 | int i_handleDisplayResize(unsigned uScreenId, uint32_t bpp, void *pvVRAM, uint32_t cbLine,
|
---|
132 | uint32_t w, uint32_t h, uint16_t flags);
|
---|
133 | void i_handleDisplayUpdateLegacy(int x, int y, int cx, int cy);
|
---|
134 | void i_handleDisplayUpdate(unsigned uScreenId, int x, int y, int w, int h);
|
---|
135 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
136 | int i_handleVHWACommandProcess(PVBOXVHWACMD pCommand);
|
---|
137 | #endif
|
---|
138 | #ifdef VBOX_WITH_CRHGSMI
|
---|
139 | void i_handleCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
|
---|
140 | void i_handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
|
---|
141 | void i_handleCrHgsmiCommandProcess(PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
|
---|
142 | void i_handleCrHgsmiControlProcess(PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl);
|
---|
143 | #endif
|
---|
144 | #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
|
---|
145 | int i_handleCrHgcmCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
|
---|
146 | PFNCRCTLCOMPLETION pfnCompletion,
|
---|
147 | void *pvCompletion);
|
---|
148 | void i_handleCrVRecScreenshotPerform(uint32_t uScreen,
|
---|
149 | uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBitsPerPixel,
|
---|
150 | uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight,
|
---|
151 | uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
|
---|
152 | bool i_handleCrVRecScreenshotBegin(uint32_t uScreen, uint64_t u64TimeStamp);
|
---|
153 | void i_handleCrVRecScreenshotEnd(uint32_t uScreen, uint64_t u64TimeStamp);
|
---|
154 | void i_handleVRecCompletion();
|
---|
155 | #endif
|
---|
156 |
|
---|
157 | int i_notifyCroglResize(const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM);
|
---|
158 |
|
---|
159 | int i_handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect);
|
---|
160 | int i_handleQueryVisibleRegion(uint32_t *pcRect, PRTRECT pRect);
|
---|
161 |
|
---|
162 | int i_VideoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory);
|
---|
163 | void i_VideoAccelFlush(void);
|
---|
164 | bool i_VideoAccelAllowed(void);
|
---|
165 | void i_VideoAccelVRDP(bool fEnable);
|
---|
166 |
|
---|
167 | /* Legacy video acceleration requests coming from the VGA refresh timer. */
|
---|
168 | int VideoAccelEnableVGA(bool fEnable, VBVAMEMORY *pVbvaMemory);
|
---|
169 |
|
---|
170 | /* Legacy video acceleration requests coming from VMMDev. */
|
---|
171 | int VideoAccelEnableVMMDev(bool fEnable, VBVAMEMORY *pVbvaMemory);
|
---|
172 | void VideoAccelFlushVMMDev(void);
|
---|
173 |
|
---|
174 | int i_VideoCaptureStart();
|
---|
175 | void i_VideoCaptureStop();
|
---|
176 | int i_VideoCaptureEnableScreens(ComSafeArrayIn(BOOL, aScreens));
|
---|
177 |
|
---|
178 | void i_notifyPowerDown(void);
|
---|
179 |
|
---|
180 | // DisplayMouseInterface methods
|
---|
181 | virtual HRESULT i_getScreenResolution(ULONG cScreen, ULONG *pcx,
|
---|
182 | ULONG *pcy, ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin)
|
---|
183 | {
|
---|
184 | return getScreenResolution(cScreen, pcx, pcy, pcBPP, pXOrigin, pYOrigin);
|
---|
185 | }
|
---|
186 | virtual void i_getFramebufferDimensions(int32_t *px1, int32_t *py1,
|
---|
187 | int32_t *px2, int32_t *py2);
|
---|
188 |
|
---|
189 | static const PDMDRVREG DrvReg;
|
---|
190 |
|
---|
191 | private:
|
---|
192 | // Wrapped IDisplay properties
|
---|
193 |
|
---|
194 | // Wrapped IDisplay methods
|
---|
195 | virtual HRESULT getScreenResolution(ULONG aScreenId,
|
---|
196 | ULONG *aWidth,
|
---|
197 | ULONG *aHeight,
|
---|
198 | ULONG *aBitsPerPixel,
|
---|
199 | LONG *aXOrigin,
|
---|
200 | LONG *aYOrigin);
|
---|
201 | virtual HRESULT attachFramebuffer(ULONG aScreenId,
|
---|
202 | const ComPtr<IFramebuffer> &aFramebuffer);
|
---|
203 | virtual HRESULT detachFramebuffer(ULONG aScreenId);
|
---|
204 | virtual HRESULT queryFramebuffer(ULONG aScreenId,
|
---|
205 | ComPtr<IFramebuffer> &aFramebuffer);
|
---|
206 | virtual HRESULT setVideoModeHint(ULONG aDisplay,
|
---|
207 | BOOL aEnabled,
|
---|
208 | BOOL aChangeOrigin,
|
---|
209 | LONG aOriginX,
|
---|
210 | LONG aOriginY,
|
---|
211 | ULONG aWidth,
|
---|
212 | ULONG aHeight,
|
---|
213 | ULONG aBitsPerPixel);
|
---|
214 | virtual HRESULT setSeamlessMode(BOOL aEnabled);
|
---|
215 | virtual HRESULT takeScreenShot(ULONG aScreenId,
|
---|
216 | BYTE *aAddress,
|
---|
217 | ULONG aWidth,
|
---|
218 | ULONG aHeight,
|
---|
219 | BitmapFormat_T aBitmapFormat);
|
---|
220 | virtual HRESULT takeScreenShotToArray(ULONG aScreenId,
|
---|
221 | ULONG aWidth,
|
---|
222 | ULONG aHeight,
|
---|
223 | BitmapFormat_T aBitmapFormat,
|
---|
224 | std::vector<BYTE> &aScreenData);
|
---|
225 | virtual HRESULT drawToScreen(ULONG aScreenId,
|
---|
226 | BYTE *aAddress,
|
---|
227 | ULONG aX,
|
---|
228 | ULONG aY,
|
---|
229 | ULONG aWidth,
|
---|
230 | ULONG aHeight);
|
---|
231 | virtual HRESULT invalidateAndUpdate();
|
---|
232 | virtual HRESULT invalidateAndUpdateScreen(ULONG aScreenId);
|
---|
233 | virtual HRESULT completeVHWACommand(BYTE *aCommand);
|
---|
234 | virtual HRESULT viewportChanged(ULONG aScreenId,
|
---|
235 | ULONG aX,
|
---|
236 | ULONG aY,
|
---|
237 | ULONG aWidth,
|
---|
238 | ULONG aHeight);
|
---|
239 | virtual HRESULT querySourceBitmap(ULONG aScreenId,
|
---|
240 | ComPtr<IDisplaySourceBitmap> &aDisplaySourceBitmap);
|
---|
241 |
|
---|
242 | // Wrapped IEventListener properties
|
---|
243 |
|
---|
244 | // Wrapped IEventListener methods
|
---|
245 | virtual HRESULT handleEvent(const ComPtr<IEvent> &aEvent);
|
---|
246 |
|
---|
247 | // other internal methods
|
---|
248 | HRESULT takeScreenShotWorker(ULONG aScreenId,
|
---|
249 | BYTE *aAddress,
|
---|
250 | ULONG aWidth,
|
---|
251 | ULONG aHeight,
|
---|
252 | BitmapFormat_T aBitmapFormat,
|
---|
253 | ULONG *pcbOut);
|
---|
254 |
|
---|
255 | #ifdef VBOX_WITH_CRHGSMI
|
---|
256 | void i_setupCrHgsmiData(void);
|
---|
257 | void i_destructCrHgsmiData(void);
|
---|
258 | #endif
|
---|
259 |
|
---|
260 | #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
|
---|
261 | int i_crViewportNotify(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height);
|
---|
262 | #endif
|
---|
263 |
|
---|
264 | static DECLCALLBACK(void*) i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
|
---|
265 | static DECLCALLBACK(int) i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
|
---|
266 | static DECLCALLBACK(void) i_drvDestruct(PPDMDRVINS pDrvIns);
|
---|
267 | static DECLCALLBACK(int) i_displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM,
|
---|
268 | uint32_t cbLine, uint32_t cx, uint32_t cy);
|
---|
269 | static DECLCALLBACK(void) i_displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterface,
|
---|
270 | uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
|
---|
271 | static DECLCALLBACK(void) i_displayRefreshCallback(PPDMIDISPLAYCONNECTOR pInterface);
|
---|
272 | static DECLCALLBACK(void) i_displayResetCallback(PPDMIDISPLAYCONNECTOR pInterface);
|
---|
273 | static DECLCALLBACK(void) i_displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled);
|
---|
274 | static DECLCALLBACK(void) i_displayProcessAdapterDataCallback(PPDMIDISPLAYCONNECTOR pInterface,
|
---|
275 | void *pvVRAM, uint32_t u32VRAMSize);
|
---|
276 | static DECLCALLBACK(void) i_displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface,
|
---|
277 | void *pvVRAM, unsigned uScreenId);
|
---|
278 |
|
---|
279 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
280 | static DECLCALLBACK(int) i_displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand);
|
---|
281 | #endif
|
---|
282 |
|
---|
283 | #ifdef VBOX_WITH_CRHGSMI
|
---|
284 | static DECLCALLBACK(void) i_displayCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface,
|
---|
285 | PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
|
---|
286 | static DECLCALLBACK(void) i_displayCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl,
|
---|
287 | uint32_t cbCtl);
|
---|
288 |
|
---|
289 | static DECLCALLBACK(void) i_displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
|
---|
290 | void *pvContext);
|
---|
291 | static DECLCALLBACK(void) i_displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
|
---|
292 | void *pvContext);
|
---|
293 | #endif
|
---|
294 | #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
|
---|
295 | static DECLCALLBACK(int) i_displayCrHgcmCtlSubmit(PPDMIDISPLAYCONNECTOR pInterface,
|
---|
296 | struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
|
---|
297 | PFNCRCTLCOMPLETION pfnCompletion,
|
---|
298 | void *pvCompletion);
|
---|
299 | static DECLCALLBACK(void) i_displayCrHgcmCtlSubmitCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
|
---|
300 | void *pvContext);
|
---|
301 | #endif
|
---|
302 | #ifdef VBOX_WITH_HGSMI
|
---|
303 | static DECLCALLBACK(int) i_displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
|
---|
304 | PVBVAHOSTFLAGS pHostFlags, bool fRenderThreadMode);
|
---|
305 | static DECLCALLBACK(void) i_displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
|
---|
306 | static DECLCALLBACK(void) i_displayVBVAUpdateBegin(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
|
---|
307 | static DECLCALLBACK(void) i_displayVBVAUpdateProcess(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
|
---|
308 | const PVBVACMDHDR pCmd, size_t cbCmd);
|
---|
309 | static DECLCALLBACK(void) i_displayVBVAUpdateEnd(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y,
|
---|
310 | uint32_t cx, uint32_t cy);
|
---|
311 | static DECLCALLBACK(int) i_displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, const PVBVAINFOVIEW pView,
|
---|
312 | const PVBVAINFOSCREEN pScreen, void *pvVRAM);
|
---|
313 | static DECLCALLBACK(int) i_displayVBVAMousePointerShape(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha,
|
---|
314 | uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy,
|
---|
315 | const void *pvShape);
|
---|
316 | #endif
|
---|
317 |
|
---|
318 | #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
|
---|
319 | static DECLCALLBACK(void) i_displayCrVRecScreenshotPerform(void *pvCtx, uint32_t uScreen,
|
---|
320 | uint32_t x, uint32_t y,
|
---|
321 | uint32_t uBitsPerPixel, uint32_t uBytesPerLine,
|
---|
322 | uint32_t uGuestWidth, uint32_t uGuestHeight,
|
---|
323 | uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
|
---|
324 | static DECLCALLBACK(bool) i_displayCrVRecScreenshotBegin(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
|
---|
325 | static DECLCALLBACK(void) i_displayCrVRecScreenshotEnd(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
|
---|
326 |
|
---|
327 | static DECLCALLBACK(void) i_displayVRecCompletion(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion);
|
---|
328 | #endif
|
---|
329 | static DECLCALLBACK(void) i_displayCrCmdFree(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion);
|
---|
330 |
|
---|
331 | static DECLCALLBACK(void) i_displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser);
|
---|
332 | static DECLCALLBACK(int) i_displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
|
---|
333 | static DECLCALLBACK(void) i_displaySSMSave(PSSMHANDLE pSSM, void *pvUser);
|
---|
334 | static DECLCALLBACK(int) i_displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
|
---|
335 |
|
---|
336 | Console * const mParent;
|
---|
337 | /** Pointer to the associated display driver. */
|
---|
338 | struct DRVMAINDISPLAY *mpDrv;
|
---|
339 | /** Pointer to the device instance for the VMM Device. */
|
---|
340 | PPDMDEVINS mpVMMDev;
|
---|
341 | /** Set after the first attempt to find the VMM Device. */
|
---|
342 | bool mfVMMDevInited;
|
---|
343 |
|
---|
344 | unsigned mcMonitors;
|
---|
345 | DISPLAYFBINFO maFramebuffers[SchemaDefs::MaxGuestMonitors];
|
---|
346 |
|
---|
347 | bool mfSourceBitmapEnabled;
|
---|
348 | bool volatile fVGAResizing;
|
---|
349 |
|
---|
350 | VBVAMEMORY *mpVbvaMemory;
|
---|
351 | bool mfVideoAccelEnabled;
|
---|
352 | bool mfVideoAccelVRDP;
|
---|
353 | uint32_t mfu32SupportedOrders;
|
---|
354 |
|
---|
355 | int32_t volatile mcVideoAccelVRDPRefs;
|
---|
356 |
|
---|
357 | #ifdef VBOX_WITH_CROGL
|
---|
358 | bool mfCrOglDataHidden;
|
---|
359 | #endif
|
---|
360 |
|
---|
361 | uint8_t *mpu8VbvaPartial;
|
---|
362 | uint32_t mcbVbvaPartial;
|
---|
363 |
|
---|
364 | #ifdef VBOX_WITH_CRHGSMI
|
---|
365 | /* for fast host hgcm calls */
|
---|
366 | HGCMCVSHANDLE mhCrOglSvc;
|
---|
367 | RTCRITSECTRW mCrOglLock;
|
---|
368 | #endif
|
---|
369 | #ifdef VBOX_WITH_CROGL
|
---|
370 | CR_MAIN_INTERFACE mCrOglCallbacks;
|
---|
371 | volatile uint32_t mfCrOglVideoRecState;
|
---|
372 | CRVBOXHGCMTAKESCREENSHOT mCrOglScreenshotData;
|
---|
373 | VBOXCRCMDCTL_HGCM mCrOglScreenshotCtl;
|
---|
374 | #endif
|
---|
375 |
|
---|
376 | bool i_vbvaFetchCmd(VBVACMDHDR **ppHdr, uint32_t *pcbCmd);
|
---|
377 | void i_vbvaReleaseCmd(VBVACMDHDR *pHdr, int32_t cbCmd);
|
---|
378 |
|
---|
379 | void i_handleResizeCompletedEMT(unsigned uScreenId, BOOL fResizeContext);
|
---|
380 |
|
---|
381 | /* Old guest additions (3.x and older) use both VMMDev and DevVGA refresh timer
|
---|
382 | * to process the VBVABUFFER memory. Therefore the legacy VBVA (VideoAccel) host
|
---|
383 | * code can be executed concurrently by VGA refresh timer and the guest VMMDev
|
---|
384 | * request in SMP VMs. The semaphore serialized this.
|
---|
385 | */
|
---|
386 | RTSEMXROADS mhXRoadsVideoAccel;
|
---|
387 | int videoAccelEnterVGA(void);
|
---|
388 | void videoAccelLeaveVGA(void);
|
---|
389 | int videoAccelEnterVMMDev(void);
|
---|
390 | void videoAccelLeaveVMMDev(void);
|
---|
391 |
|
---|
392 | /* Serializes access to mpVbvaMemory, etc between VRDP and Display. */
|
---|
393 | RTCRITSECT mVideoAccelLock;
|
---|
394 |
|
---|
395 | public:
|
---|
396 |
|
---|
397 | static int i_displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData,
|
---|
398 | uint32_t *pu32Width, uint32_t *pu32Height);
|
---|
399 |
|
---|
400 | #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
|
---|
401 | static BOOL i_displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *pu8Data,
|
---|
402 | uint32_t u32Width, uint32_t u32Height);
|
---|
403 | int i_crCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, PFNCRCTLCOMPLETION pfnCompletion, void *pvCompletion);
|
---|
404 | int i_crCtlSubmitSync(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
|
---|
405 | /* copies the given command and submits it asynchronously,
|
---|
406 | * i.e. the pCmd data may be discarded right after the call returns */
|
---|
407 | int i_crCtlSubmitAsyncCmdCopy(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
|
---|
408 | /* performs synchronous request processing if 3D backend has something to display
|
---|
409 | * this is primarily to work-around 3d<->main thread deadlocks on OSX
|
---|
410 | * in case of async completion, the command is coppied to the allocated buffer,
|
---|
411 | * freeded on command completion
|
---|
412 | * can be used for "notification" commands, when client is not interested in command result,
|
---|
413 | * that must synchronize with 3D backend only when some 3D data is displayed.
|
---|
414 | * The routine does NOT provide any info on whether command is processed asynchronously or not */
|
---|
415 | int i_crCtlSubmitSyncIfHasDataForScreen(uint32_t u32ScreenID, struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
|
---|
416 | #endif
|
---|
417 |
|
---|
418 | private:
|
---|
419 | static int i_InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll);
|
---|
420 | static int i_drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
|
---|
421 |
|
---|
422 | int i_videoAccelRefreshProcess(void);
|
---|
423 |
|
---|
424 | /* Functions run under VBVA lock. */
|
---|
425 | int i_videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory);
|
---|
426 | int i_videoAccelFlush(void);
|
---|
427 |
|
---|
428 | #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
|
---|
429 | int i_crOglWindowsShow(bool fShow);
|
---|
430 | #endif
|
---|
431 |
|
---|
432 | #ifdef VBOX_WITH_HGSMI
|
---|
433 | volatile uint32_t mu32UpdateVBVAFlags;
|
---|
434 | #endif
|
---|
435 |
|
---|
436 | #ifdef VBOX_WITH_VPX
|
---|
437 | VIDEORECCONTEXT *mpVideoRecCtx;
|
---|
438 | bool maVideoRecEnabled[SchemaDefs::MaxGuestMonitors];
|
---|
439 | #endif
|
---|
440 | };
|
---|
441 |
|
---|
442 | /* helper function, code in DisplayResampleImage.cpp */
|
---|
443 | void gdImageCopyResampled(uint8_t *dst, uint8_t *src,
|
---|
444 | int dstX, int dstY, int srcX, int srcY,
|
---|
445 | int dstW, int dstH, int srcW, int srcH);
|
---|
446 |
|
---|
447 | void BitmapScale32(uint8_t *dst, int dstW, int dstH,
|
---|
448 | const uint8_t *src, int iDeltaLine, int srcW, int srcH);
|
---|
449 |
|
---|
450 | /* helper function, code in DisplayPNGUtul.cpp */
|
---|
451 | int DisplayMakePNG(uint8_t *pu8Data, uint32_t cx, uint32_t cy,
|
---|
452 | uint8_t **ppu8PNG, uint32_t *pcbPNG, uint32_t *pcxPNG, uint32_t *pcyPNG,
|
---|
453 | uint8_t fLimitSize);
|
---|
454 |
|
---|
455 | class ATL_NO_VTABLE DisplaySourceBitmap:
|
---|
456 | public DisplaySourceBitmapWrap
|
---|
457 | {
|
---|
458 | public:
|
---|
459 |
|
---|
460 | DECLARE_EMPTY_CTOR_DTOR(DisplaySourceBitmap)
|
---|
461 |
|
---|
462 | HRESULT FinalConstruct();
|
---|
463 | void FinalRelease();
|
---|
464 |
|
---|
465 | /* Public initializer/uninitializer for internal purposes only. */
|
---|
466 | HRESULT init(ComObjPtr<Display> pDisplay, unsigned uScreenId, DISPLAYFBINFO *pFBInfo);
|
---|
467 | void uninit();
|
---|
468 |
|
---|
469 | bool i_usesVRAM(void) { return m.pu8Allocated == NULL; }
|
---|
470 |
|
---|
471 | private:
|
---|
472 | // wrapped IDisplaySourceBitmap properties
|
---|
473 | virtual HRESULT getScreenId(ULONG *aScreenId);
|
---|
474 |
|
---|
475 | // wrapped IDisplaySourceBitmap methods
|
---|
476 | virtual HRESULT queryBitmapInfo(BYTE **aAddress,
|
---|
477 | ULONG *aWidth,
|
---|
478 | ULONG *aHeight,
|
---|
479 | ULONG *aBitsPerPixel,
|
---|
480 | ULONG *aBytesPerLine,
|
---|
481 | ULONG *aPixelFormat);
|
---|
482 |
|
---|
483 | int initSourceBitmap(unsigned aScreenId, DISPLAYFBINFO *pFBInfo);
|
---|
484 |
|
---|
485 | struct Data
|
---|
486 | {
|
---|
487 | ComObjPtr<Display> pDisplay;
|
---|
488 | unsigned uScreenId;
|
---|
489 | DISPLAYFBINFO *pFBInfo;
|
---|
490 |
|
---|
491 | uint8_t *pu8Allocated;
|
---|
492 |
|
---|
493 | uint8_t *pu8Address;
|
---|
494 | ULONG ulWidth;
|
---|
495 | ULONG ulHeight;
|
---|
496 | ULONG ulBitsPerPixel;
|
---|
497 | ULONG ulBytesPerLine;
|
---|
498 | ULONG ulPixelFormat;
|
---|
499 | };
|
---|
500 |
|
---|
501 | Data m;
|
---|
502 | };
|
---|
503 |
|
---|
504 | #endif // ____H_DISPLAYIMPL
|
---|
505 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|