DisplayImpl.h revision 712aaf6e0dbc54e04c496329aaf83e19eaed89c4
/* $Id$ */
/** @file
* VirtualBox COM class implementation
*/
/*
* Copyright (C) 2006-2008 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef ____H_DISPLAYIMPL
#define ____H_DISPLAYIMPL
#include "VirtualBoxBase.h"
#include "SchemaDefs.h"
#include <iprt/semaphore.h>
#include <VBox/VBoxVideo.h>
struct VIDEORECCONTEXT;
enum {
};
typedef struct _DISPLAYFBINFO
{
bool fDisabled;
ULONG w;
ULONG h;
volatile uint32_t u32ResizeStatus;
/* The Framebuffer has default format and must be updates immediately. */
bool fDefaultFormat;
struct {
/* The rectangle that includes all dirty rectangles. */
} dirtyRect;
struct {
bool fPending;
void *pvVRAM;
int w;
int h;
#ifdef VBOX_WITH_HGSMI
bool fVBVAEnabled;
struct {
#endif /* VBOX_WITH_HGSMI */
{
void FinalRelease();
// public initializer/uninitializer for internal purposes only
void uninit();
// 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 handleDisplayUpdate (unsigned uScreenId, int x, int y, int w, int h);
#ifdef VBOX_WITH_VIDEOHWACCEL
#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);
#endif
{
}
void VideoAccelFlush (void);
bool VideoAccelAllowed (void);
void VideoAccelVRDP (bool fEnable);
// IEventListener methods
// IDisplay methods
STDMETHOD(GetScreenResolution)(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel);
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);
STDMETHOD(TakeScreenShotToArray)(ULONG aScreenId, ULONG width, ULONG height, ComSafeArrayOut(BYTE, aScreenData));
STDMETHOD(TakeScreenShotPNGToArray)(ULONG aScreenId, ULONG width, ULONG height, ComSafeArrayOut(BYTE, aScreenData));
STDMETHOD(DrawToScreen)(ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
void updateDisplayData(void);
#ifdef VBOX_WITH_CRHGSMI
void setupCrHgsmiData(void);
void destructCrHgsmiData(void);
#endif
static DECLCALLBACK(int) displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy);
static DECLCALLBACK(void) displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled);
static DECLCALLBACK(void) displayProcessAdapterDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, uint32_t u32VRAMSize);
static DECLCALLBACK(void) displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId);
#ifdef VBOX_WITH_VIDEOHWACCEL
static DECLCALLBACK(void) 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);
#endif
#ifdef VBOX_WITH_HGSMI
static DECLCALLBACK(int) displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags);
static DECLCALLBACK(void) displayVBVAUpdateBegin(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
static DECLCALLBACK(void) displayVBVAUpdateProcess(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, const PVBVACMDHDR pCmd, size_t cbCmd);
static DECLCALLBACK(void) displayVBVAUpdateEnd(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y, uint32_t cx, uint32_t cy);
static DECLCALLBACK(int) displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM);
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
static DECLCALLBACK(int) displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
static DECLCALLBACK(int) displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
/** Pointer to the associated display driver. */
struct DRVMAINDISPLAY *mpDrv;
/** Pointer to the device instance for the VMM Device. */
/** Set after the first attempt to find the VMM Device. */
bool mfVMMDevInited;
unsigned mcMonitors;
bool mFramebufferOpened;
/* arguments of the last handleDisplayResize() call */
void *mLastAddress;
int mLastWidth;
int mLastHeight;
bool mfVideoAccelEnabled;
bool mfVideoAccelVRDP;
int32_t volatile mcVideoAccelVRDPRefs;
bool mfMachineRunning;
#ifdef VBOX_WITH_CRHGSMI
/* for fast host hgcm calls */
#endif
void handleResizeCompletedEMT (void);
volatile uint32_t mfu32PendingVideoAccelDisable;
int vbvaLock(void);
void vbvaUnlock(void);
static int displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height);
static int drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
int videoAccelRefreshProcess(void);
/* Functions run under VBVA lock. */
void videoAccelFlush (void);
#ifdef VBOX_WITH_HGSMI
volatile uint32_t mu32UpdateVBVAFlags;
#endif
#ifdef VBOX_WITH_VPX
#endif
};
int iDeltaLine,
#endif // ____H_DISPLAYIMPL
/* vi: set tabstop=4 shiftwidth=4 expandtab: */