VBoxMPVbva.h revision 51bda560ad6e57baf58f6edba9b5dfccb2373f3c
/* $Id$ */
/** @file
* VBox WDDM Miniport driver
*/
/*
* Copyright (C) 2011 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 ___VBoxMPVbva_h___
#define ___VBoxMPVbva_h___
typedef struct VBOXVBVAINFO
{
} VBOXVBVAINFO;
int vboxVbvaCreate(PVBOXMP_DEVEXT pDevExt, VBOXVBVAINFO *pVbva, ULONG offBuffer, ULONG cbBuffer, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId);
do { \
{ \
} \
} while (0)
do { \
} while (0)
do { \
} while (0)
#ifdef VBOX_WITH_CROGL
/* customized VBVA implementation */
struct VBVAEXBUFFERCONTEXT;
typedef DECLCALLBACKPTR(void, PFNVBVAEXBUFFERFLUSH) (struct VBVAEXBUFFERCONTEXT *pCtx, PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, void *pvFlush);
/**
* Structure grouping the context needed for sending graphics acceleration
* information to the host via VBVA. Each screen has its own VBVA buffer.
*/
typedef struct VBVAEXBUFFERCONTEXT
{
/** Offset of the buffer in the VRAM section for the screen */
/** Length of the buffer in bytes */
/** This flag is set if we wrote to the buffer faster than the host could
* read it. */
bool fHwBufferOverflow;
/* the window between indexRecordFirstUncompleted and pVBVA->::indexRecordFirst represents
* command records processed by the host, but not completed by the guest yet */
volatile uint32_t indexRecordFirstUncompleted;
/* the window between off32DataUncompleted and pVBVA->::off32Data represents
* command data processed by the host, but not completed by the guest yet */
/* flush function */
void *pvFlush;
/** The VBVA record that we are currently preparing for the host, NULL if
* none. */
struct VBVARECORD *pRecord;
/** Pointer to the VBVA buffer mapped into the current address space. Will
* be NULL if VBVA is not enabled. */
struct VBVABUFFER *pVBVA;
typedef struct VBVAEXBUFFERITERBASE
{
struct VBVAEXBUFFERCONTEXT *pCtx;
/* index of the current record */
/* offset of the current command */
typedef struct VBVAEXBUFFERFORWARDITER
{
typedef struct VBVAEXBUFFERBACKWARDITER
{
#define VBOXCMDVBVA_BUFFERSIZE(_cbCmdApprox) (RT_OFFSETOF(VBVABUFFER, au8Data) + ((RT_SIZEOFMEMB(VBVABUFFER, aRecords)/RT_SIZEOFMEMB(VBVABUFFER, aRecords[0])) * (_cbCmdApprox)))
typedef struct VBOXCMDVBVA_PREEMPT_EL
{
#define VBOXCMDVBVA_PREEMPT_EL_SIZE 16
typedef struct VBOXCMDVBVA
{
/* last completted fence id */
/* last submitted fence id */
/* node ordinal */
} VBOXCMDVBVA;
/** @name VBVAEx APIs
* @{ */
struct VBVABUFFER *pVBVA);
void *pvFlush);
{
}
/* can be used to ensure the command will not cross the ring buffer boundary,
* and thus will not be splitted */
/* allocates a contiguous buffer of a given size, i.e. the one that is not splitted across ringbuffer boundaries */
RTDECL(void*) VBoxVBVAExAllocContiguous(PVBVAEXBUFFERCONTEXT pCtx, PHGSMIGUESTCOMMANDCONTEXT pHGSMICtx, uint32_t cb);
/* answers whether host is in "processing" state now,
* i.e. if "processing" is true after the command is submitted, no notification is required to be posted to host to make the commandbe processed,
* otherwise, host should be notified about the command */
/* initializes iterator that starts with free record,
* i.e. VBoxVBVAExIterNext would return the first uncompleted record.
*
* can be used by submitter only */
/* can be used by submitter only */
RTDECL(void*) VBoxVBVAExBIterNext(PVBVAEXBUFFERBACKWARDITER pIter, uint32_t *pcbBuffer, bool *pfProcessed);
/* completer functions
* completer can only use below ones, and submitter is NOT allowed to use them.
* Completter functions are prefixed with VBoxVBVAExC as opposed to submitter ones,
* that do not have the last "C" in the prefix */
/* initializes iterator that starts with completed record,
* i.e. VBoxVBVAExIterPrev would return the first uncompleted record.
* note that we can not have iterator that starts at processed record
* (i.e. the one processed by host, but not completed by guest, since host modifies
* VBVABUFFER::off32Data and VBVABUFFER::indexRecordFirst concurrently,
* and so we may end up with inconsistent index-offData pair
*
* can be used by completter only */
/* can be used by completter only */
RTDECL(void*) VBoxVBVAExCFIterNext(PVBVAEXBUFFERFORWARDITER pIter, uint32_t *pcbBuffer, bool *pfProcessed);
/** @} */
struct VBOXCMDVBVA_HDR;
int VBoxCmdVbvaSubmit(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, struct VBOXCMDVBVA_HDR *pCmd, uint32_t u32FenceID, uint32_t cbCmd);
void VBoxCmdVbvaSubmitUnlock(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, VBOXCMDVBVA_HDR* pCmd, uint32_t u32FenceID);
uint32_t VBoxCmdVbvaCheckCompleted(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, bool fPingHost, uint32_t *pu32FenceSubmitted);
/*helper functions for filling vbva commands */
{
}
DECLINLINE(void) VBoxCVDdiPackRects(VBOXCMDVBVA_RECT *paVbvaRects, const RECT *paRects, uint32_t cRects)
{
{
}
}
uint32_t VBoxCVDdiPTransferVRamSysBuildEls(VBOXCMDVBVA_PAGING_TRANSFER *pCmd, PMDL pMdl, uint32_t iPfn, uint32_t cPages, uint32_t cbBuffer, uint32_t *pcPagesWritten);
int VBoxCmdVbvaConCmdSubmitAsync(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA_CRCMD_CMD* pCmd, FNVBOXSHGSMICMDCOMPLETION pfnCompletion, void *pvCompletion);
int VBoxCmdVbvaConCmdResize(PVBOXMP_DEVEXT pDevExt, const VBOXWDDM_ALLOC_DATA *pAllocData, const uint32_t *pTargetMap, const POINT * pVScreenPos, uint16_t fFlags);
#endif /* #ifdef VBOX_WITH_CROGL */
#endif /* #ifndef ___VBoxMPVbva_h___ */