server_presenter.cpp revision 950908f64afa4125726f37856acac0b5d2eeed2d
/* $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_FBDISPLAY_INFO
{
typedef struct CR_PRESENTER_GLOBALS
{
#ifndef VBOXVDBG_MEMCACHE_DISABLE
#endif
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 crFbBltMem(uint8_t *pu8Src, int32_t cbSrcPitch, uint8_t *pu8Dst, int32_t cbDstPitch, uint32_t width, uint32_t height)
{
{
pu8Src += cbSrcPitch;
pu8Dst += cbDstPitch;
}
}
static void crFbBltImg(const CR_BLITTER_IMG *pSrc, const RTPOINT *pSrcDataPoint, bool fSrcInvert, const RTRECT *pCopyRect, const RTPOINT *pDstDataPoint, CR_BLITTER_IMG *pDst)
{
uint8_t *pu8Src = ((uint8_t*)pSrc->pvData) + pSrc->pitch * (!fSrcInvert ? srcY : pSrc->height - srcY - 1) + srcX * 4;
crFbBltMem(pu8Src, fSrcInvert ? -((int32_t)pSrc->pitch) : (int32_t)pSrc->pitch, pu8Dst, pDst->pitch, pCopyRect->xRight - pCopyRect->xLeft, pCopyRect->yBottom - pCopyRect->yTop);
}
static void crFbBltImgScaled(const CR_BLITTER_IMG *pSrc, const RTPOINT *pSrcDataPoint, bool fSrcInvert, const RTRECT *pCopyRect, const RTPOINT *pDstDataPoint, float strX, float strY, CR_BLITTER_IMG *pDst)
{
if (delta < 0)
ScaledDstWidth += delta;
if (ScaledDstWidth <= 0)
{
LOG(("ScaledDstWidth <= 0"));
if (ScaledDstWidth < 0)
return;
}
if (delta < 0)
ScaledDstHeight += delta;
if (ScaledDstHeight <= 0)
{
LOG(("ScaledDstHeight <= 0"));
if (ScaledDstHeight < 0)
return;
}
uint8_t *pu8Src = ((uint8_t*)pSrc->pvData) + pSrc->pitch * (!fSrcInvert ? srcY : pSrc->height - srcY - 1) + srcX * 4;
}
static void crFbBltImgScaledRects(const CR_BLITTER_IMG *pSrc, const RTPOINT *pSrcDataPoint, bool fSrcInvert, const RTRECT *pCopyRect, const RTPOINT *pDstDataPoint, float strX, float strY, CR_BLITTER_IMG *pDst)
{
if (delta < 0)
if (UnscaledSrcWidth <= 0)
{
LOG(("UnscaledSrcWidth <= 0"));
if (UnscaledSrcWidth < 0)
return;
}
if (delta < 0)
if (UnscaledSrcHeight <= 0)
{
LOG(("UnscaledSrcHeight <= 0"));
if (UnscaledSrcHeight < 0)
return;
}
uint8_t *pu8Src = ((uint8_t*)pSrc->pvData) + pSrc->pitch * (!fSrcInvert ? srcY : pSrc->height - srcY - 1) + srcX * 4;
);
}
static void crFbImgFromScreenVram(const VBVAINFOSCREEN *pScreen, void *pvVram, CR_BLITTER_IMG *pImg)
{
}
{
}
static int crFbBltGetContentsDirect(HCR_FRAMEBUFFER hFb, const RTRECT *pSrcRect, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
{
RTPOINT ScaledEntryPoint = {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 (!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;
}
{
/* scale */
/* translate */
{
if (VBoxRectIsZero(&Intersection))
continue;
if (!fScale)
else
}
}
}
end:
if (pEnteredTex)
if (pEnteredBlitter)
return rc;
}
static int crFbBltGetContentsScaleCPU(HCR_FRAMEBUFFER hFb, const RTRECT *pSrcRect, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
{
/* 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;
}
int CrFbBltGetContents(HCR_FRAMEBUFFER hFb, const RTRECT *pSrcRect, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
{
|| !CrFbHas3DData(hFb)
{
}
}
static void crFbBltPutContentsVram(HCR_FRAMEBUFFER hFb, const RTRECT *pSrcRect, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
{
{
if (VBoxRectIsZero(&Intersection))
continue;
ScaledSrcRect.xLeft = 0;
ScaledSrcRect.yTop = 0;
if (VBoxRectIsZero(&Intersection))
continue;
if (!fScale)
else
}
}
static int crFbBltPutContentsNonscaled(HCR_FRAMEBUFFER hFb, const RTRECT *pSrcRect, const RTRECT *pDstRect, 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 RTRECT *pSrcRect, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
{
{
WARN(("framebuffer not updating"));
return VERR_INVALID_STATE;
}
if (fScale)
{
WARN(("scaling not supported"));
return VERR_NOT_IMPLEMENTED;
}
}
int CrFbBltPutContentsNe(HCR_FRAMEBUFFER hFb, const RTRECT *pSrcRect, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
{
if (fScale)
{
WARN(("scaling not supported"));
return VERR_NOT_IMPLEMENTED;
}
const RTRECT *pCompRects;
if (!RT_SUCCESS(rc))
{
return rc;
}
bool fRegChanged = false;
for (uint32_t i = 0; i < cCompRects; ++i)
{
{
{
fRegChanged = true;
break;
}
}
}
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 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)
}
}
{
}
{
}
{
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;
}
{
}
{
}
{
{
WARN(("framebuffer not updating"));
return VERR_INVALID_STATE;
}
bool fChanged = false;
if (fChanged)
{
}
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;
}
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;
}
return windowSync();
}
{
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]);
}
}
{
int rc;
int cDisplays = 0, i;
for (i = 0; i < cr_server.screenCount; ++i)
{
++cDisplays;
}
if (!cDisplays)
return VINF_SUCCESS;
for (i = 0; i < cr_server.screenCount; ++i)
{
}
for (i = 0; i < cr_server.screenCount; ++i)
{
{
}
}
return VINF_SUCCESS;
}
{
}
#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 CrPMgrInit()
{
int rc = VINF_SUCCESS;
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 (pInfo->pDpComposite)
delete pInfo->pDpComposite;
}
#ifndef VBOXVDBG_MEMCACHE_DISABLE
#endif
if (g_CrPresenter.pvTmpBuf)
if (g_CrPresenter.pvTmpBuf2)
}
{
if (idScreen >= CR_MAX_GUEST_MONITORS)
{
return NULL;
}
{
}
else
}
{
if (idScreen >= CR_MAX_GUEST_MONITORS)
{
return NULL;
}
{
return NULL;
}
else
}
{
return hFb;
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;
}
{
}
{
if (CR_PMGR_MODE_ROOTVR & u32Mode)
return u32Mode;
}
{
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;
}
{
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;
}
{
if (u32Tmp != u32ModeResulting)
{
}
if (!u32ModeRemove && !u32ModeAdd)
return VINF_SUCCESS;
if (!pInfo->pDpComposite)
{
}
if (u32ModeRemove & CR_PMGR_MODE_ROOTVR)
{
delete pInfo->pDpWinRootVr;
}
else if (u32ModeRemove & CR_PMGR_MODE_WINDOW)
{
}
if (u32ModeRemove & CR_PMGR_MODE_VRDP)
{
if (pInfo->pDpComposite)
else
}
if (u32ModeAdd & CR_PMGR_MODE_ROOTVR)
{
if (!pOldWin)
pInfo->pDpWinRootVr = new CrFbDisplayWindowRootVr(pOldWin, &cr_server.screenVieport[idScreen].Rect);
}
else if (u32ModeAdd & CR_PMGR_MODE_WINDOW)
{
if (!pOldWin)
}
if (u32ModeAdd & CR_PMGR_MODE_VRDP)
{
}
{
}
else
{
}
if (pOldWin)
delete pOldWin;
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;
hFb;
{
}
return VINF_SUCCESS;
}
int CrPMgrRootVrUpdate()
{
hFb;
{
if (RT_SUCCESS(rc))
{
}
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;
}
}
/*client should notify the manager about the framebuffer resize via this function */
{
int rc = VINF_SUCCESS;
if (CrFbIsEnabled(hFb))
{
if (!RT_SUCCESS(rc))
{
return rc;
}
}
else
{
if (!RT_SUCCESS(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;
}
void *pvVRAM;
{
}
else
{
}
if (!RT_SUCCESS(rc))
{
return rc;
}
}
return VINF_SUCCESS;
}
crServerDispatchVBoxTexPresent(GLuint texture, GLuint cfg, GLint xPos, GLint yPos, GLint cRects, const GLint *pRects)
{
if (idScreen >= 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 (!hFb)
{
WARN(("request to present on disabled framebuffer, ignore"));
return VINF_SUCCESS;
}
uint32_t cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_PRIMARY, aRects)) / sizeof (VBOXCMDVBVA_RECT);
{
if (g_CrPresenter.pvTmpBuf)
if (!g_CrPresenter.pvTmpBuf)
{
WARN(("RTMemAlloc failed!"));
g_CrPresenter.cbTmpBuf = 0;
return VINF_SUCCESS;
}
}
{
if (!(u8Flags & VBOXCMDVBVA_OPF_ALLOC_SRCPRIMARY))
{
/* blit to primary from non-primary */
{
/* TexPresent */
crServerDispatchVBoxTexPresent(texId, u8PrimaryID, pBlt->Pos.x, pBlt->Pos.y, cRects, (const GLint*)pRects);
}
else
{
{
WARN(("invalid param"));
return VINF_SUCCESS;
}
if (!RT_SUCCESS(rc))
{
return rc;
}
if (cRects)
{
bool fDirtyEmpty = true;
{
cr_server.CrCmdClientInfo.pfnCltScrUpdateProcess(cr_server.CrCmdClientInfo.hCltScr, u8PrimaryID, &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, u8PrimaryID, dirtyRect.xLeft, dirtyRect.yTop,
}
else
{
cr_server.CrCmdClientInfo.pfnCltScrUpdateEnd(cr_server.CrCmdClientInfo.hCltScr, u8PrimaryID, 0, 0, 0, 0);
}
}
}
return VINF_SUCCESS;
}
else
{
/* blit from one primary to another primary, wow */
WARN(("not implemented"));
return VINF_SUCCESS;
}
}
else
{
/* blit from primary to non-primary */
{
WARN(("not implemented"));
return VINF_SUCCESS;
}
else
{
{
WARN(("invalid param"));
return VINF_SUCCESS;
}
if (!RT_SUCCESS(rc))
{
return VINF_SUCCESS;
}
}
}
}
else
{
WARN(("not implemented"));
return VINF_SUCCESS;
}
return VINF_SUCCESS;
}