summaryrefslogtreecommitdiff
path: root/src/VBox/Main/include/DisplayImpl.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Main/include/DisplayImpl.h')
-rw-r--r--src/VBox/Main/include/DisplayImpl.h215
1 files changed, 153 insertions, 62 deletions
diff --git a/src/VBox/Main/include/DisplayImpl.h b/src/VBox/Main/include/DisplayImpl.h
index 1f783700..4bc1415a 100644
--- a/src/VBox/Main/include/DisplayImpl.h
+++ b/src/VBox/Main/include/DisplayImpl.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2008 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -26,10 +26,15 @@
#include <VBox/VMMDev.h>
#include <VBox/VBoxVideo.h>
+#ifdef VBOX_WITH_CROGL
+# include <VBox/HostServices/VBoxCrOpenGLSvc.h>
+#endif
+
class Console;
struct VIDEORECCONTEXT;
-enum {
+enum
+{
ResizeStatus_Void,
ResizeStatus_InProgress,
ResizeStatus_UpdateDisplayData
@@ -56,6 +61,10 @@ typedef struct _DISPLAYFBINFO
uint16_t flags;
+ /* for saving the rectangles arrived during fb resize is in progress. */
+ PRTRECT mpSavedVisibleRegion;
+ uint32_t mcSavedVisibleRegion;
+
VBOXVIDEOINFOHOSTEVENTS *pHostEvents;
volatile uint32_t u32ResizeStatus;
@@ -63,7 +72,8 @@ typedef struct _DISPLAYFBINFO
/* The Framebuffer has default format and must be updates immediately. */
bool fDefaultFormat;
- struct {
+ struct
+ {
/* The rectangle that includes all dirty rectangles. */
int32_t xLeft;
int32_t xRight;
@@ -71,21 +81,23 @@ typedef struct _DISPLAYFBINFO
int32_t yBottom;
} dirtyRect;
- struct {
+ struct
+ {
bool fPending;
ULONG pixelFormat;
void *pvVRAM;
uint32_t bpp;
uint32_t cbLine;
- int w;
- int h;
+ uint32_t w;
+ uint32_t h;
uint16_t flags;
} pendingResize;
#ifdef VBOX_WITH_HGSMI
bool fVBVAEnabled;
uint32_t cVBVASkipUpdate;
- struct {
+ struct
+ {
int32_t xLeft;
int32_t yTop;
int32_t xRight;
@@ -93,12 +105,35 @@ typedef struct _DISPLAYFBINFO
} vbvaSkippedRect;
PVBVAHOSTFLAGS pVBVAHostFlags;
#endif /* VBOX_WITH_HGSMI */
+
+#ifdef VBOX_WITH_CROGL
+ struct
+ {
+ bool fPending;
+ ULONG x;
+ ULONG y;
+ ULONG width;
+ ULONG height;
+ } pendingViewportInfo;
+#endif /* VBOX_WITH_CROGL */
} DISPLAYFBINFO;
+class DisplayMouseInterface
+{
+public:
+ virtual int getScreenResolution(uint32_t cScreen, ULONG *pcx,
+ ULONG *pcy, ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin) = 0;
+ virtual void getFramebufferDimensions(int32_t *px1, int32_t *py1,
+ int32_t *px2, int32_t *py2) = 0;
+};
+
+class VMMDev;
+
class ATL_NO_VTABLE Display :
public VirtualBoxBase,
VBOX_SCRIPTABLE_IMPL(IEventListener),
- VBOX_SCRIPTABLE_IMPL(IDisplay)
+ VBOX_SCRIPTABLE_IMPL(IDisplay),
+ public DisplayMouseInterface
{
public:
@@ -113,52 +148,74 @@ public:
COM_INTERFACE_ENTRY(IEventListener)
END_COM_MAP()
- DECLARE_EMPTY_CTOR_DTOR (Display)
+ DECLARE_EMPTY_CTOR_DTOR(Display)
HRESULT FinalConstruct();
void FinalRelease();
// public initializer/uninitializer for internal purposes only
- HRESULT init (Console *aParent);
+ HRESULT init(Console *aParent);
void uninit();
- int registerSSM(PVM pVM);
+ int registerSSM(PUVM pUVM);
// public methods only for internal purposes
- int handleDisplayResize (unsigned uScreenId, uint32_t bpp, void *pvVRAM, uint32_t cbLine, int w, int h, uint16_t flags);
- void handleDisplayUpdateLegacy (int x, int y, int cx, int cy);
- void handleDisplayUpdate (unsigned uScreenId, int x, int y, int w, int h);
+ int handleDisplayResize(unsigned uScreenId, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t w, uint32_t h, uint16_t flags);
+ void handleDisplayUpdateLegacy(int x, int y, int cx, int cy);
+ void handleDisplayUpdate(unsigned uScreenId, int x, int y, int w, int h);
#ifdef VBOX_WITH_VIDEOHWACCEL
- void handleVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand);
+ int handleVHWACommandProcess(PVBOXVHWACMD pCommand);
#endif
#ifdef VBOX_WITH_CRHGSMI
- void handleCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
- void handleCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl);
+ void handleCrHgsmiCommandProcess(PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
+ void handleCrHgsmiControlProcess(PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl);
void handleCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
void handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
#endif
+ int handleCrHgcmCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
+ PFNCRCTLCOMPLETION pfnCompletion,
+ void *pvCompletion);
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
+ void handleCrAsyncCmdCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
+ void handleCrVRecScreenshotPerform(uint32_t uScreen,
+ uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBitsPerPixel,
+ uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight,
+ uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
+ bool handleCrVRecScreenshotBegin(uint32_t uScreen, uint64_t u64TimeStamp);
+ void handleCrVRecScreenshotEnd(uint32_t uScreen, uint64_t u64TimeStamp);
+ void handleVRecCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
+#endif
+
+ int notifyCroglResize(const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM);
+
IFramebuffer *getFramebuffer()
{
return maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN].pFramebuffer;
}
- void getFramebufferDimensions(int32_t *px1, int32_t *py1, int32_t *px2,
- int32_t *py2);
-
- int handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect);
- int handleQueryVisibleRegion(uint32_t *pcRect, PRTRECT pRect);
+ void getFramebufferDimensions(int32_t *px1, int32_t *py1, int32_t *px2, int32_t *py2);
+ int getScreenResolution(uint32_t cScreen, ULONG *pcx, ULONG *pcy,
+ ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin)
+ {
+ return GetScreenResolution(cScreen, pcx, pcy, pcBPP, pXOrigin, pYOrigin);
+ }
- int VideoAccelEnable (bool fEnable, VBVAMEMORY *pVbvaMemory);
- void VideoAccelFlush (void);
+ int handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect);
+ int handleQueryVisibleRegion(uint32_t *pcRect, PRTRECT pRect);
- bool VideoAccelAllowed (void);
+ int VideoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory);
+ void VideoAccelFlush(void);
+ bool VideoAccelAllowed(void);
+ void VideoAccelVRDP(bool fEnable);
- void VideoAccelVRDP (bool fEnable);
+ int VideoCaptureStart();
+ void VideoCaptureStop();
+ int VideoCaptureEnableScreens(ComSafeArrayIn(BOOL, aScreens));
// IEventListener methods
STDMETHOD(HandleEvent)(IEvent * aEvent);
// IDisplay methods
- STDMETHOD(GetScreenResolution)(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel);
+ STDMETHOD(GetScreenResolution)(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel, LONG *aXOrigin, LONG *aYOrigin);
STDMETHOD(SetFramebuffer)(ULONG aScreenId, IFramebuffer *aFramebuffer);
STDMETHOD(GetFramebuffer)(ULONG aScreenId, IFramebuffer **aFramebuffer, LONG *aXOrigin, LONG *aYOrigin);
STDMETHOD(SetVideoModeHint)(ULONG aDisplay, BOOL aEnabled, BOOL aChangeOrigin, LONG aOriginX, LONG aOriginY, ULONG aWidth, ULONG aHeight, ULONG aBitsPerPixel);
@@ -178,13 +235,17 @@ public:
private:
- void updateDisplayData(void);
+ int updateDisplayData(void);
#ifdef VBOX_WITH_CRHGSMI
void setupCrHgsmiData(void);
void destructCrHgsmiData(void);
#endif
+#ifdef VBOX_WITH_CROGL
+ void crViewportNotify(class VMMDev *pVMMDev, ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height);
+#endif
+
static DECLCALLBACK(int) changeFramebuffer(Display *that, IFramebuffer *aFB, unsigned uScreenId);
static DECLCALLBACK(void*) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
@@ -200,17 +261,21 @@ private:
static DECLCALLBACK(void) displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId);
#ifdef VBOX_WITH_VIDEOHWACCEL
- static DECLCALLBACK(void) displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand);
+ static DECLCALLBACK(int) displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand);
#endif
#ifdef VBOX_WITH_CRHGSMI
static DECLCALLBACK(void) displayCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
static DECLCALLBACK(void) displayCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl);
- static DECLCALLBACK(void) displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
- static DECLCALLBACK(void) displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
+ static DECLCALLBACK(void) displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
+ static DECLCALLBACK(void) displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
#endif
-
+ static DECLCALLBACK(int) displayCrHgcmCtlSubmit(PPDMIDISPLAYCONNECTOR pInterface,
+ struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
+ PFNCRCTLCOMPLETION pfnCompletion,
+ void *pvCompletion);
+ static DECLCALLBACK(void) displayCrHgcmCtlSubmitCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
#ifdef VBOX_WITH_HGSMI
static DECLCALLBACK(int) displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags);
static DECLCALLBACK(void) displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
@@ -221,6 +286,18 @@ private:
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);
#endif
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
+ static DECLCALLBACK(void) displayCrVRecScreenshotPerform(void *pvCtx, uint32_t uScreen,
+ uint32_t x, uint32_t y,
+ uint32_t uBitsPerPixel, uint32_t uBytesPerLine,
+ uint32_t uGuestWidth, uint32_t uGuestHeight,
+ uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
+ static DECLCALLBACK(bool) displayCrVRecScreenshotBegin(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
+ static DECLCALLBACK(void) displayCrVRecScreenshotEnd(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
+
+ static DECLCALLBACK(void) displayVRecCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
+ static DECLCALLBACK(void) displayCrAsyncCmdCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
+#endif
static DECLCALLBACK(void) displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser);
static DECLCALLBACK(int) displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
@@ -238,15 +315,13 @@ private:
unsigned mcMonitors;
DISPLAYFBINFO maFramebuffers[SchemaDefs::MaxGuestMonitors];
- bool mFramebufferOpened;
-
/* arguments of the last handleDisplayResize() call */
- void *mLastAddress;
- uint32_t mLastBytesPerLine;
- uint32_t mLastBitsPerPixel;
- int mLastWidth;
- int mLastHeight;
- uint16_t mLastFlags;
+ void *mLastAddress;
+ uint32_t mLastBytesPerLine;
+ uint32_t mLastBitsPerPixel;
+ uint32_t mLastWidth;
+ uint32_t mLastHeight;
+ uint16_t mLastFlags;
VBVAMEMORY *mpVbvaMemory;
bool mfVideoAccelEnabled;
@@ -258,59 +333,75 @@ private:
VBVAMEMORY *mpPendingVbvaMemory;
bool mfPendingVideoAccelEnable;
bool mfMachineRunning;
+#ifdef VBOX_WITH_CROGL
+ bool mfCrOglDataHidden;
+#endif
uint8_t *mpu8VbvaPartial;
- uint32_t mcbVbvaPartial;
+ uint32_t mcbVbvaPartial;
#ifdef VBOX_WITH_CRHGSMI
/* for fast host hgcm calls */
HGCMCVSHANDLE mhCrOglSvc;
#endif
+#ifdef VBOX_WITH_CROGL
+ CR_MAIN_INTERFACE mCrOglCallbacks;
+ volatile uint32_t mfCrOglVideoRecState;
+ CRVBOXHGCMTAKESCREENSHOT mCrOglScreenshotData;
+#endif
- bool vbvaFetchCmd (VBVACMDHDR **ppHdr, uint32_t *pcbCmd);
- void vbvaReleaseCmd (VBVACMDHDR *pHdr, int32_t cbCmd);
+ bool vbvaFetchCmd(VBVACMDHDR **ppHdr, uint32_t *pcbCmd);
+ void vbvaReleaseCmd(VBVACMDHDR *pHdr, int32_t cbCmd);
- void handleResizeCompletedEMT (void);
+ void handleResizeCompletedEMT(void);
RTCRITSECT mVBVALock;
volatile uint32_t mfu32PendingVideoAccelDisable;
- int vbvaLock(void);
+ int vbvaLock(void);
void vbvaUnlock(void);
+ RTCRITSECT mSaveSeamlessRectLock;
+ int SaveSeamlessRectLock(void);
+ void SaveSeamlessRectUnLock(void);
+
public:
- static int displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height);
+ static int displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height);
+
+#ifdef VBOX_WITH_CROGL
+ static BOOL displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *pu8Data, uint32_t u32Width, uint32_t u32Height);
+#endif
private:
- static void InvalidateAndUpdateEMT(Display *pDisplay);
- static int drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
+ static void InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll);
+ static int drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
- int videoAccelRefreshProcess(void);
+ int videoAccelRefreshProcess(void);
/* Functions run under VBVA lock. */
- int videoAccelEnable (bool fEnable, VBVAMEMORY *pVbvaMemory);
- void videoAccelFlush (void);
+ int videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory);
+ void videoAccelFlush(void);
+
+#ifdef VBOX_WITH_CROGL
+ int crOglWindowsShow(bool fShow);
+#endif
#ifdef VBOX_WITH_HGSMI
volatile uint32_t mu32UpdateVBVAFlags;
#endif
#ifdef VBOX_WITH_VPX
- VIDEORECCONTEXT *mpVideoRecContext;
+ VIDEORECCONTEXT *mpVideoRecCtx;
+ bool maVideoRecEnabled[SchemaDefs::MaxGuestMonitors];
#endif
};
-void gdImageCopyResampled (uint8_t *dst, uint8_t *src,
- int dstX, int dstY,
- int srcX, int srcY,
- int dstW, int dstH, int srcW, int srcH);
-
+void gdImageCopyResampled(uint8_t *dst, uint8_t *src,
+ int dstX, int dstY, int srcX, int srcY,
+ int dstW, int dstH, int srcW, int srcH);
-void BitmapScale32 (uint8_t *dst,
- int dstW, int dstH,
- const uint8_t *src,
- int iDeltaLine,
- int srcW, int srcH);
+void BitmapScale32(uint8_t *dst, int dstW, int dstH,
+ const uint8_t *src, int iDeltaLine, int srcW, int srcH);
int DisplayMakePNG(uint8_t *pu8Data, uint32_t cx, uint32_t cy,
uint8_t **ppu8PNG, uint32_t *pcbPNG, uint32_t *pcxPNG, uint32_t *pcyPNG,