VirtualBox

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

Last change on this file since 51525 was 51525, checked in by vboxsync, 11 years ago

DisplayImpl: notify framebuffer about VM shutdown.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 19.4 KB
Line 
1/* $Id: DisplayImpl.h 51525 2014-06-04 08:32:22Z vboxsync $ */
2/** @file
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2014 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.215389.xyz. 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 ____H_DISPLAYIMPL
19#define ____H_DISPLAYIMPL
20
21#include "VirtualBoxBase.h"
22#include "SchemaDefs.h"
23
24#include <iprt/semaphore.h>
25#include <VBox/vmm/pdmdrv.h>
26#include <VBox/VMMDev.h>
27#include <VBox/VBoxVideo.h>
28#include <VBox/vmm/pdmifs.h>
29
30#ifdef VBOX_WITH_CROGL
31# include <VBox/HostServices/VBoxCrOpenGLSvc.h>
32#endif
33
34#include "DisplaySourceBitmapWrap.h"
35
36class Console;
37struct VIDEORECCONTEXT;
38
39enum
40{
41 ResizeStatus_Void,
42 ResizeStatus_InProgress,
43 ResizeStatus_UpdateDisplayData
44};
45
46typedef struct _DISPLAYFBINFO
47{
48 uint32_t u32Offset;
49 uint32_t u32MaxFramebufferSize;
50 uint32_t u32InformationSize;
51
52 ComPtr<IFramebuffer> pFramebuffer;
53 ComPtr<IDisplaySourceBitmap> pSourceBitmap;
54 bool fDisabled;
55
56 LONG xOrigin;
57 LONG yOrigin;
58
59 ULONG w;
60 ULONG h;
61
62 uint16_t u16BitsPerPixel;
63 uint8_t *pu8FramebufferVRAM;
64 uint32_t u32LineSize;
65
66 uint16_t flags;
67
68 /** For saving the rectangles arrived during fb resize is in progress. */
69 PRTRECT mpSavedVisibleRegion;
70 uint32_t mcSavedVisibleRegion;
71
72 VBOXVIDEOINFOHOSTEVENTS *pHostEvents;
73
74 volatile uint32_t u32ResizeStatus;
75
76 /** The framebuffer has default format and must be updates immediately. */
77 bool fDefaultFormat;
78
79 struct
80 {
81 /* The rectangle that includes all dirty rectangles. */
82 int32_t xLeft;
83 int32_t xRight;
84 int32_t yTop;
85 int32_t yBottom;
86 } dirtyRect;
87
88 struct
89 {
90 bool fPending;
91 ULONG pixelFormat;
92 void *pvVRAM;
93 uint32_t bpp;
94 uint32_t cbLine;
95 uint32_t w;
96 uint32_t h;
97 uint16_t flags;
98 } pendingResize;
99
100#ifdef VBOX_WITH_HGSMI
101 bool fVBVAEnabled;
102 bool fVBVAForceResize;
103 bool fRenderThreadMode;
104 uint32_t cVBVASkipUpdate;
105 struct
106 {
107 int32_t xLeft;
108 int32_t yTop;
109 int32_t xRight;
110 int32_t yBottom;
111 } vbvaSkippedRect;
112 PVBVAHOSTFLAGS pVBVAHostFlags;
113#endif /* VBOX_WITH_HGSMI */
114
115#ifdef VBOX_WITH_CROGL
116 struct
117 {
118 bool fPending;
119 ULONG x;
120 ULONG y;
121 ULONG width;
122 ULONG height;
123 } pendingViewportInfo;
124#endif /* VBOX_WITH_CROGL */
125} DISPLAYFBINFO;
126
127class DisplayMouseInterface
128{
129public:
130 virtual int getScreenResolution(uint32_t cScreen, ULONG *pcx,
131 ULONG *pcy, ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin) = 0;
132 virtual void getFramebufferDimensions(int32_t *px1, int32_t *py1,
133 int32_t *px2, int32_t *py2) = 0;
134};
135
136class VMMDev;
137
138class ATL_NO_VTABLE Display :
139 public VirtualBoxBase,
140 VBOX_SCRIPTABLE_IMPL(IEventListener),
141 VBOX_SCRIPTABLE_IMPL(IDisplay),
142 public DisplayMouseInterface
143{
144public:
145
146 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Display, IDisplay)
147
148 DECLARE_NOT_AGGREGATABLE(Display)
149
150 DECLARE_PROTECT_FINAL_CONSTRUCT()
151
152 BEGIN_COM_MAP(Display)
153 VBOX_DEFAULT_INTERFACE_ENTRIES(IDisplay)
154 COM_INTERFACE_ENTRY(IEventListener)
155 END_COM_MAP()
156
157 DECLARE_EMPTY_CTOR_DTOR(Display)
158
159 HRESULT FinalConstruct();
160 void FinalRelease();
161
162 // public initializer/uninitializer for internal purposes only
163 HRESULT init(Console *aParent);
164 void uninit();
165 int registerSSM(PUVM pUVM);
166
167 // public methods only for internal purposes
168 int handleDisplayResize(unsigned uScreenId, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t w, uint32_t h, uint16_t flags);
169 void handleDisplayUpdateLegacy(int x, int y, int cx, int cy);
170 void handleDisplayUpdate(unsigned uScreenId, int x, int y, int w, int h);
171#ifdef VBOX_WITH_VIDEOHWACCEL
172 int handleVHWACommandProcess(PVBOXVHWACMD pCommand);
173#endif
174#ifdef VBOX_WITH_CRHGSMI
175 void handleCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
176 void handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
177 void handleCrHgsmiCommandProcess(PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
178 void handleCrHgsmiControlProcess(PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl);
179#endif
180#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
181 int handleCrHgcmCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
182 PFNCRCTLCOMPLETION pfnCompletion,
183 void *pvCompletion);
184 void handleCrVRecScreenshotPerform(uint32_t uScreen,
185 uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBitsPerPixel,
186 uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight,
187 uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
188 bool handleCrVRecScreenshotBegin(uint32_t uScreen, uint64_t u64TimeStamp);
189 void handleCrVRecScreenshotEnd(uint32_t uScreen, uint64_t u64TimeStamp);
190 void handleVRecCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
191#endif
192
193 int notifyCroglResize(const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM);
194
195 IFramebuffer *getFramebuffer()
196 {
197 return maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN].pFramebuffer;
198 }
199 void getFramebufferDimensions(int32_t *px1, int32_t *py1, int32_t *px2, int32_t *py2);
200 int getScreenResolution(uint32_t cScreen, ULONG *pcx, ULONG *pcy,
201 ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin)
202 {
203 return GetScreenResolution(cScreen, pcx, pcy, pcBPP, pXOrigin, pYOrigin);
204 }
205
206 int handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect);
207 int handleQueryVisibleRegion(uint32_t *pcRect, PRTRECT pRect);
208
209 int VideoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory);
210 void VideoAccelFlush(void);
211 bool VideoAccelAllowed(void);
212 void VideoAccelVRDP(bool fEnable);
213
214 int VideoCaptureStart();
215 void VideoCaptureStop();
216 int VideoCaptureEnableScreens(ComSafeArrayIn(BOOL, aScreens));
217
218 void notifyPowerDown(void);
219
220 // IEventListener methods
221 STDMETHOD(HandleEvent)(IEvent * aEvent);
222
223 // IDisplay methods
224 STDMETHOD(GetScreenResolution)(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel, LONG *aXOrigin, LONG *aYOrigin);
225 STDMETHOD(SetFramebuffer)(ULONG aScreenId, IFramebuffer *aFramebuffer);
226 STDMETHOD(AttachFramebuffer)(ULONG aScreenId,
227 IFramebuffer *aFramebuffer);
228 STDMETHOD(DetachFramebuffer)(ULONG aScreenId);
229 STDMETHOD(QueryFramebuffer)(ULONG aScreenId,
230 IFramebuffer **aFramebuffer);
231 STDMETHOD(GetFramebuffer)(ULONG aScreenId, IFramebuffer **aFramebuffer, LONG *aXOrigin, LONG *aYOrigin);
232 STDMETHOD(SetVideoModeHint)(ULONG aDisplay, BOOL aEnabled, BOOL aChangeOrigin, LONG aOriginX, LONG aOriginY, ULONG aWidth, ULONG aHeight, ULONG aBitsPerPixel);
233 STDMETHOD(TakeScreenShot)(ULONG aScreenId, BYTE *address, ULONG width, ULONG height);
234 STDMETHOD(TakeScreenShotToArray)(ULONG aScreenId, ULONG width, ULONG height, ComSafeArrayOut(BYTE, aScreenData));
235 STDMETHOD(TakeScreenShotPNGToArray)(ULONG aScreenId, ULONG width, ULONG height, ComSafeArrayOut(BYTE, aScreenData));
236 STDMETHOD(DrawToScreen)(ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
237 STDMETHOD(InvalidateAndUpdate)();
238 STDMETHOD(ResizeCompleted)(ULONG aScreenId);
239 STDMETHOD(SetSeamlessMode)(BOOL enabled);
240
241 STDMETHOD(CompleteVHWACommand)(BYTE *pCommand);
242
243 STDMETHOD(ViewportChanged)(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height);
244 STDMETHOD(QuerySourceBitmap)(ULONG aScreenId,
245 IDisplaySourceBitmap **aDisplaySourceBitmap);
246
247 static const PDMDRVREG DrvReg;
248
249private:
250
251 HRESULT querySourceBitmap(ULONG aScreenId,
252 IDisplaySourceBitmap **ppDisplaySourceBitmap);
253 int updateDisplayData(void);
254
255#ifdef VBOX_WITH_CRHGSMI
256 void setupCrHgsmiData(void);
257 void destructCrHgsmiData(void);
258#endif
259
260#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
261 int crViewportNotify(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height);
262#endif
263
264 static DECLCALLBACK(int) changeFramebuffer(Display *that, IFramebuffer *aFB, unsigned uScreenId);
265
266 static DECLCALLBACK(void*) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
267 static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
268 static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
269 static DECLCALLBACK(int) displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy);
270 static DECLCALLBACK(void) displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterface,
271 uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
272 static DECLCALLBACK(void) displayRefreshCallback(PPDMIDISPLAYCONNECTOR pInterface);
273 static DECLCALLBACK(void) displayResetCallback(PPDMIDISPLAYCONNECTOR pInterface);
274 static DECLCALLBACK(void) displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled);
275 static DECLCALLBACK(void) displayProcessAdapterDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, uint32_t u32VRAMSize);
276 static DECLCALLBACK(void) displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId);
277
278#ifdef VBOX_WITH_VIDEOHWACCEL
279 static DECLCALLBACK(int) displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand);
280#endif
281
282#ifdef VBOX_WITH_CRHGSMI
283 static DECLCALLBACK(void) displayCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
284 static DECLCALLBACK(void) displayCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl);
285
286 static DECLCALLBACK(void) displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
287 static DECLCALLBACK(void) displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
288#endif
289#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
290 static DECLCALLBACK(int) displayCrHgcmCtlSubmit(PPDMIDISPLAYCONNECTOR pInterface,
291 struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
292 PFNCRCTLCOMPLETION pfnCompletion,
293 void *pvCompletion);
294 static DECLCALLBACK(void) displayCrHgcmCtlSubmitCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
295#endif
296#ifdef VBOX_WITH_HGSMI
297 static DECLCALLBACK(int) displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags, bool fRenderThreadMode);
298 static DECLCALLBACK(void) displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
299 static DECLCALLBACK(void) displayVBVAUpdateBegin(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
300 static DECLCALLBACK(void) displayVBVAUpdateProcess(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, const PVBVACMDHDR pCmd, size_t cbCmd);
301 static DECLCALLBACK(void) displayVBVAUpdateEnd(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y, uint32_t cx, uint32_t cy);
302 static DECLCALLBACK(int) displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM);
303 static DECLCALLBACK(int) displayVBVAMousePointerShape(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha, uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy, const void *pvShape);
304#endif
305
306#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
307 static DECLCALLBACK(void) displayCrVRecScreenshotPerform(void *pvCtx, uint32_t uScreen,
308 uint32_t x, uint32_t y,
309 uint32_t uBitsPerPixel, uint32_t uBytesPerLine,
310 uint32_t uGuestWidth, uint32_t uGuestHeight,
311 uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
312 static DECLCALLBACK(bool) displayCrVRecScreenshotBegin(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
313 static DECLCALLBACK(void) displayCrVRecScreenshotEnd(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
314
315 static DECLCALLBACK(void) displayVRecCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
316#endif
317 static DECLCALLBACK(void) displayCrCmdFree(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion);
318
319 static DECLCALLBACK(void) displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser);
320 static DECLCALLBACK(int) displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
321 static DECLCALLBACK(void) displaySSMSave(PSSMHANDLE pSSM, void *pvUser);
322 static DECLCALLBACK(int) displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
323
324 Console * const mParent;
325 /** Pointer to the associated display driver. */
326 struct DRVMAINDISPLAY *mpDrv;
327 /** Pointer to the device instance for the VMM Device. */
328 PPDMDEVINS mpVMMDev;
329 /** Set after the first attempt to find the VMM Device. */
330 bool mfVMMDevInited;
331
332 unsigned mcMonitors;
333 DISPLAYFBINFO maFramebuffers[SchemaDefs::MaxGuestMonitors];
334
335 bool mfSourceBitmapEnabled;
336
337 /* arguments of the last handleDisplayResize() call */
338 void *mLastAddress;
339 uint32_t mLastBytesPerLine;
340 uint32_t mLastBitsPerPixel;
341 uint32_t mLastWidth;
342 uint32_t mLastHeight;
343 uint16_t mLastFlags;
344
345 VBVAMEMORY *mpVbvaMemory;
346 bool mfVideoAccelEnabled;
347 bool mfVideoAccelVRDP;
348 uint32_t mfu32SupportedOrders;
349
350 int32_t volatile mcVideoAccelVRDPRefs;
351
352 VBVAMEMORY *mpPendingVbvaMemory;
353 bool mfPendingVideoAccelEnable;
354 bool mfMachineRunning;
355#ifdef VBOX_WITH_CROGL
356 bool mfCrOglDataHidden;
357#endif
358
359 uint8_t *mpu8VbvaPartial;
360 uint32_t mcbVbvaPartial;
361
362#ifdef VBOX_WITH_CRHGSMI
363 /* for fast host hgcm calls */
364 HGCMCVSHANDLE mhCrOglSvc;
365 RTCRITSECTRW mCrOglLock;
366#endif
367#ifdef VBOX_WITH_CROGL
368 CR_MAIN_INTERFACE mCrOglCallbacks;
369 volatile uint32_t mfCrOglVideoRecState;
370 CRVBOXHGCMTAKESCREENSHOT mCrOglScreenshotData;
371 VBOXCRCMDCTL_HGCM mCrOglScreenshotCtl;
372#endif
373
374 bool vbvaFetchCmd(VBVACMDHDR **ppHdr, uint32_t *pcbCmd);
375 void vbvaReleaseCmd(VBVACMDHDR *pHdr, int32_t cbCmd);
376
377 void handleResizeCompletedEMT(unsigned uScreenId, BOOL fResizeContext);
378
379 RTCRITSECT mVBVALock;
380 volatile uint32_t mfu32PendingVideoAccelDisable;
381
382 int vbvaLock(void);
383 void vbvaUnlock(void);
384
385 RTCRITSECT mSaveSeamlessRectLock;
386 int SaveSeamlessRectLock(void);
387 void SaveSeamlessRectUnLock(void);
388
389public:
390 static int displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height);
391
392#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
393 static BOOL displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *pu8Data, uint32_t u32Width, uint32_t u32Height);
394 int crCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, PFNCRCTLCOMPLETION pfnCompletion, void *pvCompletion);
395 int crCtlSubmitSync(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
396 /* copies the given command and submits it asynchronously,
397 * i.e. the pCmd data may be discarded right after the call returns */
398 int crCtlSubmitAsyncCmdCopy(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
399 /* performs synchronous request processing if 3D backend has something to display
400 * this is primarily to work-around 3d<->main thread deadlocks on OSX
401 * in case of async completion, the command is coppied to the allocated buffer,
402 * freeded on command completion
403 * can be used for "notification" commands, when client is not interested in command result,
404 * that must synchronize with 3D backend only when some 3D data is displayed.
405 * The routine does NOT provide any info on whether command is processed asynchronously or not */
406 int crCtlSubmitSyncIfHasDataForScreen(uint32_t u32ScreenID, struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
407#endif
408
409private:
410 static void InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll);
411 static int drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
412
413 int videoAccelRefreshProcess(void);
414
415 /* Functions run under VBVA lock. */
416 int videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory);
417 void videoAccelFlush(void);
418
419#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
420 int crOglWindowsShow(bool fShow);
421#endif
422
423#ifdef VBOX_WITH_HGSMI
424 volatile uint32_t mu32UpdateVBVAFlags;
425#endif
426
427#ifdef VBOX_WITH_VPX
428 VIDEORECCONTEXT *mpVideoRecCtx;
429 bool maVideoRecEnabled[SchemaDefs::MaxGuestMonitors];
430#endif
431};
432
433void gdImageCopyResampled(uint8_t *dst, uint8_t *src,
434 int dstX, int dstY, int srcX, int srcY,
435 int dstW, int dstH, int srcW, int srcH);
436
437void BitmapScale32(uint8_t *dst, int dstW, int dstH,
438 const uint8_t *src, int iDeltaLine, int srcW, int srcH);
439
440int DisplayMakePNG(uint8_t *pu8Data, uint32_t cx, uint32_t cy,
441 uint8_t **ppu8PNG, uint32_t *pcbPNG, uint32_t *pcxPNG, uint32_t *pcyPNG,
442 uint8_t fLimitSize);
443
444class ATL_NO_VTABLE DisplaySourceBitmap:
445 public DisplaySourceBitmapWrap
446{
447public:
448
449 DECLARE_EMPTY_CTOR_DTOR(DisplaySourceBitmap)
450
451 HRESULT FinalConstruct();
452 void FinalRelease();
453
454 /* Public initializer/uninitializer for internal purposes only. */
455 HRESULT init(ComObjPtr<Display> pDisplay, unsigned uScreenId, DISPLAYFBINFO *pFBInfo);
456 void uninit();
457
458 bool usesVRAM(void) { return m.pu8Allocated == NULL; }
459
460private:
461 // wrapped IDisplaySourceBitmap properties
462 virtual HRESULT getScreenId(ULONG *aScreenId);
463
464 // wrapped IDisplaySourceBitmap methods
465 virtual HRESULT queryBitmapInfo(BYTE **aAddress,
466 ULONG *aWidth,
467 ULONG *aHeight,
468 ULONG *aBitsPerPixel,
469 ULONG *aBytesPerLine,
470 ULONG *aPixelFormat);
471
472 int initSourceBitmap(unsigned aScreenId, DISPLAYFBINFO *pFBInfo);
473
474 struct Data
475 {
476 ComObjPtr<Display> pDisplay;
477 unsigned uScreenId;
478 DISPLAYFBINFO *pFBInfo;
479
480 uint8_t *pu8Allocated;
481
482 uint8_t *pu8Address;
483 ULONG ulWidth;
484 ULONG ulHeight;
485 ULONG ulBitsPerPixel;
486 ULONG ulBytesPerLine;
487 ULONG ulPixelFormat;
488 };
489
490 Data m;
491};
492
493#endif // ____H_DISPLAYIMPL
494/* 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