VirtualBox

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

Last change on this file was 98103, checked in by vboxsync, 16 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 23.5 KB
Line 
1/* $Id: DisplayImpl.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
8 *
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
26 */
27
28#ifndef MAIN_INCLUDED_DisplayImpl_h
29#define MAIN_INCLUDED_DisplayImpl_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include "SchemaDefs.h"
35
36#include <iprt/semaphore.h>
37#include <VBox/vmm/pdmdrv.h>
38#include <VBoxVideo.h>
39#include <VBox/vmm/pdmifs.h>
40#include <VBox/VMMDev.h> /* For struct VMMDevDisplayDef - why is it in that file? */
41#include "DisplayWrap.h"
42
43#include "DisplaySourceBitmapWrap.h"
44#include "GuestScreenInfoWrap.h"
45
46
47class Console;
48
49typedef struct _DISPLAYFBINFO
50{
51 /* The following 3 fields (u32Offset, u32MaxFramebufferSize and u32InformationSize)
52 * are not used by the current HGSMI. They are needed for backward compatibility with
53 * pre-HGSMI additions.
54 */
55 uint32_t u32Offset;
56 uint32_t u32MaxFramebufferSize;
57 uint32_t u32InformationSize;
58
59 ComPtr<IFramebuffer> pFramebuffer;
60 com::Guid framebufferId;
61 ComPtr<IDisplaySourceBitmap> pSourceBitmap;
62 bool fDisabled;
63
64 uint32_t u32Caps;
65
66 struct
67 {
68 ComPtr<IDisplaySourceBitmap> pSourceBitmap;
69 uint8_t *pu8Address;
70 uint32_t cbLine;
71 } updateImage;
72
73 LONG xOrigin;
74 LONG yOrigin;
75
76 ULONG w;
77 ULONG h;
78
79 uint16_t u16BitsPerPixel;
80 uint8_t *pu8FramebufferVRAM;
81 uint32_t u32LineSize;
82
83 uint16_t flags;
84
85 VBOXVIDEOINFOHOSTEVENTS *pHostEvents;
86
87 /** The framebuffer has default format and must be updates immediately. */
88 bool fDefaultFormat;
89
90#ifdef VBOX_WITH_HGSMI
91 bool fVBVAEnabled;
92 bool fVBVAForceResize;
93 VBVAHOSTFLAGS RT_UNTRUSTED_VOLATILE_GUEST *pVBVAHostFlags;
94#endif /* VBOX_WITH_HGSMI */
95
96#ifdef VBOX_WITH_RECORDING
97 struct
98 {
99 ComPtr<IDisplaySourceBitmap> pSourceBitmap;
100 } Recording;
101#endif /* VBOX_WITH_RECORDING */
102
103 /** Description of the currently plugged monitor with preferred mode,
104 * a.k.a the last mode hint sent. */
105 struct VMMDevDisplayDef monitorDesc;
106} DISPLAYFBINFO;
107
108/* The legacy VBVA (VideoAccel) data.
109 *
110 * Backward compatibility with the Guest Additions 3.x or older.
111 */
112typedef struct VIDEOACCEL
113{
114 VBVAMEMORY *pVbvaMemory;
115 bool fVideoAccelEnabled;
116
117 uint8_t *pu8VbvaPartial;
118 uint32_t cbVbvaPartial;
119
120 /* Old Guest Additions (3.x and older) use both VMMDev and DevVGA refresh timer
121 * to process the VBVABUFFER memory. Therefore the legacy VBVA (VideoAccel) host
122 * code can be executed concurrently by VGA refresh timer and the guest VMMDev
123 * request in SMP VMs. The semaphore serialized this.
124 */
125 RTSEMXROADS hXRoadsVideoAccel;
126
127} VIDEOACCEL;
128
129class DisplayMouseInterface
130{
131public:
132 virtual ~DisplayMouseInterface() { }
133 virtual HRESULT i_getScreenResolution(ULONG cScreen, ULONG *pcx,
134 ULONG *pcy, ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin) = 0;
135 virtual void i_getFramebufferDimensions(int32_t *px1, int32_t *py1,
136 int32_t *px2, int32_t *py2) = 0;
137 virtual HRESULT i_reportHostCursorCapabilities(uint32_t fCapabilitiesAdded, uint32_t fCapabilitiesRemoved) = 0;
138 virtual HRESULT i_reportHostCursorPosition(int32_t x, int32_t y, bool fOutOfRange) = 0;
139 virtual bool i_isInputMappingSet(void) = 0;
140};
141
142class VMMDev;
143
144class ATL_NO_VTABLE Display :
145 public DisplayWrap,
146 public DisplayMouseInterface
147{
148public:
149
150 DECLARE_COMMON_CLASS_METHODS(Display)
151
152 HRESULT FinalConstruct();
153 void FinalRelease();
154
155 // public initializer/uninitializer for internal purposes only
156 HRESULT init(Console *aParent);
157 void uninit();
158 int i_registerSSM(PUVM pUVM);
159
160 // public methods only for internal purposes
161 unsigned i_getMonitorCount() { return mcMonitors; }
162 int i_handleDisplayResize(unsigned uScreenId, uint32_t bpp, void *pvVRAM,
163 uint32_t cbLine, uint32_t w, uint32_t h, uint16_t flags,
164 int32_t xOrigin, int32_t yOrigin, bool fVGAResize);
165 void i_handleDisplayUpdate(unsigned uScreenId, int x, int y, int w, int h);
166 void i_handleUpdateVMMDevSupportsGraphics(bool fSupportsGraphics);
167 void i_handleUpdateGuestVBVACapabilities(uint32_t fNewCapabilities);
168 void i_handleUpdateVBVAInputMapping(int32_t xOrigin, int32_t yOrigin, uint32_t cx, uint32_t cy);
169#ifdef VBOX_WITH_VIDEOHWACCEL
170 int i_handleVHWACommandProcess(int enmCmd, bool fGuestCmd, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand);
171#endif
172 int i_handle3DNotifyProcess(VBOX3DNOTIFY *p3DNotify);
173
174 int i_saveVisibleRegion(uint32_t cRect, PRTRECT pRect);
175 int i_handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect);
176 int i_handleUpdateMonitorPositions(uint32_t cPositions, PCRTPOINT paPositions);
177 int i_handleQueryVisibleRegion(uint32_t *pcRects, PRTRECT paRects);
178
179 void i_VRDPConnectionEvent(bool fConnect);
180 void i_VideoAccelVRDP(bool fEnable, int c);
181
182 /* Legacy video acceleration requests coming from the VGA refresh timer. */
183 int VideoAccelEnableVGA(bool fEnable, VBVAMEMORY *pVbvaMemory);
184
185 /* Legacy video acceleration requests coming from VMMDev. */
186 int VideoAccelEnableVMMDev(bool fEnable, VBVAMEMORY *pVbvaMemory);
187 void VideoAccelFlushVMMDev(void);
188
189 void i_UpdateDeviceCursorCapabilities(void);
190
191#ifdef VBOX_WITH_RECORDING
192 int i_recordingInvalidate(void);
193 void i_recordingScreenChanged(unsigned uScreenId);
194#endif
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, bool fOutOfRange);
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 virtual HRESULT getGuestScreenLayout(std::vector<ComPtr<IGuestScreenInfo> > &aGuestScreenLayout);
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 BOOL aNotify);
243 virtual HRESULT getVideoModeHint(ULONG aDisplay,
244 BOOL *aEnabled,
245 BOOL *aChangeOrigin,
246 LONG *aOriginX,
247 LONG *aOriginY,
248 ULONG *aWidth,
249 ULONG *aHeight,
250 ULONG *aBitsPerPixel);
251 virtual HRESULT setSeamlessMode(BOOL aEnabled);
252 virtual HRESULT takeScreenShot(ULONG aScreenId,
253 BYTE *aAddress,
254 ULONG aWidth,
255 ULONG aHeight,
256 BitmapFormat_T aBitmapFormat);
257 virtual HRESULT takeScreenShotToArray(ULONG aScreenId,
258 ULONG aWidth,
259 ULONG aHeight,
260 BitmapFormat_T aBitmapFormat,
261 std::vector<BYTE> &aScreenData);
262 virtual HRESULT drawToScreen(ULONG aScreenId,
263 BYTE *aAddress,
264 ULONG aX,
265 ULONG aY,
266 ULONG aWidth,
267 ULONG aHeight);
268 virtual HRESULT invalidateAndUpdate();
269 virtual HRESULT invalidateAndUpdateScreen(ULONG aScreenId);
270 virtual HRESULT completeVHWACommand(BYTE *aCommand);
271 virtual HRESULT viewportChanged(ULONG aScreenId,
272 ULONG aX,
273 ULONG aY,
274 ULONG aWidth,
275 ULONG aHeight);
276 virtual HRESULT querySourceBitmap(ULONG aScreenId,
277 ComPtr<IDisplaySourceBitmap> &aDisplaySourceBitmap);
278 virtual HRESULT notifyScaleFactorChange(ULONG aScreenId,
279 ULONG aScaleFactorWMultiplied,
280 ULONG aScaleFactorHMultiplied);
281 virtual HRESULT notifyHiDPIOutputPolicyChange(BOOL fUnscaledHiDPI);
282 virtual HRESULT setScreenLayout(ScreenLayoutMode_T aScreenLayoutMode,
283 const std::vector<ComPtr<IGuestScreenInfo> > &aGuestScreenInfo);
284 virtual HRESULT detachScreens(const std::vector<LONG> &aScreenIds);
285 virtual HRESULT createGuestScreenInfo(ULONG aDisplay,
286 GuestMonitorStatus_T aStatus,
287 BOOL aPrimary,
288 BOOL aChangeOrigin,
289 LONG aOriginX,
290 LONG aOriginY,
291 ULONG aWidth,
292 ULONG aHeight,
293 ULONG aBitsPerPixel,
294 ComPtr<IGuestScreenInfo> &aGuestScreenInfo);
295
296 // Wrapped IEventListener properties
297
298 // Wrapped IEventListener methods
299 virtual HRESULT handleEvent(const ComPtr<IEvent> &aEvent);
300
301 // other internal methods
302 HRESULT takeScreenShotWorker(ULONG aScreenId,
303 BYTE *aAddress,
304 ULONG aWidth,
305 ULONG aHeight,
306 BitmapFormat_T aBitmapFormat,
307 ULONG *pcbOut);
308 int processVBVAResize(PCVBVAINFOVIEW pView, PCVBVAINFOSCREEN pScreen, void *pvVRAM, bool fResetInputMapping);
309
310 static DECLCALLBACK(void*) i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
311 static DECLCALLBACK(int) i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
312 static DECLCALLBACK(void) i_drvDestruct(PPDMDRVINS pDrvIns);
313 static DECLCALLBACK(void) i_drvPowerOff(PPDMDRVINS pDrvIns);
314 static DECLCALLBACK(int) i_displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM,
315 uint32_t cbLine, uint32_t cx, uint32_t cy);
316 static DECLCALLBACK(void) i_displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterface,
317 uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
318 static DECLCALLBACK(void) i_displayRefreshCallback(PPDMIDISPLAYCONNECTOR pInterface);
319 static DECLCALLBACK(void) i_displayResetCallback(PPDMIDISPLAYCONNECTOR pInterface);
320 static DECLCALLBACK(void) i_displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled);
321 static DECLCALLBACK(void) i_displayProcessAdapterDataCallback(PPDMIDISPLAYCONNECTOR pInterface,
322 void *pvVRAM, uint32_t u32VRAMSize);
323 static DECLCALLBACK(void) i_displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface,
324 void *pvVRAM, unsigned uScreenId);
325
326#ifdef VBOX_WITH_VIDEOHWACCEL
327 static DECLCALLBACK(int) i_displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, int enmCmd, bool fGuestCmd,
328 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand);
329#endif
330 static DECLCALLBACK(int) i_display3DNotifyProcess(PPDMIDISPLAYCONNECTOR pInterface,
331 VBOX3DNOTIFY *p3DNotify);
332
333#ifdef VBOX_WITH_HGSMI
334 static DECLCALLBACK(int) i_displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
335 VBVAHOSTFLAGS RT_UNTRUSTED_VOLATILE_GUEST *pHostFlags);
336 static DECLCALLBACK(void) i_displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
337 static DECLCALLBACK(void) i_displayVBVAUpdateBegin(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
338 static DECLCALLBACK(void) i_displayVBVAUpdateProcess(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
339 struct VBVACMDHDR const RT_UNTRUSTED_VOLATILE_GUEST *pCmd, size_t cbCmd);
340 static DECLCALLBACK(void) i_displayVBVAUpdateEnd(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y,
341 uint32_t cx, uint32_t cy);
342 static DECLCALLBACK(int) i_displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, PCVBVAINFOVIEW pView,
343 PCVBVAINFOSCREEN pScreen, void *pvVRAM,
344 bool fResetInputMapping);
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 static DECLCALLBACK(void) i_displayVBVAReportCursorPosition(PPDMIDISPLAYCONNECTOR pInterface, uint32_t fFlags, uint32_t uScreen, uint32_t x, uint32_t y);
353#endif
354
355 static DECLCALLBACK(int) i_displaySSMSaveScreenshot(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser);
356 static DECLCALLBACK(int) i_displaySSMLoadScreenshot(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser,
357 uint32_t uVersion, uint32_t uPass);
358 static DECLCALLBACK(int) i_displaySSMSave(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser);
359 static DECLCALLBACK(int) i_displaySSMLoad(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser,
360 uint32_t uVersion, uint32_t uPass);
361
362 Console * const mParent;
363 /** Pointer to the associated display driver. */
364 struct DRVMAINDISPLAY *mpDrv;
365
366 unsigned mcMonitors;
367 /** Input mapping rectangle top left X relative to the first screen. */
368 int32_t xInputMappingOrigin;
369 /** Input mapping rectangle top left Y relative to the first screen. */
370 int32_t yInputMappingOrigin;
371 uint32_t cxInputMapping; /**< Input mapping rectangle width. */
372 uint32_t cyInputMapping; /**< Input mapping rectangle height. */
373 DISPLAYFBINFO maFramebuffers[SchemaDefs::MaxGuestMonitors];
374 /** Does the VMM device have the "supports graphics" capability set?
375 * Does not go into the saved state as it is refreshed on restore. */
376 bool mfVMMDevSupportsGraphics;
377 /** Mirror of the current guest VBVA capabilities. */
378 uint32_t mfGuestVBVACapabilities;
379 /** Mirror of the current host cursor capabilities. */
380 uint32_t mfHostCursorCapabilities;
381
382 bool mfSourceBitmapEnabled;
383 bool volatile fVGAResizing;
384
385 /** Are we in seamless mode? Not saved, as we exit seamless on saving. */
386 bool mfSeamlessEnabled;
387 /** Last set seamless visible region, number of rectangles. */
388 uint32_t mcRectVisibleRegion;
389 /** Last set seamless visible region, data. Freed on final clean-up. */
390 PRTRECT mpRectVisibleRegion;
391
392 bool mfVideoAccelVRDP;
393 uint32_t mfu32SupportedOrders;
394 /** Number of currently connected VRDP clients. */
395 int32_t volatile mcVRDPRefs;
396
397 /* The legacy VBVA data and methods. */
398 VIDEOACCEL mVideoAccelLegacy;
399
400 int i_VideoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory, PPDMIDISPLAYPORT pUpPort);
401 void i_VideoAccelFlush(PPDMIDISPLAYPORT pUpPort);
402 bool i_VideoAccelAllowed(void);
403
404 int i_videoAccelRefreshProcess(PPDMIDISPLAYPORT pUpPort);
405 int i_videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory, PPDMIDISPLAYPORT pUpPort);
406 int i_videoAccelFlush(PPDMIDISPLAYPORT pUpPort);
407
408 /* Legacy pre-HGSMI handlers. */
409 void processAdapterData(void *pvVRAM, uint32_t u32VRAMSize);
410 void processDisplayData(void *pvVRAM, unsigned uScreenId);
411
412 /** Serializes access to mVideoAccelLegacy and mfVideoAccelVRDP, etc between VRDP and Display. */
413 RTCRITSECT mVideoAccelLock;
414
415#ifdef VBOX_WITH_RECORDING
416 /* Serializes access to video recording source bitmaps. */
417 RTCRITSECT mVideoRecLock;
418 /** Array which defines which screens are being enabled for recording. */
419 bool maRecordingEnabled[SchemaDefs::MaxGuestMonitors];
420#endif
421
422public:
423
424 static DECLCALLBACK(int) i_displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppbData, size_t *pcbData,
425 uint32_t *pcx, uint32_t *pcy, bool *pfMemFree);
426
427private:
428 static DECLCALLBACK(int) i_InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll);
429 static DECLCALLBACK(int) i_drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y,
430 ULONG width, ULONG height);
431
432 void i_updateGuestGraphicsFacility(void);
433
434#ifdef VBOX_WITH_HGSMI
435 volatile uint32_t mu32UpdateVBVAFlags;
436#endif
437
438private:
439 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(Display); /* Shuts up MSC warning C4625. */
440};
441
442/* The legacy VBVA helpers. */
443int videoAccelConstruct(VIDEOACCEL *pVideoAccel);
444void videoAccelDestroy(VIDEOACCEL *pVideoAccel);
445void i_vbvaSetMemoryFlags(VBVAMEMORY *pVbvaMemory,
446 bool fVideoAccelEnabled,
447 bool fVideoAccelVRDP,
448 uint32_t fu32SupportedOrders,
449 DISPLAYFBINFO *paFBInfos,
450 unsigned cFBInfos);
451int videoAccelEnterVGA(VIDEOACCEL *pVideoAccel);
452void videoAccelLeaveVGA(VIDEOACCEL *pVideoAccel);
453int videoAccelEnterVMMDev(VIDEOACCEL *pVideoAccel);
454void videoAccelLeaveVMMDev(VIDEOACCEL *pVideoAccel);
455
456
457/* helper function, code in DisplayResampleImage.cpp */
458void BitmapScale32(uint8_t *dst, int dstW, int dstH,
459 const uint8_t *src, int iDeltaLine, int srcW, int srcH);
460
461/* helper function, code in DisplayPNGUtul.cpp */
462int DisplayMakePNG(uint8_t *pbData, uint32_t cx, uint32_t cy,
463 uint8_t **ppu8PNG, uint32_t *pcbPNG, uint32_t *pcxPNG, uint32_t *pcyPNG,
464 uint8_t fLimitSize);
465
466class ATL_NO_VTABLE DisplaySourceBitmap:
467 public DisplaySourceBitmapWrap
468{
469public:
470
471 DECLARE_COMMON_CLASS_METHODS(DisplaySourceBitmap)
472
473 HRESULT FinalConstruct();
474 void FinalRelease();
475
476 /* Public initializer/uninitializer for internal purposes only. */
477 HRESULT init(ComObjPtr<Display> pDisplay, unsigned uScreenId, DISPLAYFBINFO *pFBInfo);
478 void uninit();
479
480 bool i_usesVRAM(void) { return m.pu8Allocated == NULL; }
481
482private:
483 // wrapped IDisplaySourceBitmap properties
484 virtual HRESULT getScreenId(ULONG *aScreenId);
485
486 // wrapped IDisplaySourceBitmap methods
487 virtual HRESULT queryBitmapInfo(BYTE **aAddress,
488 ULONG *aWidth,
489 ULONG *aHeight,
490 ULONG *aBitsPerPixel,
491 ULONG *aBytesPerLine,
492 BitmapFormat_T *aBitmapFormat);
493
494 int initSourceBitmap(unsigned aScreenId, DISPLAYFBINFO *pFBInfo);
495
496 struct Data
497 {
498 ComObjPtr<Display> pDisplay;
499 unsigned uScreenId;
500 DISPLAYFBINFO *pFBInfo;
501
502 uint8_t *pu8Allocated;
503
504 uint8_t *pu8Address;
505 ULONG ulWidth;
506 ULONG ulHeight;
507 ULONG ulBitsPerPixel;
508 ULONG ulBytesPerLine;
509 BitmapFormat_T bitmapFormat;
510 };
511
512 Data m;
513};
514
515class ATL_NO_VTABLE GuestScreenInfo:
516 public GuestScreenInfoWrap
517{
518public:
519
520 DECLARE_COMMON_CLASS_METHODS(GuestScreenInfo)
521
522 HRESULT FinalConstruct();
523 void FinalRelease();
524
525 /* Public initializer/uninitializer for internal purposes only. */
526 HRESULT init(ULONG aDisplay,
527 GuestMonitorStatus_T aGuestMonitorStatus,
528 BOOL aPrimary,
529 BOOL aChangeOrigin,
530 LONG aOriginX,
531 LONG aOriginY,
532 ULONG aWidth,
533 ULONG aHeight,
534 ULONG aBitsPerPixel);
535 void uninit();
536
537private:
538 // wrapped IGuestScreenInfo properties
539 virtual HRESULT getScreenId(ULONG *aScreenId);
540 virtual HRESULT getGuestMonitorStatus(GuestMonitorStatus_T *aGuestMonitorStatus);
541 virtual HRESULT getPrimary(BOOL *aPrimary);
542 virtual HRESULT getOrigin(BOOL *aOrigin);
543 virtual HRESULT getOriginX(LONG *aOriginX);
544 virtual HRESULT getOriginY(LONG *aOriginY);
545 virtual HRESULT getWidth(ULONG *aWidth);
546 virtual HRESULT getHeight(ULONG *aHeight);
547 virtual HRESULT getBitsPerPixel(ULONG *aBitsPerPixel);
548 virtual HRESULT getExtendedInfo(com::Utf8Str &aExtendedInfo);
549
550 ULONG mScreenId;
551 GuestMonitorStatus_T mGuestMonitorStatus;
552 BOOL mPrimary;
553 BOOL mOrigin;
554 LONG mOriginX;
555 LONG mOriginY;
556 ULONG mWidth;
557 ULONG mHeight;
558 ULONG mBitsPerPixel;
559};
560
561#endif /* !MAIN_INCLUDED_DisplayImpl_h */
562/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use