1 | /* $Id: DisplayImpl.h 51762 2014-06-30 09:31:20Z 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.virtualbox.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 "VirtualBoxBase.h"
|
---|
22 | #include "SchemaDefs.h"
|
---|
23 |
|
---|
24 | #include <iprt/semaphore.h>
|
---|
25 | #include <VBox/vmm/pdmdrv.h>
|
---|
26 | #include <VBox/VMMDev.h>
|
---|
27 | #include <VBox/VBoxVideo.h>
|
---|
28 | #include <VBox/vmm/pdmifs.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 | FramebufferUpdateMode_T enmFramebufferUpdateMode;
|
---|
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 int getScreenResolution(uint32_t cScreen, ULONG *pcx,
|
---|
107 | ULONG *pcy, ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin) = 0;
|
---|
108 | virtual void 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 VirtualBoxBase,
|
---|
116 | VBOX_SCRIPTABLE_IMPL(IEventListener),
|
---|
117 | VBOX_SCRIPTABLE_IMPL(IDisplay),
|
---|
118 | public DisplayMouseInterface
|
---|
119 | {
|
---|
120 | public:
|
---|
121 |
|
---|
122 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Display, IDisplay)
|
---|
123 |
|
---|
124 | DECLARE_NOT_AGGREGATABLE(Display)
|
---|
125 |
|
---|
126 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
127 |
|
---|
128 | BEGIN_COM_MAP(Display)
|
---|
129 | VBOX_DEFAULT_INTERFACE_ENTRIES(IDisplay)
|
---|
130 | COM_INTERFACE_ENTRY(IEventListener)
|
---|
131 | END_COM_MAP()
|
---|
132 |
|
---|
133 | DECLARE_EMPTY_CTOR_DTOR(Display)
|
---|
134 |
|
---|
135 | HRESULT FinalConstruct();
|
---|
136 | void FinalRelease();
|
---|
137 |
|
---|
138 | // public initializer/uninitializer for internal purposes only
|
---|
139 | HRESULT init(Console *aParent);
|
---|
140 | void uninit();
|
---|
141 | int registerSSM(PUVM pUVM);
|
---|
142 |
|
---|
143 | // public methods only for internal purposes
|
---|
144 | int handleDisplayResize(unsigned uScreenId, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t w, uint32_t h, uint16_t flags);
|
---|
145 | void handleDisplayUpdateLegacy(int x, int y, int cx, int cy);
|
---|
146 | void handleDisplayUpdate(unsigned uScreenId, int x, int y, int w, int h);
|
---|
147 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
148 | int handleVHWACommandProcess(PVBOXVHWACMD pCommand);
|
---|
149 | #endif
|
---|
150 | #ifdef VBOX_WITH_CRHGSMI
|
---|
151 | void handleCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
|
---|
152 | void handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
|
---|
153 | void handleCrHgsmiCommandProcess(PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
|
---|
154 | void handleCrHgsmiControlProcess(PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl);
|
---|
155 | #endif
|
---|
156 | #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
|
---|
157 | int handleCrHgcmCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
|
---|
158 | PFNCRCTLCOMPLETION pfnCompletion,
|
---|
159 | void *pvCompletion);
|
---|
160 | void handleCrVRecScreenshotPerform(uint32_t uScreen,
|
---|
161 | uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBitsPerPixel,
|
---|
162 | uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight,
|
---|
163 | uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
|
---|
164 | bool handleCrVRecScreenshotBegin(uint32_t uScreen, uint64_t u64TimeStamp);
|
---|
165 | void handleCrVRecScreenshotEnd(uint32_t uScreen, uint64_t u64TimeStamp);
|
---|
166 | void handleVRecCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
|
---|
167 | #endif
|
---|
168 |
|
---|
169 | int notifyCroglResize(const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM);
|
---|
170 |
|
---|
171 | void getFramebufferDimensions(int32_t *px1, int32_t *py1, int32_t *px2, int32_t *py2);
|
---|
172 | int getScreenResolution(uint32_t cScreen, ULONG *pcx, ULONG *pcy,
|
---|
173 | ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin)
|
---|
174 | {
|
---|
175 | return GetScreenResolution(cScreen, pcx, pcy, pcBPP, pXOrigin, pYOrigin);
|
---|
176 | }
|
---|
177 |
|
---|
178 | int handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect);
|
---|
179 | int handleQueryVisibleRegion(uint32_t *pcRect, PRTRECT pRect);
|
---|
180 |
|
---|
181 | int VideoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory);
|
---|
182 | void VideoAccelFlush(void);
|
---|
183 | bool VideoAccelAllowed(void);
|
---|
184 | void VideoAccelVRDP(bool fEnable);
|
---|
185 |
|
---|
186 | int VideoCaptureStart();
|
---|
187 | void VideoCaptureStop();
|
---|
188 | int VideoCaptureEnableScreens(ComSafeArrayIn(BOOL, aScreens));
|
---|
189 |
|
---|
190 | void notifyPowerDown(void);
|
---|
191 |
|
---|
192 | // IEventListener methods
|
---|
193 | STDMETHOD(HandleEvent)(IEvent * aEvent);
|
---|
194 |
|
---|
195 | // IDisplay methods
|
---|
196 | STDMETHOD(GetScreenResolution)(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel, LONG *aXOrigin, LONG *aYOrigin);
|
---|
197 | STDMETHOD(AttachFramebuffer)(ULONG aScreenId,
|
---|
198 | IFramebuffer *aFramebuffer);
|
---|
199 | STDMETHOD(DetachFramebuffer)(ULONG aScreenId);
|
---|
200 | STDMETHOD(QueryFramebuffer)(ULONG aScreenId,
|
---|
201 | IFramebuffer **aFramebuffer);
|
---|
202 | STDMETHOD(SetVideoModeHint)(ULONG aDisplay, BOOL aEnabled, BOOL aChangeOrigin, LONG aOriginX, LONG aOriginY, ULONG aWidth, ULONG aHeight, ULONG aBitsPerPixel);
|
---|
203 | STDMETHOD(TakeScreenShot)(ULONG aScreenId, BYTE *address, ULONG width, ULONG height);
|
---|
204 | STDMETHOD(TakeScreenShotToArray)(ULONG aScreenId, ULONG width, ULONG height, ComSafeArrayOut(BYTE, aScreenData));
|
---|
205 | STDMETHOD(TakeScreenShotPNGToArray)(ULONG aScreenId, ULONG width, ULONG height, ComSafeArrayOut(BYTE, aScreenData));
|
---|
206 | STDMETHOD(DrawToScreen)(ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
|
---|
207 | STDMETHOD(InvalidateAndUpdate)();
|
---|
208 | STDMETHOD(SetSeamlessMode)(BOOL enabled);
|
---|
209 |
|
---|
210 | STDMETHOD(CompleteVHWACommand)(BYTE *pCommand);
|
---|
211 |
|
---|
212 | STDMETHOD(ViewportChanged)(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height);
|
---|
213 | STDMETHOD(QuerySourceBitmap)(ULONG aScreenId,
|
---|
214 | IDisplaySourceBitmap **aDisplaySourceBitmap);
|
---|
215 | STDMETHOD(SetFramebufferUpdateMode)(ULONG aScreenId,
|
---|
216 | FramebufferUpdateMode_T aFramebufferUpdateMode);
|
---|
217 |
|
---|
218 | static const PDMDRVREG DrvReg;
|
---|
219 |
|
---|
220 | private:
|
---|
221 |
|
---|
222 | #ifdef VBOX_WITH_CRHGSMI
|
---|
223 | void setupCrHgsmiData(void);
|
---|
224 | void destructCrHgsmiData(void);
|
---|
225 | #endif
|
---|
226 |
|
---|
227 | #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
|
---|
228 | int crViewportNotify(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height);
|
---|
229 | #endif
|
---|
230 |
|
---|
231 | static DECLCALLBACK(void*) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
|
---|
232 | static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
|
---|
233 | static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
|
---|
234 | static DECLCALLBACK(int) displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy);
|
---|
235 | static DECLCALLBACK(void) displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterface,
|
---|
236 | uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
|
---|
237 | static DECLCALLBACK(void) displayRefreshCallback(PPDMIDISPLAYCONNECTOR pInterface);
|
---|
238 | static DECLCALLBACK(void) displayResetCallback(PPDMIDISPLAYCONNECTOR pInterface);
|
---|
239 | static DECLCALLBACK(void) displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled);
|
---|
240 | static DECLCALLBACK(void) displayProcessAdapterDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, uint32_t u32VRAMSize);
|
---|
241 | static DECLCALLBACK(void) displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId);
|
---|
242 |
|
---|
243 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
244 | static DECLCALLBACK(int) displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand);
|
---|
245 | #endif
|
---|
246 |
|
---|
247 | #ifdef VBOX_WITH_CRHGSMI
|
---|
248 | static DECLCALLBACK(void) displayCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
|
---|
249 | static DECLCALLBACK(void) displayCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl);
|
---|
250 |
|
---|
251 | static DECLCALLBACK(void) displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
|
---|
252 | static DECLCALLBACK(void) displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
|
---|
253 | #endif
|
---|
254 | #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
|
---|
255 | static DECLCALLBACK(int) displayCrHgcmCtlSubmit(PPDMIDISPLAYCONNECTOR pInterface,
|
---|
256 | struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
|
---|
257 | PFNCRCTLCOMPLETION pfnCompletion,
|
---|
258 | void *pvCompletion);
|
---|
259 | static DECLCALLBACK(void) displayCrHgcmCtlSubmitCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
|
---|
260 | #endif
|
---|
261 | #ifdef VBOX_WITH_HGSMI
|
---|
262 | static DECLCALLBACK(int) displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags, bool fRenderThreadMode);
|
---|
263 | static DECLCALLBACK(void) displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
|
---|
264 | static DECLCALLBACK(void) displayVBVAUpdateBegin(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
|
---|
265 | static DECLCALLBACK(void) displayVBVAUpdateProcess(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, const PVBVACMDHDR pCmd, size_t cbCmd);
|
---|
266 | static DECLCALLBACK(void) displayVBVAUpdateEnd(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y, uint32_t cx, uint32_t cy);
|
---|
267 | static DECLCALLBACK(int) displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM);
|
---|
268 | static DECLCALLBACK(int) displayVBVAMousePointerShape(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha, uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy, const void *pvShape);
|
---|
269 | #endif
|
---|
270 |
|
---|
271 | #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
|
---|
272 | static DECLCALLBACK(void) displayCrVRecScreenshotPerform(void *pvCtx, uint32_t uScreen,
|
---|
273 | uint32_t x, uint32_t y,
|
---|
274 | uint32_t uBitsPerPixel, uint32_t uBytesPerLine,
|
---|
275 | uint32_t uGuestWidth, uint32_t uGuestHeight,
|
---|
276 | uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
|
---|
277 | static DECLCALLBACK(bool) displayCrVRecScreenshotBegin(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
|
---|
278 | static DECLCALLBACK(void) displayCrVRecScreenshotEnd(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
|
---|
279 |
|
---|
280 | static DECLCALLBACK(void) displayVRecCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
|
---|
281 | #endif
|
---|
282 | static DECLCALLBACK(void) displayCrCmdFree(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion);
|
---|
283 |
|
---|
284 | static DECLCALLBACK(void) displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser);
|
---|
285 | static DECLCALLBACK(int) displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
|
---|
286 | static DECLCALLBACK(void) displaySSMSave(PSSMHANDLE pSSM, void *pvUser);
|
---|
287 | static DECLCALLBACK(int) displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
|
---|
288 |
|
---|
289 | Console * const mParent;
|
---|
290 | /** Pointer to the associated display driver. */
|
---|
291 | struct DRVMAINDISPLAY *mpDrv;
|
---|
292 | /** Pointer to the device instance for the VMM Device. */
|
---|
293 | PPDMDEVINS mpVMMDev;
|
---|
294 | /** Set after the first attempt to find the VMM Device. */
|
---|
295 | bool mfVMMDevInited;
|
---|
296 |
|
---|
297 | unsigned mcMonitors;
|
---|
298 | DISPLAYFBINFO maFramebuffers[SchemaDefs::MaxGuestMonitors];
|
---|
299 |
|
---|
300 | bool mfSourceBitmapEnabled;
|
---|
301 | bool volatile fVGAResizing;
|
---|
302 |
|
---|
303 | VBVAMEMORY *mpVbvaMemory;
|
---|
304 | bool mfVideoAccelEnabled;
|
---|
305 | bool mfVideoAccelVRDP;
|
---|
306 | uint32_t mfu32SupportedOrders;
|
---|
307 |
|
---|
308 | int32_t volatile mcVideoAccelVRDPRefs;
|
---|
309 |
|
---|
310 | VBVAMEMORY *mpPendingVbvaMemory;
|
---|
311 | bool mfPendingVideoAccelEnable;
|
---|
312 | bool mfMachineRunning;
|
---|
313 | #ifdef VBOX_WITH_CROGL
|
---|
314 | bool mfCrOglDataHidden;
|
---|
315 | #endif
|
---|
316 |
|
---|
317 | uint8_t *mpu8VbvaPartial;
|
---|
318 | uint32_t mcbVbvaPartial;
|
---|
319 |
|
---|
320 | #ifdef VBOX_WITH_CRHGSMI
|
---|
321 | /* for fast host hgcm calls */
|
---|
322 | HGCMCVSHANDLE mhCrOglSvc;
|
---|
323 | RTCRITSECTRW mCrOglLock;
|
---|
324 | #endif
|
---|
325 | #ifdef VBOX_WITH_CROGL
|
---|
326 | CR_MAIN_INTERFACE mCrOglCallbacks;
|
---|
327 | volatile uint32_t mfCrOglVideoRecState;
|
---|
328 | CRVBOXHGCMTAKESCREENSHOT mCrOglScreenshotData;
|
---|
329 | VBOXCRCMDCTL_HGCM mCrOglScreenshotCtl;
|
---|
330 | #endif
|
---|
331 |
|
---|
332 | bool vbvaFetchCmd(VBVACMDHDR **ppHdr, uint32_t *pcbCmd);
|
---|
333 | void vbvaReleaseCmd(VBVACMDHDR *pHdr, int32_t cbCmd);
|
---|
334 |
|
---|
335 | void handleResizeCompletedEMT(unsigned uScreenId, BOOL fResizeContext);
|
---|
336 |
|
---|
337 | /* Old guest additions (3.x?) use VMMDev for VBVA and the host VBVA code (VideoAccel*)
|
---|
338 | * can be executed concurrently by VGA refresh timer and the guest VMMDev request
|
---|
339 | * in SMP VMs. The lock serialized this.
|
---|
340 | */
|
---|
341 | RTCRITSECT mVBVALock;
|
---|
342 | volatile uint32_t mfu32PendingVideoAccelDisable;
|
---|
343 |
|
---|
344 | int vbvaLock(void);
|
---|
345 | void vbvaUnlock(void);
|
---|
346 |
|
---|
347 | public:
|
---|
348 | bool vbvaLockIsOwner(void);
|
---|
349 |
|
---|
350 | static int displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height);
|
---|
351 |
|
---|
352 | #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
|
---|
353 | static BOOL displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *pu8Data, uint32_t u32Width, uint32_t u32Height);
|
---|
354 | int crCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, PFNCRCTLCOMPLETION pfnCompletion, void *pvCompletion);
|
---|
355 | int crCtlSubmitSync(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
|
---|
356 | /* copies the given command and submits it asynchronously,
|
---|
357 | * i.e. the pCmd data may be discarded right after the call returns */
|
---|
358 | int crCtlSubmitAsyncCmdCopy(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
|
---|
359 | /* performs synchronous request processing if 3D backend has something to display
|
---|
360 | * this is primarily to work-around 3d<->main thread deadlocks on OSX
|
---|
361 | * in case of async completion, the command is coppied to the allocated buffer,
|
---|
362 | * freeded on command completion
|
---|
363 | * can be used for "notification" commands, when client is not interested in command result,
|
---|
364 | * that must synchronize with 3D backend only when some 3D data is displayed.
|
---|
365 | * The routine does NOT provide any info on whether command is processed asynchronously or not */
|
---|
366 | int crCtlSubmitSyncIfHasDataForScreen(uint32_t u32ScreenID, struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
|
---|
367 | #endif
|
---|
368 |
|
---|
369 | private:
|
---|
370 | static void InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll);
|
---|
371 | static int drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
|
---|
372 |
|
---|
373 | int videoAccelRefreshProcess(void);
|
---|
374 |
|
---|
375 | /* Functions run under VBVA lock. */
|
---|
376 | int videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory);
|
---|
377 | int videoAccelFlush(void);
|
---|
378 |
|
---|
379 | #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
|
---|
380 | int crOglWindowsShow(bool fShow);
|
---|
381 | #endif
|
---|
382 |
|
---|
383 | #ifdef VBOX_WITH_HGSMI
|
---|
384 | volatile uint32_t mu32UpdateVBVAFlags;
|
---|
385 | #endif
|
---|
386 |
|
---|
387 | #ifdef VBOX_WITH_VPX
|
---|
388 | VIDEORECCONTEXT *mpVideoRecCtx;
|
---|
389 | bool maVideoRecEnabled[SchemaDefs::MaxGuestMonitors];
|
---|
390 | #endif
|
---|
391 | };
|
---|
392 |
|
---|
393 | void gdImageCopyResampled(uint8_t *dst, uint8_t *src,
|
---|
394 | int dstX, int dstY, int srcX, int srcY,
|
---|
395 | int dstW, int dstH, int srcW, int srcH);
|
---|
396 |
|
---|
397 | void BitmapScale32(uint8_t *dst, int dstW, int dstH,
|
---|
398 | const uint8_t *src, int iDeltaLine, int srcW, int srcH);
|
---|
399 |
|
---|
400 | int DisplayMakePNG(uint8_t *pu8Data, uint32_t cx, uint32_t cy,
|
---|
401 | uint8_t **ppu8PNG, uint32_t *pcbPNG, uint32_t *pcxPNG, uint32_t *pcyPNG,
|
---|
402 | uint8_t fLimitSize);
|
---|
403 |
|
---|
404 | class ATL_NO_VTABLE DisplaySourceBitmap:
|
---|
405 | public DisplaySourceBitmapWrap
|
---|
406 | {
|
---|
407 | public:
|
---|
408 |
|
---|
409 | DECLARE_EMPTY_CTOR_DTOR(DisplaySourceBitmap)
|
---|
410 |
|
---|
411 | HRESULT FinalConstruct();
|
---|
412 | void FinalRelease();
|
---|
413 |
|
---|
414 | /* Public initializer/uninitializer for internal purposes only. */
|
---|
415 | HRESULT init(ComObjPtr<Display> pDisplay, unsigned uScreenId, DISPLAYFBINFO *pFBInfo);
|
---|
416 | void uninit();
|
---|
417 |
|
---|
418 | bool usesVRAM(void) { return m.pu8Allocated == NULL; }
|
---|
419 |
|
---|
420 | private:
|
---|
421 | // wrapped IDisplaySourceBitmap properties
|
---|
422 | virtual HRESULT getScreenId(ULONG *aScreenId);
|
---|
423 |
|
---|
424 | // wrapped IDisplaySourceBitmap methods
|
---|
425 | virtual HRESULT queryBitmapInfo(BYTE **aAddress,
|
---|
426 | ULONG *aWidth,
|
---|
427 | ULONG *aHeight,
|
---|
428 | ULONG *aBitsPerPixel,
|
---|
429 | ULONG *aBytesPerLine,
|
---|
430 | ULONG *aPixelFormat);
|
---|
431 |
|
---|
432 | int initSourceBitmap(unsigned aScreenId, DISPLAYFBINFO *pFBInfo);
|
---|
433 |
|
---|
434 | struct Data
|
---|
435 | {
|
---|
436 | ComObjPtr<Display> pDisplay;
|
---|
437 | unsigned uScreenId;
|
---|
438 | DISPLAYFBINFO *pFBInfo;
|
---|
439 |
|
---|
440 | uint8_t *pu8Allocated;
|
---|
441 |
|
---|
442 | uint8_t *pu8Address;
|
---|
443 | ULONG ulWidth;
|
---|
444 | ULONG ulHeight;
|
---|
445 | ULONG ulBitsPerPixel;
|
---|
446 | ULONG ulBytesPerLine;
|
---|
447 | ULONG ulPixelFormat;
|
---|
448 | };
|
---|
449 |
|
---|
450 | Data m;
|
---|
451 | };
|
---|
452 |
|
---|
453 | #endif // ____H_DISPLAYIMPL
|
---|
454 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|