VirtualBox

Ignore:
Timestamp:
Jan 17, 2014 4:34:07 PM (11 years ago)
Author:
vboxsync
Message:

crOpenGL: presentation infrastructure rework (still work in progress)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h

    r50041 r50095  
    1515
    1616#include "cr_server.h"
     17#include <cr_htable.h>
     18#include <cr_compositor.h>
    1719
    1820#ifdef VBOX_WITH_CRHGSMI
     
    114116GLint crServerDispatchCreateContextEx(const char *dpyName, GLint visualBits, GLint shareCtx, GLint preloadCtxID, int32_t internalID);
    115117GLint crServerDispatchWindowCreateEx(const char *dpyName, GLint visBits, GLint preloadWinID);
    116 GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID, GLboolean fUseDefaultDEntry);
     118GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID);
    117119void crServerMuralTerm(CRMuralInfo *mural);
    118120GLboolean crServerMuralSize(CRMuralInfo *mural, GLint width, GLint height);
    119 void crServerMuralPosition(CRMuralInfo *mural, GLint x, GLint y, GLboolean fSkipCheckGeometry);
     121void crServerMuralPosition(CRMuralInfo *mural, GLint x, GLint y);
    120122void crServerMuralVisibleRegion( CRMuralInfo *mural, GLint cRects, const GLint *pRects );
    121123void crServerMuralShow( CRMuralInfo *mural, GLint state );
    122 int crServerMuralSynchRootVr(CRMuralInfo *mural, bool *pfChanged);
    123124
    124125GLint crServerGenerateID(GLint *pCounter);
     
    129130
    130131CRMuralInfo * crServerGetDummyMural(GLint visualBits);
    131 
    132 void crServerPresentOutputRedirect(CRMuralInfo *pMural);
    133 void crServerOutputRedirectCheckEnableDisable(CRMuralInfo *pMural);
    134132
    135133void crServerCheckMuralGeometry(CRMuralInfo *mural);
    136134GLboolean crServerSupportRedirMuralFBO(void);
    137135
     136void crVBoxServerMuralFbResizeBegin(HCR_FRAMEBUFFER hFb);
     137void crVBoxServerMuralFbResizeEnd(HCR_FRAMEBUFFER hFb);
     138
    138139void crVBoxServerNotifyEvent(int32_t idScreen, uint32_t uEvent, void*pvData);
    139140void crVBoxServerCheckVisibilityEvent(int32_t idScreen);
    140141
    141 void crServerDisplayTermAll();
    142 
    143 void crServerWindowSize(CRMuralInfo *pMural);
    144 void crServerWindowShow(CRMuralInfo *pMural);
    145 void crServerWindowVisibleRegion(CRMuralInfo *pMural);
     142void crServerRedirMuralFbClear(CRMuralInfo *mural);
     143
    146144void crServerWindowReparent(CRMuralInfo *pMural);
    147145
    148 void crServerWindowSetIsVisible(CRMuralInfo *pMural, GLboolean fIsVisible);
    149 void crServerWindowCheckIsVisible(CRMuralInfo *pMural);
    150 
    151 int crVBoxServerUpdateMuralRootVisibleRegion(CRMuralInfo *pMI);
    152 
    153 #define CR_SERVER_REDIR_F_NONE     0x00
    154 /* the data should be displayed on host (unset when is on or when CR_SERVER_REDIR_F_FBO_RAM_VMFB is set) */
    155 #define CR_SERVER_REDIR_F_DISPLAY       0x01
    156 /* guest window data get redirected to FBO on host */
    157 #define CR_SERVER_REDIR_F_FBO           0x02
    158 /* used with CR_SERVER_REDIR_F_FBO only
    159  * indicates that FBO data should be copied to RAM for further processing */
    160 #define CR_SERVER_REDIR_F_FBO_RAM       0x04
    161 /* used with CR_SERVER_REDIR_F_FBO_RAM only
    162  * indicates that FBO data should be passed to VRDP backend */
    163 #define CR_SERVER_REDIR_F_FBO_RAM_VRDP  0x08
    164 /* used with CR_SERVER_REDIR_F_FBO_RAM only
    165  * indicates that FBO data should be passed to VM Framebuffer */
    166 #define CR_SERVER_REDIR_F_FBO_RAM_VMFB  0x10
    167 /* used with CR_SERVER_REDIR_F_FBO_RAM only
    168  * makes the RPW (Read Pixels Worker) mechanism to be used for GPU memory aquisition */
    169 #define CR_SERVER_REDIR_F_FBO_RPW       0x20
    170 
    171 
    172 #define CR_SERVER_REDIR_F_ALL           0x3f
    173 
    174 #define CR_SERVER_REDIR_FGROUP_REQUIRE_FBO     (CR_SERVER_REDIR_F_ALL & ~CR_SERVER_REDIR_F_DISPLAY)
    175 #define CR_SERVER_REDIR_FGROUP_REQUIRE_FBO_RAM (CR_SERVER_REDIR_F_FBO_RAM_VRDP | CR_SERVER_REDIR_F_FBO_RAM_VMFB | CR_SERVER_REDIR_F_FBO_RPW)
    176 
    177 DECLINLINE(GLuint) crServerRedirModeAdjust(GLuint value)
    178 {
    179     /* sanitize values */
    180     value &= CR_SERVER_REDIR_F_ALL;
    181 
    182     if (value & CR_SERVER_REDIR_FGROUP_REQUIRE_FBO)
    183         value |=  CR_SERVER_REDIR_F_FBO;
    184     if (value & CR_SERVER_REDIR_FGROUP_REQUIRE_FBO_RAM)
    185         value |=  CR_SERVER_REDIR_F_FBO_RAM;
    186 
    187     return value;
    188 }
    189 
    190 int32_t crServerSetOffscreenRenderingMode(GLuint value);
    191 void crServerRedirMuralFBO(CRMuralInfo *mural, GLuint redir);
     146void crServerRedirMuralFBO(CRMuralInfo *mural, bool fEnabled);
    192147void crServerDeleteMuralFBO(CRMuralInfo *mural);
    193148void crServerPresentFBO(CRMuralInfo *mural);
     
    196151void crServerMuralFBOSwapBuffers(CRMuralInfo *mural);
    197152
    198 void crServerVBoxCompositionDisableEnter(CRMuralInfo *mural);
    199 void crServerVBoxCompositionDisableLeave(CRMuralInfo *mural, GLboolean fForcePresentOnEnabled);
    200 void crServerVBoxCompositionPresent(CRMuralInfo *mural);
    201 DECLINLINE(GLboolean) crServerVBoxCompositionPresentNeeded(CRMuralInfo *mural)
    202 {
    203     return mural->bVisible
    204                 && mural->width
    205                 && mural->height
    206                 && !mural->fRootVrOn ? !CrVrScrCompositorIsEmpty(&mural->Compositor) : !CrVrScrCompositorIsEmpty(&mural->RootVrCompositor);
    207 }
    208153
    209154#define CR_SERVER_FBO_BB_IDX(_mural) ((_mural)->iBbBuffer)
     
    219164int32_t crVBoxServerInternalClientRead(CRClient *pClient, uint8_t *pBuffer, uint32_t *pcbBuffer);
    220165
    221 PCR_DISPLAY crServerDisplayGetInitialized(uint32_t idScreen);
    222 
    223166void crServerPerformMakeCurrent( CRMuralInfo *mural, CRContextInfo *ctxInfo );
    224167
    225168PCR_BLITTER crServerVBoxBlitterGet();
     169PCR_BLITTER crServerVBoxBlitterGetInitialized();
    226170
    227171DECLINLINE(void) crServerVBoxBlitterWinInit(CR_BLITTER_WINDOW *win, CRMuralInfo *mural)
     
    420364int crServerVBoxParseNumerics(const char *pszStr, const int defaultVal);
    421365
    422 void CrDpRootUpdate(PCR_DISPLAY pDisplay);
    423 void CrDpEnter(PCR_DISPLAY pDisplay);
    424 void CrDpLeave(PCR_DISPLAY pDisplay);
    425 int CrDpInit(PCR_DISPLAY pDisplay);
    426 void CrDpTerm(PCR_DISPLAY pDisplay);
    427 
    428 DECLINLINE(bool) CrDpIsEmpty(PCR_DISPLAY pDisplay)
    429 {
    430     return CrVrScrCompositorIsEmpty(&pDisplay->Mural.Compositor);
    431 }
    432 
    433 int CrDpSaveState(PCR_DISPLAY pDisplay, PSSMHANDLE pSSM);
    434 int CrDpLoadState(PCR_DISPLAY pDisplay, PSSMHANDLE pSSM, uint32_t version);
    435 
    436 void CrDpReparent(PCR_DISPLAY pDisplay, CRScreenInfo *pScreen);
    437 
    438 void CrDpResize(PCR_DISPLAY pDisplay, int32_t xPos, int32_t yPos, uint32_t width, uint32_t height);
    439 void CrDpEntryInit(PCR_DISPLAY_ENTRY pEntry, const VBOXVR_TEXTURE *pTextureData, uint32_t fFlags, PFNVBOXVRSCRCOMPOSITOR_ENTRY_RELEASED pfnEntryReleased);
    440 void CrDpEntryCleanup(PCR_DISPLAY_ENTRY pEntry);
    441 int CrDpEntryRegionsSet(PCR_DISPLAY pDisplay, PCR_DISPLAY_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions);
    442 int CrDpEntryRegionsAdd(PCR_DISPLAY pDisplay, PCR_DISPLAY_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions, CR_DISPLAY_ENTRY_MAP *pMap);
    443 void CrDpRegionsClear(PCR_DISPLAY pDisplay);
    444 DECLINLINE(bool) CrDpEntryIsUsed(PCR_DISPLAY_ENTRY pEntry)
    445 {
    446     return CrVrScrCompositorEntryIsInList(&pEntry->CEntry);
    447 }
    448 
    449 DECLINLINE(CRMuralInfo*) CrDpGetMural(PCR_DISPLAY pDisplay)
    450 {
    451     return &pDisplay->Mural;
    452 }
    453 
    454 int CrDemGlobalInit();
    455 void CrDemTeGlobalTerm();
    456 void CrDemEnter(PCR_DISPLAY_ENTRY_MAP pMap);
    457 void CrDemLeave(PCR_DISPLAY_ENTRY_MAP pMap, PCR_DISPLAY_ENTRY pNewEntry, PCR_DISPLAY_ENTRY pReplacedEntry);
    458 int CrDemInit(PCR_DISPLAY_ENTRY_MAP pMap);
    459 void CrDemTerm(PCR_DISPLAY_ENTRY_MAP pMap);
    460 PCR_DISPLAY_ENTRY CrDemEntryAcquire(PCR_DISPLAY_ENTRY_MAP pMap, GLuint idTexture, uint32_t fFlags);
    461 void CrDemEntryRelease(PCR_DISPLAY_ENTRY pEntry);
    462 int CrDemEntrySaveState(PCR_DISPLAY_ENTRY pEntry, PSSMHANDLE pSSM);
    463 int CrDemEntryLoadState(PCR_DISPLAY_ENTRY_MAP pMap, PCR_DISPLAY_ENTRY *ppEntry, PSSMHANDLE pSSM);
    464 
    465 int crServerDisplaySaveState(PSSMHANDLE pSSM);
    466 int crServerDisplayLoadState(PSSMHANDLE pSSM, uint32_t u32Version);
    467 
    468 
    469 void crServerDEntryResized(CRMuralInfo *pMural, CR_DISPLAY_ENTRY *pDEntry);
    470 void crServerDEntryMoved(CRMuralInfo *pMural, CR_DISPLAY_ENTRY *pDEntry);
    471 void crServerDEntryVibleRegions(CRMuralInfo *pMural, CR_DISPLAY_ENTRY *pDEntry);
    472 void crServerDEntryCheckFBO(CRMuralInfo *pMural, CR_DISPLAY_ENTRY *pDEntry, CRContext *ctx);
    473 
    474 void crServerDEntryAllResized(CRMuralInfo *pMural);
    475 void crServerDEntryAllMoved(CRMuralInfo *pMural);
    476 void crServerDEntryAllVibleRegions(CRMuralInfo *pMural);
     366/*helper function that calls CrFbUpdateBegin for all enabled framebuffers */
     367int CrPMgrHlpGlblUpdateBegin();
     368/*helper function that calls CrFbUpdateEnd for all framebuffers being updated */
     369void CrPMgrHlpGlblUpdateEnd();
     370HCR_FRAMEBUFFER CrPMgrFbGetFirstEnabled();
     371HCR_FRAMEBUFFER CrPMgrFbGetNextEnabled(HCR_FRAMEBUFFER hFb);
     372int CrPMgrModeVrdp(bool fEnable);
     373int CrPMgrModeRootVr(bool fEnable);
     374int CrPMgrRootVrUpdate();
     375int CrPMgrViewportUpdate(uint32_t idScreen);
     376int CrPMgrScreenChanged(uint32_t idScreen);
     377int CrPMgrNotifyResize(HCR_FRAMEBUFFER hFb);
     378int CrPMgrSaveState(PSSMHANDLE pSSM);
     379int CrPMgrLoadState(PSSMHANDLE pSSM, uint32_t version);
     380HCR_FRAMEBUFFER CrPMgrFbGet(uint32_t idScreen);
     381/*cleanup stuff*/
     382
     383int CrPMgrInit();
     384void CrPMgrTerm();
     385
     386int CrFbResize(HCR_FRAMEBUFFER hFb, const struct VBVAINFOSCREEN * pScreen, void *pvVRAM);
     387bool CrFbIsEnabled(HCR_FRAMEBUFFER hFb);
     388int CrFbEntryCreateForTexId(HCR_FRAMEBUFFER hFb, GLuint idTex, uint32_t fFlags, HCR_FRAMEBUFFER_ENTRY *phEntry);
     389int CrFbEntryCreateForTexData(HCR_FRAMEBUFFER hFb, struct CR_TEXDATA *pTex, uint32_t fFlags, HCR_FRAMEBUFFER_ENTRY *phEntry);
     390void CrFbEntryAddRef(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry);
     391void CrFbEntryRelease(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry);
     392const struct VBVAINFOSCREEN* CrFbGetScreenInfo(HCR_FRAMEBUFFER hFb);
     393const struct VBOXVR_SCR_COMPOSITOR* CrFbGetCompositor(HCR_FRAMEBUFFER hFb);
     394const struct VBOXVR_SCR_COMPOSITOR_ENTRY* CrFbEntryGetCompositorEntry(HCR_FRAMEBUFFER_ENTRY hEntry);
     395
     396/* start doing modifications to the framebuffer */
     397int CrFbUpdateBegin(HCR_FRAMEBUFFER hFb);
     398/*below commands can only be used in Framebuffer update mode, i.e. after the CrFbUpdateBegin succeeded */
     399int CrFbEntryRegions(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry);
     400
     401/* complete doing modifications to the framebuffer */
     402void CrFbUpdateEnd(HCR_FRAMEBUFFER hFb);
     403
     404int CrFbEntryRegionsAdd(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions, bool fPosRelated);
     405int CrFbEntryRegionsSet(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions, bool fPosRelated);
     406
     407int CrFbEntryTexDataUpdate(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY pEntry, struct CR_TEXDATA *pTex);
     408
     409CRHTABLE_HANDLE CrFbDDataAllocSlot(HCR_FRAMEBUFFER hFb);
     410void CrFbDDataReleaseSlot(HCR_FRAMEBUFFER hFb, CRHTABLE_HANDLE hSlot);
     411int CrFbDDataEntryPut(HCR_FRAMEBUFFER_ENTRY hEntry, CRHTABLE_HANDLE hSlot, void *pvData);
     412void* CrFbDDataEntryGet(HCR_FRAMEBUFFER_ENTRY hEntry, CRHTABLE_HANDLE hSlot);
     413
     414CR_TEXDATA* CrFbTexDataCreate(const VBOXVR_TEXTURE *pTex);
     415void CrFbTexDataInit(CR_TEXDATA* pFbTex, const VBOXVR_TEXTURE *pTex, PFNCRTEXDATA_RELEASED pfnTextureReleased);
    477416
    478417//#define VBOX_WITH_CRSERVER_DUMPER
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette