VirtualBox

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

Last change on this file was 106061, checked in by vboxsync, 2 days ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 24.7 KB
RevLine 
[13607]1/* $Id: DisplayImpl.h 106061 2024-09-16 14:03:52Z vboxsync $ */
[1]2/** @file
3 * VirtualBox COM class implementation
4 */
5
6/*
[106061]7 * Copyright (C) 2006-2024 Oracle and/or its affiliates.
[1]8 *
[96407]9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
[1]26 */
27
[76562]28#ifndef MAIN_INCLUDED_DisplayImpl_h
29#define MAIN_INCLUDED_DisplayImpl_h
[76487]30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
[1]33
[3153]34#include "SchemaDefs.h"
[13606]35
[1]36#include <iprt/semaphore.h>
[35346]37#include <VBox/vmm/pdmdrv.h>
[65381]38#include <VBoxVideo.h>
[50848]39#include <VBox/vmm/pdmifs.h>
[78784]40#include <VBox/VMMDev.h> /* For struct VMMDevDisplayDef - why is it in that file? */
[52064]41#include "DisplayWrap.h"
[1]42
[51436]43#include "DisplaySourceBitmapWrap.h"
[72352]44#include "GuestScreenInfoWrap.h"
[51436]45
[105006]46#ifdef VBOX_WITH_RECORDING
47# include "RecordingInternals.h"
[105095]48class RecordingContext;
[105006]49#endif
[66396]50
[1]51class Console;
52
[3153]53typedef struct _DISPLAYFBINFO
54{
[52769]55 /* The following 3 fields (u32Offset, u32MaxFramebufferSize and u32InformationSize)
56 * are not used by the current HGSMI. They are needed for backward compatibility with
57 * pre-HGSMI additions.
58 */
[3153]59 uint32_t u32Offset;
60 uint32_t u32MaxFramebufferSize;
61 uint32_t u32InformationSize;
62
63 ComPtr<IFramebuffer> pFramebuffer;
[55133]64 com::Guid framebufferId;
[51436]65 ComPtr<IDisplaySourceBitmap> pSourceBitmap;
[35177]66 bool fDisabled;
[3153]67
[52574]68 uint32_t u32Caps;
[51627]69
70 struct
71 {
72 ComPtr<IDisplaySourceBitmap> pSourceBitmap;
73 uint8_t *pu8Address;
74 uint32_t cbLine;
75 } updateImage;
76
[3153]77 LONG xOrigin;
78 LONG yOrigin;
79
80 ULONG w;
81 ULONG h;
82
[27751]83 uint16_t u16BitsPerPixel;
84 uint8_t *pu8FramebufferVRAM;
85 uint32_t u32LineSize;
86
[35148]87 uint16_t flags;
[48955]88
[3153]89 VBOXVIDEOINFOHOSTEVENTS *pHostEvents;
90
[51476]91 /** The framebuffer has default format and must be updates immediately. */
[3153]92 bool fDefaultFormat;
[13606]93
[22412]94#ifdef VBOX_WITH_HGSMI
95 bool fVBVAEnabled;
[50260]96 bool fVBVAForceResize;
[71619]97 VBVAHOSTFLAGS RT_UNTRUSTED_VOLATILE_GUEST *pVBVAHostFlags;
[22412]98#endif /* VBOX_WITH_HGSMI */
[50095]99
[78784]100 /** Description of the currently plugged monitor with preferred mode,
101 * a.k.a the last mode hint sent. */
102 struct VMMDevDisplayDef monitorDesc;
[3153]103} DISPLAYFBINFO;
104
[52769]105/* The legacy VBVA (VideoAccel) data.
106 *
[84564]107 * Backward compatibility with the Guest Additions 3.x or older.
[52769]108 */
109typedef struct VIDEOACCEL
110{
111 VBVAMEMORY *pVbvaMemory;
112 bool fVideoAccelEnabled;
113
114 uint8_t *pu8VbvaPartial;
115 uint32_t cbVbvaPartial;
116
[84564]117 /* Old Guest Additions (3.x and older) use both VMMDev and DevVGA refresh timer
[52769]118 * to process the VBVABUFFER memory. Therefore the legacy VBVA (VideoAccel) host
119 * code can be executed concurrently by VGA refresh timer and the guest VMMDev
120 * request in SMP VMs. The semaphore serialized this.
121 */
122 RTSEMXROADS hXRoadsVideoAccel;
123
124} VIDEOACCEL;
125
[47190]126class DisplayMouseInterface
127{
128public:
[84342]129 virtual ~DisplayMouseInterface() { }
[52064]130 virtual HRESULT i_getScreenResolution(ULONG cScreen, ULONG *pcx,
131 ULONG *pcy, ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin) = 0;
132 virtual void i_getFramebufferDimensions(int32_t *px1, int32_t *py1,
133 int32_t *px2, int32_t *py2) = 0;
[53965]134 virtual HRESULT i_reportHostCursorCapabilities(uint32_t fCapabilitiesAdded, uint32_t fCapabilitiesRemoved) = 0;
[77451]135 virtual HRESULT i_reportHostCursorPosition(int32_t x, int32_t y, bool fOutOfRange) = 0;
[54495]136 virtual bool i_isInputMappingSet(void) = 0;
[47190]137};
138
[50095]139class VMMDev;
140
[1]141class ATL_NO_VTABLE Display :
[52064]142 public DisplayWrap,
[47190]143 public DisplayMouseInterface
[1]144{
145public:
146
[90828]147 DECLARE_COMMON_CLASS_METHODS(Display)
[13606]148
[1]149 HRESULT FinalConstruct();
150 void FinalRelease();
151
152 // public initializer/uninitializer for internal purposes only
[45674]153 HRESULT init(Console *aParent);
[1]154 void uninit();
[52064]155 int i_registerSSM(PUVM pUVM);
[1]156
157 // public methods only for internal purposes
[81964]158 unsigned i_getMonitorCount() { return mcMonitors; }
[66328]159 int i_handleDisplayResize(unsigned uScreenId, uint32_t bpp, void *pvVRAM,
160 uint32_t cbLine, uint32_t w, uint32_t h, uint16_t flags,
[66400]161 int32_t xOrigin, int32_t yOrigin, bool fVGAResize);
[52064]162 void i_handleDisplayUpdate(unsigned uScreenId, int x, int y, int w, int h);
[53528]163 void i_handleUpdateVMMDevSupportsGraphics(bool fSupportsGraphics);
164 void i_handleUpdateGuestVBVACapabilities(uint32_t fNewCapabilities);
[53965]165 void i_handleUpdateVBVAInputMapping(int32_t xOrigin, int32_t yOrigin, uint32_t cx, uint32_t cy);
[19844]166#ifdef VBOX_WITH_VIDEOHWACCEL
[71626]167 int i_handleVHWACommandProcess(int enmCmd, bool fGuestCmd, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand);
[19844]168#endif
[84740]169 int i_handle3DNotifyProcess(VBOX3DNOTIFY *p3DNotify);
[50178]170
[56468]171 int i_saveVisibleRegion(uint32_t cRect, PRTRECT pRect);
[52064]172 int i_handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect);
[90691]173 int i_handleUpdateMonitorPositions(uint32_t cPositions, PCRTPOINT paPositions);
[63240]174 int i_handleQueryVisibleRegion(uint32_t *pcRects, PRTRECT paRects);
[35304]175
[77370]176 void i_VRDPConnectionEvent(bool fConnect);
177 void i_VideoAccelVRDP(bool fEnable, int c);
[1]178
[52652]179 /* Legacy video acceleration requests coming from the VGA refresh timer. */
180 int VideoAccelEnableVGA(bool fEnable, VBVAMEMORY *pVbvaMemory);
181
182 /* Legacy video acceleration requests coming from VMMDev. */
183 int VideoAccelEnableVMMDev(bool fEnable, VBVAMEMORY *pVbvaMemory);
184 void VideoAccelFlushVMMDev(void);
185
[105006]186 void i_updateDeviceCursorCapabilities(void);
[77370]187
[75345]188#ifdef VBOX_WITH_RECORDING
[105006]189 int i_recordingStart(void);
190 int i_recordingStop(void);
[105095]191 int i_recordingInvalidate(void);
[105006]192 int i_recordingScreenChanged(unsigned uScreenId, const DISPLAYFBINFO *pFBInfo);
[105095]193 int i_recordingScreenUpdate(unsigned uScreenId, uint8_t *pauFramebuffer, size_t cbFramebuffer, uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t uBytesPerLine);
194 int i_recordingScreenUpdate(unsigned uScreenId, uint32_t x, uint32_t y, uint32_t w, uint32_t h);
[105006]195 int i_recordingCursorPositionChange(unsigned uScreenId, uint32_t fFlags, int32_t x, int32_t y);
[62139]196#endif
[1]197
[52064]198 void i_notifyPowerDown(void);
[46523]199
[52064]200 // DisplayMouseInterface methods
201 virtual HRESULT i_getScreenResolution(ULONG cScreen, ULONG *pcx,
202 ULONG *pcy, ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin)
203 {
[52978]204 return getScreenResolution(cScreen, pcx, pcy, pcBPP, pXOrigin, pYOrigin, NULL);
[52064]205 }
206 virtual void i_getFramebufferDimensions(int32_t *px1, int32_t *py1,
207 int32_t *px2, int32_t *py2);
[53965]208 virtual HRESULT i_reportHostCursorCapabilities(uint32_t fCapabilitiesAdded, uint32_t fCapabilitiesRemoved);
[77451]209 virtual HRESULT i_reportHostCursorPosition(int32_t x, int32_t y, bool fOutOfRange);
[54495]210 virtual bool i_isInputMappingSet(void)
211 {
212 return cxInputMapping != 0 && cyInputMapping != 0;
213 }
[52901]214
[52064]215 static const PDMDRVREG DrvReg;
[51525]216
[52064]217private:
218 // Wrapped IDisplay properties
[61564]219 virtual HRESULT getGuestScreenLayout(std::vector<ComPtr<IGuestScreenInfo> > &aGuestScreenLayout);
[1]220
[52064]221 // Wrapped IDisplay methods
222 virtual HRESULT getScreenResolution(ULONG aScreenId,
223 ULONG *aWidth,
224 ULONG *aHeight,
225 ULONG *aBitsPerPixel,
226 LONG *aXOrigin,
[52978]227 LONG *aYOrigin,
228 GuestMonitorStatus_T *aGuestMonitorStatus);
[52064]229 virtual HRESULT attachFramebuffer(ULONG aScreenId,
[55133]230 const ComPtr<IFramebuffer> &aFramebuffer,
231 com::Guid &aId);
232 virtual HRESULT detachFramebuffer(ULONG aScreenId,
233 const com::Guid &aId);
[52064]234 virtual HRESULT queryFramebuffer(ULONG aScreenId,
235 ComPtr<IFramebuffer> &aFramebuffer);
236 virtual HRESULT setVideoModeHint(ULONG aDisplay,
237 BOOL aEnabled,
238 BOOL aChangeOrigin,
239 LONG aOriginX,
240 LONG aOriginY,
241 ULONG aWidth,
242 ULONG aHeight,
[78995]243 ULONG aBitsPerPixel,
244 BOOL aNotify);
[78784]245 virtual HRESULT getVideoModeHint(ULONG aDisplay,
246 BOOL *aEnabled,
247 BOOL *aChangeOrigin,
248 LONG *aOriginX,
249 LONG *aOriginY,
250 ULONG *aWidth,
251 ULONG *aHeight,
252 ULONG *aBitsPerPixel);
[52064]253 virtual HRESULT setSeamlessMode(BOOL aEnabled);
254 virtual HRESULT takeScreenShot(ULONG aScreenId,
255 BYTE *aAddress,
256 ULONG aWidth,
[52200]257 ULONG aHeight,
258 BitmapFormat_T aBitmapFormat);
[52064]259 virtual HRESULT takeScreenShotToArray(ULONG aScreenId,
260 ULONG aWidth,
261 ULONG aHeight,
[52200]262 BitmapFormat_T aBitmapFormat,
[52064]263 std::vector<BYTE> &aScreenData);
264 virtual HRESULT drawToScreen(ULONG aScreenId,
265 BYTE *aAddress,
266 ULONG aX,
267 ULONG aY,
268 ULONG aWidth,
269 ULONG aHeight);
270 virtual HRESULT invalidateAndUpdate();
[52117]271 virtual HRESULT invalidateAndUpdateScreen(ULONG aScreenId);
[52064]272 virtual HRESULT completeVHWACommand(BYTE *aCommand);
273 virtual HRESULT viewportChanged(ULONG aScreenId,
274 ULONG aX,
275 ULONG aY,
276 ULONG aWidth,
277 ULONG aHeight);
278 virtual HRESULT querySourceBitmap(ULONG aScreenId,
279 ComPtr<IDisplaySourceBitmap> &aDisplaySourceBitmap);
[53851]280 virtual HRESULT notifyScaleFactorChange(ULONG aScreenId,
281 ULONG aScaleFactorWMultiplied,
282 ULONG aScaleFactorHMultiplied);
[54582]283 virtual HRESULT notifyHiDPIOutputPolicyChange(BOOL fUnscaledHiDPI);
[61560]284 virtual HRESULT setScreenLayout(ScreenLayoutMode_T aScreenLayoutMode,
285 const std::vector<ComPtr<IGuestScreenInfo> > &aGuestScreenInfo);
[68534]286 virtual HRESULT detachScreens(const std::vector<LONG> &aScreenIds);
[72352]287 virtual HRESULT createGuestScreenInfo(ULONG aDisplay,
288 GuestMonitorStatus_T aStatus,
289 BOOL aPrimary,
290 BOOL aChangeOrigin,
291 LONG aOriginX,
292 LONG aOriginY,
293 ULONG aWidth,
294 ULONG aHeight,
295 ULONG aBitsPerPixel,
296 ComPtr<IGuestScreenInfo> &aGuestScreenInfo);
[1]297
[52064]298 // Wrapped IEventListener properties
[19844]299
[52064]300 // Wrapped IEventListener methods
301 virtual HRESULT handleEvent(const ComPtr<IEvent> &aEvent);
[41404]302
[52901]303 // other internal methods
[52200]304 HRESULT takeScreenShotWorker(ULONG aScreenId,
305 BYTE *aAddress,
306 ULONG aWidth,
307 ULONG aHeight,
308 BitmapFormat_T aBitmapFormat,
309 ULONG *pcbOut);
[66328]310 int processVBVAResize(PCVBVAINFOVIEW pView, PCVBVAINFOSCREEN pScreen, void *pvVRAM, bool fResetInputMapping);
[52200]311
[52064]312 static DECLCALLBACK(void*) i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
313 static DECLCALLBACK(int) i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
314 static DECLCALLBACK(void) i_drvDestruct(PPDMDRVINS pDrvIns);
[75448]315 static DECLCALLBACK(void) i_drvPowerOff(PPDMDRVINS pDrvIns);
[52064]316 static DECLCALLBACK(int) i_displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM,
317 uint32_t cbLine, uint32_t cx, uint32_t cy);
318 static DECLCALLBACK(void) i_displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterface,
319 uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
320 static DECLCALLBACK(void) i_displayRefreshCallback(PPDMIDISPLAYCONNECTOR pInterface);
321 static DECLCALLBACK(void) i_displayResetCallback(PPDMIDISPLAYCONNECTOR pInterface);
322 static DECLCALLBACK(void) i_displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled);
323 static DECLCALLBACK(void) i_displayProcessAdapterDataCallback(PPDMIDISPLAYCONNECTOR pInterface,
324 void *pvVRAM, uint32_t u32VRAMSize);
325 static DECLCALLBACK(void) i_displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface,
326 void *pvVRAM, unsigned uScreenId);
[1]327
[19844]328#ifdef VBOX_WITH_VIDEOHWACCEL
[71626]329 static DECLCALLBACK(int) i_displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, int enmCmd, bool fGuestCmd,
[71590]330 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand);
[19844]331#endif
[84740]332 static DECLCALLBACK(int) i_display3DNotifyProcess(PPDMIDISPLAYCONNECTOR pInterface,
333 VBOX3DNOTIFY *p3DNotify);
[19844]334
[22412]335#ifdef VBOX_WITH_HGSMI
[52064]336 static DECLCALLBACK(int) i_displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
[80872]337 VBVAHOSTFLAGS RT_UNTRUSTED_VOLATILE_GUEST *pHostFlags);
[52064]338 static DECLCALLBACK(void) i_displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
339 static DECLCALLBACK(void) i_displayVBVAUpdateBegin(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
340 static DECLCALLBACK(void) i_displayVBVAUpdateProcess(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
[71619]341 struct VBVACMDHDR const RT_UNTRUSTED_VOLATILE_GUEST *pCmd, size_t cbCmd);
[52064]342 static DECLCALLBACK(void) i_displayVBVAUpdateEnd(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y,
343 uint32_t cx, uint32_t cy);
[63606]344 static DECLCALLBACK(int) i_displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, PCVBVAINFOVIEW pView,
345 PCVBVAINFOSCREEN pScreen, void *pvVRAM,
[60905]346 bool fResetInputMapping);
[52064]347 static DECLCALLBACK(int) i_displayVBVAMousePointerShape(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha,
348 uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy,
349 const void *pvShape);
[53528]350 static DECLCALLBACK(void) i_displayVBVAGuestCapabilityUpdate(PPDMIDISPLAYCONNECTOR pInterface, uint32_t fCapabilities);
[53965]351
352 static DECLCALLBACK(void) i_displayVBVAInputMappingUpdate(PPDMIDISPLAYCONNECTOR pInterface, int32_t xOrigin, int32_t yOrigin,
353 uint32_t cx, uint32_t cy);
[77130]354 static DECLCALLBACK(void) i_displayVBVAReportCursorPosition(PPDMIDISPLAYCONNECTOR pInterface, uint32_t fFlags, uint32_t uScreen, uint32_t x, uint32_t y);
[22412]355#endif
356
[93444]357 static DECLCALLBACK(int) i_displaySSMSaveScreenshot(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser);
358 static DECLCALLBACK(int) i_displaySSMLoadScreenshot(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser,
359 uint32_t uVersion, uint32_t uPass);
360 static DECLCALLBACK(int) i_displaySSMSave(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser);
361 static DECLCALLBACK(int) i_displaySSMLoad(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser,
362 uint32_t uVersion, uint32_t uPass);
[20021]363
[27607]364 Console * const mParent;
[1]365 /** Pointer to the associated display driver. */
[52064]366 struct DRVMAINDISPLAY *mpDrv;
[3153]367
368 unsigned mcMonitors;
[53965]369 /** Input mapping rectangle top left X relative to the first screen. */
370 int32_t xInputMappingOrigin;
371 /** Input mapping rectangle top left Y relative to the first screen. */
372 int32_t yInputMappingOrigin;
373 uint32_t cxInputMapping; /**< Input mapping rectangle width. */
374 uint32_t cyInputMapping; /**< Input mapping rectangle height. */
[3153]375 DISPLAYFBINFO maFramebuffers[SchemaDefs::MaxGuestMonitors];
[53528]376 /** Does the VMM device have the "supports graphics" capability set?
377 * Does not go into the saved state as it is refreshed on restore. */
378 bool mfVMMDevSupportsGraphics;
[54053]379 /** Mirror of the current guest VBVA capabilities. */
[53528]380 uint32_t mfGuestVBVACapabilities;
[54053]381 /** Mirror of the current host cursor capabilities. */
382 uint32_t mfHostCursorCapabilities;
[3153]383
[51525]384 bool mfSourceBitmapEnabled;
[51603]385 bool volatile fVGAResizing;
[51525]386
[56468]387 /** Are we in seamless mode? Not saved, as we exit seamless on saving. */
388 bool mfSeamlessEnabled;
389 /** Last set seamless visible region, number of rectangles. */
390 uint32_t mcRectVisibleRegion;
391 /** Last set seamless visible region, data. Freed on final clean-up. */
392 PRTRECT mpRectVisibleRegion;
393
[1]394 bool mfVideoAccelVRDP;
395 uint32_t mfu32SupportedOrders;
[77370]396 /** Number of currently connected VRDP clients. */
397 int32_t volatile mcVRDPRefs;
[1]398
[52769]399 /* The legacy VBVA data and methods. */
400 VIDEOACCEL mVideoAccelLegacy;
[25966]401
[52769]402 int i_VideoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory, PPDMIDISPLAYPORT pUpPort);
403 void i_VideoAccelFlush(PPDMIDISPLAYPORT pUpPort);
404 bool i_VideoAccelAllowed(void);
405
406 int i_videoAccelRefreshProcess(PPDMIDISPLAYPORT pUpPort);
407 int i_videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory, PPDMIDISPLAYPORT pUpPort);
408 int i_videoAccelFlush(PPDMIDISPLAYPORT pUpPort);
409
410 /* Legacy pre-HGSMI handlers. */
411 void processAdapterData(void *pvVRAM, uint32_t u32VRAMSize);
412 void processDisplayData(void *pvVRAM, unsigned uScreenId);
413
[68971]414 /** Serializes access to mVideoAccelLegacy and mfVideoAccelVRDP, etc between VRDP and Display. */
415 RTCRITSECT mVideoAccelLock;
416
[75345]417#ifdef VBOX_WITH_RECORDING
[105095]418 /** Struct which holds information and state about (video) recording. */
419 struct Recording
420 {
421 Recording()
422 : pCtx(NULL) { }
423
424 /** Recording context. Constant across lifetime.
425 * Might be NULL if not being used. */
426 RecordingContext * const pCtx;
427 } Recording;
[62139]428#endif
[48955]429
[104799]430#ifdef VBOX_WITH_STATISTICS
[105095]431 /** Struct for keeping STAM values. */
[104799]432 struct
433 {
434 /** Profiling Display::i_displayRefreshCallback(). */
435 STAMPROFILE profileDisplayRefreshCallback;
436 /** Statistics for monitor N. */
437 struct
438 {
439 /** Statistics for recording of monitor N. */
440 struct
441 {
442 /** Profiling recording code of monitor N. */
443 STAMPROFILE profileRecording;
444 } Recording;
445 } Monitor[SchemaDefs::MaxGuestMonitors];
446 /** Statistics for audio/video recording. */
447 struct
448 {
449 /** Profiling recording code of all active monitors. */
450 STAMPROFILE profileRecording;
451 } Recording;
452 } Stats;
453#endif
454
[24924]455public:
[51762]456
[85121]457 static DECLCALLBACK(int) i_displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppbData, size_t *pcbData,
458 uint32_t *pcx, uint32_t *pcy, bool *pfMemFree);
[50848]459
[24924]460private:
[85121]461 static DECLCALLBACK(int) i_InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll);
462 static DECLCALLBACK(int) i_drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y,
463 ULONG width, ULONG height);
[24931]464
[53528]465 void i_updateGuestGraphicsFacility(void);
466
[25069]467#ifdef VBOX_WITH_HGSMI
468 volatile uint32_t mu32UpdateVBVAFlags;
469#endif
[42878]470
[63147]471private:
472 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(Display); /* Shuts up MSC warning C4625. */
[1]473};
474
[52769]475/* The legacy VBVA helpers. */
476int videoAccelConstruct(VIDEOACCEL *pVideoAccel);
477void videoAccelDestroy(VIDEOACCEL *pVideoAccel);
478void i_vbvaSetMemoryFlags(VBVAMEMORY *pVbvaMemory,
479 bool fVideoAccelEnabled,
480 bool fVideoAccelVRDP,
481 uint32_t fu32SupportedOrders,
482 DISPLAYFBINFO *paFBInfos,
483 unsigned cFBInfos);
484int videoAccelEnterVGA(VIDEOACCEL *pVideoAccel);
485void videoAccelLeaveVGA(VIDEOACCEL *pVideoAccel);
486int videoAccelEnterVMMDev(VIDEOACCEL *pVideoAccel);
487void videoAccelLeaveVMMDev(VIDEOACCEL *pVideoAccel);
488
489
[52064]490/* helper function, code in DisplayResampleImage.cpp */
[46523]491void BitmapScale32(uint8_t *dst, int dstW, int dstH,
492 const uint8_t *src, int iDeltaLine, int srcW, int srcH);
[24373]493
[52064]494/* helper function, code in DisplayPNGUtul.cpp */
[57088]495int DisplayMakePNG(uint8_t *pbData, uint32_t cx, uint32_t cy,
[31958]496 uint8_t **ppu8PNG, uint32_t *pcbPNG, uint32_t *pcxPNG, uint32_t *pcyPNG,
[52064]497 uint8_t fLimitSize);
[31958]498
[51436]499class ATL_NO_VTABLE DisplaySourceBitmap:
500 public DisplaySourceBitmapWrap
501{
502public:
503
[90828]504 DECLARE_COMMON_CLASS_METHODS(DisplaySourceBitmap)
[51436]505
506 HRESULT FinalConstruct();
507 void FinalRelease();
508
509 /* Public initializer/uninitializer for internal purposes only. */
510 HRESULT init(ComObjPtr<Display> pDisplay, unsigned uScreenId, DISPLAYFBINFO *pFBInfo);
511 void uninit();
512
[52064]513 bool i_usesVRAM(void) { return m.pu8Allocated == NULL; }
[51436]514
515private:
516 // wrapped IDisplaySourceBitmap properties
517 virtual HRESULT getScreenId(ULONG *aScreenId);
518
519 // wrapped IDisplaySourceBitmap methods
520 virtual HRESULT queryBitmapInfo(BYTE **aAddress,
521 ULONG *aWidth,
522 ULONG *aHeight,
523 ULONG *aBitsPerPixel,
524 ULONG *aBytesPerLine,
[54828]525 BitmapFormat_T *aBitmapFormat);
[51436]526
527 int initSourceBitmap(unsigned aScreenId, DISPLAYFBINFO *pFBInfo);
528
529 struct Data
530 {
531 ComObjPtr<Display> pDisplay;
532 unsigned uScreenId;
533 DISPLAYFBINFO *pFBInfo;
534
535 uint8_t *pu8Allocated;
536
537 uint8_t *pu8Address;
538 ULONG ulWidth;
539 ULONG ulHeight;
540 ULONG ulBitsPerPixel;
541 ULONG ulBytesPerLine;
[54828]542 BitmapFormat_T bitmapFormat;
[51436]543 };
544
545 Data m;
546};
547
[72352]548class ATL_NO_VTABLE GuestScreenInfo:
549 public GuestScreenInfoWrap
550{
551public:
552
[90828]553 DECLARE_COMMON_CLASS_METHODS(GuestScreenInfo)
[72352]554
555 HRESULT FinalConstruct();
556 void FinalRelease();
557
558 /* Public initializer/uninitializer for internal purposes only. */
559 HRESULT init(ULONG aDisplay,
560 GuestMonitorStatus_T aGuestMonitorStatus,
561 BOOL aPrimary,
562 BOOL aChangeOrigin,
563 LONG aOriginX,
564 LONG aOriginY,
565 ULONG aWidth,
566 ULONG aHeight,
567 ULONG aBitsPerPixel);
568 void uninit();
569
570private:
571 // wrapped IGuestScreenInfo properties
572 virtual HRESULT getScreenId(ULONG *aScreenId);
573 virtual HRESULT getGuestMonitorStatus(GuestMonitorStatus_T *aGuestMonitorStatus);
574 virtual HRESULT getPrimary(BOOL *aPrimary);
575 virtual HRESULT getOrigin(BOOL *aOrigin);
576 virtual HRESULT getOriginX(LONG *aOriginX);
577 virtual HRESULT getOriginY(LONG *aOriginY);
578 virtual HRESULT getWidth(ULONG *aWidth);
579 virtual HRESULT getHeight(ULONG *aHeight);
580 virtual HRESULT getBitsPerPixel(ULONG *aBitsPerPixel);
581 virtual HRESULT getExtendedInfo(com::Utf8Str &aExtendedInfo);
582
583 ULONG mScreenId;
584 GuestMonitorStatus_T mGuestMonitorStatus;
585 BOOL mPrimary;
586 BOOL mOrigin;
587 LONG mOriginX;
588 LONG mOriginY;
589 ULONG mWidth;
590 ULONG mHeight;
591 ULONG mBitsPerPixel;
592};
593
[76562]594#endif /* !MAIN_INCLUDED_DisplayImpl_h */
[14949]595/* 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