VirtualBox

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

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

Main: removed obsolete RequestResize, ResizeCompleted methods.

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