VirtualBox

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

Last change on this file since 108641 was 108641, checked in by vboxsync, 4 weeks ago

Removed 2D video acceleration (aka VHWA / VBOX_WITH_VIDEOHWACCEL). bugref:10756

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette