VirtualBox

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

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

Main/Display and Mouse: input mapping fix for when VMMDev is not in use.

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

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