VirtualBox

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

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

Main/Display: do not send ACPI events if host cursor capabilities have not changed and remember guest VBVA and host cursor capabilities in the saved state.

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