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