VirtualBox

Changeset 43888 in vbox


Ignore:
Timestamp:
Nov 15, 2012 9:23:50 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
82105
Message:

crOpenGL: more new present mechanism

Location:
trunk
Files:
1 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/HostServices/VBoxCrOpenGLSvc.h

    r41404 r43888  
    9090    /* Update the window visible region. */
    9191    DECLR3CALLBACKMEMBER(void, H3DORVisibleRegion,   (void *pvInstance,
    92                                                       uint32_t cRects, RTRECT *paRects));
     92                                                      uint32_t cRects, const RTRECT *paRects));
    9393    /* A rendered 3D frame is ready. Format of pvData is "pszFormat" parameter of H3DORBegin. */
    9494    DECLR3CALLBACKMEMBER(void, H3DORFrame,           (void *pvInstance,
  • trunk/src/VBox/Additions/common/crOpenGL/stub.c

    r42518 r43888  
    152152        stub.spu->dispatch_table.WindowVisibleRegion( window, cRects, pRects );
    153153    }
     154}
     155
     156void APIENTRY crTexPresent(GLuint texture, GLuint cfg, GLint xPos, GLint yPos, GLint cRects, GLint *pRects)
     157{
     158    crError("not expected!");
    154159}
    155160
  • trunk/src/VBox/GuestHost/OpenGL/Makefile.kmk

    r42499 r43888  
    7777        util/url.c \
    7878        util/warp.c \
     79        util/vreg.cpp \
    7980        util/vboxhgcm.c \
    8081        $(VBOX_PATH_CROGL_GENFILES)/debug_opcodes.c
  • trunk/src/VBox/GuestHost/OpenGL/glapi_parser/APIspec.txt

    r42499 r43888  
    83728372chromium    extpack
    83738373
     8374name        TexPresent
     8375return      void
     8376param       texture     GLuint
     8377param       cfg         GLuint
     8378param       xPos        GLint
     8379param       yPos        GLint
     8380param       cRects      GLint
     8381param       pRects      GLint *
     8382category    Chromium
     8383props       nolist
     8384chromium    extpack
     8385chrelopcode 0
     8386
    83748387name        WindowShow
    83758388return      void
  • trunk/src/VBox/GuestHost/OpenGL/include/chromium.h

    r42536 r43888  
    768768extern void APIENTRY crWindowVisibleRegion( GLint window, GLint cRects, void *pRects );
    769769extern void APIENTRY crWindowShow( GLint window, GLint flag );
     770extern void APIENTRY crTexPresent(GLuint texture, GLuint cfg, GLint xPos, GLint yPos, GLint cRects, GLint *pRects);
    770771
    771772typedef int (CR_APIENTRY *CR_PROC)();
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_server.h

    r43874 r43888  
    2828#include <VBox/Hardware/VBoxVideoVBE.h>
    2929
     30#include "cr_vreg.h"
     31
    3032#ifdef __cplusplus
    3133extern "C" {
     
    5658                                                     int32_t x, int32_t y, uint32_t w, uint32_t h));
    5759    DECLR3CALLBACKMEMBER(void, CRORVisibleRegion,   (void *pvInstance,
    58                                                      uint32_t cRects, RTRECT *paRects));
     60                                                     uint32_t cRects, const RTRECT *paRects));
    5961    DECLR3CALLBACKMEMBER(void, CRORFrame,           (void *pvInstance,
    6062                                                     void *pvData, uint32_t cbData));
     
    175177
    176178
     179/* BLITTER */
     180typedef struct CR_BLITTER_BUFFER
     181{
     182    GLuint cbBuffer;
     183    GLvoid * pvBuffer;
     184} CR_BLITTER_BUFFER, *PCR_BLITTER_BUFFER;
     185
     186typedef struct CR_BLITTER_TEXTURE
     187{
     188    GLint width;
     189    GLint height;
     190    GLenum target;
     191    GLuint hwid;
     192} CR_BLITTER_TEXTURE, *PCR_BLITTER_TEXTURE;
     193
     194typedef union CR_BLITTER_FLAGS
     195{
     196    struct
     197    {
     198        uint32_t Initialized     : 1;
     199        uint32_t SupportsFBO     : 1;
     200        uint32_t SupportsFBOBlit : 1;
     201        uint32_t Reserved        : 29;
     202    };
     203    uint32_t Value;
     204} CR_BLITTER_FLAGS, *PCR_BLITTER_FLAGS;
     205
     206typedef DECLCALLBACK(int) FNCRBLT_BLITTER(struct CR_BLITTER *pBlitter, CR_BLITTER_TEXTURE *pSrc, const RTRECT *paSrcRect, const PRTRECTSIZE pDstSize, const RTRECT *paDstRect, uint32_t cRects, uint32_t fFlags);
     207typedef FNCRBLT_BLITTER *PFNCRBLT_BLITTER;
     208
     209#define CRBLT_F_LINEAR 0x00000001
     210
     211typedef struct CR_BLITTER
     212{
     213    GLuint idFBO;
     214    CR_BLITTER_FLAGS Flags;
     215    PFNCRBLT_BLITTER pfnBlt;
     216    CR_BLITTER_BUFFER Verticies;
     217    CR_BLITTER_BUFFER Indicies;
     218    RTRECTSIZE CurrentSetSize;
     219    CRMuralInfo *pCurrentMural;
     220    CRContextInfo CtxInfo;
     221    CRContextInfo *pRestoreCtxInfo;
     222    CRMuralInfo *pRestoreMural;
     223} CR_BLITTER, *PCR_BLITTER;
     224
     225int CrBltInit(PCR_BLITTER pBlitter, CRMuralInfo *pCurrentMural, GLint visualBits);
     226void CrBltTerm(PCR_BLITTER pBlitter);
     227
     228static DECLINLINE(GLboolean) CrBltSupportsTexTex(PCR_BLITTER pBlitter)
     229{
     230    return pBlitter->Flags.SupportsFBO;
     231}
     232
     233DECLINLINE(GLboolean) CrBltIsEntered(PCR_BLITTER pBlitter)
     234{
     235    return !!pBlitter->pRestoreCtxInfo;
     236}
     237
     238void CrBltMuralSetCurrent(PCR_BLITTER pBlitter, CRMuralInfo *pMural);
     239
     240void CrBltLeave(PCR_BLITTER pBlitter);
     241int CrBltEnter(PCR_BLITTER pBlitter, CRContextInfo *pRestoreCtxInfo, CRMuralInfo *pRestoreMural);
     242void CrBltBlitTexMural(PCR_BLITTER pBlitter, CR_BLITTER_TEXTURE *pSrc, const RTRECT *paSrcRects, const RTRECT *paDstRects, uint32_t cRects, uint32_t fFlags);
     243void CrBltBlitTexTex(PCR_BLITTER pBlitter, CR_BLITTER_TEXTURE *pSrc, const RTRECT *pSrcRect, CR_BLITTER_TEXTURE *pDst, const RTRECT *pDstRect, uint32_t cRects, uint32_t fFlags);
     244/* */
     245
     246/* PRESENTER */
     247struct CR_PRESENTER;
     248struct CR_PRESENTER_ENTRY;
     249
     250typedef DECLCALLBACK(int) FNCRDISPLAY_REGIONS_CHANGED(struct CR_PRESENTER *pPresenter);
     251typedef FNCRDISPLAY_REGIONS_CHANGED *PFNCRDISPLAY_REGIONS_CHANGED;
     252
     253typedef DECLCALLBACK(int) FNCRDISPLAY_DRAW_ENTRY(struct CR_PRESENTER *pPresenter, struct CR_PRESENTER_ENTRY *pEntry, PCR_BLITTER pBlitter);
     254typedef FNCRDISPLAY_DRAW_ENTRY *PFNCRDISPLAY_DRAW_ENTRY;
     255
     256typedef DECLCALLBACK(int) FNCRDISPLAY_DRAW_TEXTURE(struct CR_PRESENTER *pPresenter, PCR_BLITTER pBlitter,
     257                                            CR_BLITTER_TEXTURE *pTexture, const RTRECT *paSrcRects, const RTRECT *paDstRects, uint32_t cRects);
     258typedef FNCRDISPLAY_DRAW_TEXTURE *PFNCRDISPLAY_DRAW_TEXTURE;
     259
     260typedef struct CR_PRESENTER_ENTRY
     261{
     262    VBOXVR_COMPOSITOR_ENTRY Ce;
     263    CR_BLITTER_TEXTURE Texture;
     264    RTPOINT Pos;
     265    PRTRECT paSrcRects;
     266    PRTRECT paDstRects;
     267    uint32_t cRects;
     268} CR_PRESENTER_ENTRY, *PCR_PRESENTER_ENTRY;
     269
     270typedef struct CR_PRESENTER
     271{
     272    VBOXVR_COMPOSITOR Compositor;
     273    float StretchX;
     274    float StretchY;
     275    PFNCRDISPLAY_REGIONS_CHANGED pfnRegionsChanged;
     276    PFNCRDISPLAY_DRAW_ENTRY pfnDrawEntry;
     277    PFNCRDISPLAY_DRAW_TEXTURE pfnDrawTexture;
     278    uint32_t cRects;
     279    uint32_t cRectsBuffer;
     280    PRTRECT paSrcRects;
     281    PRTRECT paDstRects;
     282} CR_PRESENTER, *PCR_PRESENTER;
     283
     284
     285DECLCALLBACK(int) CrPtCbDrawEntrySingle(struct CR_PRESENTER *pPresenter, struct CR_PRESENTER_ENTRY *pEntry, PCR_BLITTER pBlitter);
     286DECLCALLBACK(int) CrPtCbDrawEntryAll(struct CR_PRESENTER *pPresenter, struct CR_PRESENTER_ENTRY *pEntry, PCR_BLITTER pBlitter);
     287
     288DECLINLINE(void) CrPtEntryInit(PCR_PRESENTER_ENTRY pEntry, PCR_BLITTER_TEXTURE pTextureData)
     289{
     290    VBoxVrCompositorEntryInit(&pEntry->Ce);
     291    pEntry->Texture = *pTextureData;
     292    memset(&pEntry->Pos, 0, sizeof (CR_PRESENTER_ENTRY) - RT_OFFSETOF(CR_PRESENTER_ENTRY, Pos));
     293}
     294DECLINLINE(bool) CrPtEntryIsUsed(const PCR_PRESENTER_ENTRY pEntry)
     295{
     296    return VBoxVrCompositorEntryIsInList(&pEntry->Ce);
     297}
     298int CrPtEntryPresent(PCR_PRESENTER pPresenter, PCR_PRESENTER_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions, PCR_BLITTER pBlitter);
     299int CrPtEntryRemove(PCR_PRESENTER pPresenter, PCR_PRESENTER_ENTRY pEntry);
     300int CrPtInit(PCR_PRESENTER pPresenter, PFNCRDISPLAY_REGIONS_CHANGED pfnRegionsChanged, PFNCRDISPLAY_DRAW_ENTRY pfnDrawEntry, PFNCRDISPLAY_DRAW_TEXTURE pfnDrawTexture);
     301void CrPtTerm(PCR_PRESENTER pPresenter);
     302void CrPtSetStretching(PCR_PRESENTER pPresenter, float StretchX, float StretchY);
     303/* regions are valid until the next CrPt call */
     304int CrPtGetRegions(PCR_PRESENTER pPresenter, uint32_t *pcRegions, const RTRECT **ppaRegions);
     305/* */
     306
     307/* DISPLAY */
     308
     309typedef struct CR_DISPLAY_ENTRY
     310{
     311    CR_PRESENTER_ENTRY Pe;
     312} CR_DISPLAY_ENTRY, *PCR_DISPLAY_ENTRY;
     313
     314typedef struct CR_DISPLAY
     315{
     316    CR_PRESENTER Presenter;
     317    CRMuralInfo Mural;
     318    CRCreateInfo_t MuralCreateInfo;
     319    PCR_BLITTER pBlitter;
     320} CR_DISPLAY, *PCR_DISPLAY;
     321
     322int CrDpInit(PCR_DISPLAY pDisplay);
     323void CrDpTerm(PCR_DISPLAY pDisplay);
     324DECLINLINE(void) CrDpBlitterSet(PCR_DISPLAY pDisplay, PCR_BLITTER pBlitter)
     325{
     326    pDisplay->pBlitter = pBlitter;
     327}
     328bool CrDpBlitterTest(PCR_DISPLAY pDisplay, PCR_BLITTER pBlitter);
     329void CrDpResize(PCR_DISPLAY pDisplay, uint32_t width, uint32_t height,
     330        uint32_t stretchedWidth, uint32_t stretchedHeight);
     331void CrDpEntryInit(PCR_DISPLAY_ENTRY pEntry, PCR_BLITTER_TEXTURE pTextureData);
     332void CrDpEntryCleanup(PCR_DISPLAY pDisplay, PCR_DISPLAY_ENTRY pEntry);
     333int CrDpPresentTexture(PCR_DISPLAY pDisplay, PCR_DISPLAY_ENTRY pEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions);
     334DECLINLINE(bool) CrDpEntryIsUsed(PCR_DISPLAY_ENTRY pEntry)
     335{
     336    return CrPtEntryIsUsed(&pEntry->Pe);
     337}
     338
     339DECLINLINE(CRMuralInfo*) CrDpGetMural(PCR_DISPLAY pDisplay)
     340{
     341    return &pDisplay->Mural;
     342}
     343
     344DECLINLINE(CRCreateInfo_t*) CrDpGetMuralCreateInfo(PCR_DISPLAY pDisplay)
     345{
     346    return &pDisplay->MuralCreateInfo;
     347}
     348
     349
     350typedef struct CR_DISPLAY_ENTRY_MAP
     351{
     352    CRHashTable * pTextureMap;
     353} CR_DISPLAY_ENTRY_MAP, *PCR_DISPLAY_ENTRY_MAP;
     354
     355int CrDemInit(PCR_DISPLAY_ENTRY_MAP pMap);
     356void CrDemTerm(PCR_DISPLAY_ENTRY_MAP pMap);
     357PCR_DISPLAY_ENTRY CrDemEntryGetCreate(PCR_DISPLAY_ENTRY_MAP pMap, GLuint idTexture, CRContextInfo *pCtxInfo);
     358void CrDemEntryDestroy(PCR_DISPLAY_ENTRY_MAP pMap, GLuint idTexture);
     359
     360/* */
     361
     362
    177363typedef struct {
    178364    unsigned short tcpip_port;
     
    196382    GLint currentWindow;
    197383    GLint currentNativeWindow;
     384    CRMuralInfo *currentMural;
    198385
    199386    CRHashTable *muralTable;  /**< hash table where all murals are stored */
     
    286473
    287474    GLboolean             bUseMultipleContexts;
     475
     476    uint8_t               fPresentBlitterInited;
     477    CR_DISPLAY_ENTRY_MAP  PresentTexturepMap;
     478    CR_BLITTER            PresentBlitter;
     479    uint32_t              DisplaysInitMap[(CR_MAX_GUEST_MONITORS + 31)/32];
     480    CR_DISPLAY            aDispplays[CR_MAX_GUEST_MONITORS];
    288481} CRServer;
    289482
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_vreg.h

    r43834 r43888  
    2121#include <iprt/list.h>
    2222#include <iprt/types.h>
     23#include <iprt/mem.h>
     24#include <iprt/string.h>
     25#include <iprt/assert.h>
     26
     27#ifndef IN_RING0
     28# define VBOXVREGDECL(_type) DECLEXPORT(_type)
     29#else
     30# define VBOXVREGDECL(_type) RTDECL(_type)
     31#endif
     32
     33
    2334
    2435RT_C_DECLS_BEGIN
     
    3041} VBOXVR_LIST, *PVBOXVR_LIST;
    3142
    32 DECLINLINE(void) VBoxRectRectTranslate(RTRECT * pRect, int32_t x, int32_t y)
     43DECLINLINE(int) VBoxRectCmp(const RTRECT * pRect1, const RTRECT * pRect2)
     44{
     45    return memcmp(pRect1, pRect2, sizeof (*pRect1));
     46}
     47
     48DECLINLINE(void) VBoxRectTranslate(RTRECT * pRect, int32_t x, int32_t y)
    3349{
    3450    pRect->xLeft   += x;
     
    3854}
    3955
    40 DECLINLINE(void) VBoxRectRectMove(RTRECT * pRect, int32_t x, int32_t y)
     56DECLINLINE(void) VBoxRectMove(RTRECT * pRect, int32_t x, int32_t y)
    4157{
    42     LONG w = pRect->xRight - pRect->xLeft;
    43     LONG h = pRect->yBottom - pRect->yTop;
     58    int32_t w = pRect->xRight - pRect->xLeft;
     59    int32_t h = pRect->yBottom - pRect->yTop;
    4460    pRect->xLeft   = x;
    4561    pRect->yTop    = y;
     
    4864}
    4965
    50 DECLINLINE(bool) VBoxRectRectIsCoveres(const RTRECT *pRect, const RTRECT *pCovered)
     66DECLINLINE(bool) VBoxRectIsCoveres(const RTRECT *pRect, const RTRECT *pCovered)
    5167{
    5268    Assert(pRect);
     
    6379}
    6480
    65 DECLINLINE(bool) VBoxRectRectIsIntersect(const RTRECT * pRect1, const RTRECT * pRect2)
     81DECLINLINE(bool) VBoxRectIsIntersect(const RTRECT * pRect1, const RTRECT * pRect2)
    6682{
    6783    return !((pRect1->xLeft < pRect2->xLeft && pRect1->xRight <= pRect2->xLeft)
     
    7692}
    7793
    78 DECLINLINE(bool) VBoxVrListIsEmpty(PVBOXVR_LIST pList)
     94DECLINLINE(bool) VBoxVrListIsEmpty(const PVBOXVR_LIST pList)
    7995{
    8096    return !VBoxVrListRectsCount(pList);
     
    87103}
    88104
    89 void VBoxVrListClear(PVBOXVR_LIST pList);
     105VBOXVREGDECL(void) VBoxVrListClear(PVBOXVR_LIST pList);
    90106
    91 void VBoxVrListTranslate(PVBOXVR_LIST pList, int32_t x, int32_t y);
     107VBOXVREGDECL(void) VBoxVrListTranslate(PVBOXVR_LIST pList, int32_t x, int32_t y);
    92108
    93 int VBoxVrListRectsAdd(PVBOXVR_LIST pList, uint32_t cRects, const PRTRECT aRects, bool *pfChanged);
    94 int VBoxVrListRectsSubst(PVBOXVR_LIST pList, uint32_t cRects, const PRTRECT aRects, bool *pfChanged);
    95 int VBoxVrListRectsGet(PVBOXVR_LIST pList, uint32_t cRects, PRTRECT aRects);
     109VBOXVREGDECL(int) VBoxVrListCmp(PVBOXVR_LIST pList1, PVBOXVR_LIST pList2);
    96110
    97 int VBoxVrInit();
    98 void VBoxVrTerm();
     111VBOXVREGDECL(int) VBoxVrListRectsAdd(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged);
     112VBOXVREGDECL(int) VBoxVrListRectsSubst(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged);
     113VBOXVREGDECL(int) VBoxVrListRectsGet(PVBOXVR_LIST pList, uint32_t cRects, RTRECT * aRects);
     114
     115VBOXVREGDECL(int) VBoxVrInit();
     116VBOXVREGDECL(void) VBoxVrTerm();
    99117
    100118typedef struct VBOXVR_COMPOSITOR_ENTRY
     
    104122} VBOXVR_COMPOSITOR_ENTRY, *PVBOXVR_COMPOSITOR_ENTRY;
    105123
     124struct VBOXVR_COMPOSITOR;
     125
     126typedef DECLCALLBACK(void) FNVBOXVRCOMPOSITOR_ENTRY_REMOVED(const struct VBOXVR_COMPOSITOR *pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, PVBOXVR_COMPOSITOR_ENTRY pReplacingEntry);
     127typedef FNVBOXVRCOMPOSITOR_ENTRY_REMOVED *PFNVBOXVRCOMPOSITOR_ENTRY_REMOVED;
     128
    106129typedef struct VBOXVR_COMPOSITOR
    107130{
    108131    RTLISTNODE List;
     132    PFNVBOXVRCOMPOSITOR_ENTRY_REMOVED pfnEntryRemoved;
    109133} VBOXVR_COMPOSITOR, *PVBOXVR_COMPOSITOR;
    110134
     
    112136typedef FNVBOXVRCOMPOSITOR_VISITOR *PFNVBOXVRCOMPOSITOR_VISITOR;
    113137
    114 void VBoxVrCompositorInit(PVBOXVR_COMPOSITOR pCompositor);
    115 void VBoxVrCompositorEntryInit(PVBOXVR_COMPOSITOR_ENTRY pEntry);
    116 DECLINLINE(bool) VBoxVrCompositorEntryIsInList(PVBOXVR_COMPOSITOR_ENTRY pEntry)
     138VBOXVREGDECL(void) VBoxVrCompositorInit(PVBOXVR_COMPOSITOR pCompositor, PFNVBOXVRCOMPOSITOR_ENTRY_REMOVED pfnEntryRemoved);
     139VBOXVREGDECL(void) VBoxVrCompositorTerm(PVBOXVR_COMPOSITOR pCompositor);
     140VBOXVREGDECL(void) VBoxVrCompositorEntryInit(PVBOXVR_COMPOSITOR_ENTRY pEntry);
     141DECLINLINE(bool) VBoxVrCompositorEntryIsInList(const PVBOXVR_COMPOSITOR_ENTRY pEntry)
    117142{
    118143    return !VBoxVrListIsEmpty(&pEntry->Vr);
    119144}
    120 bool VBoxVrCompositorEntryRemove(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry);
    121 int VBoxVrCompositorEntryRegionsAdd(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
    122 int VBoxVrCompositorEntryRegionsSubst(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
    123 int VBoxVrCompositorEntryRegionsSet(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
    124 int VBoxVrCompositorEntryRegionsTranslate(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, int32_t x, int32_t y, bool *pfChanged);
    125 void VBoxVrCompositorVisit(PVBOXVR_COMPOSITOR pCompositor, PFNVBOXVRCOMPOSITOR_VISITOR pfnVisitor, void *pvVisitor);
     145
     146#define VBOXVR_COMPOSITOR_CF_ENTRIES_REGIONS_CHANGED    0x00000001
     147#define VBOXVR_COMPOSITOR_CF_COMPOSITED_REGIONS_CHANGED 0x00000002
     148
     149VBOXVREGDECL(bool) VBoxVrCompositorEntryRemove(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry);
     150VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsAdd(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, uint32_t *pfChangeFlags);
     151VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsSubst(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
     152VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsSet(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRegions, const RTRECT *paRegions, bool *pfChanged);
     153VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsTranslate(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, int32_t x, int32_t y, bool *pfChanged);
     154VBOXVREGDECL(void) VBoxVrCompositorVisit(PVBOXVR_COMPOSITOR pCompositor, PFNVBOXVRCOMPOSITOR_VISITOR pfnVisitor, void *pvVisitor);
    126155
    127156RT_C_DECLS_END
  • trunk/src/VBox/GuestHost/OpenGL/util/vreg.cpp

    r43834 r43888  
    2121#include <iprt/assert.h>
    2222
     23#ifndef IN_RING0
     24#include <cr_error.h>
     25#define WARN(_m) do { crWarning _m ; } while (0)
     26#else
     27# error port me!
     28#endif
     29
    2330typedef struct VBOXVR_REG
    2431{
     
    6067}
    6168
    62 void VBoxVrListClear(PVBOXVR_LIST pList)
     69VBOXVREGDECL(void) VBoxVrListClear(PVBOXVR_LIST pList)
    6370{
    6471    PVBOXVR_REG pReg, pRegNext;
     
    7380#define VBOXVR_MEMTAG 'vDBV'
    7481
    75 int VBoxVrInit()
     82VBOXVREGDECL(int) VBoxVrInit()
    7683{
    7784#ifndef VBOXVDBG_VR_LAL_DISABLE
     
    94101}
    95102
    96 void VBoxVrTerm()
     103VBOXVREGDECL(void) VBoxVrTerm()
    97104{
    98105#ifndef VBOXVDBG_VR_LAL_DISABLE
     
    106113static DECLCALLBACK(int) vboxVrRegNonintersectedComparator(const RTRECT* pRect1, const RTRECT* pRect2)
    107114{
    108     Assert(!VBoxRectRectIsIntersect(pRect1, pRect2));
     115    Assert(!VBoxRectIsIntersect(pRect1, pRect2));
    109116    if (pRect1->yTop != pRect2->yTop)
    110117        return pRect1->yTop - pRect2->yTop;
     
    195202}
    196203
    197 static int vboxVrListRegIntersectSubstNoJoin(PRTLISTNODE pList1, PVBOXVR_REG pReg1, const RTRECT * pRect2)
     204static int vboxVrListRegIntersectSubstNoJoin(PVBOXVR_LIST pList1, PVBOXVR_REG pReg1, const RTRECT * pRect2)
    198205{
    199206    uint32_t topLim = VBOXVR_INVALID_COORD;
     
    208215    RTListInit(&List);
    209216
    210     Assert(VBoxRectRectIsIntersect(&pReg1->Rect, pRect2));
     217    Assert(VBoxRectIsIntersect(&pReg1->Rect, pRect2));
    211218
    212219    if (pReg1->Rect.yTop < pRect2->yTop)
     
    263270    vboxVrRegTerm(pReg1);
    264271
    265     if (IsListEmpty(&List))
     272    if (RTListIsEmpty(&List))
    266273        return VINF_SUCCESS; /* the region is covered by the pRect2 */
    267274
     
    474481    pData->fChanged = true;
    475482
    476     Assert(VBoxRectRectIsIntersect(&pReg1->Rect, pRect2));
     483    Assert(VBoxRectIsIntersect(&pReg1->Rect, pRect2));
    477484
    478485    /* NOTE: the pReg1 will be invalid after the vboxVrListRegIntersectSubstNoJoin call!!! */
    479486    int rc = vboxVrListRegIntersectSubstNoJoin(pList, pReg1, pRect2);
    480     if (RC_SUCCESS(rc))
     487    if (RT_SUCCESS(rc))
    481488    {
    482489        *ppNext = pPrev->pNext;
     
    490497}
    491498
    492 static int vboxVrListSubstNoJoin(PVBOXVR_LIST pList, uint32_t cRects, const PRTRECT aRects, bool *pfChanged)
     499static int vboxVrListSubstNoJoin(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged)
    493500{
    494501    if (VBoxVrListIsEmpty(pList))
     
    513520
    514521#if 0
    515 static const PRTRECT vboxVrRectsOrder(uint32_t cRects, const PRTRECT aRects)
     522static const RTRECT * vboxVrRectsOrder(uint32_t cRects, const RTRECT * aRects)
    516523{
    517524#ifdef DEBUG
     
    523530            {
    524531                RTRECT *pRectJ = &aRects[j];
    525                 Assert(!VBoxRectRectIsIntersect(pRectI, pRectJ));
     532                Assert(!VBoxRectIsIntersect(pRectI, pRectJ));
    526533            }
    527534        }
     
    575582#endif
    576583
    577 void VBoxVrListTranslate(PVBOXVR_LIST pList, int32_t x, int32_t y)
     584VBOXVREGDECL(void) VBoxVrListTranslate(PVBOXVR_LIST pList, int32_t x, int32_t y)
    578585{
    579586    for (PRTLISTNODE pEntry1 = pList->ListHead.pNext; pEntry1 != &pList->ListHead; pEntry1 = pEntry1->pNext)
    580587    {
    581588        PVBOXVR_REG pReg1 = PVBOXVR_REG_FROM_ENTRY(pEntry1);
    582         VBoxRectRectTranslate(&pReg1->Rect, x, y);
    583     }
    584 }
    585 
    586 int VBoxVrListRectsSubst(PVBOXVR_LIST pList, uint32_t cRects, const PRTRECT aRects, bool *pfChanged)
     589        VBoxRectTranslate(&pReg1->Rect, x, y);
     590    }
     591}
     592
     593VBOXVREGDECL(int) VBoxVrListRectsSubst(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged)
    587594{
    588595#if 0
    589     const PRTRECT pRects = vboxVrRectsOrder(cRects, aRects);
     596    const RTRECT * pRects = vboxVrRectsOrder(cRects, aRects);
    590597    if (!pRects)
    591598    {
     
    615622}
    616623
    617 int VBoxVrListRectsAdd(PRTLISTNODE pList, uint32_t cRects, const PRTRECT aRects, bool *pfChanged)
     624VBOXVREGDECL(int) VBoxVrListRectsAdd(PVBOXVR_LIST pList, uint32_t cRects, const RTRECT * aRects, bool *pfChanged)
    618625{
    619626    uint32_t cCovered = 0;
     
    628635            {
    629636                RTRECT *pRectJ = &aRects[j];
    630                 Assert(!VBoxRectRectIsIntersect(pRectI, pRectJ));
     637                Assert(!VBoxRectIsIntersect(pRectI, pRectJ));
    631638            }
    632639        }
     
    641648        {
    642649            PVBOXVR_REG pReg1 = PVBOXVR_REG_FROM_ENTRY(pEntry1);
    643             if (VBoxRectRectIsCoveres(&pReg1->Rect, &aRects[i]))
     650            if (VBoxRectIsCoveres(&pReg1->Rect, &aRects[i]))
    644651            {
    645652                cCovered++;
     
    659666    VBOXVR_LIST DiffList;
    660667    VBoxVrListInit(&DiffList);
    661     PRTRECT pListRects = NULL;
     668    RTRECT * pListRects = NULL;
    662669    uint32_t cAllocatedRects = 0;
    663670    bool fNeedRectreate = true;
     
    695702            if (pListRects)
    696703                RTMemFree(pListRects);
    697             pListRects = (PRTRECT)RTMemAlloc(sizeof (RTRECT) * cAllocatedRects);
     704            pListRects = (RTRECT *)RTMemAlloc(sizeof (RTRECT) * cAllocatedRects);
    698705            if (!pListRects)
    699706            {
     
    745752}
    746753
    747 int VBoxVrListRectsGet(PVBOXVR_LIST pList, uint32_t cRects, PRTRECT aRects)
     754VBOXVREGDECL(int) VBoxVrListRectsGet(PVBOXVR_LIST pList, uint32_t cRects, RTRECT * aRects)
    748755{
    749756    if (cRects < VBoxVrListRectsCount(pList))
     
    759766}
    760767
    761 
    762 void VBoxVrCompositorInit(PVBOXVR_COMPOSITOR pCompositor)
     768VBOXVREGDECL(int) VBoxVrListCmp(PVBOXVR_LIST pList1, PVBOXVR_LIST pList2)
     769{
     770    int cTmp = pList1->cEntries - pList2->cEntries;
     771    if (cTmp)
     772        return cTmp;
     773
     774    PVBOXVR_REG pReg1, pReg2;
     775
     776    for (pReg1 = RTListNodeGetNext(&pList1->ListHead, VBOXVR_REG, ListEntry),
     777            pReg2 = RTListNodeGetNext(&pList2->ListHead, VBOXVR_REG, ListEntry);
     778            !RTListNodeIsDummy(&pList1->ListHead, pReg1, VBOXVR_REG, ListEntry);
     779            pReg1 = RT_FROM_MEMBER(pReg1->ListEntry.pNext, VBOXVR_REG, ListEntry),
     780            pReg2 = RT_FROM_MEMBER(pReg2->ListEntry.pNext, VBOXVR_REG, ListEntry))
     781    {
     782        Assert(!RTListNodeIsDummy(&pList2->ListHead, pReg2, VBOXVR_REG, ListEntry));
     783        cTmp = VBoxRectCmp(&pReg1->Rect, &pReg2->Rect);
     784        if (cTmp)
     785            return cTmp;
     786    }
     787    Assert(RTListNodeIsDummy(&pList2->ListHead, pReg2, VBOXVR_REG, ListEntry));
     788    return 0;
     789}
     790
     791VBOXVREGDECL(void) VBoxVrCompositorInit(PVBOXVR_COMPOSITOR pCompositor, PFNVBOXVRCOMPOSITOR_ENTRY_REMOVED pfnEntryRemoved)
    763792{
    764793    RTListInit(&pCompositor->List);
     794    pCompositor->pfnEntryRemoved = pfnEntryRemoved;
     795}
     796
     797VBOXVREGDECL(void) VBoxVrCompositorTerm(PVBOXVR_COMPOSITOR pCompositor)
     798{
     799    PVBOXVR_COMPOSITOR_ENTRY pEntry, pEntryNext;
     800    RTListForEachSafe(&pCompositor->List, pEntry, pEntryNext, VBOXVR_COMPOSITOR_ENTRY, Node);
     801    {
     802        VBoxVrCompositorEntryRemove(pCompositor, pEntry);
     803    }
    765804}
    766805
     
    770809}
    771810
    772 static DECLINLINE(void) vboxVrCompositorEntryRemove(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry)
     811static DECLINLINE(void) vboxVrCompositorEntryRemove(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, PVBOXVR_COMPOSITOR_ENTRY pReplacingEntry)
    773812{
    774813    RTListNodeRemove(&pEntry->Node);
    775 }
    776 
    777 void VBoxVrCompositorEntryInit(PVBOXVR_COMPOSITOR_ENTRY pEntry)
     814    if (pCompositor->pfnEntryRemoved)
     815        pCompositor->pfnEntryRemoved(pCompositor, pEntry, pReplacingEntry);
     816}
     817
     818VBOXVREGDECL(void) VBoxVrCompositorEntryInit(PVBOXVR_COMPOSITOR_ENTRY pEntry)
    778819{
    779820    VBoxVrListInit(&pEntry->Vr);
    780821}
    781822
    782 bool VBoxVrCompositorEntryRemove(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry)
     823VBOXVREGDECL(bool) VBoxVrCompositorEntryRemove(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry)
    783824{
    784825    if (!VBoxVrCompositorEntryIsInList(pEntry))
    785826        return false;
    786827    VBoxVrListClear(&pEntry->Vr);
    787     vboxVrCompositorEntryRemove(pCompositor, pEntry);
     828    vboxVrCompositorEntryRemove(pCompositor, pEntry, NULL);
    788829    return true;
    789830}
    790831
    791 static int vboxVrCompositorEntryRegionsSubst(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRects, RTRECT *paRects, bool *pfChanged)
     832static int vboxVrCompositorEntryRegionsSubst(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRects, const RTRECT * paRects, bool *pfChanged)
    792833{
    793834    bool fChanged;
     
    798839        {
    799840            Assert(fChanged);
    800             vboxVrCompositorEntryRemove(pCompositor, pEntry);
     841            vboxVrCompositorEntryRemove(pCompositor, pEntry, NULL);
    801842        }
    802843        if (pfChanged)
     
    809850}
    810851
    811 int VBoxVrCompositorEntryRegionsAdd(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRects, RTRECT *paRects, bool *pfChanged)
    812 {
    813     bool fChanged = false, fCurChanged = false, fEntryInList = false;
     852VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsAdd(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRects, const RTRECT *paRects, uint32_t *pfChangeFlags)
     853{
     854    bool fOthersChanged = false, fCurChanged = false, fEntryChanged = false, fEntryInList = false, fEntryReplaces = false;
     855    PVBOXVR_COMPOSITOR_ENTRY pCur;
    814856    int rc = VINF_SUCCESS;
    815     PVBOXVR_COMPOSITOR_ENTRY pCur;
    816857
    817858    if (!cRects)
    818859    {
    819         if (pfChanged)
    820             *pfChanged = false;
     860        if (pfChangeFlags)
     861            *pfChangeFlags = 0;
    821862        return VINF_SUCCESS;
     863    }
     864
     865    if (pEntry)
     866    {
     867        fEntryInList = VBoxVrCompositorEntryIsInList(pEntry);
     868        rc = VBoxVrListRectsAdd(&pEntry->Vr, cRects, paRects, &fEntryChanged);
     869        if (RT_SUCCESS(rc))
     870        {
     871            if (VBoxVrListIsEmpty(&pEntry->Vr))
     872            {
     873                WARN(("Empty rectangles passed in, is it expected?"));
     874                if (pfChangeFlags)
     875                    *pfChangeFlags = 0;
     876                return VINF_SUCCESS;
     877            }
     878        }
     879        else
     880        {
     881            WARN(("VBoxVrListRectsAdd failed, rc %d", rc));
     882            return rc;
     883        }
     884
     885        Assert(!VBoxVrListIsEmpty(&pEntry->Vr));
    822886    }
    823887
     
    827891        if (pCur == pEntry)
    828892        {
    829             fEntryInList = true;
    830             rc = VBoxVrListRectsAdd(&pCur->Vr, cRects, paRects, &fCurChanged);
    831             if (RT_SUCCESS(rc))
    832             {
    833                 fChanged |= fCurChanged;
    834                 Assert(!VBoxVrListIsEmpty(&pCur->Vr));
     893            Assert(fEntryInList);
     894        }
     895        else
     896        {
     897            if (pEntry && !VBoxVrListCmp(&pCur->Vr, &pEntry->Vr))
     898            {
     899                VBoxVrListClear(&pCur->Vr);
     900                vboxVrCompositorEntryRemove(pCompositor, pCur, pEntry);
     901                fEntryReplaces = true;
    835902            }
    836903            else
    837904            {
    838                 WARN(("VBoxVrListRectsAdd failed, rc %d", rc));
    839                 return rc;
    840             }
    841         }
    842         else
    843         {
    844             rc = vboxVrCompositorEntryRegionsSubst(pCompositor, pCur, cRects, paRects, fCurChanged);
    845             if (RT_SUCCESS(rc))
    846                 fChanged |= fCurChanged;
    847             else
    848             {
    849                 WARN(("vboxVrCompositorEntryRegionsSubst failed, rc %d", rc));
    850                 return rc;
     905                rc = vboxVrCompositorEntryRegionsSubst(pCompositor, pCur, cRects, paRects, &fCurChanged);
     906                if (RT_SUCCESS(rc))
     907                    fOthersChanged |= fCurChanged;
     908                else
     909                {
     910                    WARN(("vboxVrCompositorEntryRegionsSubst failed, rc %d", rc));
     911                    return rc;
     912                }
    851913            }
    852914        }
     
    857919    if (pEntry && !fEntryInList)
    858920    {
    859         Assert(VBoxVrListIsEmpty(&pEntry->Vr));
    860         rc = VBoxVrListRectsAdd(&pEntry->Vr, cRects, paRects, &fCurChanged);
    861         if (RT_SUCCESS(rc))
    862         {
    863             fChanged |= fCurChanged;
    864             if (!VBoxVrListIsEmpty(&pEntry->Vr))
    865             {
    866                 Assert(fCurChanged);
    867                 vboxVrCompositorEntryAdd(pCompositor, pEntry);
    868             }
    869         }
    870         else
    871         {
    872             WARN(("VBoxVrListRectsAdd failed, rc %d", rc));
    873             return rc;
    874         }
    875     }
    876 
    877     if (pfChanged)
    878         *pfChanged = fChanged;
     921        Assert(!VBoxVrListIsEmpty(&pEntry->Vr));
     922        vboxVrCompositorEntryAdd(pCompositor, pEntry);
     923    }
     924
     925    if (pfChangeFlags)
     926    {
     927        uint32_t fFlags = 0;
     928        if (fOthersChanged)
     929            fFlags = VBOXVR_COMPOSITOR_CF_ENTRIES_REGIONS_CHANGED | VBOXVR_COMPOSITOR_CF_COMPOSITED_REGIONS_CHANGED;
     930        else if (fEntryReplaces)
     931        {
     932            Assert(fEntryChanged);
     933            fFlags = VBOXVR_COMPOSITOR_CF_ENTRIES_REGIONS_CHANGED;
     934        }
     935        else if (fEntryChanged)
     936            fFlags = VBOXVR_COMPOSITOR_CF_ENTRIES_REGIONS_CHANGED | VBOXVR_COMPOSITOR_CF_COMPOSITED_REGIONS_CHANGED;
     937
     938        *pfChangeFlags = fFlags;
     939    }
     940
    879941    return VINF_SUCCESS;
    880942}
    881943
    882 int VBoxVrCompositorEntryRegionsSubst(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRects, const RTRECT *paRects, bool *pfChanged)
    883 {
    884     bool fChanged;
     944VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsSubst(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRects, const RTRECT * paRects, bool *pfChanged)
     945{
    885946    if (!pEntry)
    886947    {
     
    899960    }
    900961
    901     rc = vboxVrCompositorEntryRegionsSubst(pCompositor, pEntry, cRects, paRects, pfChanged);
     962    int rc = vboxVrCompositorEntryRegionsSubst(pCompositor, pEntry, cRects, paRects, pfChanged);
    902963    if (RT_SUCCESS(rc))
    903964        return VINF_SUCCESS;
     
    907968}
    908969
    909 int VBoxVrCompositorEntryRegionsSet(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRects, const RTRECT *paRects, bool *pfChanged)
     970VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsSet(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, uint32_t cRects, const RTRECT *paRects, bool *pfChanged)
    910971{
    911972    if (!pEntry)
     
    918979
    919980    bool fChanged = false, fCurChanged = false;
     981    uint32_t fChangeFlags = 0;
    920982    int rc;
    921983    fCurChanged = VBoxVrCompositorEntryRemove(pCompositor, pEntry);
     984    fChanged |= fCurChanged;
     985
     986    rc = VBoxVrCompositorEntryRegionsAdd(pCompositor, pEntry, cRects, paRects, &fChangeFlags);
    922987    if (RT_SUCCESS(rc))
    923         fChanged |= fCurChanged;
    924     else
    925     {
    926         WARN(("VBoxVrCompositorEntryRegionsClear failed, rc %d", rc));
    927         return rc;
    928     }
    929 
    930     rc = VBoxVrCompositorEntryRegionsAdd(pCompositor, pEntry, cRects, paRects, fCurChanged);
    931     if (RT_SUCCESS(rc))
    932         fChanged |= fCurChanged;
     988        fChanged |= !!fChangeFlags;
    933989    else
    934990    {
     
    9441000}
    9451001
    946 int VBoxVrCompositorEntryRegionsTranslate(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, int32_t x, int32_t y, bool *pfChanged)
     1002VBOXVREGDECL(int) VBoxVrCompositorEntryRegionsTranslate(PVBOXVR_COMPOSITOR pCompositor, PVBOXVR_COMPOSITOR_ENTRY pEntry, int32_t x, int32_t y, bool *pfChanged)
    9471003{
    9481004    if (!pEntry)
     
    9811037            cRects = VBoxVrListRectsCount(&pEntry->Vr);
    9821038            Assert(cRects);
    983             paRects = RTMemAlloc(cRects * sizeof (RTRECT));
     1039            paRects = (RTRECT*)RTMemAlloc(cRects * sizeof (RTRECT));
    9841040            if (!paRects)
    9851041            {
     
    10141070}
    10151071
    1016 void VBoxVrCompositorVisit(PVBOXVR_COMPOSITOR pCompositor, PFNVBOXVRCOMPOSITOR_VISITOR pfnVisitor, void *pvVisitor)
     1072VBOXVREGDECL(void) VBoxVrCompositorVisit(PVBOXVR_COMPOSITOR pCompositor, PFNVBOXVRCOMPOSITOR_VISITOR pfnVisitor, void *pvVisitor)
    10171073{
    10181074    PVBOXVR_COMPOSITOR_ENTRY pEntry, pEntryNext;
  • trunk/src/VBox/HostServices/SharedOpenGL/Makefile.kmk

    r43010 r43888  
    134134        crserverlib/server_muralfbo.c \
    135135        crserverlib/server_texture.c \
     136        crserverlib/server_blitter.cpp \
     137        crserverlib/server_presenter.cpp \
    136138        $(VBOX_PATH_CROGL_GENFILES)/server_dispatch.c \
    137139        $(VBOX_PATH_CROGL_GENFILES)/server_retval.c \
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h

    r40691 r43888  
    1818#ifdef VBOX_WITH_CRHGSMI
    1919# include <VBox/VBoxVideo.h>
     20
     21#include <iprt/cdefs.h>
     22
     23RT_C_DECLS_BEGIN
    2024
    2125extern uint8_t* g_pvVRamBase;
     
    109113GLint crServerDispatchCreateContextEx(const char *dpyName, GLint visualBits, GLint shareCtx, GLint preloadCtxID, int32_t internalID);
    110114GLint crServerDispatchWindowCreateEx(const char *dpyName, GLint visBits, GLint preloadWinID);
     115GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID);
     116void crServerMuralTerm(CRMuralInfo *mural);
     117void crServerMuralSize(CRMuralInfo *mural, GLint width, GLint height);
    111118
    112119void crServerCreateInfoDeleteCB(void *data);
     
    129136int32_t crVBoxServerInternalClientRead(CRClient *pClient, uint8_t *pBuffer, uint32_t *pcbBuffer);
    130137
     138RT_C_DECLS_END
     139
    131140#endif /* CR_SERVER_H */
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_blitter.cpp

    r43834 r43888  
    2828#include <iprt/cdefs.h>
    2929#include <iprt/types.h>
    30 
    31 typedef struct CR_BLITTER_STATE
    32 {
    33     GLint drawFB;
    34     GLint readFB;
    35 } CR_BLITTER_STATE, *PCR_BLITTER_STATE;
    36 
    37 typedef struct CR_BLITTER_BUFFER
    38 {
    39     GLuint cbBuffer;
    40     GLvoid * pvBuffer;
    41 } CR_BLITTER_BUFFER, *PCR_BLITTER_BUFFER;
    42 
    43 typedef struct CR_BLITTER_TEXTURE
    44 {
    45     GLint width;
    46     GLint height;
    47     GLenum target;
    48     GLuint hwid;
    49 } CR_BLITTER_TEXTURE, *PCR_BLITTER_TEXTURE;
    50 
    51 typedef DECLCALLBACK(int) FNCRBLT_BLITTER(struct CR_BLITTER *pBlitter, CR_BLITTER_TEXTURE *pSrc, RECT *paSrcRect, PRTRECTSIZE pDstSize, RECT *paDstRect, uint32_t cRects, uint32_t fFlags);
    52 typedef FNCRBLT_BLITTER *PFNCRBLT_BLITTER;
    53 
    54 typedef union CR_BLITTER_FLAGS
    55 {
    56     struct
    57     {
    58         uint32_t Initialized     : 1;
    59         uint32_t SupportsFBO     : 1;
    60         uint32_t SupportsFBOBlit : 1;
    61         uint32_t Reserved        : 29;
    62     };
    63     uint32_t Value;
    64 } CR_BLITTER_FLAGS, *PCR_BLITTER_FLAGS;
    65 
    66 typedef struct CR_BLITTER
    67 {
    68     GLint idFBO;
    69     CR_BLITTER_FLAGS Flags;
    70     PFNCRBLT_BLITTER pfnBlt;
    71     CR_BLITTER_BUFFER Verticies;
    72     CR_BLITTER_BUFFER Indicies;
    73     RTRECTSIZE CurrentSetSize;
    74     CRMuralInfo *pCurrentMural;
    75     CRContextInfo CtxInfo;
    76     CRContextInfo *pRestoreCtxInfo;
    77     CRMuralInfo *pRestoreMural;
    78 } CR_BLITTER, *PCR_BLITTER;
    79 
    80 int crBltInit(PCR_BLITTER pBlitter, CRMuralInfo *pCurrentMural)
     30#include <iprt/mem.h>
     31
     32
     33int CrBltInit(PCR_BLITTER pBlitter, CRMuralInfo *pCurrentMural, GLint visualBits)
    8134{
    8235    memset(pBlitter, 0, sizeof (*pBlitter));
     
    9043
    9144    pBlitter->CtxInfo.CreateInfo.pszDpyName = "";
    92     pBlitter->CtxInfo.CreateInfo.visualBits = CR_RGB_BIT | CR_DOUBLE_BIT;
     45    pBlitter->CtxInfo.CreateInfo.visualBits = visualBits;
    9346    pBlitter->CtxInfo.SpuContext = cr_server.head_spu->dispatch_table.CreateContext(pBlitter->CtxInfo.CreateInfo.pszDpyName,
    9447                                        pBlitter->CtxInfo.CreateInfo.visualBits,
     
    10053    }
    10154
     55    CrBltMuralSetCurrent(pBlitter, pCurrentMural);
     56
    10257    return VINF_SUCCESS;
    10358}
    10459
    105 void crBltTerm(PCR_BLITTER pBlitter)
     60void CrBltTerm(PCR_BLITTER pBlitter)
    10661{
    10762    cr_server.head_spu->dispatch_table.DestroyContext(pBlitter->CtxInfo.SpuContext);
    10863}
    10964
    110 static DECLINLINE(GLboolean) crBltSupportsTexTex(PCR_BLITTER pBlitter)
    111 {
    112     return pBlitter->Flags.SupportsFBO;
    113 }
    114 
    115 DECLINLINE(GLboolean) crBltIsEntered(PCR_BLITTER pBlitter)
    116 {
    117     return !!pBlitter->pRestoreCtxInfo;
    118 }
    119 
    120 void crBltMuralSetCurrent(PCR_BLITTER pBlitter, CRMuralInfo *pMural)
     65void CrBltMuralSetCurrent(PCR_BLITTER pBlitter, CRMuralInfo *pMural)
    12166{
    12267    if (pBlitter->pCurrentMural == pMural)
     
    12570    pBlitter->pCurrentMural = pMural;
    12671
    127     if (!crBltIsEntered(pBlitter))
     72    if (!CrBltIsEntered(pBlitter))
    12873        return;
    12974
     
    13479}
    13580
    136 #define CRBLT_F_LINEAR 0x00000001
    137 
    13881#define CRBLT_FILTER_FROM_FLAGS(_f) (((_f) & CRBLT_F_LINEAR) ? GL_LINEAR : GL_NEAREST)
    13982
    140 static DECLCALLBACK(int) crBltBlitTexBufImplFbo(PCR_BLITTER pBlitter, CR_BLITTER_TEXTURE *pSrc, RECT *paSrcRect, PRTRECTSIZE pDstSize, RECT *paDstRect, uint32_t cRects, uint32_t fFlags)
     83static DECLCALLBACK(int) crBltBlitTexBufImplFbo(PCR_BLITTER pBlitter, CR_BLITTER_TEXTURE *pSrc, const RTRECT *paSrcRect, const PRTRECTSIZE pDstSize, const RTRECT *paDstRect, uint32_t cRects, uint32_t fFlags)
    14184{
    14285    GLenum filter = CRBLT_FILTER_FROM_FLAGS(fFlags);
     
    14790    for (UINT i = 0; i < cRects; ++i)
    14891    {
    149         RECT * pSrcRect = &paSrcRect[i];
    150         RECT * pDstRect = &paDstRect[i];
     92        const RTRECT * pSrcRect = &paSrcRect[i];
     93        const RTRECT * pDstRect = &paDstRect[i];
    15194        cr_server.head_spu->dispatch_table.BlitFramebufferEXT(
    152                 pSrcRect->left, pSrcRect->top, pSrcRect->right, pSrcRect->bottom,
    153                 pDstRect->left, pDstRect->top, pDstRect->right, pDstRect->bottom,
     95                pSrcRect->xLeft, pSrcRect->yTop, pSrcRect->xRight, pSrcRect->yBottom,
     96                pDstRect->xLeft, pDstRect->yTop, pDstRect->xRight, pDstRect->yBottom,
    15497                GL_COLOR_BUFFER_BIT, filter);
    15598    }
     
    159102
    160103/* GL_TRIANGLE_FAN */
    161 static DECLINLINE(GLfloat*) crBltVtRectTFNormalized(RECT *pRect, uint32_t normalX, uint32_t normalY, GLfloat* pBuff)
    162 {
    163     /* left top */
    164     pBuff[0] = ((float)pRect->left)/((float)normalX);
    165     pBuff[1] = ((float)pRect->top)/((float)normalY);
    166 
    167     /* left bottom */
     104static DECLINLINE(GLfloat*) crBltVtRectTFNormalized(const RTRECT *pRect, uint32_t normalX, uint32_t normalY, GLfloat* pBuff)
     105{
     106    /* xLeft yTop */
     107    pBuff[0] = ((float)pRect->xLeft)/((float)normalX);
     108    pBuff[1] = ((float)pRect->yTop)/((float)normalY);
     109
     110    /* xLeft yBottom */
    168111    pBuff[2] = pBuff[0];
    169     pBuff[3] = ((float)pRect->bottom)/((float)normalY);
    170 
    171     /* right bottom */
    172     pBuff[4] = ((float)pRect->right)/((float)normalX);
     112    pBuff[3] = ((float)pRect->yBottom)/((float)normalY);
     113
     114    /* xRight yBottom */
     115    pBuff[4] = ((float)pRect->xRight)/((float)normalX);
    173116    pBuff[5] = pBuff[3];
    174117
    175     /* right top */
     118    /* xRight yTop */
    176119    pBuff[6] = pBuff[4];
    177120    pBuff[7] = pBuff[1];
     
    179122}
    180123
    181 static DECLINLINE(GLint*) crBltVtRectTF(RECT *pRect, uint32_t normalX, uint32_t normalY, GLint* pBuff)
    182 {
    183     /* left top */
    184     pBuff[0] = pRect->left;
    185     pBuff[1] = pRect->top;
    186 
    187     /* left bottom */
     124static DECLINLINE(GLint*) crBltVtRectTF(const RTRECT *pRect, uint32_t normalX, uint32_t normalY, GLint* pBuff)
     125{
     126    /* xLeft yTop */
     127    pBuff[0] = pRect->xLeft;
     128    pBuff[1] = pRect->yTop;
     129
     130    /* xLeft yBottom */
    188131    pBuff[2] = pBuff[0];
    189     pBuff[3] = pRect->bottom;
    190 
    191     /* right bottom */
    192     pBuff[4] = pRect->right;
     132    pBuff[3] = pRect->yBottom;
     133
     134    /* xRight yBottom */
     135    pBuff[4] = pRect->xRight;
    193136    pBuff[5] = pBuff[3];
    194137
    195     /* right top */
     138    /* xRight yTop */
    196139    pBuff[6] = pBuff[4];
    197140    pBuff[7] = pBuff[1];
     
    216159
    217160/* Indexed GL_TRIANGLES */
    218 static DECLINLINE(GLfloat*) crBltVtRectITNormalized(RECT *pRect, uint32_t normalX, uint32_t normalY, GLfloat* pBuff, GLubyte **ppIndex, GLubyte *piBase)
     161static DECLINLINE(GLfloat*) crBltVtRectITNormalized(const RTRECT *pRect, uint32_t normalX, uint32_t normalY, GLfloat* pBuff, GLubyte **ppIndex, GLubyte *piBase)
    219162{
    220163    GLfloat* ret = crBltVtRectTFNormalized(pRect, normalX, normalY, pBuff);
    221164
    222165    if (ppIndex)
    223         *ppIndex = crBltVtFillRectIndicies(*ppIndex, *piBase);
     166        *ppIndex = crBltVtFillRectIndicies(*ppIndex, piBase);
    224167
    225168    return ret;
    226169}
    227170
    228 static DECLINLINE(GLint*) crBltVtRectIT(RECT *pRect, uint32_t normalX, uint32_t normalY, GLint* pBuff, GLubyte **ppIndex, GLubyte *piBase)
     171static DECLINLINE(GLint*) crBltVtRectIT(RTRECT *pRect, uint32_t normalX, uint32_t normalY, GLint* pBuff, GLubyte **ppIndex, GLubyte *piBase)
    229172{
    230173    GLint* ret = crBltVtRectTF(pRect, normalX, normalY, pBuff);
    231174
    232175    if (ppIndex)
    233         *ppIndex = crBltVtFillRectIndicies(*ppIndex, *piBase);
     176        *ppIndex = crBltVtFillRectIndicies(*ppIndex, piBase);
    234177
    235178    return ret;
     
    249192
    250193
    251 static GLfloat* crBltVtRectsITNormalized(RECT *paRects, uint32_t cRects, uint32_t normalX, uint32_t normalY, GLfloat* pBuff, GLubyte **ppIndex, GLubyte *piBase)
     194static GLfloat* crBltVtRectsITNormalized(const RTRECT *paRects, uint32_t cRects, uint32_t normalX, uint32_t normalY, GLfloat* pBuff, GLubyte **ppIndex, GLubyte *piBase)
    252195{
    253196    for (uint32_t i = 0; i < cRects; ++i)
    254197    {
    255         pBuff = crBltVtRectITNormalized(*paRects[i], normalX, normalY, pBuff, ppIndex, piBase);
     198        pBuff = crBltVtRectITNormalized(&paRects[i], normalX, normalY, pBuff, ppIndex, piBase);
    256199    }
    257200    return pBuff;
     
    281224}
    282225
    283 static DECLCALLBACK(int) crBltBlitTexBufImplDraw2D(PCR_BLITTER pBlitter, CR_BLITTER_TEXTURE *pSrc, RECT *paSrcRect, PRTRECTSIZE pDstSize, RECT *paDstRect, uint32_t cRects, uint32_t fFlags)
     226static DECLCALLBACK(int) crBltBlitTexBufImplDraw2D(PCR_BLITTER pBlitter, CR_BLITTER_TEXTURE *pSrc, const RTRECT *paSrcRect, const PRTRECTSIZE pDstSize, const RTRECT *paDstRect, uint32_t cRects, uint32_t fFlags)
    284227{
    285228    GLuint normalX, normalY;
     
    321264        {
    322265            crWarning("Unsupported texture target 0x%x", pSrc->target);
    323             return;
    324         }
    325     }
    326 
    327     CRASSERT(pSrc->hwid);
     266            return VERR_INVALID_PARAMETER;
     267        }
     268    }
     269
     270    Assert(pSrc->hwid);
    328271
    329272    cr_server.head_spu->dispatch_table.BindTexture(pSrc->target, pSrc->hwid);
     
    372315        GLuint cElements = crBltVtGetNumVerticiesIT(cRects);
    373316        GLuint cIndicies = crBltVtGetNumIndiciesIT(cRects);
    374         GLuint iIdxBase = 0;
     317        GLubyte iIdxBase = 0;
    375318        if (bUseSameVerticies)
    376319        {
     
    401344        cr_server.head_spu->dispatch_table.DisableClientState(GL_VERTEX_ARRAY);
    402345    }
    403 }
    404 
    405 int crBltInitOnMakeCurent(PCR_BLITTER pBlitter)
    406 {
    407     const char * pszExtension = cr_server.head_spu->dispatch_table.GetString(GL_EXTENSIONS);
     346
     347    return VINF_SUCCESS;
     348}
     349
     350static int crBltInitOnMakeCurent(PCR_BLITTER pBlitter)
     351{
     352    const char * pszExtension = (const char*)cr_server.head_spu->dispatch_table.GetString(GL_EXTENSIONS);
    408353    if (crStrstr(pszExtension, "GL_EXT_framebuffer_object"))
    409354    {
    410355        pBlitter->Flags.SupportsFBO = 1;
    411356        cr_server.head_spu->dispatch_table.GenFramebuffersEXT(1, &pBlitter->idFBO);
    412         CRASSERT(pBlitter->idFBO);
     357        Assert(pBlitter->idFBO);
    413358    }
    414359    else
     
    429374}
    430375
    431 void crBltLeave(PCR_BLITTER pBlitter)
    432 {
    433     CRASSERT(crBltIsEntered(pBlitter));
     376void CrBltLeave(PCR_BLITTER pBlitter)
     377{
     378    Assert(CrBltIsEntered(pBlitter));
    434379
    435380    if (pBlitter->pRestoreCtxInfo != &pBlitter->CtxInfo)
     
    441386}
    442387
    443 int crBltEnter(PCR_BLITTER pBlitter, CRContextInfo *pRestoreCtxInfo, CRMuralInfo *pRestoreMural)
     388int CrBltEnter(PCR_BLITTER pBlitter, CRContextInfo *pRestoreCtxInfo, CRMuralInfo *pRestoreMural)
    444389{
    445390    if (!pBlitter->pCurrentMural)
     
    449394    }
    450395
    451     if (crBltIsEntered(pBlitter))
     396    if (CrBltIsEntered(pBlitter))
    452397    {
    453398        crWarning("blitter is entered already!");
     
    468413
    469414    crWarning("crBltInitOnMakeCurent failed, rc %d", rc);
    470     crBltLeave(pBlitter);
     415    CrBltLeave(pBlitter);
    471416    return rc;
    472417}
    473418
    474 static void crBltBlitTexBuf(PCR_BLITTER pBlitter, CR_BLITTER_TEXTURE *pSrc, RECT *paSrcRects, GLenum enmDstBuff, PRTRECTSIZE pDstSize, RECT *paDstRects, uint32_t cRects, uint32_t fFlags)
     419static void crBltBlitTexBuf(PCR_BLITTER pBlitter, CR_BLITTER_TEXTURE *pSrc, const RTRECT *paSrcRects, GLenum enmDstBuff, const PRTRECTSIZE pDstSize, const RTRECT *paDstRects, uint32_t cRects, uint32_t fFlags)
    475420{
    476421    cr_server.head_spu->dispatch_table.DrawBuffer(enmDstBuff);
     
    479424}
    480425
    481 void crBltBlitTexMural(PCR_BLITTER pBlitter, CR_BLITTER_TEXTURE *pSrc, RECT *paSrcRects, RECT *paDstRects, uint32_t cRects, uint32_t fFlags)
     426void CrBltBlitTexMural(PCR_BLITTER pBlitter, CR_BLITTER_TEXTURE *pSrc, const RTRECT *paSrcRects, const RTRECT *paDstRects, uint32_t cRects, uint32_t fFlags)
    482427{
    483428    RTRECTSIZE DstSize = {pBlitter->pCurrentMural->width, pBlitter->pCurrentMural->height};
     
    486431}
    487432
    488 void crBltBlitTexTex(PCR_BLITTER pBlitter, CR_BLITTER_TEXTURE *pSrc, RECT *pSrcRect, CR_BLITTER_TEXTURE *pDst, RECT *pDstRect, uint32_t cRects, uint32_t fFlags)
     433void CrBltBlitTexTex(PCR_BLITTER pBlitter, CR_BLITTER_TEXTURE *pSrc, const RTRECT *pSrcRect, CR_BLITTER_TEXTURE *pDst, const RTRECT *pDstRect, uint32_t cRects, uint32_t fFlags)
    489434{
    490435    RTRECTSIZE DstSize = {pDst->width, pDst->height};
     
    499444//    cr_server.head_spu->dispatch_table.FramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
    500445
    501     crBltBlitTexBuf(pBlitter, pSrc, pSrcRect, GL_DRAW_FRAMEBUFFER, DstSize, pDstRect, cRects, fFlags);
    502 }
     446    crBltBlitTexBuf(pBlitter, pSrc, pSrcRect, GL_DRAW_FRAMEBUFFER, &DstSize, pDstRect, cRects, fFlags);
     447}
     448
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_context.c

    r43182 r43888  
    389389        cr_server.currentWindow = window;
    390390        cr_server.currentNativeWindow = nativeWindow;
     391        cr_server.currentMural = mural;
    391392    }
    392393
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_dispatch_header.py

    r15532 r43888  
    2323#include "chromium.h"
    2424#include "state/cr_statetypes.h"
     25
     26#if defined(__cplusplus)
     27extern "C" {
     28#endif
     29
    2530"""
    2631
     
    3742        print '%s SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s );' % (return_type, func_name, apiutil.MakeDeclarationString( params ))
    3843
    39 print '#endif /* SERVER_DISPATCH_HEADER */'
     44print """
     45#if defined(__cplusplus)
     46}
     47#endif
     48
     49#endif /* SERVER_DISPATCH_HEADER */
     50"""
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_special

    r41258 r43888  
    249249DrawBuffer
    250250ReadBuffer
     251TexPresent
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c

    r43744 r43888  
    1717}
    1818
     19GLint crServerMuralInit(CRMuralInfo *mural, const char *dpyName, GLint visBits, GLint preloadWinID)
     20{
     21    CRMuralInfo *defaultMural;
     22    GLint dims[2];
     23    GLint windowID = -1;
     24    /*
     25     * Have first SPU make a new window.
     26     */
     27    GLint spuWindow = cr_server.head_spu->dispatch_table.WindowCreate( dpyName, visBits );
     28    if (spuWindow < 0) {
     29        crServerReturnValue( &spuWindow, sizeof(spuWindow) );
     30        return spuWindow;
     31    }
     32
     33    /* get initial window size */
     34    cr_server.head_spu->dispatch_table.GetChromiumParametervCR(GL_WINDOW_SIZE_CR, spuWindow, GL_INT, 2, dims);
     35
     36    defaultMural = (CRMuralInfo *) crHashtableSearch(cr_server.muralTable, 0);
     37    CRASSERT(defaultMural);
     38    mural->gX = 0;
     39    mural->gY = 0;
     40    mural->width = dims[0];
     41    mural->height = dims[1];
     42
     43    mural->spuWindow = spuWindow;
     44    mural->screenId = 0;
     45    mural->bVisible = GL_FALSE;
     46    mural->bUseFBO = GL_FALSE;
     47
     48    mural->cVisibleRects = 0;
     49    mural->pVisibleRects = NULL;
     50    mural->bReceivedRects = GL_FALSE;
     51
     52    mural->pvOutputRedirectInstance = NULL;
     53
     54    /* generate ID for this new window/mural (special-case for file conns) */
     55    if (cr_server.curClient && cr_server.curClient->conn->type == CR_FILE)
     56        windowID = spuWindow;
     57    else
     58        windowID = preloadWinID<0 ? crServerGenerateID(&cr_server.idsPool.freeWindowID) : preloadWinID;
     59
     60    crServerSetupOutputRedirect(mural);
     61
     62    return windowID;
     63}
    1964
    2065GLint
     
    2368    CRMuralInfo *mural;
    2469    GLint windowID = -1;
    25     GLint spuWindow;
    26     GLint dims[2];
    2770    CRCreateInfo_t *pCreateInfo;
    2871
     
    5598    }
    5699
    57     /*
    58      * Have first SPU make a new window.
    59      */
    60     spuWindow = cr_server.head_spu->dispatch_table.WindowCreate( dpyName, visBits );
    61     if (spuWindow < 0) {
    62         crServerReturnValue( &spuWindow, sizeof(spuWindow) );
    63         return spuWindow;
    64     }
    65 
    66     /* get initial window size */
    67     cr_server.head_spu->dispatch_table.GetChromiumParametervCR(GL_WINDOW_SIZE_CR, spuWindow, GL_INT, 2, dims);
    68100
    69101    /*
     
    71103     */
    72104    mural = (CRMuralInfo *) crCalloc(sizeof(CRMuralInfo));
    73     if (mural) {
    74         CRMuralInfo *defaultMural = (CRMuralInfo *) crHashtableSearch(cr_server.muralTable, 0);
    75         CRASSERT(defaultMural);
    76         mural->gX = 0;
    77         mural->gY = 0;
    78         mural->width = dims[0];
    79         mural->height = dims[1];
    80 
    81         mural->spuWindow = spuWindow;
    82         mural->screenId = 0;
    83         mural->bVisible = GL_FALSE;
    84         mural->bUseFBO = GL_FALSE;
    85 
    86         mural->cVisibleRects = 0;
    87         mural->pVisibleRects = NULL;
    88         mural->bReceivedRects = GL_FALSE;
    89 
    90         mural->pvOutputRedirectInstance = NULL;
    91 
    92         /* generate ID for this new window/mural (special-case for file conns) */
    93         if (cr_server.curClient && cr_server.curClient->conn->type == CR_FILE)
    94             windowID = spuWindow;
    95         else
    96             windowID = preloadWinID<0 ? crServerGenerateID(&cr_server.idsPool.freeWindowID) : preloadWinID;
    97         crHashtableAdd(cr_server.muralTable, windowID, mural);
    98 
    99         pCreateInfo = (CRCreateInfo_t *) crAlloc(sizeof(CRCreateInfo_t));
    100         pCreateInfo->pszDpyName = dpyName ? crStrdup(dpyName) : NULL;
    101         pCreateInfo->visualBits = visBits;
    102         crHashtableAdd(cr_server.pWindowCreateInfoTable, windowID, pCreateInfo);
    103 
    104         crServerSetupOutputRedirect(mural);
    105     }
     105    if (!mural)
     106    {
     107        crWarning("crCalloc failed!");
     108        return -1;
     109    }
     110
     111    windowID = crServerMuralInit(mural, dpyName, visBits, preloadWinID);
     112    if (windowID < 0)
     113    {
     114        crWarning("crServerMuralInit failed!");
     115        crFree(mural);
     116        return windowID;
     117    }
     118
     119    crHashtableAdd(cr_server.muralTable, windowID, mural);
     120
     121    pCreateInfo = (CRCreateInfo_t *) crAlloc(sizeof(CRCreateInfo_t));
     122    pCreateInfo->pszDpyName = dpyName ? crStrdup(dpyName) : NULL;
     123    pCreateInfo->visualBits = visBits;
     124    crHashtableAdd(cr_server.pWindowCreateInfoTable, windowID, pCreateInfo);
    106125
    107126    crDebug("CRServer: client %p created new window %d (SPU window %d)",
    108                     cr_server.curClient, windowID, spuWindow);
     127                    cr_server.curClient, windowID, mural->spuWindow);
    109128
    110129    if (windowID != -1 && !cr_server.bIsInLoadingState) {
     
    138157}
    139158
     159void crServerMuralTerm(CRMuralInfo *mural)
     160{
     161    if (mural->pvOutputRedirectInstance)
     162    {
     163        cr_server.outputRedirect.CROREnd(mural->pvOutputRedirectInstance);
     164        mural->pvOutputRedirectInstance = NULL;
     165    }
     166
     167    crServerRedirMuralFBO(mural, GL_FALSE);
     168    crServerDeleteMuralFBO(mural);
     169
     170    cr_server.head_spu->dispatch_table.WindowDestroy( mural->spuWindow );
     171
     172    if (mural->pVisibleRects)
     173    {
     174        crFree(mural->pVisibleRects);
     175    }
     176}
     177
    140178void SERVER_DISPATCH_APIENTRY
    141179crServerDispatchWindowDestroy( GLint window )
     
    158196    }
    159197
    160     if (mural->pvOutputRedirectInstance)
    161     {
    162         cr_server.outputRedirect.CROREnd(mural->pvOutputRedirectInstance);
    163         mural->pvOutputRedirectInstance = NULL;
    164     }
     198    crDebug("CRServer: Destroying window %d (spu window %d)", window, mural->spuWindow);
     199
     200    crServerMuralTerm(mural);
    165201
    166202    if (cr_server.currentWindow == window)
    167203    {
    168204        cr_server.currentWindow = -1;
    169     }
    170 
    171     crServerRedirMuralFBO(mural, GL_FALSE);
    172     crServerDeleteMuralFBO(mural);
    173 
    174     crDebug("CRServer: Destroying window %d (spu window %d)", window, mural->spuWindow);
    175     cr_server.head_spu->dispatch_table.WindowDestroy( mural->spuWindow );
     205        CRASSERT(cr_server.currentMural == mural);
     206        cr_server.currentMural = NULL;
     207    }
     208    else
     209    {
     210        CRASSERT(cr_server.currentMural != mural);
     211    }
    176212
    177213    if (cr_server.curClient)
     
    236272    crHashtableDelete(cr_server.pWindowCreateInfoTable, window, crServerCreateInfoDeleteCB);
    237273
    238     if (mural->pVisibleRects)
    239     {
    240         crFree(mural->pVisibleRects);
    241     }
    242274    crHashtableDelete(cr_server.muralTable, window, crFree);
     275}
     276
     277void crServerMuralSize(CRMuralInfo *mural, GLint width, GLint height)
     278{
     279    mural->width = width;
     280    mural->height = height;
     281
     282    if (cr_server.curClient && cr_server.curClient->currentMural == mural)
     283    {
     284        crStateGetCurrent()->buffer.width = mural->width;
     285        crStateGetCurrent()->buffer.height = mural->height;
     286    }
     287
     288    crServerCheckMuralGeometry(mural);
     289
     290    cr_server.head_spu->dispatch_table.WindowSize(mural->spuWindow, width, height);
    243291}
    244292
     
    257305    }
    258306
    259     mural->width = width;
    260     mural->height = height;
    261 
    262     if (cr_server.curClient && cr_server.curClient->currentMural == mural)
    263     {
    264         crStateGetCurrent()->buffer.width = mural->width;
    265         crStateGetCurrent()->buffer.height = mural->height;
    266     }
    267 
    268     crServerCheckMuralGeometry(mural);
    269 
    270     cr_server.head_spu->dispatch_table.WindowSize(mural->spuWindow, width, height);
     307    crServerMuralSize(mural, width, height);
    271308
    272309    /* Work-around Intel driver bug */
  • trunk/src/VBox/Main/include/ConsoleVRDPServer.h

    r43350 r43888  
    243243                                            int32_t x, int32_t y, uint32_t w, uint32_t h);
    244244    static DECLCALLBACK(void) H3DORVisibleRegion(void *pvInstance,
    245                                                  uint32_t cRects, RTRECT *paRects);
     245                                                 uint32_t cRects, const RTRECT *paRects);
    246246    static DECLCALLBACK(void) H3DORFrame(void *pvInstance,
    247247                                         void *pvData, uint32_t cbData);
  • trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp

    r43462 r43888  
    18361836
    18371837/* static */ DECLCALLBACK(void) ConsoleVRDPServer::H3DORVisibleRegion(void *pvInstance,
    1838                                                                       uint32_t cRects, RTRECT *paRects)
     1838                                                                      uint32_t cRects, const RTRECT *paRects)
    18391839{
    18401840    LogFlowFunc(("ins %p %d\n", pvInstance, cRects));
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