VirtualBox

Changeset 45248 in vbox


Ignore:
Timestamp:
Mar 29, 2013 2:57:24 PM (12 years ago)
Author:
vboxsync
Message:

crOpenGL/VRDP: always show 3D window unles in Headles mode

Location:
trunk/src/VBox
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_server.h

    r45217 r45248  
    100100
    101101    GLboolean bVisible;      /*guest window is visible*/
    102     GLubyte   fUseFBO;       /*redirect to FBO instead of real host window*/
     102    GLubyte   u8Unused;       /*redirect to FBO instead of real host window*/
    103103    GLboolean bFbDraw;       /*GL_FRONT buffer is drawn to directly*/
    104104    GLboolean fDataPresented;
     
    128128
    129129    GLuint cDisabled;
     130
     131    GLuint   fPresentMode;       /*redirect to FBO instead of real host window*/
     132
     133    GLboolean fHasParentWindow;
    130134
    131135    GLboolean fRootVrOn;
     
    219223/* @todo:
    220224 * 1. use compositor stored inside mural to use current MuralFBO and window-related API
    221  * 2. CR_SERVER_REDIR_NONE and CR_SERVER_REDIR_FBO_BLT should be trated identically for presented window
    222  *    since we just need to blit the given textures to it if we are NOT in CR_SERVER_REDIR_FBO_RAM mode */
     225 * 2. CR_SERVER_REDIR_F_NONE and CR_SERVER_REDIR_F_FBO should be trated identically for presented window
     226 *    since we just need to blit the given textures to it if we are NOT in CR_SERVER_REDIR_F_FBO_RAM mode */
    223227typedef struct CR_DISPLAY
    224228{
     
    388392
    389393    PFNCRSERVERPRESENTFBO pfnPresentFBO;
    390     GLubyte               bForceOffscreenRendering; /*Force server to render 3d data offscreen
     394    GLuint                fPresentMode; /*Force server to render 3d data offscreen
    391395                                                     *using callback above to update vbox framebuffers*/
    392     GLubyte               bOffscreenRenderingDefault; /*can be set with CR_SERVER_DEFAULT_RENDER_TYPE*/
     396    GLuint                fPresentModeDefault; /*can be set with CR_SERVER_DEFAULT_RENDER_TYPE*/
    393397    GLboolean             bUsePBOForReadback;       /*Use PBO's for data readback*/
    394398
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h

    r45148 r45248  
    130130GLboolean crServerSupportRedirMuralFBO(void);
    131131
    132 #define CR_SERVER_REDIR_NONE     0
    133 #define CR_SERVER_REDIR_FBO_BLT  1
    134 #define CR_SERVER_REDIR_FBO_RAM  2
    135 #define CR_SERVER_REDIR_MAXVAL   CR_SERVER_REDIR_FBO_RAM
     132#define CR_SERVER_REDIR_F_NONE     0x00
     133/* the data should be displayed on host (unset when is on or when CR_SERVER_REDIR_F_FBO_RAM_VMFB is set) */
     134#define CR_SERVER_REDIR_F_DISPLAY       0x01
     135/* guest window data get redirected to FBO on host */
     136#define CR_SERVER_REDIR_F_FBO           0x02
     137/* used with CR_SERVER_REDIR_F_FBO only
     138 * makes a separate texture to be used for maintaining the window framebuffer presented data */
     139#define CR_SERVER_REDIR_F_FBO_VMFB_TEX  0x04
     140/* used with CR_SERVER_REDIR_F_FBO only
     141 * indicates that FBO data should be copied to RAM for further processing */
     142#define CR_SERVER_REDIR_F_FBO_RAM       0x08
     143/* used with CR_SERVER_REDIR_F_FBO_RAM only
     144 * indicates that FBO data should be passed to VRDP backend */
     145#define CR_SERVER_REDIR_F_FBO_RAM_VRDP  0x10
     146/* used with CR_SERVER_REDIR_F_FBO_RAM only
     147 * indicates that FBO data should be passed to VM Framebuffer */
     148#define CR_SERVER_REDIR_F_FBO_RAM_VMFB  0x20
    136149
    137 int32_t crServerSetOffscreenRenderingMode(GLubyte value);
    138 void crServerRedirMuralFBO(CRMuralInfo *mural, GLubyte redir);
     150#define CR_SERVER_REDIR_F_ALL           0x3f
     151
     152#define CR_SERVER_REDIR_FGROUP_REQUIRE_FBO     (CR_SERVER_REDIR_F_ALL & ~CR_SERVER_REDIR_F_DISPLAY)
     153#define CR_SERVER_REDIR_FGROUP_REQUIRE_FBO_RAM (CR_SERVER_REDIR_F_FBO_RAM_VRDP | CR_SERVER_REDIR_F_FBO_RAM_VMFB)
     154
     155DECLINLINE(GLuint) crServerRedirModeAdjust(GLuint value)
     156{
     157    /* sanitize values */
     158    value &= CR_SERVER_REDIR_F_ALL;
     159
     160    if (value & CR_SERVER_REDIR_FGROUP_REQUIRE_FBO)
     161        value |=  CR_SERVER_REDIR_F_FBO;
     162    if (value & CR_SERVER_REDIR_FGROUP_REQUIRE_FBO_RAM)
     163        value |=  CR_SERVER_REDIR_F_FBO_RAM;
     164
     165    return value;
     166}
     167
     168int32_t crServerSetOffscreenRenderingMode(GLuint value);
     169void crServerRedirMuralFBO(CRMuralInfo *mural, GLuint redir);
     170void crServerEnableDisplayMuralFBO(CRMuralInfo *mural, GLboolean fEnable);
    139171void crServerDeleteMuralFBO(CRMuralInfo *mural);
    140172void crServerPresentFBO(CRMuralInfo *mural);
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_config.c

    r44951 r45248  
    5252
    5353    cr_server.screenCount = 0;
    54     cr_server.bForceOffscreenRendering = CR_SERVER_REDIR_NONE;
    55     cr_server.bOffscreenRenderingDefault = cr_server.bForceOffscreenRendering;
     54    cr_server.fPresentMode = CR_SERVER_REDIR_F_NONE;
     55    cr_server.fPresentModeDefault = cr_server.fPresentMode;
    5656    cr_server.bUsePBOForReadback = GL_FALSE;
    5757    cr_server.bUseOutputRedirect = GL_FALSE;
     58}
     59
     60static int crServerVBoxParseNumerics(const char *pszStr, const int defaultVal)
     61{
     62    int result = 0;
     63    bool neg = false;
     64    unsigned char iDigit = 0;
     65    if (!pszStr || pszStr[0] == '\0')
     66        return defaultVal;
     67
     68    for (;;)
     69    {
     70        if (pszStr[0] == '\0')
     71            return defaultVal;
     72
     73        if (pszStr[0] == ' ' || pszStr[0] == '\t' || pszStr[0] == '\n')
     74        {
     75            ++pszStr;
     76            continue;
     77        }
     78
     79        if (pszStr[0] == '-')
     80        {
     81            if (neg)
     82                return defaultVal;
     83
     84            neg = true;
     85            ++pszStr;
     86            continue;
     87        }
     88
     89        break;
     90    }
     91
     92    for (;;)
     93    {
     94        unsigned char digit;
     95        if (pszStr[0] == '\0')
     96        {
     97            if (!iDigit)
     98                return defaultVal;
     99            break;
     100        }
     101
     102        digit = pszStr[0] - '0';
     103        if (digit > 9)
     104            return defaultVal;
     105
     106        result *= 10;
     107        result += digit;
     108        ++iDigit;
     109
     110        ++pszStr;
     111    }
     112
     113    return !neg ? result : -result;
    58114}
    59115
     
    155211
    156212    env = crGetenv( "CR_SERVER_DEFAULT_RENDER_TYPE" );
    157     if (env != NULL)
    158     {
    159         GLubyte redir = (env[0] - 0x30);
    160         if (redir <= CR_SERVER_REDIR_MAXVAL)
     213    if (env != NULL && env[0] != '\0')
     214    {
     215        unsigned int redir = (unsigned int)crServerVBoxParseNumerics(env, CR_SERVER_REDIR_F_NONE);
     216        if (redir <= CR_SERVER_REDIR_F_ALL)
    161217        {
    162218            int rc = crServerSetOffscreenRenderingMode(redir);
     
    168224    }
    169225#if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS) || defined(GLX)
    170     else
    171     {
    172         int rc = crServerSetOffscreenRenderingMode(CR_SERVER_REDIR_FBO_BLT);
     226    if (cr_server.fPresentMode == CR_SERVER_REDIR_F_NONE)
     227    {
     228        /* the CR_SERVER_REDIR_F_FBO_BLT is set only if parent window is received, which means we are not in headles */
     229        int rc = crServerSetOffscreenRenderingMode(CR_SERVER_REDIR_F_FBO | CR_SERVER_REDIR_F_DISPLAY);
    173230        if (!RT_SUCCESS(rc))
    174231            crWarning("offscreen rendering unsupported, no offscreen rendering will be used..");
     
    176233    }
    177234#endif
    178     cr_server.bOffscreenRenderingDefault = cr_server.bForceOffscreenRendering;
     235    cr_server.fPresentModeDefault = cr_server.fPresentMode;
    179236
    180237    /* Need to do this as early as possible */
     
    297354
    298355    env = crGetenv( "CR_SERVER_DEFAULT_RENDER_TYPE" );
    299     if (env != NULL)
    300     {
    301         GLubyte redir = (env[0] - 0x30);
    302         if (redir <= CR_SERVER_REDIR_MAXVAL)
     356    if (env != NULL && env[0] != '\0')
     357    {
     358        unsigned int redir = (unsigned int)crServerVBoxParseNumerics(env, CR_SERVER_REDIR_F_NONE);
     359        if (redir <= CR_SERVER_REDIR_F_ALL)
    303360        {
    304361            int rc = crServerSetOffscreenRenderingMode(redir);
    305362            if (!RT_SUCCESS(rc))
    306                             crWarning("offscreen rendering unsupported, no offscreen rendering will be used..");
     363                crWarning("offscreen rendering unsupported, no offscreen rendering will be used..");
    307364        }
    308365        else
     
    310367    }
    311368#if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS) || defined(GLX)
    312     else
    313     {
    314         int rc = crServerSetOffscreenRenderingMode(CR_SERVER_REDIR_FBO_BLT);
     369    if (cr_server.fPresentMode == CR_SERVER_REDIR_F_NONE)
     370    {
     371        /* the CR_SERVER_REDIR_F_FBO_BLT is set only if parent window is received, which means we are not in headles */
     372        int rc = crServerSetOffscreenRenderingMode(CR_SERVER_REDIR_F_FBO | CR_SERVER_REDIR_F_DISPLAY);
    315373        if (!RT_SUCCESS(rc))
    316374            crWarning("offscreen rendering unsupported, no offscreen rendering will be used..");
     
    318376    }
    319377#endif
    320     cr_server.bOffscreenRenderingDefault = cr_server.bForceOffscreenRendering;
     378    cr_server.fPresentModeDefault = cr_server.fPresentMode;
    321379
    322380    cr_server.head_spu->dispatch_table.GetChromiumParametervCR(GL_WINDOW_POSITION_CR, 0, GL_INT, 2, &dims[0]);
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_context.c

    r45009 r45248  
    295295     * while crStateSwitchPostprocess restores it back to the original values */
    296296    oldCtx = crStateGetCurrent();
    297     if (oldMural && oldMural->fUseFBO && crServerSupportRedirMuralFBO())
     297    if (oldMural && (oldMural->fPresentMode & CR_SERVER_REDIR_F_FBO) && crServerSupportRedirMuralFBO())
    298298    {
    299299        idDrawFBO = oldMural->aidFBOs[oldMural->iCurDrawBuffer];
     
    374374    crStateMakeCurrent( ctx );
    375375
    376     if (mural && mural->fUseFBO && crServerSupportRedirMuralFBO())
     376    if (mural && (mural->fPresentMode & CR_SERVER_REDIR_F_FBO) && crServerSupportRedirMuralFBO())
    377377    {
    378378        GLuint id = crServerMuralFBOIdxFromBufferName(mural, ctx->buffer.drawBuffer);
     
    404404        cr_server.curClient->currentMural->bFbDraw = GL_TRUE;
    405405
    406     if (!mural->fUseFBO)
     406    if (!(mural->fPresentMode & CR_SERVER_REDIR_F_FBO))
    407407    {
    408408        ctx->buffer.width = mural->width;
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c

    r45217 r45248  
    10811081        return VINF_SUCCESS;
    10821082
    1083     pData->idFBO = pMural->fUseFBO ? pMural->aidColorTexs[fWrite ? pMural->iCurDrawBuffer : pMural->iCurReadBuffer] : 0;
     1083    pData->idFBO = (pMural->fPresentMode & CR_SERVER_REDIR_F_FBO) ? pMural->aidColorTexs[fWrite ? pMural->iCurDrawBuffer : pMural->iCurReadBuffer] : 0;
    10841084    pData->cElements = 0;
    10851085
    10861086    pEl = &pData->aElements[pData->cElements];
    1087     pEl->idFBO = pMural->fUseFBO ? pMural->aidFBOs[CR_SERVER_FBO_FB_IDX(pMural)] : 0;
     1087    pEl->idFBO = (pMural->fPresentMode & CR_SERVER_REDIR_F_FBO) ? pMural->aidFBOs[CR_SERVER_FBO_FB_IDX(pMural)] : 0;
    10881088    pEl->enmBuffer = pData->aElements[1].idFBO ? GL_COLOR_ATTACHMENT0 : GL_FRONT;
    10891089    pEl->posX = 0;
     
    11121112    {
    11131113        pEl = &pData->aElements[pData->cElements];
    1114         pEl->idFBO = pMural->fUseFBO ? pMural->aidFBOs[CR_SERVER_FBO_BB_IDX(pMural)] : 0;
     1114        pEl->idFBO = (pMural->fPresentMode & CR_SERVER_REDIR_F_FBO) ? pMural->aidFBOs[CR_SERVER_FBO_BB_IDX(pMural)] : 0;
    11151115        pEl->enmBuffer = pData->aElements[1].idFBO ? GL_COLOR_ATTACHMENT0 : GL_BACK;
    11161116        pEl->posX = 0;
     
    11421142            AssertCompile(sizeof (GLfloat) == 4);
    11431143            pEl = &pData->aElements[pData->cElements];
    1144             pEl->idFBO = pMural->fUseFBO ? pMural->aidFBOs[CR_SERVER_FBO_FB_IDX(pMural)] : 0;
     1144            pEl->idFBO = (pMural->fPresentMode & CR_SERVER_REDIR_F_FBO) ? pMural->aidFBOs[CR_SERVER_FBO_FB_IDX(pMural)] : 0;
    11451145            pEl->enmBuffer = 0; /* we do not care */
    11461146            pEl->posX = 0;
     
    11731173            AssertCompile(sizeof (GLuint) == 4);
    11741174            pEl = &pData->aElements[pData->cElements];
    1175             pEl->idFBO = pMural->fUseFBO ? pMural->aidFBOs[CR_SERVER_FBO_FB_IDX(pMural)] : 0;
     1175            pEl->idFBO = (pMural->fPresentMode & CR_SERVER_REDIR_F_FBO) ? pMural->aidFBOs[CR_SERVER_FBO_FB_IDX(pMural)] : 0;
    11761176            pEl->enmBuffer = 0; /* we do not care */
    11771177            pEl->posX = 0;
     
    11981198    {
    11991199        pEl = &pData->aElements[pData->cElements];
    1200         pEl->idFBO = pMural->fUseFBO ? pMural->aidFBOs[CR_SERVER_FBO_FB_IDX(pMural)] : 0;
     1200        pEl->idFBO = (pMural->fPresentMode & CR_SERVER_REDIR_F_FBO) ? pMural->aidFBOs[CR_SERVER_FBO_FB_IDX(pMural)] : 0;
    12011201        pEl->enmBuffer = 0; /* we do not care */
    12021202        pEl->posX = 0;
     
    18531853        crVBoxServerFBImageDataTerm(&Data.data);
    18541854
    1855         if (pMural->fUseFBO && pMural->fDataPresented && crServerVBoxCompositionPresentNeeded(pMural))
     1855        if ((pMural->fPresentMode & CR_SERVER_REDIR_F_FBO) && pMural->fDataPresented && crServerVBoxCompositionPresentNeeded(pMural))
    18561856        {
    18571857            crServerPresentFBO(pMural);
     
    23092309
    23102310    renderspuSetWindowId(SCREEN(0).winID);
     2311
     2312    crHashtableWalk(cr_server.muralTable, crVBoxServerCheckMuralCB, NULL);
     2313
    23112314    return VINF_SUCCESS;
    23122315}
     
    24022405            {
    24032406                crWarning("CrVrScrCompositorInit failed, rc %d", rc);
    2404                 return rc;
     2407                goto end;
    24052408            }
    24062409
     
    24172420        {
    24182421            crWarning("crServerMuralSynchRootVr failed, rc %d", rc);
    2419             return rc;
     2422            goto end;
    24202423        }
    24212424
     
    24302433        {
    24312434            crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);
    2432             return rc;
     2435            goto end;
    24332436        }
    24342437
     
    24412444    pMI->fRootVrOn = cr_server.fRootVrOn;
    24422445
     2446end:
    24432447    crServerVBoxCompositionDisableLeave(pMI, fForcePresent);
    24442448
     
    24962500}
    24972501
    2498 int32_t crServerSetOffscreenRenderingMode(GLubyte value)
    2499 {
    2500     if (cr_server.bForceOffscreenRendering==value)
     2502int32_t crServerSetOffscreenRenderingMode(GLuint value)
     2503{
     2504    /* sanitize values */
     2505    value = crServerRedirModeAdjust(value);
     2506
     2507    if (value == CR_SERVER_REDIR_F_NONE)
     2508    {
     2509        crWarning("crServerSetOffscreenRenderingMode: value undefined");
     2510    }
     2511
     2512    if (cr_server.fPresentMode==value)
    25012513    {
    25022514        return VINF_SUCCESS;
    25032515    }
    25042516
    2505     if (value > CR_SERVER_REDIR_MAXVAL)
    2506     {
    2507         crWarning("crServerSetOffscreenRenderingMode: invalid arg: %d", value);
    2508         return VERR_INVALID_PARAMETER;
    2509     }
    2510 
    2511     if (value && !crServerSupportRedirMuralFBO())
    2512     {
     2517    if ((value & CR_SERVER_REDIR_F_FBO) && !crServerSupportRedirMuralFBO())
     2518    {
     2519        crWarning("crServerSetOffscreenRenderingMode: FBO not supported");
    25132520        return VERR_NOT_SUPPORTED;
    25142521    }
    25152522
    2516     cr_server.bForceOffscreenRendering=value;
     2523    cr_server.fPresentMode=value;
    25172524
    25182525    crHashtableWalk(cr_server.muralTable, crVBoxServerCheckMuralCB, NULL);
     
    25232530DECLEXPORT(int32_t) crVBoxServerSetOffscreenRendering(GLboolean value)
    25242531{
    2525     return crServerSetOffscreenRenderingMode(value ? CR_SERVER_REDIR_FBO_RAM : cr_server.bOffscreenRenderingDefault);
     2532    return crServerSetOffscreenRenderingMode(value ?
     2533            cr_server.fPresentModeDefault | CR_SERVER_REDIR_F_FBO_RAM_VRDP
     2534            : cr_server.fPresentModeDefault);
    25262535}
    25272536
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c

    r45217 r45248  
    663663        GLuint hwid;
    664664
    665         if (mural->fUseFBO == CR_SERVER_REDIR_NONE)
     665        if (!(mural->fPresentMode & CR_SERVER_REDIR_F_FBO))
    666666            return VERR_NOT_IMPLEMENTED;
    667667
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.c

    r45179 r45248  
    110110{
    111111    int tlS, brS, trS, blS;
    112     int overlappingScreenCount, primaryS, i;
     112    int overlappingScreenCount = 0, primaryS = -1 , i;
     113    uint64_t winID = 0;
     114    GLuint fPresentMode;
    113115
    114116    if (!mural->CreateInfo.externalID)
    115117        return;
    116118
     119    CRASSERT(mural->spuWindow);
     120    CRASSERT(mural->spuWindow != CR_RENDER_DEFAULT_WINDOW_ID);
     121
    117122    if (!mural->width || !mural->height)
    118123    {
    119         crServerRedirMuralFBO(mural, CR_SERVER_REDIR_NONE);
     124        crServerRedirMuralFBO(mural, CR_SERVER_REDIR_F_NONE);
    120125        crServerDeleteMuralFBO(mural);
    121126        return;
     
    123128
    124129    crServerVBoxCompositionDisableEnter(mural);
    125 
    126     if (cr_server.screenCount<2 && !cr_server.bForceOffscreenRendering)
    127     {
    128         CRScreenViewportInfo *pVieport = &cr_server.screenVieport[mural->screenId];
    129         CRASSERT(cr_server.screenCount>0);
    130         CRASSERT(mural->fUseFBO == CR_SERVER_REDIR_NONE);
    131 
    132         mural->hX = mural->gX-cr_server.screen[0].x;
    133         mural->hY = mural->gY-cr_server.screen[0].y;
    134 
    135         cr_server.head_spu->dispatch_table.WindowPosition(mural->spuWindow, mural->hX - pVieport->x, mural->hY - pVieport->y);
    136 
    137         crServerVBoxCompositionDisableLeave(mural, GL_FALSE);
    138 
    139         return;
    140     }
    141130
    142131    tlS = crServerGetPointScreen(mural->gX, mural->gY);
    143132    brS = crServerGetPointScreen(mural->gX+mural->width-1, mural->gY+mural->height-1);
    144133
    145     if (tlS==brS && tlS>=0)
    146     {
    147         overlappingScreenCount = 1;
    148         primaryS = tlS;
     134    if ((tlS==brS && tlS>=0) || cr_server.screenCount <= 1)
     135    {
     136        if (cr_server.screenCount <= 1)
     137        {
     138            if (tlS != brS)
     139            {
     140                if (tlS >= 0)
     141                    brS = tlS;
     142                else
     143                    tlS = brS;
     144            }
     145
     146            primaryS = 0;
     147        }
     148
     149        Assert(brS == tlS);
     150
     151        if (tlS>=0 && cr_server.screen[tlS].winID)
     152        {
     153            overlappingScreenCount = 1;
     154        }
    149155    }
    150156    else
    151157    {
     158        bool fFoundWindIdScreen = false;
    152159        trS = crServerGetPointScreen(mural->gX+mural->width-1, mural->gY);
    153160        blS = crServerGetPointScreen(mural->gX, mural->gY+mural->height-1);
     
    159166                || crServerMuralCoverScreen(mural, i))
    160167            {
    161                 overlappingScreenCount++;
    162                 primaryS = primaryS<0 ? i:primaryS;
    163             }
    164         }
    165 
    166         if (!overlappingScreenCount)
     168                if ((!fFoundWindIdScreen && cr_server.screen[i].winID) || primaryS<0)
     169                    primaryS = i;
     170
     171                if (cr_server.screen[i].winID)
     172                {
     173                    overlappingScreenCount++;
     174                    fFoundWindIdScreen = true;
     175                }
     176            }
     177        }
     178
     179        if (primaryS<0)
    167180        {
    168181            primaryS = 0;
     
    170183    }
    171184
    172     if (primaryS!=mural->screenId)
    173     {
    174         mural->screenId = primaryS;
    175 
    176         renderspuSetWindowId(cr_server.screen[primaryS].winID);
     185    winID = overlappingScreenCount ? cr_server.screen[primaryS].winID : 0;
     186
     187    if (!winID == !mural->fHasParentWindow
     188            || (winID && primaryS!=mural->screenId))
     189    {
     190        mural->fHasParentWindow = !!winID;
     191
     192        renderspuSetWindowId(winID);
    177193        renderspuReparentWindow(mural->spuWindow);
    178194        renderspuSetWindowId(cr_server.screen[0].winID);
    179195    }
    180196
     197    mural->screenId = primaryS;
     198
    181199    mural->hX = mural->gX-cr_server.screen[primaryS].x;
    182200    mural->hY = mural->gY-cr_server.screen[primaryS].y;
    183201
    184     if (overlappingScreenCount<2 && !cr_server.bForceOffscreenRendering)
     202    fPresentMode = cr_server.fPresentMode;
     203    if (!overlappingScreenCount)
     204        fPresentMode &= ~CR_SERVER_REDIR_F_DISPLAY;
     205    else if (overlappingScreenCount > 1)
     206        fPresentMode = (fPresentMode | CR_SERVER_REDIR_F_FBO_RAM_VMFB) & ~CR_SERVER_REDIR_F_DISPLAY;
     207
     208    fPresentMode = crServerRedirModeAdjust(fPresentMode);
     209
     210    if (!(fPresentMode & CR_SERVER_REDIR_F_FBO))
     211    {
     212        crServerRedirMuralFBO(mural, fPresentMode);
     213        crServerDeleteMuralFBO(mural);
     214    }
     215    else
     216    {
     217        if (mural->fPresentMode & CR_SERVER_REDIR_F_FBO)
     218        {
     219            if (mural->width!=mural->fboWidth
     220                || mural->height!=mural->fboHeight)
     221            {
     222                crServerRedirMuralFBO(mural, fPresentMode & CR_SERVER_REDIR_F_DISPLAY);
     223                crServerDeleteMuralFBO(mural);
     224            }
     225        }
     226
     227        crServerRedirMuralFBO(mural, fPresentMode);
     228    }
     229
     230    if (mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY)
    185231    {
    186232        CRScreenViewportInfo *pVieport = &cr_server.screenVieport[mural->screenId];
    187233
    188         if (mural->fUseFBO)
    189         {
    190             crServerRedirMuralFBO(mural, CR_SERVER_REDIR_NONE);
    191             crServerDeleteMuralFBO(mural);
    192         }
    193 
    194234        cr_server.head_spu->dispatch_table.WindowPosition(mural->spuWindow, mural->hX - pVieport->x, mural->hY - pVieport->y);
    195     }
    196     else
    197     {
    198         GLubyte redir = overlappingScreenCount >= 2 ? CR_SERVER_REDIR_FBO_RAM : cr_server.bForceOffscreenRendering;
    199 
    200         if (mural->spuWindow)
    201         {
    202             if (mural->fUseFBO)
    203             {
    204                 if (mural->width!=mural->fboWidth
    205                     || mural->height!=mural->fboHeight)
    206                 {
    207                     crServerRedirMuralFBO(mural, CR_SERVER_REDIR_NONE);
    208                     crServerDeleteMuralFBO(mural);
    209                 }
    210             }
    211 
    212             if (mural->fUseFBO != redir)
    213             {
    214                 crServerRedirMuralFBO(mural, redir);
    215             }
    216         }
    217 #ifdef DEBUG_misha
    218         else
    219         {
    220             Assert(!mural->fUseFBO);
    221         }
    222 #endif
    223 
    224         if (mural->fUseFBO != CR_SERVER_REDIR_FBO_RAM)
    225         {
    226             CRScreenViewportInfo *pVieport = &cr_server.screenVieport[mural->screenId];
    227 
    228             cr_server.head_spu->dispatch_table.WindowPosition(mural->spuWindow, mural->hX - pVieport->x, mural->hY - pVieport->y);
    229         }
    230235    }
    231236
     
    258263static void crServerCreateMuralFBO(CRMuralInfo *mural);
    259264
    260 void crServerRedirMuralFBO(CRMuralInfo *mural, GLubyte redir)
    261 {
    262     if (mural->fUseFBO == redir)
    263     {
    264         if (redir)
    265             crWarning("crServerRedirMuralFBO called with the same redir status %d", redir);
     265void crServerEnableDisplayMuralFBO(CRMuralInfo *mural, GLboolean fEnable)
     266{
     267    if (!mural->CreateInfo.externalID)
     268        return;
     269
     270    if (fEnable)
     271    {
     272        if (!(mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY))
     273        {
     274            if  (mural->bVisible)
     275                cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, GL_TRUE);
     276            mural->fPresentMode |= CR_SERVER_REDIR_F_DISPLAY;
     277        }
     278    }
     279    else
     280    {
     281        if ((mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY))
     282        {
     283            if (mural->bVisible)
     284                cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, GL_FALSE);
     285            mural->fPresentMode &= ~CR_SERVER_REDIR_F_DISPLAY;
     286        }
     287    }
     288}
     289
     290void crServerRedirMuralFBO(CRMuralInfo *mural, GLuint redir)
     291{
     292    if (mural->fPresentMode == redir)
     293    {
     294//        if (redir)
     295//            crWarning("crServerRedirMuralFBO called with the same redir status %d", redir);
    266296        return;
    267297    }
     
    269299    crServerVBoxCompositionDisableEnter(mural);
    270300
    271     if (redir)
     301    if (redir & CR_SERVER_REDIR_F_FBO)
    272302    {
    273303        if (!crServerSupportRedirMuralFBO())
    274304        {
    275305            crWarning("FBO not supported, can't redirect window output");
    276             crServerVBoxCompositionDisableLeave(mural, GL_FALSE);
    277             return;
    278         }
    279 
    280         if (redir == CR_SERVER_REDIR_FBO_RAM)
    281             cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, GL_FALSE);
    282         else
    283             cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, mural->bVisible);
     306            goto end;
     307        }
    284308
    285309        if (mural->aidFBOs[0]==0)
     
    288312        }
    289313
    290         if (cr_server.currentMural == mural)
     314        if (cr_server.curClient && cr_server.curClient->currentMural == mural)
    291315        {
    292316            if (!crStateGetCurrent()->framebufferobject.drawFB)
     
    305329    else
    306330    {
    307         if (mural->fUseFBO == CR_SERVER_REDIR_FBO_RAM)
    308             cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, mural->bVisible);
    309 
    310         if (cr_server.currentMural == mural)
     331        if (cr_server.curClient && cr_server.curClient->currentMural == mural)
    311332        {
    312333            if (!crStateGetCurrent()->framebufferobject.drawFB)
     
    324345    }
    325346
    326     mural->fUseFBO = redir;
     347    crServerEnableDisplayMuralFBO(mural, !!(redir & CR_SERVER_REDIR_F_DISPLAY));
     348
     349    mural->fPresentMode = redir;
     350
     351end:
    327352    crServerVBoxCompositionDisableLeave(mural, GL_FALSE);
    328353}
     
    448473void crServerDeleteMuralFBO(CRMuralInfo *mural)
    449474{
    450     CRASSERT(!mural->fUseFBO);
     475    CRASSERT(!(mural->fPresentMode & CR_SERVER_REDIR_F_FBO));
    451476
    452477    if (mural->aidFBOs[0]!=0)
     
    539564    CRASSERT(curCtx == crStateGetCurrent());
    540565
     566    Assert(mural->fPresentMode & CR_SERVER_REDIR_F_FBO);
     567    Assert(mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY);
     568
    541569    mural->fDataPresented = GL_TRUE;
    542570
     
    571599static void crServerVBoxCompositionReenable(CRMuralInfo *mural, GLboolean fForcePresent)
    572600{
    573     if (mural->fUseFBO != CR_SERVER_REDIR_FBO_BLT
     601    if ((mural->fPresentMode & (CR_SERVER_REDIR_F_FBO | CR_SERVER_REDIR_F_DISPLAY)) != (CR_SERVER_REDIR_F_FBO | CR_SERVER_REDIR_F_DISPLAY)
    574602            || !mural->fDataPresented
    575603            || (!fForcePresent
     
    582610static void crServerVBoxCompositionDisable(CRMuralInfo *mural)
    583611{
    584     if (mural->fUseFBO != CR_SERVER_REDIR_FBO_BLT
     612    if ((mural->fPresentMode & (CR_SERVER_REDIR_F_FBO | CR_SERVER_REDIR_F_DISPLAY)) != (CR_SERVER_REDIR_F_FBO | CR_SERVER_REDIR_F_DISPLAY)
    585613            || !mural->fDataPresented)
    586614        return;
     
    636664    VBOXVR_TEXTURE Tex;
    637665
    638     CRASSERT(mural->fUseFBO);
    639     CRASSERT(cr_server.pfnPresentFBO || mural->fUseFBO == CR_SERVER_REDIR_FBO_BLT);
    640 
    641     if (mural->fUseFBO == CR_SERVER_REDIR_FBO_BLT)
    642     {
    643         crServerVBoxCompositionPresent(mural);
    644         return;
    645     }
     666    CRASSERT(mural->fPresentMode & CR_SERVER_REDIR_F_FBO);
     667    CRASSERT(cr_server.pfnPresentFBO || (mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY));
    646668
    647669    if (!crServerVBoxCompositionPresentNeeded(mural))
    648670        return;
    649671
     672    if (mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY)
     673    {
     674        crServerVBoxCompositionPresentPerform(mural);
     675    }
     676
    650677    mural->fDataPresented = GL_TRUE;
     678
     679    if (!(mural->fPresentMode & CR_SERVER_REDIR_FGROUP_REQUIRE_FBO_RAM))
     680        return;
    651681
    652682    Tex.width = mural->width;
     
    675705    }
    676706
    677     for (i=0; i<cr_server.screenCount; ++i)
    678     {
    679         if (crServerIntersectScreen(mural, i, &rect))
    680         {
    681             /* rect in window relative coords */
    682             crServerTransformRect(&rectwr, &rect, -mural->gX, -mural->gY);
    683 
    684             if (!mural->pVisibleRects)
    685             {
    686                 /*we don't get any rects info for guest compiz windows, so we treat windows as visible unless explicitly received 0 visible rects*/
    687                 if (!mural->bReceivedRects)
     707    if (mural->fPresentMode & CR_SERVER_REDIR_F_FBO_RAM_VMFB)
     708    {
     709        for (i=0; i<cr_server.screenCount; ++i)
     710        {
     711            if (crServerIntersectScreen(mural, i, &rect))
     712            {
     713                /* rect in window relative coords */
     714                crServerTransformRect(&rectwr, &rect, -mural->gX, -mural->gY);
     715
     716                if (!mural->pVisibleRects)
    688717                {
    689                     tmppixels = crAlloc(4*(rect.x2-rect.x1)*(rect.y2-rect.y1));
    690                     if (!tmppixels)
     718                    /*we don't get any rects info for guest compiz windows, so we treat windows as visible unless explicitly received 0 visible rects*/
     719                    if (!mural->bReceivedRects)
    691720                    {
    692                         crWarning("Out of memory in crServerPresentFBO");
    693                         crFree(pixels);
    694                         return;
    695                     }
    696 
    697                     crServerCopySubImage(tmppixels, pixels, &rectwr, mural->fboWidth, mural->fboHeight);
    698                     /*Note: pfnPresentFBO would free tmppixels*/
    699                     cr_server.pfnPresentFBO(tmppixels, i, rect.x1-cr_server.screen[i].x, rect.y1-cr_server.screen[i].y, rect.x2-rect.x1, rect.y2-rect.y1);
    700                 }
    701             }
    702             else
    703             {
    704                 for (j=0; j<mural->cVisibleRects; ++j)
    705                 {
    706                     if (crServerIntersectRect(&rectwr, (CRrecti*) &mural->pVisibleRects[4*j], &sectr))
    707                     {
    708                         tmppixels = crAlloc(4*(sectr.x2-sectr.x1)*(sectr.y2-sectr.y1));
     721                        tmppixels = crAlloc(4*(rect.x2-rect.x1)*(rect.y2-rect.y1));
    709722                        if (!tmppixels)
    710723                        {
     
    714727                        }
    715728
    716                         crServerCopySubImage(tmppixels, pixels, &sectr, mural->fboWidth, mural->fboHeight);
     729                        crServerCopySubImage(tmppixels, pixels, &rectwr, mural->fboWidth, mural->fboHeight);
    717730                        /*Note: pfnPresentFBO would free tmppixels*/
    718                         cr_server.pfnPresentFBO(tmppixels, i,
    719                                                 sectr.x1+mural->gX-cr_server.screen[i].x,
    720                                                 sectr.y1+mural->gY-cr_server.screen[i].y,
    721                                                 sectr.x2-sectr.x1, sectr.y2-sectr.y1);
     731                        cr_server.pfnPresentFBO(tmppixels, i, rect.x1-cr_server.screen[i].x, rect.y1-cr_server.screen[i].y, rect.x2-rect.x1, rect.y2-rect.y1);
     732                    }
     733                }
     734                else
     735                {
     736                    for (j=0; j<mural->cVisibleRects; ++j)
     737                    {
     738                        if (crServerIntersectRect(&rectwr, (CRrecti*) &mural->pVisibleRects[4*j], &sectr))
     739                        {
     740                            tmppixels = crAlloc(4*(sectr.x2-sectr.x1)*(sectr.y2-sectr.y1));
     741                            if (!tmppixels)
     742                            {
     743                                crWarning("Out of memory in crServerPresentFBO");
     744                                crFree(pixels);
     745                                return;
     746                            }
     747
     748                            crServerCopySubImage(tmppixels, pixels, &sectr, mural->fboWidth, mural->fboHeight);
     749                            /*Note: pfnPresentFBO would free tmppixels*/
     750                            cr_server.pfnPresentFBO(tmppixels, i,
     751                                                    sectr.x1+mural->gX-cr_server.screen[i].x,
     752                                                    sectr.y1+mural->gY-cr_server.screen[i].y,
     753                                                    sectr.x2-sectr.x1, sectr.y2-sectr.y1);
     754                        }
    722755                    }
    723756                }
     
    749782    return cr_server.curClient
    750783           && cr_server.curClient->currentMural
    751            && cr_server.curClient->currentMural->fUseFBO;
     784           && (cr_server.curClient->currentMural->fPresentMode & CR_SERVER_REDIR_F_FBO);
    752785}
    753786
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_window.c

    r45201 r45248  
    8383    mural->spuWindow = spuWindow;
    8484    mural->screenId = 0;
     85    mural->fHasParentWindow = !!cr_server.screen[0].winID;
    8586    mural->bVisible = !!dims[0];
    86     mural->fUseFBO = CR_SERVER_REDIR_NONE;
     87    mural->fPresentMode = CR_SERVER_REDIR_F_NONE;
    8788
    8889    mural->cVisibleRects = 0;
     
    266267    }
    267268
    268     crServerRedirMuralFBO(mural, CR_SERVER_REDIR_NONE);
     269    crServerRedirMuralFBO(mural, CR_SERVER_REDIR_F_NONE);
    269270    crServerDeleteMuralFBO(mural);
    270271
     
    437438void crServerMuralSize(CRMuralInfo *mural, GLint width, GLint height)
    438439{
    439     if (mural->width != width || mural->height != height)
    440     {
    441         uint32_t cRects;
    442         const RTRECT *pRects;
    443         RTRECT Rect;
    444         VBOXVR_TEXTURE Tex;
    445         int rc = VINF_SUCCESS;
    446         Tex.width = width;
    447         Tex.height = height;
    448         Tex.target = GL_TEXTURE_2D;
    449         Tex.hwid = 0;
    450 
    451 
    452         /* since we're going to change the current compositor & the window we need to avoid
    453          * renderspu fron dealing with inconsistent data, i.e. modified compositor and
    454          * still unmodified window.
    455          * So what we do is:
    456          * 1. tell renderspu to stop using the current compositor -> renderspu would do necessary synchronization with its redraw thread to ensure compositor is no longer used
    457          * 2. do necessary modifications
    458          * 3. (so far not needed for resize, but in case it is in the future) re-set the compositor */
    459 
    460         /* 1. tell renderspu to stop using the current compositor (see above comment) */
    461         crServerVBoxCompositionDisableEnter(mural);
    462 
    463         /* 2. do necessary modifications (see above comment) */
    464         /* NOTE: we can do it even if mural->fUseFBO == CR_SERVER_REDIR_NONE to make sure the compositor data is always up to date */
    465         /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */
    466         /* CrVrScrCompositorLock(&mural->Compositor); */
    467         rc = CrVrScrCompositorEntryRemove(&mural->Compositor, &mural->CEntry);
     440    uint32_t cRects;
     441    const RTRECT *pRects;
     442    RTRECT Rect;
     443    VBOXVR_TEXTURE Tex;
     444    int rc = VINF_SUCCESS;
     445    Tex.width = width;
     446    Tex.height = height;
     447    Tex.target = GL_TEXTURE_2D;
     448    Tex.hwid = 0;
     449
     450    if (mural->width == width && mural->height == height)
     451        return;
     452
     453
     454    /* since we're going to change the current compositor & the window we need to avoid
     455     * renderspu fron dealing with inconsistent data, i.e. modified compositor and
     456     * still unmodified window.
     457     * So what we do is:
     458     * 1. tell renderspu to stop using the current compositor -> renderspu would do necessary synchronization with its redraw thread to ensure compositor is no longer used
     459     * 2. do necessary modifications
     460     * 3. (so far not needed for resize, but in case it is in the future) re-set the compositor */
     461
     462    /* 1. tell renderspu to stop using the current compositor (see above comment) */
     463    crServerVBoxCompositionDisableEnter(mural);
     464
     465    /* 2. do necessary modifications (see above comment) */
     466    /* NOTE: we can do it even if mural->fPresentMode == CR_SERVER_REDIR_F_NONE to make sure the compositor data is always up to date */
     467    /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */
     468    /* CrVrScrCompositorLock(&mural->Compositor); */
     469    rc = CrVrScrCompositorEntryRemove(&mural->Compositor, &mural->CEntry);
     470    if (!RT_SUCCESS(rc))
     471    {
     472        crWarning("CrVrScrCompositorEntryRemove failed, rc %d", rc);
     473        goto end;
     474    }
     475    CrVrScrCompositorEntryInit(&mural->CEntry, &Tex);
     476    /* initially set regions to all visible since this is what some guest assume
     477     * and will not post any more visible regions command */
     478    Rect.xLeft = 0;
     479    Rect.xRight = width;
     480    Rect.yTop = 0;
     481    Rect.yBottom = height;
     482    rc = CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->CEntry, NULL, 1, &Rect, NULL);
     483    if (!RT_SUCCESS(rc))
     484    {
     485        crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);
     486        goto end;
     487    }
     488    /* CrVrScrCompositorUnlock(&mural->Compositor); */
     489    mural->width = width;
     490    mural->height = height;
     491
     492    mural->fDataPresented = GL_FALSE;
     493
     494    if (cr_server.currentMural == mural)
     495    {
     496        crStateGetCurrent()->buffer.width = mural->width;
     497        crStateGetCurrent()->buffer.height = mural->height;
     498    }
     499
     500    if (mural->fRootVrOn)
     501    {
     502        rc = CrVrScrCompositorEntryRemove(&mural->RootVrCompositor, &mural->RootVrCEntry);
    468503        if (!RT_SUCCESS(rc))
    469504        {
    470505            crWarning("CrVrScrCompositorEntryRemove failed, rc %d", rc);
    471             return;
    472         }
    473         CrVrScrCompositorEntryInit(&mural->CEntry, &Tex);
     506            goto end;
     507        }
     508        CrVrScrCompositorEntryInit(&mural->RootVrCEntry, &Tex);
    474509        /* initially set regions to all visible since this is what some guest assume
    475510         * and will not post any more visible regions command */
     
    478513        Rect.yTop = 0;
    479514        Rect.yBottom = height;
    480         rc = CrVrScrCompositorEntryRegionsSet(&mural->Compositor, &mural->CEntry, NULL, 1, &Rect, NULL);
     515        rc = CrVrScrCompositorEntryRegionsSet(&mural->RootVrCompositor, &mural->RootVrCEntry, NULL, 1, &Rect, NULL);
    481516        if (!RT_SUCCESS(rc))
    482517        {
    483518            crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);
    484             return;
    485         }
    486         /* CrVrScrCompositorUnlock(&mural->Compositor); */
    487         mural->width = width;
    488         mural->height = height;
    489 
    490         mural->fDataPresented = GL_FALSE;
    491 
    492         if (cr_server.currentMural == mural)
    493         {
    494             crStateGetCurrent()->buffer.width = mural->width;
    495             crStateGetCurrent()->buffer.height = mural->height;
    496         }
    497 
     519            goto end;
     520        }
     521
     522        crServerVBoxRootVrTranslateForMural(mural);
     523        rc = CrVrScrCompositorEntryListIntersect(&mural->RootVrCompositor, &mural->RootVrCEntry, &cr_server.RootVr, NULL);
     524        if (!RT_SUCCESS(rc))
     525        {
     526            crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);
     527            goto end;
     528        }
     529
     530        rc = CrVrScrCompositorEntryRegionsGet(&mural->RootVrCompositor, &mural->RootVrCEntry, &cRects, NULL, &pRects);
     531        if (!RT_SUCCESS(rc))
     532        {
     533            crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);
     534            goto end;
     535        }
     536    }
     537    else
     538    {
     539        rc = CrVrScrCompositorEntryRegionsGet(&mural->Compositor, &mural->CEntry, &cRects, NULL, &pRects);
     540        if (!RT_SUCCESS(rc))
     541        {
     542            crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);
     543            goto end;
     544        }
     545    }
     546
     547    crServerCheckMuralGeometry(mural);
     548
     549    cr_server.head_spu->dispatch_table.WindowSize(mural->spuWindow, width, height);
     550
     551    cr_server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRects, pRects);
     552
     553    if (mural->pvOutputRedirectInstance)
     554    {
    498555        if (mural->fRootVrOn)
    499         {
    500             rc = CrVrScrCompositorEntryRemove(&mural->RootVrCompositor, &mural->RootVrCEntry);
    501             if (!RT_SUCCESS(rc))
    502             {
    503                 crWarning("CrVrScrCompositorEntryRemove failed, rc %d", rc);
    504                 return;
    505             }
    506             CrVrScrCompositorEntryInit(&mural->RootVrCEntry, &Tex);
    507             /* initially set regions to all visible since this is what some guest assume
    508              * and will not post any more visible regions command */
    509             Rect.xLeft = 0;
    510             Rect.xRight = width;
    511             Rect.yTop = 0;
    512             Rect.yBottom = height;
    513             rc = CrVrScrCompositorEntryRegionsSet(&mural->RootVrCompositor, &mural->RootVrCEntry, NULL, 1, &Rect, NULL);
    514             if (!RT_SUCCESS(rc))
    515             {
    516                 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);
    517                 return;
    518             }
    519 
    520             crServerVBoxRootVrTranslateForMural(mural);
    521             rc = CrVrScrCompositorEntryListIntersect(&mural->RootVrCompositor, &mural->RootVrCEntry, &cr_server.RootVr, NULL);
    522             if (!RT_SUCCESS(rc))
    523             {
    524                 crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);
    525                 return;
    526             }
    527 
    528             rc = CrVrScrCompositorEntryRegionsGet(&mural->RootVrCompositor, &mural->RootVrCEntry, &cRects, NULL, &pRects);
    529             if (!RT_SUCCESS(rc))
    530             {
    531                 crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);
    532                 return;
    533             }
    534         }
    535         else
    536556        {
    537557            rc = CrVrScrCompositorEntryRegionsGet(&mural->Compositor, &mural->CEntry, &cRects, NULL, &pRects);
     
    539559            {
    540560                crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);
    541                 return;
    542             }
    543         }
    544 
    545         crServerCheckMuralGeometry(mural);
    546 
    547         cr_server.head_spu->dispatch_table.WindowSize(mural->spuWindow, width, height);
    548 
    549         cr_server.head_spu->dispatch_table.WindowVisibleRegion(mural->spuWindow, cRects, pRects);
    550 
    551         if (mural->pvOutputRedirectInstance)
    552         {
    553             if (mural->fRootVrOn)
    554             {
    555                 rc = CrVrScrCompositorEntryRegionsGet(&mural->Compositor, &mural->CEntry, &cRects, NULL, &pRects);
    556                 if (!RT_SUCCESS(rc))
    557                 {
    558                     crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);
    559                     return;
    560                 }
    561             }
    562             /* @todo the code assumes that RTRECT == four GLInts. */
    563             cr_server.outputRedirect.CRORVisibleRegion(mural->pvOutputRedirectInstance,
    564                     cRects, pRects);
    565         }
    566 
    567         /* 3. (so far not needed for resize, but in case it is in the future) re-set the compositor (see above comment) */
    568         /* uncomment when needed */
    569         /* NOTE: !!! we have mural->fHasPresentationData set to GL_FALSE above, so crServerVBoxCompositionReenable will have no effect in any way
    570 
    571         */
    572         crServerVBoxCompositionDisableLeave(mural, GL_FALSE);
    573     }
     561                goto end;
     562            }
     563        }
     564        /* @todo the code assumes that RTRECT == four GLInts. */
     565        cr_server.outputRedirect.CRORVisibleRegion(mural->pvOutputRedirectInstance,
     566                cRects, pRects);
     567    }
     568
     569end:
     570    /* 3. (so far not needed for resize, but in case it is in the future) re-set the compositor (see above comment) */
     571    /* uncomment when needed */
     572    /* NOTE: !!! we have mural->fHasPresentationData set to GL_FALSE above, so crServerVBoxCompositionReenable will have no effect in any way
     573
     574    */
     575    crServerVBoxCompositionDisableLeave(mural, GL_FALSE);
     576
    574577}
    575578
     
    623626
    624627        /* 2. do necessary modifications (see above comment) */
    625         /* NOTE: we can do it even if mural->fUseFBO == CR_SERVER_REDIR_NONE to make sure the compositor data is always up to date */
     628        /* NOTE: we can do it even if !(mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY) to make sure the compositor data is always up to date */
    626629
    627630        if (mural->gX != x || mural->gY != y)
     
    709712    }
    710713
    711     /* NOTE: we can do it even if mural->fUseFBO = CR_SERVER_REDIR_NONE to make sure the compositor data is always up to date */
     714    /* NOTE: we can do it even if !(mural->fPresentMode & CR_SERVER_REDIR_F_DISPLAY) to make sure the compositor data is always up to date */
    712715    /* the compositor lock is not needed actually since we have prevented renderspu from using the compositor */
    713716    /* CrVrScrCompositorLock(&mural->Compositor); */
     
    717720    {
    718721        crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);
    719         return;
     722        goto end;
    720723    }
    721724
     
    731734            {
    732735                crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);
    733                 return;
     736                goto end;
    734737            }
    735738
     
    739742            {
    740743                crWarning("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc);
    741                 return;
     744                goto end;
    742745            }
    743746
     
    746749            {
    747750                crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);
    748                 return;
     751                goto end;
    749752            }
    750753        }
     
    755758            {
    756759                crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);
    757                 return;
     760                goto end;
    758761            }
    759762        }
     
    769772                {
    770773                    crWarning("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc);
    771                     return;
     774                    goto end;
    772775                }
    773776            }
     
    776779        }
    777780    }
    778 
     781end:
    779782    /* 3. re-set the compositor (see above comment) */
    780783    crServerVBoxCompositionDisableLeave(mural, fForcePresent);
     
    792795    }
    793796
    794     if (mural->fUseFBO != CR_SERVER_REDIR_FBO_RAM)
     797    if (mural->fPresentMode && CR_SERVER_REDIR_F_DISPLAY)
    795798    {
    796799        cr_server.head_spu->dispatch_table.WindowShow(mural->spuWindow, state);
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