VirtualBox

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

Last change on this file since 94521 was 93444, checked in by vboxsync, 2 years ago

VMM,Main,HostServices: Use a function table for accessing the VBoxVMM.dll/so/dylib functionality, and load it dynamically when the Console object is initialized. Also converted a few drivers in Main to use device helpers to get config values and such. bugref:10074

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 23.2 KB
Line 
1/* $Id: DisplayImpl.h 93444 2022-01-26 18:01:15Z vboxsync $ */
2/** @file
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2022 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 MAIN_INCLUDED_DisplayImpl_h
19#define MAIN_INCLUDED_DisplayImpl_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24#include "SchemaDefs.h"
25
26#include <iprt/semaphore.h>
27#include <VBox/vmm/pdmdrv.h>
28#include <VBoxVideo.h>
29#include <VBox/vmm/pdmifs.h>
30#include <VBox/VMMDev.h> /* For struct VMMDevDisplayDef - why is it in that file? */
31#include "DisplayWrap.h"
32
33#include "DisplaySourceBitmapWrap.h"
34#include "GuestScreenInfoWrap.h"
35
36
37class Console;
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 VBVAHOSTFLAGS RT_UNTRUSTED_VOLATILE_GUEST *pVBVAHostFlags;
84#endif /* VBOX_WITH_HGSMI */
85
86#ifdef VBOX_WITH_RECORDING
87 struct
88 {
89 ComPtr<IDisplaySourceBitmap> pSourceBitmap;
90 } Recording;
91#endif /* VBOX_WITH_RECORDING */
92
93 /** Description of the currently plugged monitor with preferred mode,
94 * a.k.a the last mode hint sent. */
95 struct VMMDevDisplayDef monitorDesc;
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 ~DisplayMouseInterface() { }
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, bool fOutOfRange) = 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_COMMON_CLASS_METHODS(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 unsigned i_getMonitorCount() { return mcMonitors; }
152 int i_handleDisplayResize(unsigned uScreenId, uint32_t bpp, void *pvVRAM,
153 uint32_t cbLine, uint32_t w, uint32_t h, uint16_t flags,
154 int32_t xOrigin, int32_t yOrigin, bool fVGAResize);
155 void i_handleDisplayUpdate(unsigned uScreenId, int x, int y, int w, int h);
156 void i_handleUpdateVMMDevSupportsGraphics(bool fSupportsGraphics);
157 void i_handleUpdateGuestVBVACapabilities(uint32_t fNewCapabilities);
158 void i_handleUpdateVBVAInputMapping(int32_t xOrigin, int32_t yOrigin, uint32_t cx, uint32_t cy);
159#ifdef VBOX_WITH_VIDEOHWACCEL
160 int i_handleVHWACommandProcess(int enmCmd, bool fGuestCmd, VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand);
161#endif
162 int i_handle3DNotifyProcess(VBOX3DNOTIFY *p3DNotify);
163
164 int i_saveVisibleRegion(uint32_t cRect, PRTRECT pRect);
165 int i_handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect);
166 int i_handleUpdateMonitorPositions(uint32_t cPositions, PCRTPOINT paPositions);
167 int i_handleQueryVisibleRegion(uint32_t *pcRects, PRTRECT paRects);
168
169 void i_VRDPConnectionEvent(bool fConnect);
170 void i_VideoAccelVRDP(bool fEnable, int c);
171
172 /* Legacy video acceleration requests coming from the VGA refresh timer. */
173 int VideoAccelEnableVGA(bool fEnable, VBVAMEMORY *pVbvaMemory);
174
175 /* Legacy video acceleration requests coming from VMMDev. */
176 int VideoAccelEnableVMMDev(bool fEnable, VBVAMEMORY *pVbvaMemory);
177 void VideoAccelFlushVMMDev(void);
178
179 void i_UpdateDeviceCursorCapabilities(void);
180
181#ifdef VBOX_WITH_RECORDING
182 int i_recordingInvalidate(void);
183 void i_recordingScreenChanged(unsigned uScreenId);
184#endif
185
186 void i_notifyPowerDown(void);
187
188 // DisplayMouseInterface methods
189 virtual HRESULT i_getScreenResolution(ULONG cScreen, ULONG *pcx,
190 ULONG *pcy, ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin)
191 {
192 return getScreenResolution(cScreen, pcx, pcy, pcBPP, pXOrigin, pYOrigin, NULL);
193 }
194 virtual void i_getFramebufferDimensions(int32_t *px1, int32_t *py1,
195 int32_t *px2, int32_t *py2);
196 virtual HRESULT i_reportHostCursorCapabilities(uint32_t fCapabilitiesAdded, uint32_t fCapabilitiesRemoved);
197 virtual HRESULT i_reportHostCursorPosition(int32_t x, int32_t y, bool fOutOfRange);
198 virtual bool i_isInputMappingSet(void)
199 {
200 return cxInputMapping != 0 && cyInputMapping != 0;
201 }
202
203 static const PDMDRVREG DrvReg;
204
205private:
206 // Wrapped IDisplay properties
207 virtual HRESULT getGuestScreenLayout(std::vector<ComPtr<IGuestScreenInfo> > &aGuestScreenLayout);
208
209 // Wrapped IDisplay methods
210 virtual HRESULT getScreenResolution(ULONG aScreenId,
211 ULONG *aWidth,
212 ULONG *aHeight,
213 ULONG *aBitsPerPixel,
214 LONG *aXOrigin,
215 LONG *aYOrigin,
216 GuestMonitorStatus_T *aGuestMonitorStatus);
217 virtual HRESULT attachFramebuffer(ULONG aScreenId,
218 const ComPtr<IFramebuffer> &aFramebuffer,
219 com::Guid &aId);
220 virtual HRESULT detachFramebuffer(ULONG aScreenId,
221 const com::Guid &aId);
222 virtual HRESULT queryFramebuffer(ULONG aScreenId,
223 ComPtr<IFramebuffer> &aFramebuffer);
224 virtual HRESULT setVideoModeHint(ULONG aDisplay,
225 BOOL aEnabled,
226 BOOL aChangeOrigin,
227 LONG aOriginX,
228 LONG aOriginY,
229 ULONG aWidth,
230 ULONG aHeight,
231 ULONG aBitsPerPixel,
232 BOOL aNotify);
233 virtual HRESULT getVideoModeHint(ULONG aDisplay,
234 BOOL *aEnabled,
235 BOOL *aChangeOrigin,
236 LONG *aOriginX,
237 LONG *aOriginY,
238 ULONG *aWidth,
239 ULONG *aHeight,
240 ULONG *aBitsPerPixel);
241 virtual HRESULT setSeamlessMode(BOOL aEnabled);
242 virtual HRESULT takeScreenShot(ULONG aScreenId,
243 BYTE *aAddress,
244 ULONG aWidth,
245 ULONG aHeight,
246 BitmapFormat_T aBitmapFormat);
247 virtual HRESULT takeScreenShotToArray(ULONG aScreenId,
248 ULONG aWidth,
249 ULONG aHeight,
250 BitmapFormat_T aBitmapFormat,
251 std::vector<BYTE> &aScreenData);
252 virtual HRESULT drawToScreen(ULONG aScreenId,
253 BYTE *aAddress,
254 ULONG aX,
255 ULONG aY,
256 ULONG aWidth,
257 ULONG aHeight);
258 virtual HRESULT invalidateAndUpdate();
259 virtual HRESULT invalidateAndUpdateScreen(ULONG aScreenId);
260 virtual HRESULT completeVHWACommand(BYTE *aCommand);
261 virtual HRESULT viewportChanged(ULONG aScreenId,
262 ULONG aX,
263 ULONG aY,
264 ULONG aWidth,
265 ULONG aHeight);
266 virtual HRESULT querySourceBitmap(ULONG aScreenId,
267 ComPtr<IDisplaySourceBitmap> &aDisplaySourceBitmap);
268 virtual HRESULT notifyScaleFactorChange(ULONG aScreenId,
269 ULONG aScaleFactorWMultiplied,
270 ULONG aScaleFactorHMultiplied);
271 virtual HRESULT notifyHiDPIOutputPolicyChange(BOOL fUnscaledHiDPI);
272 virtual HRESULT setScreenLayout(ScreenLayoutMode_T aScreenLayoutMode,
273 const std::vector<ComPtr<IGuestScreenInfo> > &aGuestScreenInfo);
274 virtual HRESULT detachScreens(const std::vector<LONG> &aScreenIds);
275 virtual HRESULT createGuestScreenInfo(ULONG aDisplay,
276 GuestMonitorStatus_T aStatus,
277 BOOL aPrimary,
278 BOOL aChangeOrigin,
279 LONG aOriginX,
280 LONG aOriginY,
281 ULONG aWidth,
282 ULONG aHeight,
283 ULONG aBitsPerPixel,
284 ComPtr<IGuestScreenInfo> &aGuestScreenInfo);
285
286 // Wrapped IEventListener properties
287
288 // Wrapped IEventListener methods
289 virtual HRESULT handleEvent(const ComPtr<IEvent> &aEvent);
290
291 // other internal methods
292 HRESULT takeScreenShotWorker(ULONG aScreenId,
293 BYTE *aAddress,
294 ULONG aWidth,
295 ULONG aHeight,
296 BitmapFormat_T aBitmapFormat,
297 ULONG *pcbOut);
298 int processVBVAResize(PCVBVAINFOVIEW pView, PCVBVAINFOSCREEN pScreen, void *pvVRAM, bool fResetInputMapping);
299
300 static DECLCALLBACK(void*) i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
301 static DECLCALLBACK(int) i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
302 static DECLCALLBACK(void) i_drvDestruct(PPDMDRVINS pDrvIns);
303 static DECLCALLBACK(void) i_drvPowerOff(PPDMDRVINS pDrvIns);
304 static DECLCALLBACK(int) i_displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM,
305 uint32_t cbLine, uint32_t cx, uint32_t cy);
306 static DECLCALLBACK(void) i_displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterface,
307 uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
308 static DECLCALLBACK(void) i_displayRefreshCallback(PPDMIDISPLAYCONNECTOR pInterface);
309 static DECLCALLBACK(void) i_displayResetCallback(PPDMIDISPLAYCONNECTOR pInterface);
310 static DECLCALLBACK(void) i_displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled);
311 static DECLCALLBACK(void) i_displayProcessAdapterDataCallback(PPDMIDISPLAYCONNECTOR pInterface,
312 void *pvVRAM, uint32_t u32VRAMSize);
313 static DECLCALLBACK(void) i_displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface,
314 void *pvVRAM, unsigned uScreenId);
315
316#ifdef VBOX_WITH_VIDEOHWACCEL
317 static DECLCALLBACK(int) i_displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, int enmCmd, bool fGuestCmd,
318 VBOXVHWACMD RT_UNTRUSTED_VOLATILE_GUEST *pCommand);
319#endif
320 static DECLCALLBACK(int) i_display3DNotifyProcess(PPDMIDISPLAYCONNECTOR pInterface,
321 VBOX3DNOTIFY *p3DNotify);
322
323#ifdef VBOX_WITH_HGSMI
324 static DECLCALLBACK(int) i_displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
325 VBVAHOSTFLAGS RT_UNTRUSTED_VOLATILE_GUEST *pHostFlags);
326 static DECLCALLBACK(void) i_displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
327 static DECLCALLBACK(void) i_displayVBVAUpdateBegin(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
328 static DECLCALLBACK(void) i_displayVBVAUpdateProcess(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
329 struct VBVACMDHDR const RT_UNTRUSTED_VOLATILE_GUEST *pCmd, size_t cbCmd);
330 static DECLCALLBACK(void) i_displayVBVAUpdateEnd(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y,
331 uint32_t cx, uint32_t cy);
332 static DECLCALLBACK(int) i_displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, PCVBVAINFOVIEW pView,
333 PCVBVAINFOSCREEN pScreen, void *pvVRAM,
334 bool fResetInputMapping);
335 static DECLCALLBACK(int) i_displayVBVAMousePointerShape(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha,
336 uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy,
337 const void *pvShape);
338 static DECLCALLBACK(void) i_displayVBVAGuestCapabilityUpdate(PPDMIDISPLAYCONNECTOR pInterface, uint32_t fCapabilities);
339
340 static DECLCALLBACK(void) i_displayVBVAInputMappingUpdate(PPDMIDISPLAYCONNECTOR pInterface, int32_t xOrigin, int32_t yOrigin,
341 uint32_t cx, uint32_t cy);
342 static DECLCALLBACK(void) i_displayVBVAReportCursorPosition(PPDMIDISPLAYCONNECTOR pInterface, uint32_t fFlags, uint32_t uScreen, uint32_t x, uint32_t y);
343#endif
344
345 static DECLCALLBACK(int) i_displaySSMSaveScreenshot(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser);
346 static DECLCALLBACK(int) i_displaySSMLoadScreenshot(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser,
347 uint32_t uVersion, uint32_t uPass);
348 static DECLCALLBACK(int) i_displaySSMSave(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser);
349 static DECLCALLBACK(int) i_displaySSMLoad(PSSMHANDLE pSSM, PCVMMR3VTABLE pVMM, void *pvUser,
350 uint32_t uVersion, uint32_t uPass);
351
352 Console * const mParent;
353 /** Pointer to the associated display driver. */
354 struct DRVMAINDISPLAY *mpDrv;
355
356 unsigned mcMonitors;
357 /** Input mapping rectangle top left X relative to the first screen. */
358 int32_t xInputMappingOrigin;
359 /** Input mapping rectangle top left Y relative to the first screen. */
360 int32_t yInputMappingOrigin;
361 uint32_t cxInputMapping; /**< Input mapping rectangle width. */
362 uint32_t cyInputMapping; /**< Input mapping rectangle height. */
363 DISPLAYFBINFO maFramebuffers[SchemaDefs::MaxGuestMonitors];
364 /** Does the VMM device have the "supports graphics" capability set?
365 * Does not go into the saved state as it is refreshed on restore. */
366 bool mfVMMDevSupportsGraphics;
367 /** Mirror of the current guest VBVA capabilities. */
368 uint32_t mfGuestVBVACapabilities;
369 /** Mirror of the current host cursor capabilities. */
370 uint32_t mfHostCursorCapabilities;
371
372 bool mfSourceBitmapEnabled;
373 bool volatile fVGAResizing;
374
375 /** Are we in seamless mode? Not saved, as we exit seamless on saving. */
376 bool mfSeamlessEnabled;
377 /** Last set seamless visible region, number of rectangles. */
378 uint32_t mcRectVisibleRegion;
379 /** Last set seamless visible region, data. Freed on final clean-up. */
380 PRTRECT mpRectVisibleRegion;
381
382 bool mfVideoAccelVRDP;
383 uint32_t mfu32SupportedOrders;
384 /** Number of currently connected VRDP clients. */
385 int32_t volatile mcVRDPRefs;
386
387 /* The legacy VBVA data and methods. */
388 VIDEOACCEL mVideoAccelLegacy;
389
390 int i_VideoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory, PPDMIDISPLAYPORT pUpPort);
391 void i_VideoAccelFlush(PPDMIDISPLAYPORT pUpPort);
392 bool i_VideoAccelAllowed(void);
393
394 int i_videoAccelRefreshProcess(PPDMIDISPLAYPORT pUpPort);
395 int i_videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory, PPDMIDISPLAYPORT pUpPort);
396 int i_videoAccelFlush(PPDMIDISPLAYPORT pUpPort);
397
398 /* Legacy pre-HGSMI handlers. */
399 void processAdapterData(void *pvVRAM, uint32_t u32VRAMSize);
400 void processDisplayData(void *pvVRAM, unsigned uScreenId);
401
402 /** Serializes access to mVideoAccelLegacy and mfVideoAccelVRDP, etc between VRDP and Display. */
403 RTCRITSECT mVideoAccelLock;
404
405#ifdef VBOX_WITH_RECORDING
406 /* Serializes access to video recording source bitmaps. */
407 RTCRITSECT mVideoRecLock;
408 /** Array which defines which screens are being enabled for recording. */
409 bool maRecordingEnabled[SchemaDefs::MaxGuestMonitors];
410#endif
411
412public:
413
414 static DECLCALLBACK(int) i_displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppbData, size_t *pcbData,
415 uint32_t *pcx, uint32_t *pcy, bool *pfMemFree);
416
417private:
418 static DECLCALLBACK(int) i_InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll);
419 static DECLCALLBACK(int) i_drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y,
420 ULONG width, ULONG height);
421
422 void i_updateGuestGraphicsFacility(void);
423
424#ifdef VBOX_WITH_HGSMI
425 volatile uint32_t mu32UpdateVBVAFlags;
426#endif
427
428private:
429 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(Display); /* Shuts up MSC warning C4625. */
430};
431
432/* The legacy VBVA helpers. */
433int videoAccelConstruct(VIDEOACCEL *pVideoAccel);
434void videoAccelDestroy(VIDEOACCEL *pVideoAccel);
435void i_vbvaSetMemoryFlags(VBVAMEMORY *pVbvaMemory,
436 bool fVideoAccelEnabled,
437 bool fVideoAccelVRDP,
438 uint32_t fu32SupportedOrders,
439 DISPLAYFBINFO *paFBInfos,
440 unsigned cFBInfos);
441int videoAccelEnterVGA(VIDEOACCEL *pVideoAccel);
442void videoAccelLeaveVGA(VIDEOACCEL *pVideoAccel);
443int videoAccelEnterVMMDev(VIDEOACCEL *pVideoAccel);
444void videoAccelLeaveVMMDev(VIDEOACCEL *pVideoAccel);
445
446
447/* helper function, code in DisplayResampleImage.cpp */
448void BitmapScale32(uint8_t *dst, int dstW, int dstH,
449 const uint8_t *src, int iDeltaLine, int srcW, int srcH);
450
451/* helper function, code in DisplayPNGUtul.cpp */
452int DisplayMakePNG(uint8_t *pbData, uint32_t cx, uint32_t cy,
453 uint8_t **ppu8PNG, uint32_t *pcbPNG, uint32_t *pcxPNG, uint32_t *pcyPNG,
454 uint8_t fLimitSize);
455
456class ATL_NO_VTABLE DisplaySourceBitmap:
457 public DisplaySourceBitmapWrap
458{
459public:
460
461 DECLARE_COMMON_CLASS_METHODS(DisplaySourceBitmap)
462
463 HRESULT FinalConstruct();
464 void FinalRelease();
465
466 /* Public initializer/uninitializer for internal purposes only. */
467 HRESULT init(ComObjPtr<Display> pDisplay, unsigned uScreenId, DISPLAYFBINFO *pFBInfo);
468 void uninit();
469
470 bool i_usesVRAM(void) { return m.pu8Allocated == NULL; }
471
472private:
473 // wrapped IDisplaySourceBitmap properties
474 virtual HRESULT getScreenId(ULONG *aScreenId);
475
476 // wrapped IDisplaySourceBitmap methods
477 virtual HRESULT queryBitmapInfo(BYTE **aAddress,
478 ULONG *aWidth,
479 ULONG *aHeight,
480 ULONG *aBitsPerPixel,
481 ULONG *aBytesPerLine,
482 BitmapFormat_T *aBitmapFormat);
483
484 int initSourceBitmap(unsigned aScreenId, DISPLAYFBINFO *pFBInfo);
485
486 struct Data
487 {
488 ComObjPtr<Display> pDisplay;
489 unsigned uScreenId;
490 DISPLAYFBINFO *pFBInfo;
491
492 uint8_t *pu8Allocated;
493
494 uint8_t *pu8Address;
495 ULONG ulWidth;
496 ULONG ulHeight;
497 ULONG ulBitsPerPixel;
498 ULONG ulBytesPerLine;
499 BitmapFormat_T bitmapFormat;
500 };
501
502 Data m;
503};
504
505class ATL_NO_VTABLE GuestScreenInfo:
506 public GuestScreenInfoWrap
507{
508public:
509
510 DECLARE_COMMON_CLASS_METHODS(GuestScreenInfo)
511
512 HRESULT FinalConstruct();
513 void FinalRelease();
514
515 /* Public initializer/uninitializer for internal purposes only. */
516 HRESULT init(ULONG aDisplay,
517 GuestMonitorStatus_T aGuestMonitorStatus,
518 BOOL aPrimary,
519 BOOL aChangeOrigin,
520 LONG aOriginX,
521 LONG aOriginY,
522 ULONG aWidth,
523 ULONG aHeight,
524 ULONG aBitsPerPixel);
525 void uninit();
526
527private:
528 // wrapped IGuestScreenInfo properties
529 virtual HRESULT getScreenId(ULONG *aScreenId);
530 virtual HRESULT getGuestMonitorStatus(GuestMonitorStatus_T *aGuestMonitorStatus);
531 virtual HRESULT getPrimary(BOOL *aPrimary);
532 virtual HRESULT getOrigin(BOOL *aOrigin);
533 virtual HRESULT getOriginX(LONG *aOriginX);
534 virtual HRESULT getOriginY(LONG *aOriginY);
535 virtual HRESULT getWidth(ULONG *aWidth);
536 virtual HRESULT getHeight(ULONG *aHeight);
537 virtual HRESULT getBitsPerPixel(ULONG *aBitsPerPixel);
538 virtual HRESULT getExtendedInfo(com::Utf8Str &aExtendedInfo);
539
540 ULONG mScreenId;
541 GuestMonitorStatus_T mGuestMonitorStatus;
542 BOOL mPrimary;
543 BOOL mOrigin;
544 LONG mOriginX;
545 LONG mOriginY;
546 ULONG mWidth;
547 ULONG mHeight;
548 ULONG mBitsPerPixel;
549};
550
551#endif /* !MAIN_INCLUDED_DisplayImpl_h */
552/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use