VirtualBox

Changeset 53858 in vbox


Ignore:
Timestamp:
Jan 19, 2015 9:56:10 AM (10 years ago)
Author:
vboxsync
Message:

3D content scaling: keep window size parameters unchanged (not multiplied by scaling factor); update window geometry once scaling factor updated (fixes visual artifacts when Win guest login screen displayed).

Location:
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.cpp

    r53856 r53858  
    18451845            bool rc;
    18461846            rc = pWin->SetScaleFactor((GLdouble)dScaleFactorW, (GLdouble)dScaleFactorH);
    1847 
    1848             /* Sync framebuffer with scaling factor changes. */
    1849             HCR_FRAMEBUFFER pFb = pDpInfo->iFb >= 0 ? CrPMgrFbGet(pDpInfo->iFb) : NULL;
    1850             if (pFb && pFb->pDisplay)
    1851                 pFb->pDisplay->FramebufferChanged(pFb);
    1852 
    18531847            return rc ? 0 : VERR_LOCK_FAILED;
    18541848        }
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.h

    r53816 r53858  
    211211        int Reparent(uint64_t parentId);
    212212        int SetVisible(bool fVisible);
    213         int SetSize(uint32_t width, uint32_t height);
     213        int SetSize(uint32_t width, uint32_t height, bool fForced=false);
    214214        int SetPosition(int32_t x, int32_t y);
    215215        int SetVisibleRegionsChanged();
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/window.cpp

    r53854 r53858  
    128128
    129129
    130 int CrFbWindow::SetSize(uint32_t width, uint32_t height)
    131 {
    132     if (!checkInitedUpdating())
    133     {
    134         WARN(("err"));
    135         return VERR_INVALID_STATE;
    136     }
    137 
    138     if (mWidth != width || mHeight != height)
     130int CrFbWindow::SetSize(uint32_t width, uint32_t height, bool fForced)
     131{
     132    if (!checkInitedUpdating() && !fForced)
     133    {
     134        crDebug("CrFbWindow: SetSize request dropped because window is currently updating"
     135                "(width=%d, height=%d, mWidth=%d, mHeight=%d).", width, height, mWidth, mHeight);
     136        return VERR_INVALID_STATE;
     137    }
     138
     139    if (mWidth != width || mHeight != height || fForced)
    139140    {
    140141        GLdouble scaleFactorW, scaleFactorH;
     142        uint32_t scaledWidth, scaledHeight;
    141143
    142144        /* Reset to default values if operation was unsuccessfull. */
     
    145147
    146148        mFlags.fCompositoEntriesModified = 1;
    147         mWidth  = scaleFactorW ? (uint32_t)((GLdouble)width  * scaleFactorW) : width;
    148         mHeight = scaleFactorH ? (uint32_t)((GLdouble)height * scaleFactorH) : height;
    149 
    150         LOG(("CrWIN: Size [%d ; %d]", width, height));
     149
     150        /* Keep mWidth and mHeight unchanged (not multiplied by scale factor scalar). */
     151        mWidth  = width;
     152        mHeight = height;
     153
     154        scaledWidth  = (uint32_t)((GLdouble)width  * scaleFactorW);
     155        scaledHeight = (uint32_t)((GLdouble)height * scaleFactorH);
    151156
    152157        if (mSpuWindow)
    153             cr_server.head_spu->dispatch_table.WindowSize(mSpuWindow, mWidth, mHeight);
    154     }
     158        {
     159            cr_server.head_spu->dispatch_table.WindowSize(mSpuWindow, scaledWidth, scaledHeight);
     160            crDebug("CrFbWindow: SetSize request performed successfully "
     161                    "(width=%d, height=%d, scaledWidth=%d, scaledHeight=%d).", width, height, scaledWidth, scaledHeight);
     162        }
     163        else
     164            crDebug("CrFbWindow: SetSize request skipped because mSpuWindow not yet constructed "
     165                    "(width=%d, height=%d, scaledWidth=%d, scaledHeight=%d).", width, height, scaledWidth, scaledHeight);
     166    }
     167    else
     168        crDebug("CrFbWindow: SetSize request skipped because window arleady has requested size "
     169                "(width=%d, height=%d, mWidth=%d, mHeight=%d).", width, height, mWidth, mHeight);
    155170
    156171    return VINF_SUCCESS;
     
    162177    if (!checkInitedUpdating())
    163178    {
    164         WARN(("err"));
     179        crDebug("CrFbWindow: SetPosition request dropped because window is currently updating (x=%d, y=%d).", x, y);
    165180        return VERR_INVALID_STATE;
    166181    }
     
    174189        if (mSpuWindow)
    175190            cr_server.head_spu->dispatch_table.WindowPosition(mSpuWindow, x, y);
     191        crDebug("CrFbWindow: SetPosition performed successfully (x=%d, y=%d).", x, y);
    176192    }
    177193
     
    215231    if ( !(  (scaleFactorW >= VBOX_OGL_SCALE_FACTOR_MIN && scaleFactorW <= VBOX_OGL_SCALE_FACTOR_MAX)
    216232          && (scaleFactorH >= VBOX_OGL_SCALE_FACTOR_MIN && scaleFactorH <= VBOX_OGL_SCALE_FACTOR_MAX)))
     233    {
     234        crDebug("CrFbWindow: attempt to set scale factor out of valid values range: scaleFactorW=%d, scaleFactorH=%d, multiplier=%d.",
     235            (int)(scaleFactorW * VBOX_OGL_SCALE_FACTOR_MULTIPLIER), (int)(scaleFactorH * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
     236            (int)VBOX_OGL_SCALE_FACTOR_MULTIPLIER);
     237
    217238        return false;
     239    }
    218240
    219241    rc = RTSemRWRequestWrite(scaleFactorLock, RT_INDEFINITE_WAIT);
     
    223245        mScaleFactorHStorage = scaleFactorH;
    224246        RTSemRWReleaseWrite(scaleFactorLock);
     247
     248        crDebug("CrFbWindow: set scale factor: scaleFactorW=%d, scaleFactorH=%d, multiplier=%d.",
     249            (int)(scaleFactorW * VBOX_OGL_SCALE_FACTOR_MULTIPLIER), (int)(scaleFactorH * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
     250            (int)VBOX_OGL_SCALE_FACTOR_MULTIPLIER);
     251
     252        /* Update window geometry. Do not wait for GAs to send SetSize() and SetPosition()
     253         * events since they might not be running or installed at all. */
     254        SetSize(mWidth, mHeight, true);
     255        SetPosition(mxPos, myPos);
     256
    225257        return true;
    226258    }
     259
     260    crDebug("CrFbWindow: unable to set scale factor because RW lock cannot be aquired: scaleFactorW=%d, scaleFactorH=%d, multiplier=%d.",
     261            (int)(scaleFactorW * VBOX_OGL_SCALE_FACTOR_MULTIPLIER), (int)(scaleFactorH * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
     262            (int)VBOX_OGL_SCALE_FACTOR_MULTIPLIER);
    227263
    228264    return false;
     
    295331                VBOXVR_SCR_COMPOSITOR TmpCompositor;
    296332                RTRECT Rect;
    297                 Rect.xLeft = 0;
    298                 Rect.yTop = 0;
    299                 Rect.xRight = mWidth;
    300                 Rect.yBottom = mHeight;
     333                Rect.xLeft   = 0;
     334                Rect.yTop    = 0;
     335                Rect.xRight  = (uint32_t)((GLdouble)mWidth  * scaleFactorW);
     336                Rect.yBottom = (uint32_t)((GLdouble)mHeight * scaleFactorH);
    301337                CrVrScrCompositorInit(&TmpCompositor, &Rect);
    302338                CrVrScrCompositorSetStretching((VBOXVR_SCR_COMPOSITOR *)&TmpCompositor, scaleFactorW, scaleFactorH);
     
    343379    }
    344380
    345     cr_server.head_spu->dispatch_table.WindowSize(mSpuWindow, mWidth, mHeight);
     381    GLdouble scaleFactorW, scaleFactorH;
     382    /* Reset to default values if operation was unseccessfull. */
     383    if (!GetScaleFactor(&scaleFactorW, &scaleFactorH))
     384        scaleFactorW = scaleFactorH = 1.0;
     385
     386    uint32_t scaledWidth, scaledHeight;
     387
     388    scaledWidth  = (uint32_t)((GLdouble)mWidth  * scaleFactorW);
     389    scaledHeight = (uint32_t)((GLdouble)mHeight * scaleFactorH);
     390
     391    cr_server.head_spu->dispatch_table.WindowSize(mSpuWindow, scaledWidth, scaledHeight);
    346392    cr_server.head_spu->dispatch_table.WindowPosition(mSpuWindow, mxPos, myPos);
    347393
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