server_presenter.cpp revision f64b17becdfd09ab00db844f13d1e776d7823bd5
/* $Id$ */
/** @file
* Presenter API
*/
/*
* Copyright (C) 2012-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;
* 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.
*/
#include "cr_spu.h"
#include "chromium.h"
#include "cr_error.h"
#include "cr_net.h"
#include "cr_rand.h"
#include "server_dispatch.h"
#include "server.h"
#include "cr_mem.h"
#include "cr_string.h"
#include <cr_vreg.h>
#include <cr_htable.h>
#include <cr_bmpscale.h>
#ifdef DEBUG_misha
# define VBOXVDBG_MEMCACHE_DISABLE
#endif
#ifndef VBOXVDBG_MEMCACHE_DISABLE
# include <iprt/memcache.h>
#endif
#include "render/renderspu.h"
class ICrFbDisplay
{
public:
virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry) = 0;
virtual ~ICrFbDisplay() {}
};
class CrFbDisplayComposite;
class CrFbDisplayBase;
class CrFbDisplayWindow;
class CrFbDisplayWindowRootVr;
class CrFbDisplayVrdp;
typedef struct CR_FRAMEBUFFER
{
struct VBVAINFOSCREEN ScreenInfo;
void *pvVram;
typedef union CR_FBENTRY_FLAGS
{
struct {
};
typedef struct CR_FRAMEBUFFER_ENTRY
{
typedef struct CR_FBTEX
{
} CR_FBTEX;
#define PCR_FRAMEBUFFER_FROM_COMPOSITOR(_pCompositor) ((CR_FRAMEBUFFER*)((uint8_t*)(_pCompositor) - RT_OFFSETOF(CR_FRAMEBUFFER, Compositor)))
#define PCR_FBENTRY_FROM_ENTRY(_pEntry) ((CR_FRAMEBUFFER_ENTRY*)((uint8_t*)(_pEntry) - RT_OFFSETOF(CR_FRAMEBUFFER_ENTRY, Entry)))
typedef struct CR_FB_INFO
{
} CR_FB_INFO;
typedef struct CR_FBDISPLAY_INFO
{
typedef struct CR_PRESENTER_GLOBALS
{
#ifndef VBOXVDBG_MEMCACHE_DISABLE
#endif
bool fEnabled;
bool fWindowsForceHidden;
void *pvTmpBuf;
void *pvTmpBuf2;
static CR_PRESENTER_GLOBALS g_CrPresenter;
/* FRAMEBUFFER */
{
}
{
}
HCR_FRAMEBUFFER_ENTRY CrFbEntryFromCompositorEntry(const struct VBOXVR_SCR_COMPOSITOR_ENTRY* pCEntry);
{
return &pFb->Compositor;
}
{
}
{
return &hFb->ScreenInfo;
}
{
}
{
{
}
return VINF_SUCCESS;
}
{
{
WARN(("invalid UpdateEnd call!"));
return;
}
{
}
}
{
}
{
}
static void crFbImgFromScreenVram(const VBVAINFOSCREEN *pScreen, void *pvVram, CR_BLITTER_IMG *pImg)
{
}
static void crFbImgFromDimPtrBGRA(void *pvVram, uint32_t width, uint32_t height, CR_BLITTER_IMG *pImg)
{
}
static int8_t crFbImgFromDimOffVramBGRA(VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, CR_BLITTER_IMG *pImg)
{
{
WARN(("invalid param"));
return -1;
}
return 0;
}
{
}
{
}
static int crFbTexDataGetContents(CR_TEXDATA *pTex, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pDst)
{
const CR_BLITTER_IMG *pSrcImg;
if (!RT_SUCCESS(rc))
{
return rc;
}
return VINF_SUCCESS;
}
static int crFbBltGetContentsScaledDirect(HCR_FRAMEBUFFER hFb, const RTRECTSIZE *pSrcRectSize, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pDst)
{
RTPOINT ScaledEntryPoint = {0};
RTRECT ScaledSrcRect = {0};
if (!RT_SUCCESS(rc))
{
goto end;
}
{
if (!RT_SUCCESS(rc))
{
goto end;
}
if (!RT_SUCCESS(rc))
{
goto end;
}
{
/* rects are in dst coordinates,
* while the pReg is in source coords
* convert */
/* scale */
/* translate */
{
if (VBoxRectIsZero(&Intersection))
continue;
const CR_BLITTER_IMG *pSrcImg;
if (pEnteredTex != pTex)
{
if (!pEnteredBlitter)
{
if (!RT_SUCCESS(rc))
{
goto end;
}
}
if (pEnteredTex)
{
pEnteredTex = NULL;
{
WARN(("blitters not equal!"));
if (!RT_SUCCESS(rc))
{
goto end;
}
}
}
if (!RT_SUCCESS(rc))
{
goto end;
}
pEnteredTex = pTex;
ScaledEntryPoint.x = CR_FLOAT_RCAST(int32_t, strX * CrVrScrCompositorEntryRectGet(pEntry)->xLeft) + pDstRect->xLeft;
ScaledEntryPoint.y = CR_FLOAT_RCAST(int32_t, strY * CrVrScrCompositorEntryRectGet(pEntry)->yTop) + pDstRect->yTop;
}
if (VBoxRectIsZero(&Intersection))
continue;
if (!RT_SUCCESS(rc))
{
goto end;
}
}
}
}
if (c2DRects)
{
{
if (g_CrPresenter.pvTmpBuf2)
if (!g_CrPresenter.pvTmpBuf2)
{
WARN(("RTMemAlloc failed!"));
g_CrPresenter.cbTmpBuf2 = 0;
rc = VERR_NO_MEMORY;
goto end;
}
}
if (!RT_SUCCESS(rc))
{
goto end;
}
{
}
}
end:
if (pEnteredTex)
if (pEnteredBlitter)
return rc;
}
static int crFbBltGetContentsScaledCPU(HCR_FRAMEBUFFER hFb, const RTRECTSIZE *pSrcRectSize, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
{
WARN(("not implemented!"));
return VERR_NOT_IMPLEMENTED;
#if 0
/* destination is bigger than the source, do 3D data stretching with CPU */
{
WARN(("RTMemAlloc Failed"));
return VERR_NO_MEMORY;
}
if (RT_SUCCESS(rc))
{
}
else
return rc;
#endif
}
int CrFbBltGetContents(HCR_FRAMEBUFFER hFb, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pDst)
{
RTPOINT EntryPoint = {0};
if (!RT_SUCCESS(rc))
{
goto end;
}
{
if (!RT_SUCCESS(rc))
{
goto end;
}
if (!RT_SUCCESS(rc))
{
goto end;
}
{
/* rects are in dst coordinates,
* while the pReg is in source coords
* convert */
/* translate */
{
if (VBoxRectIsZero(&Intersection))
continue;
const CR_BLITTER_IMG *pSrcImg;
if (pEnteredTex != pTex)
{
if (!pEnteredBlitter)
{
if (!RT_SUCCESS(rc))
{
goto end;
}
}
if (pEnteredTex)
{
pEnteredTex = NULL;
{
WARN(("blitters not equal!"));
if (!RT_SUCCESS(rc))
{
goto end;
}
}
}
if (!RT_SUCCESS(rc))
{
goto end;
}
pEnteredTex = pTex;
}
if (!RT_SUCCESS(rc))
{
goto end;
}
}
}
}
if (c2DRects)
{
{
if (g_CrPresenter.pvTmpBuf2)
if (!g_CrPresenter.pvTmpBuf2)
{
WARN(("RTMemAlloc failed!"));
g_CrPresenter.cbTmpBuf2 = 0;
rc = VERR_NO_MEMORY;
goto end;
}
}
if (!RT_SUCCESS(rc))
{
goto end;
}
}
end:
if (pEnteredTex)
if (pEnteredBlitter)
return rc;
}
int CrFbBltGetContentsEx(HCR_FRAMEBUFFER hFb, const RTRECTSIZE *pSrcRectSize, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
{
{
}
if (!CrFbHas3DData(hFb)
}
static void crFbBltPutContentsFbVram(HCR_FRAMEBUFFER hFb, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pSrc)
{
}
static void crFbClrFillFbVram(HCR_FRAMEBUFFER hFb, uint32_t cRects, const RTRECT *pRects, uint32_t u32Color)
{
}
{
{
WARN(("framebuffer not updating"));
return VERR_INVALID_STATE;
}
if (!RT_SUCCESS(rc))
{
return rc;
}
return VINF_SUCCESS;
}
static int crFbBltPutContents(HCR_FRAMEBUFFER hFb, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
{
if (!RT_SUCCESS(rc))
{
return rc;
}
return VINF_SUCCESS;
}
int CrFbBltPutContents(HCR_FRAMEBUFFER hFb, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
{
{
WARN(("framebuffer not updating"));
return VERR_INVALID_STATE;
}
}
static int crFbRegionsIsIntersectRects(HCR_FRAMEBUFFER hFb, uint32_t cRects, const RTRECT *pRects, bool *pfRegChanged)
{
const RTRECT *pCompRects;
if (!RT_SUCCESS(rc))
{
return rc;
}
bool fRegChanged = false;
for (uint32_t i = 0; i < cCompRects; ++i)
{
{
{
*pfRegChanged = true;
return VINF_SUCCESS;
}
}
}
*pfRegChanged = false;
return VINF_SUCCESS;
}
int CrFbBltPutContentsNe(HCR_FRAMEBUFFER hFb, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
{
bool fRegChanged = false;
if (!RT_SUCCESS(rc))
{
return rc;
}
if (fRegChanged)
{
if (RT_SUCCESS(rc))
{
if (!RT_SUCCESS(rc))
}
else
return rc;
}
return VINF_SUCCESS;
}
{
bool fRegChanged = false;
if (!RT_SUCCESS(rc))
{
return rc;
}
if (fRegChanged)
{
if (RT_SUCCESS(rc))
{
if (!RT_SUCCESS(rc))
}
else
return rc;
}
return VINF_SUCCESS;
}
{
{
WARN(("no update in progress"));
return VERR_INVALID_STATE;
}
{
}
if (!RT_SUCCESS(rc))
{
return rc;
}
return VINF_SUCCESS;
}
{
{
WARN(("update in progress"));
return;
}
}
{
}
{
{
WARN(("update in progress"));
return VERR_INVALID_STATE;
}
return VINF_SUCCESS;
return VINF_SUCCESS;
}
#define CR_PMGR_MODE_WINDOW 0x1
/* mutually exclusive with CR_PMGR_MODE_WINDOW */
#define CR_PMGR_MODE_ROOTVR 0x2
#define CR_PMGR_MODE_VRDP 0x4
#define CR_PMGR_MODE_ALL 0x7
static void crPMgrCleanUnusedDisplays();
static CR_FBTEX* crFbTexAlloc()
{
#ifndef VBOXVDBG_MEMCACHE_DISABLE
#else
#endif
}
{
#ifndef VBOXVDBG_MEMCACHE_DISABLE
#else
#endif
}
static CR_FRAMEBUFFER_ENTRY* crFbEntryAlloc()
{
#ifndef VBOXVDBG_MEMCACHE_DISABLE
#else
#endif
}
{
#ifndef VBOXVDBG_MEMCACHE_DISABLE
#else
#endif
}
{
if (pTobj)
{
{
/* on the host side, we need to delete an ogl texture object here as well, which crStateDeleteTextureCallback will do
* in addition to calling crStateDeleteTextureObject to delete a state object */
}
}
}
void CrFbTexDataInit(CR_TEXDATA* pFbTex, const VBOXVR_TEXTURE *pTex, PFNCRTEXDATA_RELEASED pfnTextureReleased)
{
}
{
if (!pFbTex)
{
WARN(("crFbTexAlloc failed!"));
return NULL;
}
return pFbTex;
}
{
if (!pFbTex)
{
WARN(("crFbTexCreate failed!"));
return NULL;
}
}
{
if (pFbTex)
{
return pFbTex;
}
if (!pShared)
{
WARN(("pShared is null!"));
return NULL;
}
if (!pTobj)
{
LOG(("pTobj is null!"));
return NULL;
}
if (!hwid)
{
WARN(("hwId is null!"));
return NULL;
}
if (!pFbTex)
{
WARN(("crFbTexCreate failed!"));
return NULL;
}
return pFbTex;
}
{
if (!pTex)
{
return NULL;
}
}
{
{
if (pTex)
}
}
{
}
{
}
{
if (!cRefs)
return cRefs;
}
static DECLCALLBACK(void) crFbEntryReleased(const struct VBOXVR_SCR_COMPOSITOR *pCompositor, struct VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry, struct VBOXVR_SCR_COMPOSITOR_ENTRY *pReplacingEntry)
{
CR_FRAMEBUFFER_ENTRY *pFbReplacingEntry = pReplacingEntry ? PCR_FBENTRY_FROM_ENTRY(pReplacingEntry) : NULL;
if (pFbReplacingEntry)
{
/*replace operation implies the replaced entry gets auto-destroyed,
* while all its data gets moved to the *clean* replacing entry
* 1. ensure the replacing entry is cleaned up */
/* 2. mark the replaced entry is destroyed */
}
else
{
{
if (pTex)
}
}
}
static CR_FRAMEBUFFER_ENTRY* crFbEntryCreate(CR_FRAMEBUFFER *pFb, CR_TEXDATA* pTex, const RTRECT *pRect, uint32_t fFlags)
{
if (!pEntry)
{
WARN(("crFbEntryAlloc failed!"));
return NULL;
}
return pEntry;
}
int CrFbEntryCreateForTexData(CR_FRAMEBUFFER *pFb, struct CR_TEXDATA *pTex, uint32_t fFlags, HCR_FRAMEBUFFER_ENTRY *phEntry)
{
if (!pEntry)
{
WARN(("crFbEntryCreate failed"));
return VERR_NO_MEMORY;
}
return VINF_SUCCESS;
}
int CrFbEntryTexDataUpdate(CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY pEntry, struct CR_TEXDATA *pTex)
{
{
WARN(("framebuffer not updating"));
return VERR_INVALID_STATE;
}
if (pTex)
{
if (pTex)
}
return VINF_SUCCESS;
}
int CrFbEntryCreateForTexId(CR_FRAMEBUFFER *pFb, GLuint idTexture, uint32_t fFlags, HCR_FRAMEBUFFER_ENTRY *phEntry)
{
if (!pFbTex)
{
LOG(("crFbTexAcquire failed"));
return VERR_INVALID_PARAMETER;
}
if (!RT_SUCCESS(rc))
{
}
/*always release the tex, the CrFbEntryCreateForTexData will do incref as necessary */
return rc;
}
{
}
{
}
static int8_t crVBoxServerCrCmdBltPrimaryVramGenericProcess(uint32_t u32PrimaryID, VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, bool fToPrimary);
{
{
WARN(("framebuffer not updating"));
return VERR_INVALID_STATE;
}
if (!RT_SUCCESS(rc))
{
return rc;
}
VBOXCMDVBVAOFFSET offVRAM = (VBOXCMDVBVAOFFSET)(((uintptr_t)CrFbGetVRAM(hFb)) - ((uintptr_t)g_pvVRamBase));
int8_t i8Result = crVBoxServerCrCmdBltPrimaryVramGenericProcess(pScreen->u32ViewIndex, offVRAM, pScreen->u32Width, pScreen->u32Height, &Pos, cRegions, pRegions, true);
if (i8Result)
{
WARN(("crVBoxServerCrCmdBltPrimaryVramGenericProcess failed"));
return VERR_INTERNAL_ERROR;
}
#ifdef DEBUG
{
const RTRECT *pTmpRegions;
if (!RT_SUCCESS(tmpRc))
{
}
}
#endif
/* just in case */
bool fChanged = false;
if (cRegions)
{
}
return VINF_SUCCESS;
}
int CrFbEntryRegionsAdd(CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions, bool fPosRelated)
{
{
WARN(("framebuffer not updating"));
return VERR_INVALID_STATE;
}
uint32_t fChangeFlags = 0;
bool fEntryWasInList;
if (hEntry)
{
}
else
{
fEntryWasInList = false;
}
int rc = CrVrScrCompositorEntryRegionsAdd(&pFb->Compositor, hEntry ? &hEntry->Entry : NULL, pPos, cRegions, paRegions, fPosRelated, &pReplacedScrEntry, &fChangeFlags);
if (RT_SUCCESS(rc))
{
{
if (!fEntryWasInList && pNewEntry)
{
{
}
#ifdef DEBUG_misha
/* in theory hEntry->Flags.fInList can be set if entry is replaced,
* but then modified to fit the compositor rects,
* and so we get the regions changed notification as a result
* this should not generally happen though, so put an assertion to debug that situation */
#endif
{
}
}
}
else if (fChangeFlags & VBOXVR_COMPOSITOR_CF_ENTRY_REPLACED)
{
/* we have already processed that in a "release" callback */
}
else
{
}
if (hEntry)
{
{
if (pTex)
}
}
}
else
return rc;
}
int CrFbEntryRegionsSet(CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions, bool fPosRelated)
{
{
WARN(("framebuffer not updating"));
return VERR_INVALID_STATE;
}
bool fChanged = 0;
bool fEntryWasInList;
if (hEntry)
{
}
else
{
fEntryWasInList = false;
}
int rc = CrVrScrCompositorEntryRegionsSet(&pFb->Compositor, pNewEntry, pPos, cRegions, paRegions, fPosRelated, &fChanged);
if (RT_SUCCESS(rc))
{
if (fChanged)
{
if (!fEntryWasInList && pNewEntry)
{
{
{
}
}
}
}
if (hEntry)
{
{
if (pTex)
}
}
}
else
return rc;
}
{
}
HCR_FRAMEBUFFER_ENTRY CrFbEntryFromCompositorEntry(const struct VBOXVR_SCR_COMPOSITOR_ENTRY* pCEntry)
{
}
void CrFbVisitCreatedEntries(HCR_FRAMEBUFFER hFb, PFNCR_FRAMEBUFFER_ENTRIES_VISITOR_CB pfnVisitorCb, void *pvContext)
{
{
{
return;
}
}
}
{
}
void CrFbDDataReleaseSlot(CR_FRAMEBUFFER *pFb, CRHTABLE_HANDLE hSlot, PFNCR_FRAMEBUFFER_SLOT_RELEASE_CB pfnReleaseCb, void *pvContext)
{
{
{
if (pfnReleaseCb)
}
}
}
{
}
{
}
{
}
typedef union CR_FBDISPBASE_FLAGS
{
struct {
};
class CrFbDisplayBase : public ICrFbDisplay
{
public:
CrFbDisplayBase() :
mcUpdates(0),
{
}
virtual bool isComposite()
{
return false;
}
class CrFbDisplayComposite* getContainer()
{
return mpContainer;
}
bool isInList()
{
return !!mpContainer;
}
bool isUpdating()
{
return !!mcUpdates;
}
int setRegionsChanged()
{
if (!mcUpdates)
{
WARN(("err"));
return VERR_INVALID_STATE;
}
return VINF_SUCCESS;
}
{
if (mcUpdates)
{
WARN(("trying to set framebuffer while update is in progress"));
return VERR_INVALID_STATE;
}
return VINF_SUCCESS;
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
if (mpFb)
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
if (mpFb)
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
return VINF_SUCCESS;
}
struct CR_FRAMEBUFFER* getFramebuffer()
{
return mpFb;
}
{
++mcUpdates;
return VINF_SUCCESS;
}
{
--mcUpdates;
if (!mcUpdates)
onUpdateEnd();
}
{
if (!mcUpdates)
{
WARN(("err"));
return VERR_INVALID_STATE;
}
return VINF_SUCCESS;
}
{
if (!mcUpdates)
{
WARN(("err"));
return VERR_INVALID_STATE;
}
return VINF_SUCCESS;
}
virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry)
{
if (!mcUpdates)
{
WARN(("err"));
return VERR_INVALID_STATE;
}
return VINF_SUCCESS;
}
{
if (!mcUpdates)
{
WARN(("err"));
return VERR_INVALID_STATE;
}
return VINF_SUCCESS;
}
{
if (!mcUpdates)
{
WARN(("err"));
return VERR_INVALID_STATE;
}
return VINF_SUCCESS;
}
{
return VINF_SUCCESS;
}
{
if (!mcUpdates)
{
WARN(("err"));
return VERR_INVALID_STATE;
}
return VINF_SUCCESS;
}
{
if (!mcUpdates)
{
WARN(("err"));
return VERR_INVALID_STATE;
}
return VINF_SUCCESS;
}
{
if (!mcUpdates)
{
WARN(("err"));
return VERR_INVALID_STATE;
}
return VINF_SUCCESS;
}
virtual ~CrFbDisplayBase();
/*@todo: move to protected and switch from RTLISTNODE*/
class CrFbDisplayComposite* mpContainer;
protected:
virtual void onUpdateEnd()
{
if (mFlags.fRegionsShanged)
{
mFlags.fRegionsShanged = 0;
if (getFramebuffer()) /*<-dont't do anything on cleanup*/
ueRegions();
}
}
virtual void ueRegions()
{
}
static DECLCALLBACK(bool) entriesCreateCb(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry, void *pvContext)
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
}
return true;
}
static DECLCALLBACK(bool) entriesDestroyCb(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry, void *pvContext)
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
}
return true;
}
int fbSynchAddAllEntries()
{
const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;
int rc = VINF_SUCCESS;
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
break;
}
}
return rc;
}
{
const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;
int rc = VINF_SUCCESS;
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
break;
}
}
return rc;
}
{
return UpdateBegin(pFb);
}
{
}
static DECLCALLBACK(void) slotEntryReleaseCB(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry, void *pvContext)
{
}
virtual void slotRelease()
{
}
virtual int fbCleanup()
{
if (mhSlot)
{
slotRelease();
mhSlot = 0;
}
return VINF_SUCCESS;
}
virtual int fbSync()
{
return VINF_SUCCESS;
}
{
if (!mhSlot)
{
if (mpFb)
}
return mhSlot;
}
private:
struct CR_FRAMEBUFFER *mpFb;
};
class CrFbDisplayComposite : public CrFbDisplayBase
{
public:
mcDisplays(0)
{
}
virtual bool isComposite()
{
return true;
}
{
return mcDisplays;
}
{
{
WARN(("entry in list already"));
return false;
}
pDisplay->mpContainer = this;
++mcDisplays;
return true;
}
{
if (pDisplay->getContainer() != this)
{
WARN(("invalid entry container"));
return false;
}
if (fCleanupDisplay)
--mcDisplays;
return true;
}
{
}
{
if (pDisplay->getContainer() != this)
{
WARN(("invalid entry container"));
return NULL;
}
}
{
{
}
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
return VINF_SUCCESS;
}
{
{
}
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
return VINF_SUCCESS;
}
virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry)
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
return VINF_SUCCESS;
}
virtual ~CrFbDisplayComposite()
{
cleanup();
}
void cleanup(bool fCleanupDisplays = true)
{
{
}
}
private:
};
typedef union CR_FBWIN_FLAGS
{
struct {
};
class CrFbWindow
{
public:
mSpuWindow(0),
mcUpdates(0),
mxPos(0),
myPos(0),
mWidth(0),
mHeight(0),
{
}
bool IsCreated()
{
return !!mSpuWindow;
}
void Destroy()
{
if (!mSpuWindow)
return;
mSpuWindow = 0;
mFlags.fDataPresented = 0;
}
{
if (!checkInitedUpdating())
{
WARN(("err"));
return VERR_INVALID_STATE;
}
if (mSpuWindow)
{
if (parentId)
}
return VINF_SUCCESS;
}
int SetVisible(bool fVisible)
{
if (!checkInitedUpdating())
{
WARN(("err"));
return VERR_INVALID_STATE;
}
{
if (mSpuWindow && mParentId)
}
return VINF_SUCCESS;
}
{
if (!checkInitedUpdating())
{
WARN(("err"));
return VERR_INVALID_STATE;
}
{
if (mSpuWindow)
}
return VINF_SUCCESS;
}
{
if (!checkInitedUpdating())
{
WARN(("err"));
return VERR_INVALID_STATE;
}
LOG(("CrWIN: Pos [%d ; %d]", x, y));
// always do WindowPosition to ensure window is adjusted properly
// if (x != mxPos || y != myPos)
{
mxPos = x;
myPos = y;
if (mSpuWindow)
}
return VINF_SUCCESS;
}
int SetVisibleRegionsChanged()
{
if (!checkInitedUpdating())
{
WARN(("err"));
return VERR_INVALID_STATE;
}
return VINF_SUCCESS;
}
{
if (!checkInitedUpdating())
{
WARN(("err"));
return VERR_INVALID_STATE;
}
return VINF_SUCCESS;
}
int UpdateBegin()
{
++mcUpdates;
if (mcUpdates > 1)
return VINF_SUCCESS;
// Assert(!mFlags.fCompositoEntriesModified);
if (mFlags.fDataPresented)
{
}
return VINF_SUCCESS;
}
void UpdateEnd()
{
--mcUpdates;
if (mcUpdates)
return;
checkRegions();
if (mSpuWindow)
{
bool fPresentNeeded = isPresentNeeded();
{
mFlags.fForcePresentOnReenable = false;
}
/* even if the above branch is entered due to mFlags.fForcePresentOnReenable,
* the backend should clean up the compositor as soon as presentation is performed */
}
else
{
}
}
{
return mParentId;
}
int Create()
{
if (mSpuWindow)
{
//WARN(("window already created"));
return VINF_ALREADY_INITIALIZED;
}
if (mSpuWindow < 0) {
WARN(("WindowCreate failed"));
return VERR_GENERAL_FAILURE;
}
checkRegions();
return VINF_SUCCESS;
}
~CrFbWindow()
{
Destroy();
}
protected:
void checkRegions()
{
if (!mSpuWindow)
return;
return;
if (mpCompositor)
{
if (!RT_SUCCESS(rc))
{
cRects = 0;
}
}
else
{
cRects = 0;
}
}
bool isPresentNeeded()
{
return mFlags.fVisible && mWidth && mHeight && mpCompositor && !CrVrScrCompositorIsEmpty(mpCompositor);
}
bool checkInitedUpdating()
{
if (!mcUpdates)
{
WARN(("not updating"));
return false;
}
return true;
}
private:
const struct VBOXVR_SCR_COMPOSITOR * mpCompositor;
};
typedef union CR_FBDISPWINDOW_FLAGS
{
struct {
};
class CrFbDisplayWindow : public CrFbDisplayBase
{
public:
mu32Screen(~0)
{
}
virtual ~CrFbDisplayWindow()
{
if (mpWindow)
delete mpWindow;
}
{
if (RT_SUCCESS(rc))
{
if (RT_SUCCESS(rc))
return VINF_SUCCESS;
else
WARN(("err"));
}
else
WARN(("err"));
return rc;
}
{
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
if (mpWindow->GetParentId())
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
if (mpWindow->GetParentId())
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
return VINF_SUCCESS;
}
virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry)
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
if (mpWindow->GetParentId())
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
if (mpWindow->GetParentId())
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
return screenChanged();
}
const RTRECT* getViewportRect()
{
return &mViewportRect;
}
{
if (!isUpdating())
{
WARN(("not updating!"));
return VERR_INVALID_STATE;
}
// always call SetPosition to ensure window is adjustep properly
// if (pViewportRect->xLeft != mViewportRect.xLeft || pViewportRect->yTop != mViewportRect.yTop)
{
int rc = mpWindow->SetPosition(pRect->xLeft - pViewportRect->xLeft, pRect->yTop - pViewportRect->yTop);
if (!RT_SUCCESS(rc))
{
WARN(("SetPosition failed"));
return rc;
}
}
return VINF_SUCCESS;
}
virtual CrFbWindow * windowDetach()
{
if (isUpdating())
{
WARN(("updating!"));
return NULL;
}
if (mpWindow)
{
}
return pWindow;
}
{
if (isUpdating())
{
WARN(("updating!"));
return NULL;
}
if (mpWindow)
windowDetach();
if (pNewWindow)
windowSync();
return mpWindow;
}
{
if (!isUpdating())
{
WARN(("not updating!"));
return VERR_INVALID_STATE;
}
if (!RT_SUCCESS(rc))
WARN(("window reparent failed"));
return rc;
}
virtual bool isVisible()
{
if (!hFb)
return false;
return !CrVrScrCompositorIsEmpty(pCompositor);
}
int winVisibilityChanged()
{
if (RT_SUCCESS(rc))
{
if (!RT_SUCCESS(rc))
}
else
return rc;
}
protected:
virtual void onUpdateEnd()
{
{
crVBoxServerNotifyEvent(mu32Screen, VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_3DDATA, fVisible ? (void*)1 : NULL);
}
}
virtual void ueRegions()
{
}
virtual int screenChanged()
{
if (!isUpdating())
{
WARN(("not updating!"));
return VERR_INVALID_STATE;
}
if (CrFbIsEnabled(getFramebuffer()))
{
int rc = mpWindow->SetPosition(pRect->xLeft - mViewportRect.xLeft, pRect->yTop - mViewportRect.yTop);
if (!RT_SUCCESS(rc))
{
return rc;
}
return mpWindow->SetSize((uint32_t)(pRect->xRight - pRect->xLeft), (uint32_t)(pRect->yBottom - pRect->yTop));
}
return mpWindow->SetVisible(false);
}
virtual int windowSetCompositor(bool fSet)
{
if (fSet)
{
}
}
virtual int windowCleanup()
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
rc = windowSetCompositor(false);
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
return VINF_SUCCESS;
}
virtual int fbCleanup()
{
int rc = windowCleanup();
if (!RT_SUCCESS(rc))
{
WARN(("windowCleanup failed"));
return rc;
}
return CrFbDisplayBase::fbCleanup();
}
virtual int windowSync()
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
rc = windowSetCompositor(true);
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
rc = mpWindow->SetSize((uint32_t)(pRect->xRight - pRect->xLeft), (uint32_t)(pRect->yBottom - pRect->yTop));
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
return rc;
}
virtual int fbSync()
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
rc = windowSync();
if (!RT_SUCCESS(rc))
{
return rc;
}
if (CrFbHas3DData(hFb))
{
if (mpWindow->GetParentId())
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
}
return VINF_SUCCESS;
}
{
return CrVrScrCompositorRectGet(pCompositor);
}
private:
};
class CrFbDisplayWindowRootVr : public CrFbDisplayWindow
{
public:
{
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
CrVrScrCompositorEntryInit(pMyEntry, CrVrScrCompositorEntryRectGet(pSrcEntry), CrVrScrCompositorEntryTexGet(pSrcEntry), NULL);
if (!RT_SUCCESS(rc))
{
return rc;
}
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = (VBOXVR_SCR_COMPOSITOR_ENTRY*)CrFbDDataEntryGet(hEntry, slotGet());
return VINF_SUCCESS;
}
virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry)
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = (VBOXVR_SCR_COMPOSITOR_ENTRY*)CrFbDDataEntryGet(hNewEntry, slotGet());
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = (VBOXVR_SCR_COMPOSITOR_ENTRY*)CrFbDDataEntryGet(hEntry, slotGet());
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = (VBOXVR_SCR_COMPOSITOR_ENTRY*)CrFbDDataEntryGet(hEntry, slotGet());
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = (VBOXVR_SCR_COMPOSITOR_ENTRY*)CrFbDDataEntryGet(hEntry, slotGet());
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
rc = setRegionsChanged();
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
return VINF_SUCCESS;
}
protected:
virtual int windowSetCompositor(bool fSet)
{
if (fSet)
}
virtual void ueRegions()
{
}
int compositorMarkUpdated()
{
int rc = CrVrScrCompositorRectSet(&mCompositor, CrVrScrCompositorRectGet(CrFbGetCompositor(getFramebuffer())), NULL);
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
rc = setRegionsChanged();
if (!RT_SUCCESS(rc))
{
return rc;
}
return VINF_SUCCESS;
}
virtual int screenChanged()
{
int rc = compositorMarkUpdated();
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
if (!RT_SUCCESS(rc))
{
return rc;
}
return VINF_SUCCESS;
}
{
return CrVrScrCompositorRectGet(&mCompositor);
}
virtual int fbCleanup()
{
int rc = clearCompositor();
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
return CrFbDisplayWindow::fbCleanup();
}
virtual int fbSync()
{
int rc = synchCompositor();
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
return CrFbDisplayWindow::fbSync();
}
{
#ifndef VBOXVDBG_MEMCACHE_DISABLE
#else
#endif
}
{
#ifndef VBOXVDBG_MEMCACHE_DISABLE
#else
#endif
}
int synchCompositorRegions()
{
int rc;
/* ensure the rootvr compositor does not hold any data,
* i.e. cleanup all rootvr entries data */
rc = CrVrScrCompositorIntersectedList(CrFbGetCompositor(getFramebuffer()), &cr_server.RootVr, &mCompositor, rootVrGetCEntry, this, NULL);
if (!RT_SUCCESS(rc))
{
return rc;
}
return getWindow()->SetVisibleRegionsChanged();
}
virtual int synchCompositor()
{
int rc = compositorMarkUpdated();
if (!RT_SUCCESS(rc))
{
return rc;
}
rc = fbSynchAddAllEntries();
if (!RT_SUCCESS(rc))
{
return rc;
}
return rc;
}
virtual int clearCompositor()
{
return fbCleanupRemoveAllEntries();
}
void rootVrTranslateForPos()
{
cr_server.RootVrCurPoint.x = x;
cr_server.RootVrCurPoint.y = y;
}
static DECLCALLBACK(VBOXVR_SCR_COMPOSITOR_ENTRY*) rootVrGetCEntry(const VBOXVR_SCR_COMPOSITOR_ENTRY*pEntry, void *pvContext)
{
VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = (VBOXVR_SCR_COMPOSITOR_ENTRY*)CrFbDDataEntryGet(hEntry, pThis->slotGet());
CrVrScrCompositorEntryRectSet(&pThis->mCompositor, pMyEntry, CrVrScrCompositorEntryRectGet(pEntry));
return pMyEntry;
}
private:
};
class CrFbDisplayVrdp : public CrFbDisplayBase
{
public:
{
}
{
if (!RT_SUCCESS(rc))
{
return rc;
}
if (!RT_SUCCESS(rc))
{
return rc;
}
return VINF_SUCCESS;
}
virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry)
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
if (RT_SUCCESS(rc))
{
}
else
return rc;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
if (RT_SUCCESS(rc))
{
}
else
return rc;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
return vrdpRegionsAll(pFb);
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
syncPos();
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
return vrdpRegionsAll(pFb);
}
protected:
void syncPos()
{
}
virtual int fbCleanup()
{
int rc = fbCleanupRemoveAllEntries();
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
return CrFbDisplayBase::fbCleanup();
}
virtual int fbSync()
{
syncPos();
int rc = fbSynchAddAllEntries();
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
return CrFbDisplayBase::fbSync();
}
protected:
{
}
{
}
{
if (!RT_SUCCESS(rc))
{
return rc;
}
return VINF_SUCCESS;
}
{
const CR_BLITTER_IMG *pImg;
int rc = CrTdBltDataAcquire(pTex, GL_BGRA, !!(CrVrScrCompositorEntryFlagsGet(pEntry) & CRBLT_F_INVERT_SRC_YCOORDS), &pImg);
if (!RT_SUCCESS(rc))
{
return rc;
}
return VINF_SUCCESS;
}
{
const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;
{
}
return VINF_SUCCESS;
}
{
}
{
const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;
{
if (!RT_SUCCESS(rc))
{
return rc;
}
}
return VINF_SUCCESS;
}
{
void *pVrdp;
/* Query supported formats. */
if (!pachFormats)
{
WARN(("crAlloc failed"));
return VERR_NO_MEMORY;
}
0 /* H3DOR_PROP_FORMATS */, // @todo from a header
if (RT_SUCCESS(rc))
{
{
&pVrdp,
"H3DOR_FMT_RGBA_TOPDOWN"); // @todo from a header
if (pVrdp)
{
if (RT_SUCCESS(rc))
{
//vrdpFrame(hEntry);
return VINF_SUCCESS;
}
else
}
else
{
WARN(("CRORBegin failed"));
}
}
}
else
return rc;
}
private:
};
{
if (mpContainer)
mpContainer->remove(this);
}
#if 0
{
}
{
{
crDbgDumpRect(i, &paRects[i]);
}
}
#endif
class CrFbDisplayEntryDataMonitor : public CrFbDisplayBase
{
public:
virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry)
{
return VINF_SUCCESS;
}
{
return VINF_SUCCESS;
}
{
return VINF_SUCCESS;
}
protected:
{
}
};
int CrPMgrDisable()
{
if (!g_CrPresenter.fEnabled)
return VINF_SUCCESS;
if (RT_FAILURE(rc))
{
return rc;
}
g_CrPresenter.fEnabled = false;
return VINF_SUCCESS;
}
int CrPMgrEnable()
{
if (g_CrPresenter.fEnabled)
return VINF_SUCCESS;
g_CrPresenter.fEnabled = true;
if (RT_FAILURE(rc))
{
g_CrPresenter.fEnabled = false;
return rc;
}
return VINF_SUCCESS;
}
int CrPMgrInit()
{
int rc = VINF_SUCCESS;
g_CrPresenter.fEnabled = true;
{
}
if (g_CrPresenter.pFbTexMap)
{
#ifndef VBOXVDBG_MEMCACHE_DISABLE
0, /* size_t cbAlignment */
UINT32_MAX, /* uint32_t cMaxObjects */
NULL, /* PFNMEMCACHECTOR pfnCtor*/
NULL, /* PFNMEMCACHEDTOR pfnDtor*/
NULL, /* void *pvUser*/
0 /* uint32_t fFlags*/
);
if (RT_SUCCESS(rc))
{
0, /* size_t cbAlignment */
UINT32_MAX, /* uint32_t cMaxObjects */
NULL, /* PFNMEMCACHECTOR pfnCtor*/
NULL, /* PFNMEMCACHEDTOR pfnDtor*/
NULL, /* void *pvUser*/
0 /* uint32_t fFlags*/
);
if (RT_SUCCESS(rc))
{
0, /* size_t cbAlignment */
UINT32_MAX, /* uint32_t cMaxObjects */
NULL, /* PFNMEMCACHECTOR pfnCtor*/
NULL, /* PFNMEMCACHEDTOR pfnDtor*/
NULL, /* void *pvUser*/
0 /* uint32_t fFlags*/
);
if (RT_SUCCESS(rc))
{
#endif
if (RT_SUCCESS(rc))
return VINF_SUCCESS;
else
#ifndef VBOXVDBG_MEMCACHE_DISABLE
}
else
}
else
}
else
#endif
}
else
{
WARN(("crAllocHashtable failed"));
rc = VERR_NO_MEMORY;
}
return rc;
}
void CrPMgrTerm()
{
for (hFb = CrPMgrFbGetFirstInitialized();
hFb;
{
if (pFbInfo->pDpComposite)
{
delete pFbInfo->pDpComposite;
}
}
#ifndef VBOXVDBG_MEMCACHE_DISABLE
#endif
if (g_CrPresenter.pvTmpBuf)
if (g_CrPresenter.pvTmpBuf2)
}
{
if (idFb >= CR_MAX_GUEST_MONITORS)
{
return NULL;
}
{
}
else
}
{
if (idFb >= CR_MAX_GUEST_MONITORS)
{
return NULL;
}
{
return NULL;
}
else
}
{
return hFb;
return NULL;
}
{
{
WARN(("invalid target id"));
return NULL;
}
return NULL;
}
{
{
if (hFb)
return hFb;
}
return NULL;
}
{
{
if (hFb)
return hFb;
}
return NULL;
}
{
// if (!hFb)
// WARN(("no enabled framebuffer found"));
return hFb;
}
{
}
{
// if (!hFb)
// WARN(("no initialized framebuffer found"));
return hFb;
}
{
}
{
hFb;
{
return hFb;
}
return NULL;
}
{
if (CR_PMGR_MODE_ROOTVR & u32Mode)
return u32Mode;
}
{
if (idScreen >= CR_MAX_GUEST_MONITORS)
{
return VERR_INVALID_PARAMETER;
}
{
{
WARN(("trying to update viewport while framebuffer is being updated"));
return VERR_INVALID_STATE;
}
if (RT_SUCCESS(rc))
{
}
else
}
return VINF_SUCCESS;
}
{
if (idScreen >= CR_MAX_GUEST_MONITORS)
{
return VERR_INVALID_PARAMETER;
}
{
if (CrFbIsUpdating(hFb))
{
WARN(("trying to update viewport while framebuffer is being updated"));
return VERR_INVALID_STATE;
}
if (RT_SUCCESS(rc))
{
}
else
}
return VINF_SUCCESS;
}
{
return VINF_SUCCESS;
if (!pCurDp)
{
WARN(("no display set, unexpected"));
return VERR_INTERNAL_ERROR;
}
{
return VINF_SUCCESS;
}
{
WARN(("misconfig, expectig the curret framebuffer to be present, and thus composite is expected"));
return VERR_INTERNAL_ERROR;
}
{
if (cDisplays <= 1)
{
if (pDpFirst)
}
return VINF_SUCCESS;
}
WARN(("misconfig"));
return VERR_INTERNAL_ERROR;
}
{
return VINF_SUCCESS;
if (!pCurDp)
{
return VINF_SUCCESS;
}
{
WARN(("misconfig, current framebuffer is not expected to be set"));
return VERR_INTERNAL_ERROR;
}
{
if (!pFbInfo->pDpComposite)
{
}
}
return VINF_SUCCESS;
}
{
{
WARN(("target not connected"));
return VINF_SUCCESS;
}
int rc = VINF_SUCCESS;
{
if (RT_FAILURE(rc))
{
return rc;
}
}
if (pDpInfo->pDpWinRootVr)
{
if (RT_FAILURE(rc))
{
return rc;
}
}
{
if (RT_FAILURE(rc))
{
return rc;
}
}
return VINF_SUCCESS;
}
{
if (!pDpInfo->pDpWinRootVr)
{
{
}
else
pDpInfo->pDpWinRootVr = new CrFbDisplayWindowRootVr(pWin, &cr_server.screenVieport[pDpInfo->u32Id].Rect);
}
}
{
if (pDpInfo->pDpWinRootVr)
{
delete pDpInfo->pDpWinRootVr;
}
{
if (!pWin)
}
}
static int crPMgrFbDisconnectTargetDisplays(HCR_FRAMEBUFFER hFb, CR_FBDISPLAY_INFO *pDpInfo, uint32_t u32ModeRemove)
{
int rc = VINF_SUCCESS;
if (u32ModeRemove & CR_PMGR_MODE_ROOTVR)
{
if (RT_FAILURE(rc))
{
return rc;
}
}
else if (u32ModeRemove & CR_PMGR_MODE_WINDOW)
{
if (RT_FAILURE(rc))
{
return rc;
}
}
if (u32ModeRemove & CR_PMGR_MODE_VRDP)
{
if (RT_FAILURE(rc))
{
return rc;
}
}
return VINF_SUCCESS;
}
static int crPMgrFbConnectTargetDisplays(HCR_FRAMEBUFFER hFb, CR_FBDISPLAY_INFO *pDpInfo, uint32_t u32ModeAdd)
{
int rc = VINF_SUCCESS;
if (u32ModeAdd & CR_PMGR_MODE_ROOTVR)
{
if (RT_FAILURE(rc))
{
return rc;
}
}
else if (u32ModeAdd & CR_PMGR_MODE_WINDOW)
{
if (RT_FAILURE(rc))
{
return rc;
}
}
if (u32ModeAdd & CR_PMGR_MODE_VRDP)
{
if (RT_FAILURE(rc))
{
return rc;
}
}
return VINF_SUCCESS;
}
{
{
WARN(("target not connected"));
return VINF_SUCCESS;
}
int rc = VINF_SUCCESS;
{
if (RT_FAILURE(rc))
{
return rc;
}
}
if (RT_FAILURE(rc))
{
return rc;
}
return VINF_SUCCESS;
}
{
int rc = VINF_SUCCESS;
i >= 0;
{
if (RT_FAILURE(rc))
{
return rc;
}
}
return VINF_SUCCESS;
}
{
int rc = VINF_SUCCESS;
i >= 0;
{
if (RT_FAILURE(rc))
{
return rc;
}
}
return VINF_SUCCESS;
}
static int crPMgrModeModifyTarget(HCR_FRAMEBUFFER hFb, uint32_t iDisplay, uint32_t u32ModeAdd, uint32_t u32ModeRemove)
{
if (RT_FAILURE(rc))
{
return rc;
}
if (RT_FAILURE(rc))
{
return rc;
}
return VINF_SUCCESS;
}
{
int rc = VINF_SUCCESS;
i >= 0;
{
if (RT_FAILURE(rc))
{
return rc;
}
}
return VINF_SUCCESS;
}
static void crPMgrCleanUnusedDisplays()
{
for (int i = 0; i < cr_server.screenCount; ++i)
{
if (pDpInfo->pDpWinRootVr)
{
{
delete pDpInfo->pDpWinRootVr;
}
else
WARN(("pDpWinRootVr is used"));
}
{
{
}
else
WARN(("pDpWin is used"));
}
{
{
}
else
WARN(("pDpVrdp is used"));
}
}
}
{
uint32_t u32InternalMode = g_CrPresenter.fEnabled ? g_CrPresenter.u32DisplayMode : g_CrPresenter.u32DisabledDisplayMode;
if (u32Tmp != u32ModeResulting)
{
}
if (!u32ModeRemove && !u32ModeAdd)
return VINF_SUCCESS;
if (!g_CrPresenter.fEnabled)
{
return VINF_SUCCESS;
}
hFb;
{
}
return VINF_SUCCESS;
}
int CrPMgrModeVrdp(bool fEnable)
{
if (fEnable)
{
u32ModeRemove = 0;
}
else
{
u32ModeAdd = 0;
}
}
int CrPMgrModeRootVr(bool fEnable)
{
if (fEnable)
{
}
else
{
}
}
int CrPMgrModeWinVisible(bool fEnable)
{
return VINF_SUCCESS;
for (int i = 0; i < cr_server.screenCount; ++i)
{
continue;
}
return VINF_SUCCESS;
}
int CrPMgrRootVrUpdate()
{
hFb;
{
if (!CrFbHas3DData(hFb))
continue;
if (RT_SUCCESS(rc))
{
i >= 0;
{
}
}
else
}
return VINF_SUCCESS;
}
/*helper function that calls CrFbUpdateBegin for all enabled framebuffers */
{
hFb;
{
if (!RT_SUCCESS(rc))
{
{
}
return rc;
}
}
return VINF_SUCCESS;
}
/*helper function that calls CrFbUpdateEnd for all framebuffers being updated */
{
{
if (!CrFBmIsSet(pMap, i))
continue;
}
}
{
int rc = VINF_SUCCESS;
{
/* this is just a request to disable targets, search and disable */
i >= 0;
{
continue;
if (RT_FAILURE(rc))
{
return rc;
}
}
return VINF_SUCCESS;
}
if (!hFb)
{
WARN(("CrPMgrFbGet failed"));
return VERR_INVALID_PARAMETER;
}
bool fFbInfoChanged = true;
{
fFbInfoChanged = false;
}
bool fDisplaysAdded = false, fDisplaysRemoved = false;
for (int i = 0; i < RT_ELEMENTS(aRemovedTargetMap); ++i)
{
if (aRemovedTargetMap[i])
fDisplaysRemoved = true;
}
for (int i = 0; i < RT_ELEMENTS(aAddedTargetMap); ++i)
{
if (aAddedTargetMap[i])
fDisplaysAdded = true;
}
{
crDebug("resize: no changes");
return VINF_SUCCESS;
}
if (fDisplaysRemoved)
{
if (RT_FAILURE(rc))
{
return rc;
}
}
if (fFbInfoChanged)
{
if (!RT_SUCCESS(rc))
{
return rc;
}
if (!RT_SUCCESS(rc))
{
}
}
if (fDisplaysAdded)
{
if (RT_FAILURE(rc))
{
return rc;
}
}
return VINF_SUCCESS;
}
{
#if 0
#endif
if (u32)
{
}
return rc;
}
{
const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;
{
++u32;
}
{
{
}
}
return VINF_SUCCESS;
}
{
int rc;
int cDisplays = 0, i;
for (i = 0; i < cr_server.screenCount; ++i)
{
if (CrPMgrFbGetEnabled(i))
++cDisplays;
}
if (!cDisplays)
return VINF_SUCCESS;
for (i = 0; i < cr_server.screenCount; ++i)
{
if (hFb)
{
}
}
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("CrFbEntryCreateForTexId Failed"));
return rc;
}
if (cRects)
{
}
if (pRects)
return VINF_SUCCESS;
}
{
if (!u32)
return VINF_SUCCESS;
{
}
return VINF_SUCCESS;
}
{
int rc;
int cDisplays, screenCount, i;
if (!cDisplays)
return VINF_SUCCESS;
{
for (i = 0; i < cr_server.screenCount; ++i)
{
}
}
for (i = 0; i < cDisplays; ++i)
{
int iScreen;
if (!RT_SUCCESS(rc))
{
return rc;
}
{
}
else
{
if (offVram != 0xffffffff)
{
WARN(("not expected offVram"));
}
{
}
}
}
return VINF_SUCCESS;
}
crServerDispatchVBoxTexPresent(GLuint texture, GLuint cfg, GLint xPos, GLint yPos, GLint cRects, const GLint *pRects)
{
if (idFb >= CR_MAX_GUEST_MONITORS)
{
WARN(("Invalid guest screen"));
return;
}
if (!hFb)
{
WARN(("request to present on disabled framebuffer, ignore"));
return;
}
int rc;
if (texture)
{
rc = CrFbEntryCreateForTexId(hFb, texture, (cfg & CR_PRESENT_FLAG_TEX_NONINVERT_YCOORD) ? 0 : CRBLT_F_INVERT_SRC_YCOORDS, &hEntry);
if (!RT_SUCCESS(rc))
{
LOG(("CrFbEntryCreateForTexId Failed"));
return;
}
#if 0
if (!(cfg & CR_PRESENT_FLAG_CLEAR_RECTS))
{
}
#endif
}
else
if (RT_SUCCESS(rc))
{
if (!(cfg & CR_PRESENT_FLAG_CLEAR_RECTS))
{
}
else
{
}
}
else
{
WARN(("CrFbUpdateBegin Failed"));
}
if (hEntry)
}
{
}
DECLINLINE(void) crVBoxPRectUnpacks(const VBOXCMDVBVA_RECT *paVbvaRects, RTRECT *paRects, uint32_t cRects)
{
uint32_t i = 0;
for (; i < cRects; ++i)
{
}
}
{
{
if (g_CrPresenter.pvTmpBuf)
if (!g_CrPresenter.pvTmpBuf)
{
WARN(("RTMemAlloc failed!"));
g_CrPresenter.cbTmpBuf = 0;
return NULL;
}
}
return pRects;
}
static void crPMgrPrimaryUpdateScreen(HCR_FRAMEBUFFER hFb, uint32_t idScreen, uint32_t cRects, const RTRECT *pRects)
{
bool fDirtyEmpty = true;
{
cr_server.CrCmdClientInfo.pfnCltScrUpdateProcess(cr_server.CrCmdClientInfo.hCltScr, idScreen, &hdr, sizeof (hdr));
if (fDirtyEmpty)
{
/* This is the first rectangle to be added. */
fDirtyEmpty = false;
}
else
{
/* Adjust region coordinates. */
{
}
{
}
{
}
{
}
}
}
{
cr_server.CrCmdClientInfo.pfnCltScrUpdateEnd(cr_server.CrCmdClientInfo.hCltScr, idScreen, pScreen->i32OriginX + dirtyRect.xLeft, pScreen->i32OriginY + dirtyRect.yTop,
}
else
{
cr_server.CrCmdClientInfo.pfnCltScrUpdateEnd(cr_server.CrCmdClientInfo.hCltScr, idScreen, 0, 0, 0, 0);
}
}
{
if (!cRects)
return;
i >= 0;
{
}
}
static int8_t crVBoxServerCrCmdBltPrimaryVramGenericProcess(uint32_t u32PrimaryID, VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, bool fToPrimary)
{
if (i8Result)
{
WARN(("invalid param"));
return -1;
}
if (!hFb)
{
WARN(("request to present on disabled framebuffer"));
return -1;
}
if (!fToPrimary)
{
if (!RT_SUCCESS(rc))
{
return -1;
}
return 0;
}
if (!RT_SUCCESS(rc))
{
return -1;
}
return 0;
}
static int8_t crVBoxServerCrCmdBltPrimaryProcess(const VBOXCMDVBVA_BLT_PRIMARY *pCmd, uint32_t cbCmd)
{
if (!hFb)
{
WARN(("request to present on disabled framebuffer, ignore"));
return 0;
}
{
WARN(("invalid argument size"));
return -1;
}
if (!pRects)
{
WARN(("crVBoxServerCrCmdBltRecsUnpack failed"));
return -1;
}
{
if (!texId)
{
WARN(("texId is NULL!\n"));
return -1;
}
{
WARN(("blit from primary to texture not implemented"));
return -1;
}
crServerDispatchVBoxTexPresent(texId, u32PrimaryID, pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y, cRects, (const GLint*)pRects);
return 0;
}
else
{
int8_t i8Result = crVBoxServerCrCmdBltPrimaryVramGenericProcess(u32PrimaryID, offVRAM, width, height, &Pos, cRects, pRects, fToPrymary);
if (i8Result < 0)
{
WARN(("crVBoxServerCrCmdBltPrimaryVramGenericProcess failed"));
return i8Result;
}
if (!fToPrymary)
return 0;
}
return 0;
}
static int8_t crVBoxServerCrCmdBltIdToVramMem(uint32_t hostId, VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects)
{
if (!pTex)
{
return -1;
}
if (!width)
{
}
if (i8Result)
{
WARN(("invalid param"));
return -1;
}
if (!RT_SUCCESS(rc))
{
return -1;
}
if (!RT_SUCCESS(rc))
{
return -1;
}
return 0;
}
static int8_t crVBoxServerCrCmdBltIdToVram(uint32_t hostId, VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects)
{
if (hFb)
{
crServerDispatchVBoxTexPresent(hostId, pScreen->u32ViewIndex, pPos->x, pPos->y, cRects, (const GLint*)pRects);
return 0;
}
}
static int8_t crVBoxServerCrCmdBltVramToVramMem(VBOXCMDVBVAOFFSET offSrcVRAM, uint32_t srcWidth, uint32_t srcHeight, VBOXCMDVBVAOFFSET offDstVRAM, uint32_t dstWidth, uint32_t dstHeight, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects)
{
if (i8Result)
{
WARN(("invalid param"));
return -1;
}
if (i8Result)
{
WARN(("invalid param"));
return -1;
}
return 0;
}
static int8_t crVBoxServerCrCmdBltVramToVram(VBOXCMDVBVAOFFSET offSrcVRAM, uint32_t srcWidth, uint32_t srcHeight,
{
if (hDstFb)
{
if (hSrcFb)
{
WARN(("blit from one framebuffer, wow"));
if (RT_SUCCESS(rc))
{
}
else
}
if (i8Result)
{
WARN(("invalid param"));
return -1;
}
{
if (RT_FAILURE(rc))
{
return -1;
}
}
else
{
if (RT_SUCCESS(rc))
{
}
else
rc = crVBoxServerCrCmdBltVramToVramMem(offSrcVRAM, srcWidth, srcHeight, offDstVRAM, dstWidth, dstHeight, pPos, cRects, pRects);
if (RT_FAILURE(rc))
{
return -1;
}
}
return 0;
}
else if (hSrcFb)
{
if (i8Result)
{
WARN(("invalid param"));
return -1;
}
{
if (RT_FAILURE(rc))
{
return -1;
}
}
else
{
if (RT_SUCCESS(rc))
{
}
else
rc = crVBoxServerCrCmdBltVramToVramMem(offSrcVRAM, srcWidth, srcHeight, offDstVRAM, dstWidth, dstHeight, pPos, cRects, pRects);
if (RT_FAILURE(rc))
{
return -1;
}
}
return 0;
}
return crVBoxServerCrCmdBltVramToVramMem(offSrcVRAM, srcWidth, srcHeight, offDstVRAM, dstWidth, dstHeight, pPos, cRects, pRects);
}
static int8_t crVBoxServerCrCmdBltOffIdProcess(const VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID *pCmd, uint32_t cbCmd)
{
{
WARN(("invalid argument size"));
return -1;
}
cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID, aRects)) / sizeof (VBOXCMDVBVA_RECT);
if (!pRects)
{
WARN(("crVBoxServerCrCmdBltRecsUnpack failed"));
return -1;
}
if (!hostId)
{
WARN(("zero host id"));
return -1;
}
{
WARN(("blit from texture to texture not implemented"));
return -1;
}
{
WARN(("blit to texture not implemented"));
return -1;
}
}
static int8_t crVBoxServerCrCmdBltSameDimOrId(const VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8 *pCmd, uint32_t cbCmd)
{
{
WARN(("invalid argument size"));
return -1;
}
cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8, aRects)) / sizeof (VBOXCMDVBVA_RECT);
if (!pRects)
{
WARN(("crVBoxServerCrCmdBltRecsUnpack failed"));
return -1;
}
{
if (!hostId)
{
WARN(("zero host id"));
return -1;
}
{
WARN(("blit from texture to texture not implemented"));
return -1;
}
{
WARN(("blit to texture not implemented"));
return -1;
}
}
{
if (!(u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2))
{
WARN(("blit to texture not implemented"));
return -1;
}
return crVBoxServerCrCmdBltIdToVram(pCmd->alloc1.Info.u.id, pCmd->info2.u.offVRAM, width, height, &Pos, cRects, pRects);
}
crVBoxServerCrCmdBltVramToVram(offVRAM, width, height, pCmd->info2.u.offVRAM, width, height, &Pos, cRects, pRects);
else
crVBoxServerCrCmdBltVramToVram(pCmd->info2.u.offVRAM, width, height, offVRAM, width, height, &Pos, cRects, pRects);
return 0;
}
static int8_t crVBoxServerCrCmdBltGenericBGRAProcess(const VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8 *pCmd, uint32_t cbCmd)
{
{
WARN(("invalid argument size"));
return -1;
}
cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8, aRects)) / sizeof (VBOXCMDVBVA_RECT);
if (!pRects)
{
WARN(("crVBoxServerCrCmdBltRecsUnpack failed"));
return -1;
}
{
{
WARN(("blit from texture to texture not implemented"));
return -1;
}
{
WARN(("blit to texture not implemented"));
return -1;
}
return crVBoxServerCrCmdBltIdToVram(pCmd->alloc2.Info.u.id, pCmd->alloc1.Info.u.offVRAM, pCmd->alloc1.u16Width, pCmd->alloc1.u16Height, &Pos, cRects, pRects);
}
else
{
{
if (!(u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2))
{
WARN(("blit to texture not implemented"));
return -1;
}
return crVBoxServerCrCmdBltIdToVram(pCmd->alloc1.Info.u.id, pCmd->alloc2.Info.u.offVRAM, pCmd->alloc2.u16Width, pCmd->alloc2.u16Height, &Pos, cRects, pRects);
}
crVBoxServerCrCmdBltVramToVram(pCmd->alloc1.Info.u.offVRAM, pCmd->alloc1.u16Width, pCmd->alloc1.u16Height, pCmd->alloc2.Info.u.offVRAM, pCmd->alloc2.u16Width, pCmd->alloc2.u16Height, &Pos, cRects, pRects);
else
crVBoxServerCrCmdBltVramToVram(pCmd->alloc2.Info.u.offVRAM, pCmd->alloc2.u16Width, pCmd->alloc2.u16Height, pCmd->alloc1.Info.u.offVRAM, pCmd->alloc1.u16Width, pCmd->alloc1.u16Height, &Pos, cRects, pRects);
return 0;
}
}
static int8_t crVBoxServerCrCmdClrFillPrimaryGenericProcess(uint32_t u32PrimaryID, const RTRECT *pRects, uint32_t cRects, uint32_t u32Color)
{
if (!hFb)
{
WARN(("request to present on disabled framebuffer, ignore"));
return 0;
}
if (!RT_SUCCESS(rc))
{
return -1;
}
return 0;
}
static int8_t crVBoxServerCrCmdClrFillVramGenericProcess(VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, const RTRECT *pRects, uint32_t cRects, uint32_t u32Color)
{
if (i8Result)
{
WARN(("invalid param"));
return -1;
}
return 0;
}
static int8_t crVBoxServerCrCmdClrFillGenericBGRAProcess(const VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8 *pCmd, uint32_t cbCmd)
{
if ((cbCmd - RT_OFFSETOF(VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8, aRects)) % sizeof (VBOXCMDVBVA_RECT))
{
WARN(("invalid argument size"));
return -1;
}
cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8, aRects)) / sizeof (VBOXCMDVBVA_RECT);
if (!pRects)
{
WARN(("crVBoxServerCrCmdBltRecsUnpack failed"));
return -1;
}
// uint8_t u8Flags = pCmd->Hdr.Hdr.u8Flags;
int8_t i8Result = crVBoxServerCrCmdClrFillVramGenericProcess(pCmd->dst.Info.u.offVRAM, pCmd->dst.u16Width, pCmd->dst.u16Height, pRects, cRects, pCmd->Hdr.u32Color);
if (i8Result < 0)
{
WARN(("crVBoxServerCrCmdClrFillVramGenericProcess failed"));
return i8Result;
}
return 0;
}
{
switch (u8Cmd)
{
{
if (cbCmd < sizeof (VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8))
{
WARN(("VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8: invalid command size"));
return -1;
}
return crVBoxServerCrCmdClrFillGenericBGRAProcess((const VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8*)pCmd, cbCmd);
}
default:
WARN(("unsupported command"));
return -1;
}
}
{
switch (u8Cmd)
{
{
if (cbCmd < sizeof (VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8))
{
WARN(("VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8: invalid command size"));
return -1;
}
}
{
if (cbCmd < sizeof (VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID))
{
WARN(("VBOXCMDVBVA_OPF_BLT_TYPE_OFFPRIMSZFMT_OR_ID: invalid command size"));
return -1;
}
}
{
if (cbCmd < sizeof (VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8))
{
WARN(("VBOXCMDVBVA_OPF_BLT_TYPE_GENERIC_A8R8G8B8: invalid command size"));
return -1;
}
return crVBoxServerCrCmdBltGenericBGRAProcess((const VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8 *)pCmd, cbCmd);
}
default:
WARN(("unsupported command"));
return -1;
}
}
{
{
if (!hostId)
{
WARN(("hostId is NULL"));
return -1;
}
}
else
{
WARN(("VBOXCMDVBVA_OPF_ALLOC_SRCID not specified"));
hostId = 0;
}
if (!hFb)
{
WARN(("request to present on disabled framebuffer, ignore"));
return 0;
}
return 0;
}