DisplayImpl.h revision 1a57f94c99b4728b6529213cfea99938b2c75c15
/* $Id$ */
/** @file
* VirtualBox COM class implementation
*/
/*
* Copyright (C) 2006-2014 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 "SchemaDefs.h"
#include <iprt/semaphore.h>
#include <VBox/VBoxVideo.h>
#include "DisplayWrap.h"
#ifdef VBOX_WITH_CROGL
#endif
#include "DisplaySourceBitmapWrap.h"
struct VIDEORECCONTEXT;
typedef struct _DISPLAYFBINFO
{
/* The following 3 fields (u32Offset, u32MaxFramebufferSize and u32InformationSize)
* are not used by the current HGSMI. They are needed for backward compatibility with
* pre-HGSMI additions.
*/
bool fDisabled;
struct
{
} updateImage;
ULONG w;
ULONG h;
/** The framebuffer has default format and must be updates immediately. */
bool fDefaultFormat;
#ifdef VBOX_WITH_HGSMI
bool fVBVAEnabled;
bool fVBVAForceResize;
bool fRenderThreadMode;
#endif /* VBOX_WITH_HGSMI */
#ifdef VBOX_WITH_CROGL
struct
{
bool fPending;
ULONG x;
ULONG y;
#endif /* VBOX_WITH_CROGL */
/* The legacy VBVA (VideoAccel) data.
*
* Backward compatibility with the guest additions 3.x or older.
*/
typedef struct VIDEOACCEL
{
bool fVideoAccelEnabled;
/* Old guest additions (3.x and older) use both VMMDev and DevVGA refresh timer
* to process the VBVABUFFER memory. Therefore the legacy VBVA (VideoAccel) host
* code can be executed concurrently by VGA refresh timer and the guest VMMDev
* request in SMP VMs. The semaphore serialized this.
*/
} VIDEOACCEL;
{
};
{
void FinalRelease();
// public initializer/uninitializer for internal purposes only
void uninit();
// public methods only for internal purposes
void i_handleDisplayUpdate(unsigned uScreenId, int x, int y, int w, int h);
#ifdef VBOX_WITH_VIDEOHWACCEL
#endif
#ifdef VBOX_WITH_CRHGSMI
void i_handleCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
void i_handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
#endif
#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
void *pvCompletion);
void i_handleVRecCompletion();
#endif
void i_VideoAccelVRDP(bool fEnable);
/* Legacy video acceleration requests coming from the VGA refresh timer. */
/* Legacy video acceleration requests coming from VMMDev. */
void VideoAccelFlushVMMDev(void);
int i_VideoCaptureStart();
void i_VideoCaptureStop();
void i_notifyPowerDown(void);
// DisplayMouseInterface methods
{
}
// Wrapped IDisplay properties
// Wrapped IDisplay methods
// Wrapped IEventListener properties
// Wrapped IEventListener methods
// other internal methods
#ifdef VBOX_WITH_CRHGSMI
void i_setupCrHgsmiData(void);
void i_destructCrHgsmiData(void);
#endif
#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
#endif
static DECLCALLBACK(int) i_displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM,
static DECLCALLBACK(void) i_displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled);
#ifdef VBOX_WITH_VIDEOHWACCEL
static DECLCALLBACK(int) i_displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand);
#endif
#ifdef VBOX_WITH_CRHGSMI
static DECLCALLBACK(void) i_displayCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl,
static DECLCALLBACK(void) i_displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
void *pvContext);
static DECLCALLBACK(void) i_displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
void *pvContext);
#endif
#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
void *pvCompletion);
static DECLCALLBACK(void) i_displayCrHgcmCtlSubmitCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
void *pvContext);
#endif
#ifdef VBOX_WITH_HGSMI
static DECLCALLBACK(void) i_displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
static DECLCALLBACK(void) i_displayVBVAUpdateBegin(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
static DECLCALLBACK(void) i_displayVBVAUpdateProcess(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
static DECLCALLBACK(void) i_displayVBVAUpdateEnd(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y,
static DECLCALLBACK(int) i_displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, const PVBVAINFOVIEW pView,
static DECLCALLBACK(int) i_displayVBVAMousePointerShape(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha,
const void *pvShape);
static DECLCALLBACK(void) i_displayVBVAGuestCapabilityUpdate(PPDMIDISPLAYCONNECTOR pInterface, uint32_t fCapabilities);
#endif
#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
static DECLCALLBACK(bool) i_displayCrVRecScreenshotBegin(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
static DECLCALLBACK(void) i_displayCrVRecScreenshotEnd(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
static DECLCALLBACK(void) i_displayVRecCompletion(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion);
#endif
static DECLCALLBACK(void) i_displayCrCmdFree(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion);
static DECLCALLBACK(int) i_displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
static DECLCALLBACK(int) i_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;
/** Does the VMM device have the "supports graphics" capability set?
* Does not go into the saved state as it is refreshed on restore. */
bool mfVMMDevSupportsGraphics;
/** Mirror of the current guest VBVA capabilities.
* Does not go into the saved state as it is refreshed on restore. */
bool mfSourceBitmapEnabled;
bool volatile fVGAResizing;
bool mfVideoAccelVRDP;
int32_t volatile mcVideoAccelVRDPRefs;
#ifdef VBOX_WITH_CROGL
bool mfCrOglDataHidden;
#endif
#ifdef VBOX_WITH_CRHGSMI
/* for fast host hgcm calls */
#endif
#ifdef VBOX_WITH_CROGL
volatile uint32_t mfCrOglVideoRecState;
#endif
/* The legacy VBVA data and methods. */
bool i_VideoAccelAllowed(void);
/* Legacy pre-HGSMI handlers. */
/* Serializes access to mVideoAccelLegacy and mfVideoAccelVRDP, etc between VRDP and Display. */
static int i_displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData,
#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
int i_crCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, PFNCRCTLCOMPLETION pfnCompletion, void *pvCompletion);
/* copies the given command and submits it asynchronously,
* i.e. the pCmd data may be discarded right after the call returns */
/* performs synchronous request processing if 3D backend has something to display
* this is primarily to work-around 3d<->main thread deadlocks on OSX
* in case of async completion, the command is coppied to the allocated buffer,
* freeded on command completion
* can be used for "notification" commands, when client is not interested in command result,
* that must synchronize with 3D backend only when some 3D data is displayed.
* The routine does NOT provide any info on whether command is processed asynchronously or not */
int i_crCtlSubmitSyncIfHasDataForScreen(uint32_t u32ScreenID, struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
#endif
static int i_drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
void i_updateGuestGraphicsFacility(void);
#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
int i_crOglWindowsShow(bool fShow);
#endif
#ifdef VBOX_WITH_HGSMI
volatile uint32_t mu32UpdateVBVAFlags;
#endif
#ifdef VBOX_WITH_VPX
#endif
};
/* The legacy VBVA helpers. */
bool fVideoAccelEnabled,
bool fVideoAccelVRDP,
unsigned cFBInfos);
/* helper function, code in DisplayResampleImage.cpp */
/* helper function, code in DisplayPNGUtul.cpp */
{
void FinalRelease();
/* Public initializer/uninitializer for internal purposes only. */
void uninit();
// wrapped IDisplaySourceBitmap properties
// wrapped IDisplaySourceBitmap methods
struct Data
{
unsigned uScreenId;
};
Data m;
};
#endif // ____H_DISPLAYIMPL
/* vi: set tabstop=4 shiftwidth=4 expandtab: */