VirtualBox

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

Last change on this file since 87093 was 85121, checked in by vboxsync, 4 years ago

iprt/cdefs.h: Refactored the typedef use of DECLCALLBACK as well as DECLCALLBACKMEMBER to wrap the whole expression, similar to the DECLR?CALLBACKMEMBER macros. This allows adding a throw() at the end when compiling with the VC++ compiler to indicate that the callbacks won't throw anything, so we can stop supressing the C5039 warning about passing functions that can potential throw C++ exceptions to extern C code that can't necessarily cope with such (unwind,++). Introduced a few _EX variations that allows specifying different/no calling convention too, as that's handy when dynamically resolving host APIs. Fixed numerous places missing DECLCALLBACK and such. Left two angry @todos regarding use of CreateThread. bugref:9794

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 23.0 KB
Line 
1/* $Id: DisplayImpl.h 85121 2020-07-08 19:33:26Z vboxsync $ */
2/** @file
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2020 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_EMPTY_CTOR_DTOR(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, PRTPOINT pPosition);
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(void) i_displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser);
346 static DECLCALLBACK(int) i_displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
347 static DECLCALLBACK(void) i_displaySSMSave(PSSMHANDLE pSSM, void *pvUser);
348 static DECLCALLBACK(int) i_displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
349
350 Console * const mParent;
351 /** Pointer to the associated display driver. */
352 struct DRVMAINDISPLAY *mpDrv;
353
354 unsigned mcMonitors;
355 /** Input mapping rectangle top left X relative to the first screen. */
356 int32_t xInputMappingOrigin;
357 /** Input mapping rectangle top left Y relative to the first screen. */
358 int32_t yInputMappingOrigin;
359 uint32_t cxInputMapping; /**< Input mapping rectangle width. */
360 uint32_t cyInputMapping; /**< Input mapping rectangle height. */
361 DISPLAYFBINFO maFramebuffers[SchemaDefs::MaxGuestMonitors];
362 /** Does the VMM device have the "supports graphics" capability set?
363 * Does not go into the saved state as it is refreshed on restore. */
364 bool mfVMMDevSupportsGraphics;
365 /** Mirror of the current guest VBVA capabilities. */
366 uint32_t mfGuestVBVACapabilities;
367 /** Mirror of the current host cursor capabilities. */
368 uint32_t mfHostCursorCapabilities;
369
370 bool mfSourceBitmapEnabled;
371 bool volatile fVGAResizing;
372
373 /** Are we in seamless mode? Not saved, as we exit seamless on saving. */
374 bool mfSeamlessEnabled;
375 /** Last set seamless visible region, number of rectangles. */
376 uint32_t mcRectVisibleRegion;
377 /** Last set seamless visible region, data. Freed on final clean-up. */
378 PRTRECT mpRectVisibleRegion;
379
380 bool mfVideoAccelVRDP;
381 uint32_t mfu32SupportedOrders;
382 /** Number of currently connected VRDP clients. */
383 int32_t volatile mcVRDPRefs;
384
385 /* The legacy VBVA data and methods. */
386 VIDEOACCEL mVideoAccelLegacy;
387
388 int i_VideoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory, PPDMIDISPLAYPORT pUpPort);
389 void i_VideoAccelFlush(PPDMIDISPLAYPORT pUpPort);
390 bool i_VideoAccelAllowed(void);
391
392 int i_videoAccelRefreshProcess(PPDMIDISPLAYPORT pUpPort);
393 int i_videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory, PPDMIDISPLAYPORT pUpPort);
394 int i_videoAccelFlush(PPDMIDISPLAYPORT pUpPort);
395
396 /* Legacy pre-HGSMI handlers. */
397 void processAdapterData(void *pvVRAM, uint32_t u32VRAMSize);
398 void processDisplayData(void *pvVRAM, unsigned uScreenId);
399
400 /** Serializes access to mVideoAccelLegacy and mfVideoAccelVRDP, etc between VRDP and Display. */
401 RTCRITSECT mVideoAccelLock;
402
403#ifdef VBOX_WITH_RECORDING
404 /* Serializes access to video recording source bitmaps. */
405 RTCRITSECT mVideoRecLock;
406 /** Array which defines which screens are being enabled for recording. */
407 bool maRecordingEnabled[SchemaDefs::MaxGuestMonitors];
408#endif
409
410public:
411
412 static DECLCALLBACK(int) i_displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppbData, size_t *pcbData,
413 uint32_t *pcx, uint32_t *pcy, bool *pfMemFree);
414
415private:
416 static DECLCALLBACK(int) i_InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll);
417 static DECLCALLBACK(int) i_drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y,
418 ULONG width, ULONG height);
419
420 void i_updateGuestGraphicsFacility(void);
421
422#ifdef VBOX_WITH_HGSMI
423 volatile uint32_t mu32UpdateVBVAFlags;
424#endif
425
426private:
427 DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(Display); /* Shuts up MSC warning C4625. */
428};
429
430/* The legacy VBVA helpers. */
431int videoAccelConstruct(VIDEOACCEL *pVideoAccel);
432void videoAccelDestroy(VIDEOACCEL *pVideoAccel);
433void i_vbvaSetMemoryFlags(VBVAMEMORY *pVbvaMemory,
434 bool fVideoAccelEnabled,
435 bool fVideoAccelVRDP,
436 uint32_t fu32SupportedOrders,
437 DISPLAYFBINFO *paFBInfos,
438 unsigned cFBInfos);
439int videoAccelEnterVGA(VIDEOACCEL *pVideoAccel);
440void videoAccelLeaveVGA(VIDEOACCEL *pVideoAccel);
441int videoAccelEnterVMMDev(VIDEOACCEL *pVideoAccel);
442void videoAccelLeaveVMMDev(VIDEOACCEL *pVideoAccel);
443
444
445/* helper function, code in DisplayResampleImage.cpp */
446void BitmapScale32(uint8_t *dst, int dstW, int dstH,
447 const uint8_t *src, int iDeltaLine, int srcW, int srcH);
448
449/* helper function, code in DisplayPNGUtul.cpp */
450int DisplayMakePNG(uint8_t *pbData, uint32_t cx, uint32_t cy,
451 uint8_t **ppu8PNG, uint32_t *pcbPNG, uint32_t *pcxPNG, uint32_t *pcyPNG,
452 uint8_t fLimitSize);
453
454class ATL_NO_VTABLE DisplaySourceBitmap:
455 public DisplaySourceBitmapWrap
456{
457public:
458
459 DECLARE_EMPTY_CTOR_DTOR(DisplaySourceBitmap)
460
461 HRESULT FinalConstruct();
462 void FinalRelease();
463
464 /* Public initializer/uninitializer for internal purposes only. */
465 HRESULT init(ComObjPtr<Display> pDisplay, unsigned uScreenId, DISPLAYFBINFO *pFBInfo);
466 void uninit();
467
468 bool i_usesVRAM(void) { return m.pu8Allocated == NULL; }
469
470private:
471 // wrapped IDisplaySourceBitmap properties
472 virtual HRESULT getScreenId(ULONG *aScreenId);
473
474 // wrapped IDisplaySourceBitmap methods
475 virtual HRESULT queryBitmapInfo(BYTE **aAddress,
476 ULONG *aWidth,
477 ULONG *aHeight,
478 ULONG *aBitsPerPixel,
479 ULONG *aBytesPerLine,
480 BitmapFormat_T *aBitmapFormat);
481
482 int initSourceBitmap(unsigned aScreenId, DISPLAYFBINFO *pFBInfo);
483
484 struct Data
485 {
486 ComObjPtr<Display> pDisplay;
487 unsigned uScreenId;
488 DISPLAYFBINFO *pFBInfo;
489
490 uint8_t *pu8Allocated;
491
492 uint8_t *pu8Address;
493 ULONG ulWidth;
494 ULONG ulHeight;
495 ULONG ulBitsPerPixel;
496 ULONG ulBytesPerLine;
497 BitmapFormat_T bitmapFormat;
498 };
499
500 Data m;
501};
502
503class ATL_NO_VTABLE GuestScreenInfo:
504 public GuestScreenInfoWrap
505{
506public:
507
508 DECLARE_EMPTY_CTOR_DTOR(GuestScreenInfo)
509
510 HRESULT FinalConstruct();
511 void FinalRelease();
512
513 /* Public initializer/uninitializer for internal purposes only. */
514 HRESULT init(ULONG aDisplay,
515 GuestMonitorStatus_T aGuestMonitorStatus,
516 BOOL aPrimary,
517 BOOL aChangeOrigin,
518 LONG aOriginX,
519 LONG aOriginY,
520 ULONG aWidth,
521 ULONG aHeight,
522 ULONG aBitsPerPixel);
523 void uninit();
524
525private:
526 // wrapped IGuestScreenInfo properties
527 virtual HRESULT getScreenId(ULONG *aScreenId);
528 virtual HRESULT getGuestMonitorStatus(GuestMonitorStatus_T *aGuestMonitorStatus);
529 virtual HRESULT getPrimary(BOOL *aPrimary);
530 virtual HRESULT getOrigin(BOOL *aOrigin);
531 virtual HRESULT getOriginX(LONG *aOriginX);
532 virtual HRESULT getOriginY(LONG *aOriginY);
533 virtual HRESULT getWidth(ULONG *aWidth);
534 virtual HRESULT getHeight(ULONG *aHeight);
535 virtual HRESULT getBitsPerPixel(ULONG *aBitsPerPixel);
536 virtual HRESULT getExtendedInfo(com::Utf8Str &aExtendedInfo);
537
538 ULONG mScreenId;
539 GuestMonitorStatus_T mGuestMonitorStatus;
540 BOOL mPrimary;
541 BOOL mOrigin;
542 LONG mOriginX;
543 LONG mOriginY;
544 ULONG mWidth;
545 ULONG mHeight;
546 ULONG mBitsPerPixel;
547};
548
549#endif /* !MAIN_INCLUDED_DisplayImpl_h */
550/* 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