VirtualBox

Changeset 51101 in vbox for trunk


Ignore:
Timestamp:
Apr 17, 2014 8:36:20 PM (11 years ago)
Author:
vboxsync
Message:

DevVGA/CrCmd: multimon support fix (some more to follow)

Location:
trunk/src/VBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp

    r51081 r51101  
    1414 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
    1515 */
    16 //#include <VBox/VMMDev.h>
     16#include <VBox/VMMDev.h>
    1717#include <VBox/vmm/pdmdev.h>
    1818#include <VBox/VBoxVideo.h>
     
    107107    VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE,
    108108    VBVAEXHOSTCTL_TYPE_GHH_ENABLE,
     109    VBVAEXHOSTCTL_TYPE_GHH_ENABLE_PAUSED,
    109110    VBVAEXHOSTCTL_TYPE_GHH_DISABLE,
    110111    VBVAEXHOSTCTL_TYPE_GH_MIN = VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE,
     
    254255}
    255256
     257static int VBoxVBVAExHPPause(struct VBVAEXHOSTCONTEXT *pCmdVbva)
     258{
     259    if (pCmdVbva->i32EnableState < VBVAEXHOSTCONTEXT_ESTATE_PAUSED)
     260    {
     261        WARN(("Invalid state\n"));
     262        return VERR_INVALID_STATE;
     263    }
     264
     265    ASMAtomicWriteS32(&pCmdVbva->i32EnableState, VBVAEXHOSTCONTEXT_ESTATE_PAUSED);
     266    return VINF_SUCCESS;
     267}
     268
     269static int VBoxVBVAExHPResume(struct VBVAEXHOSTCONTEXT *pCmdVbva)
     270{
     271    if (pCmdVbva->i32EnableState != VBVAEXHOSTCONTEXT_ESTATE_PAUSED)
     272    {
     273        WARN(("Invalid state\n"));
     274        return VERR_INVALID_STATE;
     275    }
     276
     277    ASMAtomicWriteS32(&pCmdVbva->i32EnableState, VBVAEXHOSTCONTEXT_ESTATE_ENABLED);
     278    return VINF_SUCCESS;
     279}
     280
     281
    256282static bool vboxVBVAExHPCheckProcessCtlInternal(struct VBVAEXHOSTCONTEXT *pCmdVbva, VBVAEXHOSTCTL* pCtl)
    257283{
     
    259285    {
    260286        case VBVAEXHOSTCTL_TYPE_HH_INTERNAL_PAUSE:
    261             if (pCmdVbva->i32EnableState > VBVAEXHOSTCONTEXT_ESTATE_PAUSED)
    262                 ASMAtomicWriteS32(&pCmdVbva->i32EnableState, VBVAEXHOSTCONTEXT_ESTATE_PAUSED);
     287        {
     288            int rc = VBoxVBVAExHPPause(pCmdVbva);
    263289            VBoxVBVAExHPDataCompleteCtl(pCmdVbva, pCtl, VINF_SUCCESS);
    264290            return true;
     291        }
    265292        case VBVAEXHOSTCTL_TYPE_HH_INTERNAL_RESUME:
    266             if (pCmdVbva->i32EnableState == VBVAEXHOSTCONTEXT_ESTATE_PAUSED)
    267                 ASMAtomicWriteS32(&pCmdVbva->i32EnableState, VBVAEXHOSTCONTEXT_ESTATE_ENABLED);
     293        {
     294            int rc = VBoxVBVAExHPResume(pCmdVbva);
    268295            VBoxVBVAExHPDataCompleteCtl(pCmdVbva, pCtl, VINF_SUCCESS);
    269296            return true;
     297        }
    270298        default:
    271299            return false;
     
    13521380static int vboxVDMACrGuestCtlProcess(struct VBOXVDMAHOST *pVdma, VBVAEXHOSTCTL *pCmd)
    13531381{
    1354     switch (pCmd->enmType)
     1382    VBVAEXHOSTCTL_TYPE enmType = pCmd->enmType;
     1383    switch (enmType)
    13551384    {
    13561385       case VBVAEXHOSTCTL_TYPE_GHH_BE_OPAQUE:
     
    13621391           return pVdma->CrSrvInfo.pfnGuestCtl(pVdma->CrSrvInfo.hSvr, pCmd->u.cmd.pu8Cmd, pCmd->u.cmd.cbCmd);
    13631392        case VBVAEXHOSTCTL_TYPE_GHH_ENABLE:
     1393        case VBVAEXHOSTCTL_TYPE_GHH_ENABLE_PAUSED:
    13641394        {
    13651395            VBVAENABLE *pEnable = (VBVAENABLE *)pCmd->u.cmd.pu8Cmd;
    13661396            Assert(pCmd->u.cmd.cbCmd == sizeof (VBVAENABLE));
    13671397            uint32_t u32Offset = pEnable->u32Offset;
    1368             return vdmaVBVAEnableProcess(pVdma, u32Offset);
     1398            int rc = vdmaVBVAEnableProcess(pVdma, u32Offset);
     1399            if (!RT_SUCCESS(rc))
     1400            {
     1401                WARN(("vdmaVBVAEnableProcess failed %d\n", rc));
     1402                return rc;
     1403            }
     1404
     1405            if (enmType == VBVAEXHOSTCTL_TYPE_GHH_ENABLE_PAUSED)
     1406            {
     1407                rc = VBoxVBVAExHPPause(&pVdma->CmdVbva);
     1408                if (!RT_SUCCESS(rc))
     1409                {
     1410                    WARN(("VBoxVBVAExHPPause failed %d\n", rc));
     1411                    return rc;
     1412                }
     1413            }
     1414
     1415            return VINF_SUCCESS;
    13691416        }
    13701417        case VBVAEXHOSTCTL_TYPE_GHH_DISABLE:
     
    26392686}
    26402687
    2641 static int vdmaVBVACtlEnableSubmitInternal(PVBOXVDMAHOST pVdma, VBVAENABLE *pEnable, PFNVBVAEXHOSTCTL_COMPLETE pfnComplete, void *pvComplete)
     2688static int vdmaVBVACtlEnableSubmitInternal(PVBOXVDMAHOST pVdma, VBVAENABLE *pEnable, bool fPaused, PFNVBVAEXHOSTCTL_COMPLETE pfnComplete, void *pvComplete)
    26422689{
    26432690    int rc;
    2644     VBVAEXHOSTCTL* pHCtl = VBoxVBVAExHCtlCreate(&pVdma->CmdVbva, VBVAEXHOSTCTL_TYPE_GHH_ENABLE);
     2691    VBVAEXHOSTCTL* pHCtl = VBoxVBVAExHCtlCreate(&pVdma->CmdVbva, fPaused ? VBVAEXHOSTCTL_TYPE_GHH_ENABLE_PAUSED : VBVAEXHOSTCTL_TYPE_GHH_ENABLE);
    26452692    if (pHCtl)
    26462693    {
     
    26672714}
    26682715
    2669 static int vdmaVBVACtlEnableSubmitSync(PVBOXVDMAHOST pVdma, uint32_t offVram)
     2716static int vdmaVBVACtlEnableSubmitSync(PVBOXVDMAHOST pVdma, uint32_t offVram, bool fPaused)
    26702717{
    26712718    VBVAENABLE Enable = {0};
     
    26822729    }
    26832730
    2684     rc = vdmaVBVACtlEnableSubmitInternal(pVdma, &Enable, vdmaVBVACtlSubmitSyncCompletion, &Data);
     2731    rc = vdmaVBVACtlEnableSubmitInternal(pVdma, &Enable, fPaused, vdmaVBVACtlSubmitSyncCompletion, &Data);
    26852732    if (RT_SUCCESS(rc))
    26862733    {
     
    27312778}
    27322779
     2780static DECLCALLBACK(int) vdmaVBVANotifyEnable(PVGASTATE pVGAState)
     2781{
     2782    for (uint32_t i = 0; i < pVGAState->cMonitors; i++)
     2783    {
     2784        int rc = pVGAState->pDrv->pfnVBVAEnable (pVGAState->pDrv, i, NULL);
     2785        if (!RT_SUCCESS(rc))
     2786        {
     2787            WARN(("pfnVBVAEnable failed %d\n", rc));
     2788            for (uint32_t j = 0; j < i; j++)
     2789            {
     2790                pVGAState->pDrv->pfnVBVADisable (pVGAState->pDrv, j);
     2791            }
     2792
     2793            return rc;
     2794        }
     2795    }
     2796    return VINF_SUCCESS;
     2797}
     2798
     2799static DECLCALLBACK(int) vdmaVBVANotifyDisable(PVGASTATE pVGAState)
     2800{
     2801    for (uint32_t i = 0; i < pVGAState->cMonitors; i++)
     2802    {
     2803        pVGAState->pDrv->pfnVBVADisable (pVGAState->pDrv, i);
     2804    }
     2805    return VINF_SUCCESS;
     2806}
     2807
     2808static DECLCALLBACK(void) vboxCmdVBVACmdCtlGuestEnableDisableCompletion(VBVAEXHOSTCONTEXT *pVbva, struct VBVAEXHOSTCTL *pCtl, int rc, void *pvContext)
     2809{
     2810    if (rc == VINF_SUCCESS)
     2811    {
     2812        /* we need to inform Main about VBVA enable/disable
     2813         * main expects notifications to be done from the main thread
     2814         * submit it there */
     2815        PVBOXVDMAHOST pVdma = RT_FROM_MEMBER(pVbva, VBOXVDMAHOST, CmdVbva);
     2816        PVGASTATE pVGAState = pVdma->pVGAState;
     2817
     2818        if (VBoxVBVAExHSIsEnabled(&pVdma->CmdVbva))
     2819            VMR3ReqCallNoWait(PDMDevHlpGetVM(pVGAState->pDevInsR3), VMCPUID_ANY, (PFNRT)vdmaVBVANotifyEnable, 1, pVGAState);
     2820        else
     2821            VMR3ReqCallNoWait(PDMDevHlpGetVM(pVGAState->pDevInsR3), VMCPUID_ANY, (PFNRT)vdmaVBVANotifyDisable, 1, pVGAState);
     2822    }
     2823
     2824    vboxCmdVBVACmdCtlGuestCompletion(pVbva, pCtl, rc, pvContext);
     2825}
     2826
    27332827static int vdmaVBVACtlEnableDisableSubmitInternal(PVBOXVDMAHOST pVdma, VBVAENABLE *pEnable, PFNVBVAEXHOSTCTL_COMPLETE pfnComplete, void *pvComplete)
    27342828{
    27352829    bool fEnable = ((pEnable->u32Flags & (VBVA_F_ENABLE | VBVA_F_DISABLE)) == VBVA_F_ENABLE);
    27362830    if (fEnable)
    2737         return vdmaVBVACtlEnableSubmitInternal(pVdma, pEnable, pfnComplete, pvComplete);
     2831        return vdmaVBVACtlEnableSubmitInternal(pVdma, pEnable, false, pfnComplete, pvComplete);
    27382832    return vdmaVBVACtlDisableSubmitInternal(pVdma, pEnable, pfnComplete, pvComplete);
    27392833}
     
    27422836{
    27432837    VBoxSHGSMICommandMarkAsynchCompletion(&pEnable->Hdr);
    2744     int rc = vdmaVBVACtlEnableDisableSubmitInternal(pVdma, &pEnable->Enable, vboxCmdVBVACmdCtlGuestCompletion, pVdma);
     2838    int rc = vdmaVBVACtlEnableDisableSubmitInternal(pVdma, &pEnable->Enable, vboxCmdVBVACmdCtlGuestEnableDisableCompletion, pVdma);
    27452839    if (RT_SUCCESS(rc))
    27462840        return VINF_SUCCESS;
     
    30713165    {
    30723166#ifdef VBOX_WITH_CRHGSMI
    3073         rc = vdmaVBVACtlEnableSubmitSync(pVdma, u32);
     3167        rc = vdmaVBVACtlEnableSubmitSync(pVdma, u32, true);
    30743168        AssertRCReturn(rc, rc);
    30753169
    3076         rc = vdmaVBVAPause(pVdma);
    3077         AssertRCReturn(rc, rc);
     3170        Assert(pVdma->CmdVbva.i32State == VBVAEXHOSTCONTEXT_ESTATE_PAUSED);
     3171
     3172        vdmaVBVANotifyEnable(pVdma->pVGAState);
    30783173
    30793174        VBVAEXHOSTCTL HCtl;
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp

    r51094 r51101  
    47724772}
    47734773
    4774 static void crVBoxServerCrCmdBltPrimaryUpdate(const RTRECT *pRects, uint32_t cRects, uint32_t u32PrimaryID)
     4774static void crVBoxServerCrCmdBltPrimaryUpdate(const VBVAINFOSCREEN *pScreen, const RTRECT *pRects, uint32_t cRects, uint32_t u32PrimaryID)
    47754775{
    47764776    if (!cRects)
     
    48274827    if (dirtyRect.xRight - dirtyRect.xLeft)
    48284828    {
    4829         cr_server.CrCmdClientInfo.pfnCltScrUpdateEnd(cr_server.CrCmdClientInfo.hCltScr, u32PrimaryID, dirtyRect.xLeft, dirtyRect.yTop,
     4829        cr_server.CrCmdClientInfo.pfnCltScrUpdateEnd(cr_server.CrCmdClientInfo.hCltScr, u32PrimaryID, pScreen->i32OriginX + dirtyRect.xLeft, pScreen->i32OriginY + dirtyRect.yTop,
    48304830                                           dirtyRect.xRight - dirtyRect.xLeft, dirtyRect.yBottom - dirtyRect.yTop);
    48314831    }
     
    49374937
    49384938        crServerDispatchVBoxTexPresent(texId, u32PrimaryID, pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y, cRects, (const GLint*)pRects);
     4939
     4940        return 0;
    49394941    }
    49404942    else
     
    49564958    }
    49574959
    4958     crVBoxServerCrCmdBltPrimaryUpdate(pRects, cRects, u32PrimaryID);
     4960    crVBoxServerCrCmdBltPrimaryUpdate(CrFbGetScreenInfo(hFb), pRects, cRects, u32PrimaryID);
    49594961
    49604962    return 0;
     
    51075109
    51085110        crServerDispatchVBoxTexPresent(texId, u32PrimaryID, pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y, cRects, (const GLint*)pRects);
     5111
     5112        return 0;
    51095113    }
    51105114    else
     
    51375141    }
    51385142
    5139     crVBoxServerCrCmdBltPrimaryUpdate(pRects, cRects, u32PrimaryID);
     5143    crVBoxServerCrCmdBltPrimaryUpdate(CrFbGetScreenInfo(hFb), pRects, cRects, u32PrimaryID);
    51405144
    51415145    return 0;
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