VirtualBox

source: vbox/trunk/src/VBox/Main/include/DisplayImpl.h@ 55631

Last change on this file since 55631 was 55133, checked in by vboxsync, 10 years ago

Main,Frontends: framebuffer identifier.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 24.4 KB
Line 
1/* $Id: DisplayImpl.h 55133 2015-04-08 13:12:53Z vboxsync $ */
2/** @file
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2015 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 "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
36class Console;
37struct VIDEORECCONTEXT;
38
39typedef struct _DISPLAYFBINFO
40{
41 /* The following 3 fields (u32Offset, u32MaxFramebufferSize and u32InformationSize)
42 * are not used by the current HGSMI. They are needed for backward compatibility with
43 * pre-HGSMI additions.
44 */
45 uint32_t u32Offset;
46 uint32_t u32MaxFramebufferSize;
47 uint32_t u32InformationSize;
48
49 ComPtr<IFramebuffer> pFramebuffer;
50 com::Guid framebufferId;
51 ComPtr<IDisplaySourceBitmap> pSourceBitmap;
52 bool fDisabled;
53
54 uint32_t u32Caps;
55
56 struct
57 {
58 ComPtr<IDisplaySourceBitmap> pSourceBitmap;
59 uint8_t *pu8Address;
60 uint32_t cbLine;
61 } updateImage;
62
63 LONG xOrigin;
64 LONG yOrigin;
65
66 ULONG w;
67 ULONG h;
68
69 uint16_t u16BitsPerPixel;
70 uint8_t *pu8FramebufferVRAM;
71 uint32_t u32LineSize;
72
73 uint16_t flags;
74
75 VBOXVIDEOINFOHOSTEVENTS *pHostEvents;
76
77 /** The framebuffer has default format and must be updates immediately. */
78 bool fDefaultFormat;
79
80#ifdef VBOX_WITH_HGSMI
81 bool fVBVAEnabled;
82 bool fVBVAForceResize;
83 bool fRenderThreadMode;
84 PVBVAHOSTFLAGS pVBVAHostFlags;
85#endif /* VBOX_WITH_HGSMI */
86
87#ifdef VBOX_WITH_CROGL
88 struct
89 {
90 bool fPending;
91 ULONG x;
92 ULONG y;
93 ULONG width;
94 ULONG height;
95 } pendingViewportInfo;
96#endif /* VBOX_WITH_CROGL */
97} DISPLAYFBINFO;
98
99/* The legacy VBVA (VideoAccel) data.
100 *
101 * Backward compatibility with the guest additions 3.x or older.
102 */
103typedef struct VIDEOACCEL
104{
105 VBVAMEMORY *pVbvaMemory;
106 bool fVideoAccelEnabled;
107
108 uint8_t *pu8VbvaPartial;
109 uint32_t cbVbvaPartial;
110
111 /* Old guest additions (3.x and older) use both VMMDev and DevVGA refresh timer
112 * to process the VBVABUFFER memory. Therefore the legacy VBVA (VideoAccel) host
113 * code can be executed concurrently by VGA refresh timer and the guest VMMDev
114 * request in SMP VMs. The semaphore serialized this.
115 */
116 RTSEMXROADS hXRoadsVideoAccel;
117
118} VIDEOACCEL;
119
120class DisplayMouseInterface
121{
122public:
123 virtual HRESULT i_getScreenResolution(ULONG cScreen, ULONG *pcx,
124 ULONG *pcy, ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin) = 0;
125 virtual void i_getFramebufferDimensions(int32_t *px1, int32_t *py1,
126 int32_t *px2, int32_t *py2) = 0;
127 virtual HRESULT i_reportHostCursorCapabilities(uint32_t fCapabilitiesAdded, uint32_t fCapabilitiesRemoved) = 0;
128 virtual HRESULT i_reportHostCursorPosition(int32_t x, int32_t y) = 0;
129 virtual bool i_isInputMappingSet(void) = 0;
130};
131
132class VMMDev;
133
134class ATL_NO_VTABLE Display :
135 public DisplayWrap,
136 public DisplayMouseInterface
137{
138public:
139
140 DECLARE_EMPTY_CTOR_DTOR(Display)
141
142 HRESULT FinalConstruct();
143 void FinalRelease();
144
145 // public initializer/uninitializer for internal purposes only
146 HRESULT init(Console *aParent);
147 void uninit();
148 int i_registerSSM(PUVM pUVM);
149
150 // public methods only for internal purposes
151 int i_handleDisplayResize(unsigned uScreenId, uint32_t bpp, void *pvVRAM, uint32_t cbLine,
152 uint32_t w, uint32_t h, uint16_t flags);
153 void i_handleDisplayUpdate(unsigned uScreenId, int x, int y, int w, int h);
154 void i_handleUpdateVMMDevSupportsGraphics(bool fSupportsGraphics);
155 void i_handleUpdateGuestVBVACapabilities(uint32_t fNewCapabilities);
156 void i_handleUpdateVBVAInputMapping(int32_t xOrigin, int32_t yOrigin, uint32_t cx, uint32_t cy);
157#ifdef VBOX_WITH_VIDEOHWACCEL
158 int i_handleVHWACommandProcess(PVBOXVHWACMD pCommand);
159#endif
160#ifdef VBOX_WITH_CRHGSMI
161 void i_handleCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
162 void i_handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
163 void i_handleCrHgsmiCommandProcess(PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
164 void i_handleCrHgsmiControlProcess(PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl);
165#endif
166#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
167 int i_handleCrHgcmCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
168 PFNCRCTLCOMPLETION pfnCompletion,
169 void *pvCompletion);
170 void i_handleCrVRecScreenshotPerform(uint32_t uScreen,
171 uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBitsPerPixel,
172 uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight,
173 uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
174 bool i_handleCrVRecScreenshotBegin(uint32_t uScreen, uint64_t u64TimeStamp);
175 void i_handleCrVRecScreenshotEnd(uint32_t uScreen, uint64_t u64TimeStamp);
176 void i_handleVRecCompletion();
177#endif
178
179 int i_notifyCroglResize(const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM);
180
181 int i_handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect);
182 int i_handleQueryVisibleRegion(uint32_t *pcRect, PRTRECT pRect);
183
184 void i_VideoAccelVRDP(bool fEnable);
185
186 /* Legacy video acceleration requests coming from the VGA refresh timer. */
187 int VideoAccelEnableVGA(bool fEnable, VBVAMEMORY *pVbvaMemory);
188
189 /* Legacy video acceleration requests coming from VMMDev. */
190 int VideoAccelEnableVMMDev(bool fEnable, VBVAMEMORY *pVbvaMemory);
191 void VideoAccelFlushVMMDev(void);
192
193 int i_VideoCaptureStart();
194 void i_VideoCaptureStop();
195 int i_VideoCaptureEnableScreens(ComSafeArrayIn(BOOL, aScreens));
196
197 void i_notifyPowerDown(void);
198
199 // DisplayMouseInterface methods
200 virtual HRESULT i_getScreenResolution(ULONG cScreen, ULONG *pcx,
201 ULONG *pcy, ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin)
202 {
203 return getScreenResolution(cScreen, pcx, pcy, pcBPP, pXOrigin, pYOrigin, NULL);
204 }
205 virtual void i_getFramebufferDimensions(int32_t *px1, int32_t *py1,
206 int32_t *px2, int32_t *py2);
207 virtual HRESULT i_reportHostCursorCapabilities(uint32_t fCapabilitiesAdded, uint32_t fCapabilitiesRemoved);
208 virtual HRESULT i_reportHostCursorPosition(int32_t x, int32_t y);
209 virtual bool i_isInputMappingSet(void)
210 {
211 return cxInputMapping != 0 && cyInputMapping != 0;
212 }
213
214 static const PDMDRVREG DrvReg;
215
216private:
217 // Wrapped IDisplay properties
218
219 // Wrapped IDisplay methods
220 virtual HRESULT getScreenResolution(ULONG aScreenId,
221 ULONG *aWidth,
222 ULONG *aHeight,
223 ULONG *aBitsPerPixel,
224 LONG *aXOrigin,
225 LONG *aYOrigin,
226 GuestMonitorStatus_T *aGuestMonitorStatus);
227 virtual HRESULT attachFramebuffer(ULONG aScreenId,
228 const ComPtr<IFramebuffer> &aFramebuffer,
229 com::Guid &aId);
230 virtual HRESULT detachFramebuffer(ULONG aScreenId,
231 const com::Guid &aId);
232 virtual HRESULT queryFramebuffer(ULONG aScreenId,
233 ComPtr<IFramebuffer> &aFramebuffer);
234 virtual HRESULT setVideoModeHint(ULONG aDisplay,
235 BOOL aEnabled,
236 BOOL aChangeOrigin,
237 LONG aOriginX,
238 LONG aOriginY,
239 ULONG aWidth,
240 ULONG aHeight,
241 ULONG aBitsPerPixel);
242 virtual HRESULT setSeamlessMode(BOOL aEnabled);
243 virtual HRESULT takeScreenShot(ULONG aScreenId,
244 BYTE *aAddress,
245 ULONG aWidth,
246 ULONG aHeight,
247 BitmapFormat_T aBitmapFormat);
248 virtual HRESULT takeScreenShotToArray(ULONG aScreenId,
249 ULONG aWidth,
250 ULONG aHeight,
251 BitmapFormat_T aBitmapFormat,
252 std::vector<BYTE> &aScreenData);
253 virtual HRESULT drawToScreen(ULONG aScreenId,
254 BYTE *aAddress,
255 ULONG aX,
256 ULONG aY,
257 ULONG aWidth,
258 ULONG aHeight);
259 virtual HRESULT invalidateAndUpdate();
260 virtual HRESULT invalidateAndUpdateScreen(ULONG aScreenId);
261 virtual HRESULT completeVHWACommand(BYTE *aCommand);
262 virtual HRESULT viewportChanged(ULONG aScreenId,
263 ULONG aX,
264 ULONG aY,
265 ULONG aWidth,
266 ULONG aHeight);
267 virtual HRESULT querySourceBitmap(ULONG aScreenId,
268 ComPtr<IDisplaySourceBitmap> &aDisplaySourceBitmap);
269 virtual HRESULT notifyScaleFactorChange(ULONG aScreenId,
270 ULONG aScaleFactorWMultiplied,
271 ULONG aScaleFactorHMultiplied);
272 virtual HRESULT notifyHiDPIOutputPolicyChange(BOOL fUnscaledHiDPI);
273
274 // Wrapped IEventListener properties
275
276 // Wrapped IEventListener methods
277 virtual HRESULT handleEvent(const ComPtr<IEvent> &aEvent);
278
279 // other internal methods
280 HRESULT takeScreenShotWorker(ULONG aScreenId,
281 BYTE *aAddress,
282 ULONG aWidth,
283 ULONG aHeight,
284 BitmapFormat_T aBitmapFormat,
285 ULONG *pcbOut);
286
287#ifdef VBOX_WITH_CRHGSMI
288 void i_setupCrHgsmiData(void);
289 void i_destructCrHgsmiData(void);
290#endif
291
292#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
293 int i_crViewportNotify(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height);
294#endif
295
296 static DECLCALLBACK(void*) i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
297 static DECLCALLBACK(int) i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
298 static DECLCALLBACK(void) i_drvDestruct(PPDMDRVINS pDrvIns);
299 static DECLCALLBACK(int) i_displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM,
300 uint32_t cbLine, uint32_t cx, uint32_t cy);
301 static DECLCALLBACK(void) i_displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterface,
302 uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
303 static DECLCALLBACK(void) i_displayRefreshCallback(PPDMIDISPLAYCONNECTOR pInterface);
304 static DECLCALLBACK(void) i_displayResetCallback(PPDMIDISPLAYCONNECTOR pInterface);
305 static DECLCALLBACK(void) i_displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled);
306 static DECLCALLBACK(void) i_displayProcessAdapterDataCallback(PPDMIDISPLAYCONNECTOR pInterface,
307 void *pvVRAM, uint32_t u32VRAMSize);
308 static DECLCALLBACK(void) i_displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface,
309 void *pvVRAM, unsigned uScreenId);
310
311#ifdef VBOX_WITH_VIDEOHWACCEL
312 static DECLCALLBACK(int) i_displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand);
313#endif
314
315#ifdef VBOX_WITH_CRHGSMI
316 static DECLCALLBACK(void) i_displayCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface,
317 PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
318 static DECLCALLBACK(void) i_displayCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl,
319 uint32_t cbCtl);
320
321 static DECLCALLBACK(void) i_displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
322 void *pvContext);
323 static DECLCALLBACK(void) i_displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
324 void *pvContext);
325#endif
326#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
327 static DECLCALLBACK(int) i_displayCrHgcmCtlSubmit(PPDMIDISPLAYCONNECTOR pInterface,
328 struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
329 PFNCRCTLCOMPLETION pfnCompletion,
330 void *pvCompletion);
331 static DECLCALLBACK(void) i_displayCrHgcmCtlSubmitCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
332 void *pvContext);
333#endif
334#ifdef VBOX_WITH_HGSMI
335 static DECLCALLBACK(int) i_displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
336 PVBVAHOSTFLAGS pHostFlags, bool fRenderThreadMode);
337 static DECLCALLBACK(void) i_displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
338 static DECLCALLBACK(void) i_displayVBVAUpdateBegin(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
339 static DECLCALLBACK(void) i_displayVBVAUpdateProcess(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
340 const PVBVACMDHDR pCmd, size_t cbCmd);
341 static DECLCALLBACK(void) i_displayVBVAUpdateEnd(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y,
342 uint32_t cx, uint32_t cy);
343 static DECLCALLBACK(int) i_displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, const PVBVAINFOVIEW pView,
344 const PVBVAINFOSCREEN pScreen, void *pvVRAM);
345 static DECLCALLBACK(int) i_displayVBVAMousePointerShape(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha,
346 uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy,
347 const void *pvShape);
348 static DECLCALLBACK(void) i_displayVBVAGuestCapabilityUpdate(PPDMIDISPLAYCONNECTOR pInterface, uint32_t fCapabilities);
349
350 static DECLCALLBACK(void) i_displayVBVAInputMappingUpdate(PPDMIDISPLAYCONNECTOR pInterface, int32_t xOrigin, int32_t yOrigin,
351 uint32_t cx, uint32_t cy);
352#endif
353
354#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
355 static DECLCALLBACK(void) i_displayCrVRecScreenshotPerform(void *pvCtx, uint32_t uScreen,
356 uint32_t x, uint32_t y,
357 uint32_t uBitsPerPixel, uint32_t uBytesPerLine,
358 uint32_t uGuestWidth, uint32_t uGuestHeight,
359 uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
360 static DECLCALLBACK(bool) i_displayCrVRecScreenshotBegin(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
361 static DECLCALLBACK(void) i_displayCrVRecScreenshotEnd(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
362
363 static DECLCALLBACK(void) i_displayVRecCompletion(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion);
364#endif
365 static DECLCALLBACK(void) i_displayCrCmdFree(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion);
366
367 static DECLCALLBACK(void) i_displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser);
368 static DECLCALLBACK(int) i_displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
369 static DECLCALLBACK(void) i_displaySSMSave(PSSMHANDLE pSSM, void *pvUser);
370 static DECLCALLBACK(int) i_displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
371
372 Console * const mParent;
373 /** Pointer to the associated display driver. */
374 struct DRVMAINDISPLAY *mpDrv;
375 /** Pointer to the device instance for the VMM Device. */
376 PPDMDEVINS mpVMMDev;
377 /** Set after the first attempt to find the VMM Device. */
378 bool mfVMMDevInited;
379
380 unsigned mcMonitors;
381 /** Input mapping rectangle top left X relative to the first screen. */
382 int32_t xInputMappingOrigin;
383 /** Input mapping rectangle top left Y relative to the first screen. */
384 int32_t yInputMappingOrigin;
385 uint32_t cxInputMapping; /**< Input mapping rectangle width. */
386 uint32_t cyInputMapping; /**< Input mapping rectangle height. */
387 DISPLAYFBINFO maFramebuffers[SchemaDefs::MaxGuestMonitors];
388 /** Does the VMM device have the "supports graphics" capability set?
389 * Does not go into the saved state as it is refreshed on restore. */
390 bool mfVMMDevSupportsGraphics;
391 /** Mirror of the current guest VBVA capabilities. */
392 uint32_t mfGuestVBVACapabilities;
393 /** Mirror of the current host cursor capabilities. */
394 uint32_t mfHostCursorCapabilities;
395
396 bool mfSourceBitmapEnabled;
397 bool volatile fVGAResizing;
398
399 bool mfVideoAccelVRDP;
400 uint32_t mfu32SupportedOrders;
401 int32_t volatile mcVideoAccelVRDPRefs;
402
403 /** Accelerate3DEnabled = true && GraphicsControllerType == VBoxVGA. */
404 bool mfIsCr3DEnabled;
405
406#ifdef VBOX_WITH_CROGL
407 bool mfCrOglDataHidden;
408#endif
409
410#ifdef VBOX_WITH_CRHGSMI
411 /* for fast host hgcm calls */
412 HGCMCVSHANDLE mhCrOglSvc;
413 RTCRITSECTRW mCrOglLock;
414#endif
415#ifdef VBOX_WITH_CROGL
416 CR_MAIN_INTERFACE mCrOglCallbacks;
417 volatile uint32_t mfCrOglVideoRecState;
418 CRVBOXHGCMTAKESCREENSHOT mCrOglScreenshotData;
419 VBOXCRCMDCTL_HGCM mCrOglScreenshotCtl;
420#endif
421
422 /* The legacy VBVA data and methods. */
423 VIDEOACCEL mVideoAccelLegacy;
424
425 int i_VideoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory, PPDMIDISPLAYPORT pUpPort);
426 void i_VideoAccelFlush(PPDMIDISPLAYPORT pUpPort);
427 bool i_VideoAccelAllowed(void);
428
429 int i_videoAccelRefreshProcess(PPDMIDISPLAYPORT pUpPort);
430 int i_videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory, PPDMIDISPLAYPORT pUpPort);
431 int i_videoAccelFlush(PPDMIDISPLAYPORT pUpPort);
432
433 /* Legacy pre-HGSMI handlers. */
434 void processAdapterData(void *pvVRAM, uint32_t u32VRAMSize);
435 void processDisplayData(void *pvVRAM, unsigned uScreenId);
436
437 /* Serializes access to mVideoAccelLegacy and mfVideoAccelVRDP, etc between VRDP and Display. */
438 RTCRITSECT mVideoAccelLock;
439
440public:
441
442 static int i_displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData,
443 uint32_t *pu32Width, uint32_t *pu32Height);
444
445#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
446 static BOOL i_displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *pu8Data,
447 uint32_t u32Width, uint32_t u32Height);
448 int i_crCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, PFNCRCTLCOMPLETION pfnCompletion, void *pvCompletion);
449 int i_crCtlSubmitSync(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
450 /* copies the given command and submits it asynchronously,
451 * i.e. the pCmd data may be discarded right after the call returns */
452 int i_crCtlSubmitAsyncCmdCopy(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
453 /* performs synchronous request processing if 3D backend has something to display
454 * this is primarily to work-around 3d<->main thread deadlocks on OSX
455 * in case of async completion, the command is coppied to the allocated buffer,
456 * freeded on command completion
457 * can be used for "notification" commands, when client is not interested in command result,
458 * that must synchronize with 3D backend only when some 3D data is displayed.
459 * The routine does NOT provide any info on whether command is processed asynchronously or not */
460 int i_crCtlSubmitSyncIfHasDataForScreen(uint32_t u32ScreenID, struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
461#endif
462
463private:
464 static int i_InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll);
465 static int i_drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
466
467 void i_updateGuestGraphicsFacility(void);
468
469#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
470 int i_crOglWindowsShow(bool fShow);
471#endif
472
473#ifdef VBOX_WITH_HGSMI
474 volatile uint32_t mu32UpdateVBVAFlags;
475#endif
476
477#ifdef VBOX_WITH_VPX
478 VIDEORECCONTEXT *mpVideoRecCtx;
479 bool maVideoRecEnabled[SchemaDefs::MaxGuestMonitors];
480#endif
481};
482
483/* The legacy VBVA helpers. */
484int videoAccelConstruct(VIDEOACCEL *pVideoAccel);
485void videoAccelDestroy(VIDEOACCEL *pVideoAccel);
486void i_vbvaSetMemoryFlags(VBVAMEMORY *pVbvaMemory,
487 bool fVideoAccelEnabled,
488 bool fVideoAccelVRDP,
489 uint32_t fu32SupportedOrders,
490 DISPLAYFBINFO *paFBInfos,
491 unsigned cFBInfos);
492int videoAccelEnterVGA(VIDEOACCEL *pVideoAccel);
493void videoAccelLeaveVGA(VIDEOACCEL *pVideoAccel);
494int videoAccelEnterVMMDev(VIDEOACCEL *pVideoAccel);
495void videoAccelLeaveVMMDev(VIDEOACCEL *pVideoAccel);
496
497
498/* helper function, code in DisplayResampleImage.cpp */
499void gdImageCopyResampled(uint8_t *dst, uint8_t *src,
500 int dstX, int dstY, int srcX, int srcY,
501 int dstW, int dstH, int srcW, int srcH);
502
503void BitmapScale32(uint8_t *dst, int dstW, int dstH,
504 const uint8_t *src, int iDeltaLine, int srcW, int srcH);
505
506/* helper function, code in DisplayPNGUtul.cpp */
507int DisplayMakePNG(uint8_t *pu8Data, uint32_t cx, uint32_t cy,
508 uint8_t **ppu8PNG, uint32_t *pcbPNG, uint32_t *pcxPNG, uint32_t *pcyPNG,
509 uint8_t fLimitSize);
510
511class ATL_NO_VTABLE DisplaySourceBitmap:
512 public DisplaySourceBitmapWrap
513{
514public:
515
516 DECLARE_EMPTY_CTOR_DTOR(DisplaySourceBitmap)
517
518 HRESULT FinalConstruct();
519 void FinalRelease();
520
521 /* Public initializer/uninitializer for internal purposes only. */
522 HRESULT init(ComObjPtr<Display> pDisplay, unsigned uScreenId, DISPLAYFBINFO *pFBInfo);
523 void uninit();
524
525 bool i_usesVRAM(void) { return m.pu8Allocated == NULL; }
526
527private:
528 // wrapped IDisplaySourceBitmap properties
529 virtual HRESULT getScreenId(ULONG *aScreenId);
530
531 // wrapped IDisplaySourceBitmap methods
532 virtual HRESULT queryBitmapInfo(BYTE **aAddress,
533 ULONG *aWidth,
534 ULONG *aHeight,
535 ULONG *aBitsPerPixel,
536 ULONG *aBytesPerLine,
537 BitmapFormat_T *aBitmapFormat);
538
539 int initSourceBitmap(unsigned aScreenId, DISPLAYFBINFO *pFBInfo);
540
541 struct Data
542 {
543 ComObjPtr<Display> pDisplay;
544 unsigned uScreenId;
545 DISPLAYFBINFO *pFBInfo;
546
547 uint8_t *pu8Allocated;
548
549 uint8_t *pu8Address;
550 ULONG ulWidth;
551 ULONG ulHeight;
552 ULONG ulBitsPerPixel;
553 ULONG ulBytesPerLine;
554 BitmapFormat_T bitmapFormat;
555 };
556
557 Data m;
558};
559
560#endif // ____H_DISPLAYIMPL
561/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette