VirtualBox

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

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

main: async call crogl when needed

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 19.3 KB
Line 
1/* $Id: DisplayImpl.h 51460 2014-05-29 12:44:48Z vboxsync $ */
2/** @file
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2013 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 // IEventListener methods
219 STDMETHOD(HandleEvent)(IEvent * aEvent);
220
221 // IDisplay methods
222 STDMETHOD(GetScreenResolution)(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel, LONG *aXOrigin, LONG *aYOrigin);
223 STDMETHOD(SetFramebuffer)(ULONG aScreenId, IFramebuffer *aFramebuffer);
224 STDMETHOD(AttachFramebuffer)(ULONG aScreenId,
225 IFramebuffer *aFramebuffer);
226 STDMETHOD(DetachFramebuffer)(ULONG aScreenId);
227 STDMETHOD(QueryFramebuffer)(ULONG aScreenId,
228 IFramebuffer **aFramebuffer);
229 STDMETHOD(GetFramebuffer)(ULONG aScreenId, IFramebuffer **aFramebuffer, LONG *aXOrigin, LONG *aYOrigin);
230 STDMETHOD(SetVideoModeHint)(ULONG aDisplay, BOOL aEnabled, BOOL aChangeOrigin, LONG aOriginX, LONG aOriginY, ULONG aWidth, ULONG aHeight, ULONG aBitsPerPixel);
231 STDMETHOD(TakeScreenShot)(ULONG aScreenId, BYTE *address, ULONG width, ULONG height);
232 STDMETHOD(TakeScreenShotToArray)(ULONG aScreenId, ULONG width, ULONG height, ComSafeArrayOut(BYTE, aScreenData));
233 STDMETHOD(TakeScreenShotPNGToArray)(ULONG aScreenId, ULONG width, ULONG height, ComSafeArrayOut(BYTE, aScreenData));
234 STDMETHOD(DrawToScreen)(ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
235 STDMETHOD(InvalidateAndUpdate)();
236 STDMETHOD(ResizeCompleted)(ULONG aScreenId);
237 STDMETHOD(SetSeamlessMode)(BOOL enabled);
238
239 STDMETHOD(CompleteVHWACommand)(BYTE *pCommand);
240
241 STDMETHOD(ViewportChanged)(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height);
242 STDMETHOD(QuerySourceBitmap)(ULONG aScreenId,
243 IDisplaySourceBitmap **aDisplaySourceBitmap);
244
245 static const PDMDRVREG DrvReg;
246
247private:
248
249 HRESULT querySourceBitmap(ULONG aScreenId,
250 IDisplaySourceBitmap **ppDisplaySourceBitmap);
251 int updateDisplayData(void);
252
253#ifdef VBOX_WITH_CRHGSMI
254 void setupCrHgsmiData(void);
255 void destructCrHgsmiData(void);
256#endif
257
258#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
259 int crViewportNotify(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height);
260#endif
261
262 static DECLCALLBACK(int) changeFramebuffer(Display *that, IFramebuffer *aFB, unsigned uScreenId);
263
264 static DECLCALLBACK(void*) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
265 static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
266 static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
267 static DECLCALLBACK(int) displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy);
268 static DECLCALLBACK(void) displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterface,
269 uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
270 static DECLCALLBACK(void) displayRefreshCallback(PPDMIDISPLAYCONNECTOR pInterface);
271 static DECLCALLBACK(void) displayResetCallback(PPDMIDISPLAYCONNECTOR pInterface);
272 static DECLCALLBACK(void) displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled);
273 static DECLCALLBACK(void) displayProcessAdapterDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, uint32_t u32VRAMSize);
274 static DECLCALLBACK(void) displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId);
275
276#ifdef VBOX_WITH_VIDEOHWACCEL
277 static DECLCALLBACK(int) displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand);
278#endif
279
280#ifdef VBOX_WITH_CRHGSMI
281 static DECLCALLBACK(void) displayCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
282 static DECLCALLBACK(void) displayCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl);
283
284 static DECLCALLBACK(void) displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
285 static DECLCALLBACK(void) displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
286#endif
287#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
288 static DECLCALLBACK(int) displayCrHgcmCtlSubmit(PPDMIDISPLAYCONNECTOR pInterface,
289 struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
290 PFNCRCTLCOMPLETION pfnCompletion,
291 void *pvCompletion);
292 static DECLCALLBACK(void) displayCrHgcmCtlSubmitCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
293#endif
294#ifdef VBOX_WITH_HGSMI
295 static DECLCALLBACK(int) displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags, bool fRenderThreadMode);
296 static DECLCALLBACK(void) displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
297 static DECLCALLBACK(void) displayVBVAUpdateBegin(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
298 static DECLCALLBACK(void) displayVBVAUpdateProcess(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, const PVBVACMDHDR pCmd, size_t cbCmd);
299 static DECLCALLBACK(void) displayVBVAUpdateEnd(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y, uint32_t cx, uint32_t cy);
300 static DECLCALLBACK(int) displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM);
301 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);
302#endif
303
304#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
305 static DECLCALLBACK(void) displayCrVRecScreenshotPerform(void *pvCtx, uint32_t uScreen,
306 uint32_t x, uint32_t y,
307 uint32_t uBitsPerPixel, uint32_t uBytesPerLine,
308 uint32_t uGuestWidth, uint32_t uGuestHeight,
309 uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
310 static DECLCALLBACK(bool) displayCrVRecScreenshotBegin(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
311 static DECLCALLBACK(void) displayCrVRecScreenshotEnd(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
312
313 static DECLCALLBACK(void) displayVRecCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
314#endif
315 static DECLCALLBACK(void) displayCrCmdFree(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion);
316
317 static DECLCALLBACK(void) displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser);
318 static DECLCALLBACK(int) displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
319 static DECLCALLBACK(void) displaySSMSave(PSSMHANDLE pSSM, void *pvUser);
320 static DECLCALLBACK(int) displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
321
322 Console * const mParent;
323 /** Pointer to the associated display driver. */
324 struct DRVMAINDISPLAY *mpDrv;
325 /** Pointer to the device instance for the VMM Device. */
326 PPDMDEVINS mpVMMDev;
327 /** Set after the first attempt to find the VMM Device. */
328 bool mfVMMDevInited;
329
330 unsigned mcMonitors;
331 DISPLAYFBINFO maFramebuffers[SchemaDefs::MaxGuestMonitors];
332
333 /* arguments of the last handleDisplayResize() call */
334 void *mLastAddress;
335 uint32_t mLastBytesPerLine;
336 uint32_t mLastBitsPerPixel;
337 uint32_t mLastWidth;
338 uint32_t mLastHeight;
339 uint16_t mLastFlags;
340
341 VBVAMEMORY *mpVbvaMemory;
342 bool mfVideoAccelEnabled;
343 bool mfVideoAccelVRDP;
344 uint32_t mfu32SupportedOrders;
345
346 int32_t volatile mcVideoAccelVRDPRefs;
347
348 VBVAMEMORY *mpPendingVbvaMemory;
349 bool mfPendingVideoAccelEnable;
350 bool mfMachineRunning;
351#ifdef VBOX_WITH_CROGL
352 bool mfCrOglDataHidden;
353#endif
354
355 uint8_t *mpu8VbvaPartial;
356 uint32_t mcbVbvaPartial;
357
358#ifdef VBOX_WITH_CRHGSMI
359 /* for fast host hgcm calls */
360 HGCMCVSHANDLE mhCrOglSvc;
361 RTCRITSECTRW mCrOglLock;
362#endif
363#ifdef VBOX_WITH_CROGL
364 CR_MAIN_INTERFACE mCrOglCallbacks;
365 volatile uint32_t mfCrOglVideoRecState;
366 CRVBOXHGCMTAKESCREENSHOT mCrOglScreenshotData;
367 VBOXCRCMDCTL_HGCM mCrOglScreenshotCtl;
368#endif
369
370 bool vbvaFetchCmd(VBVACMDHDR **ppHdr, uint32_t *pcbCmd);
371 void vbvaReleaseCmd(VBVACMDHDR *pHdr, int32_t cbCmd);
372
373 void handleResizeCompletedEMT(unsigned uScreenId, BOOL fResizeContext);
374
375 RTCRITSECT mVBVALock;
376 volatile uint32_t mfu32PendingVideoAccelDisable;
377
378 int vbvaLock(void);
379 void vbvaUnlock(void);
380
381 RTCRITSECT mSaveSeamlessRectLock;
382 int SaveSeamlessRectLock(void);
383 void SaveSeamlessRectUnLock(void);
384
385public:
386 static int displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height);
387
388#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
389 static BOOL displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *pu8Data, uint32_t u32Width, uint32_t u32Height);
390 int crCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, PFNCRCTLCOMPLETION pfnCompletion, void *pvCompletion);
391 int crCtlSubmitSync(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
392 /* copies the given command and submits it asynchronously,
393 * i.e. the pCmd data may be discarded right after the call returns */
394 int crCtlSubmitAsyncCmdCopy(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
395 /* performs synchronous request processing if 3D backend has something to display
396 * this is primarily to work-around 3d<->main thread deadlocks on OSX
397 * in case of async completion, the command is coppied to the allocated buffer,
398 * freeded on command completion
399 * can be used for "notification" commands, when client is not interested in command result,
400 * that must synchronize with 3D backend only when some 3D data is displayed.
401 * The routine does NOT provide any info on whether command is processed asynchronously or not */
402 int crCtlSubmitSyncIfHasDataForScreen(uint32_t u32ScreenID, struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
403#endif
404
405private:
406 static void InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll);
407 static int drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
408
409 int videoAccelRefreshProcess(void);
410
411 /* Functions run under VBVA lock. */
412 int videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory);
413 void videoAccelFlush(void);
414
415#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
416 int crOglWindowsShow(bool fShow);
417#endif
418
419#ifdef VBOX_WITH_HGSMI
420 volatile uint32_t mu32UpdateVBVAFlags;
421#endif
422
423#ifdef VBOX_WITH_VPX
424 VIDEORECCONTEXT *mpVideoRecCtx;
425 bool maVideoRecEnabled[SchemaDefs::MaxGuestMonitors];
426#endif
427};
428
429void gdImageCopyResampled(uint8_t *dst, uint8_t *src,
430 int dstX, int dstY, int srcX, int srcY,
431 int dstW, int dstH, int srcW, int srcH);
432
433void BitmapScale32(uint8_t *dst, int dstW, int dstH,
434 const uint8_t *src, int iDeltaLine, int srcW, int srcH);
435
436int DisplayMakePNG(uint8_t *pu8Data, uint32_t cx, uint32_t cy,
437 uint8_t **ppu8PNG, uint32_t *pcbPNG, uint32_t *pcxPNG, uint32_t *pcyPNG,
438 uint8_t fLimitSize);
439
440class ATL_NO_VTABLE DisplaySourceBitmap:
441 public DisplaySourceBitmapWrap
442{
443public:
444
445 DECLARE_EMPTY_CTOR_DTOR(DisplaySourceBitmap)
446
447 HRESULT FinalConstruct();
448 void FinalRelease();
449
450 /* Public initializer/uninitializer for internal purposes only. */
451 HRESULT init(ComObjPtr<Display> pDisplay, unsigned uScreenId, DISPLAYFBINFO *pFBInfo);
452 void uninit();
453
454 bool usesVRAM(void) { return m.pu8Allocated == NULL; }
455
456private:
457 // wrapped IDisplaySourceBitmap properties
458 virtual HRESULT getScreenId(ULONG *aScreenId);
459
460 // wrapped IDisplaySourceBitmap methods
461 virtual HRESULT queryBitmapInfo(BYTE **aAddress,
462 ULONG *aWidth,
463 ULONG *aHeight,
464 ULONG *aBitsPerPixel,
465 ULONG *aBytesPerLine,
466 ULONG *aPixelFormat);
467
468 int initSourceBitmap(unsigned aScreenId, DISPLAYFBINFO *pFBInfo);
469
470 struct Data
471 {
472 ComObjPtr<Display> pDisplay;
473 unsigned uScreenId;
474 DISPLAYFBINFO *pFBInfo;
475
476 uint8_t *pu8Allocated;
477
478 uint8_t *pu8Address;
479 ULONG ulWidth;
480 ULONG ulHeight;
481 ULONG ulBitsPerPixel;
482 ULONG ulBytesPerLine;
483 ULONG ulPixelFormat;
484 };
485
486 Data m;
487};
488
489#endif // ____H_DISPLAYIMPL
490/* 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