VirtualBox

Ignore:
Timestamp:
May 15, 2014 6:25:40 PM (11 years ago)
Author:
vboxsync
Message:

wddm: fix preemption

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.cpp

    r51260 r51266  
    868868    PVBOXMP_DEVEXT pDevExt;
    869869    VBOXCMDVBVA *pVbva;
    870     uint32_t u32FenceID;
     870    /* last completted fence id */
     871    uint32_t u32FenceCompleted;
     872    /* last submitted fence id */
     873    uint32_t u32FenceSubmitted;
    871874} VBOXCMDVBVA_CHECK_COMPLETED_CB;
    872875
     
    876879    BOOLEAN bRc = DxgkDdiInterruptRoutineNew(pCompleted->pDevExt, 0);
    877880    if (pCompleted->pVbva)
    878         pCompleted->u32FenceID = pCompleted->pVbva->u32FenceCompleted;
     881    {
     882        pCompleted->u32FenceCompleted = pCompleted->pVbva->u32FenceCompleted;
     883        pCompleted->u32FenceSubmitted = pCompleted->pVbva->u32FenceSubmitted;
     884    }
     885    else
     886    {
     887        WARN(("no vbva"));
     888        pCompleted->u32FenceCompleted = 0;
     889        pCompleted->u32FenceSubmitted = 0;
     890    }
    879891    return bRc;
    880892}
    881893
    882894
    883 static uint32_t vboxCmdVbvaCheckCompleted(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, bool fPingHost, HGSMIGUESTCOMMANDCONTEXT *pCtx, bool fBufferOverflow)
     895static uint32_t vboxCmdVbvaCheckCompleted(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, bool fPingHost, HGSMIGUESTCOMMANDCONTEXT *pCtx, bool fBufferOverflow, uint32_t *pu32FenceSubmitted)
    884896{
    885897    if (fPingHost)
     
    889901    context.pDevExt = pDevExt;
    890902    context.pVbva = pVbva;
    891     context.u32FenceID = 0;
     903    context.u32FenceCompleted = 0;
     904    context.u32FenceSubmitted = 0;
    892905    BOOLEAN bRet;
    893906    NTSTATUS Status = pDevExt->u.primary.DxgkInterface.DxgkCbSynchronizeExecution(
     
    899912    Assert(Status == STATUS_SUCCESS);
    900913
    901     return context.u32FenceID;
     914    if (pu32FenceSubmitted)
     915        *pu32FenceSubmitted = context.u32FenceSubmitted;
     916
     917    return context.u32FenceCompleted;
    902918}
    903919
     
    906922    PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)pvFlush;
    907923
    908     vboxCmdVbvaCheckCompleted(pDevExt, NULL,  true /*fPingHost*/, pHGSMICtx, true /*fBufferOverflow*/);
     924    vboxCmdVbvaCheckCompleted(pDevExt, NULL,  true /*fPingHost*/, pHGSMICtx, true /*fBufferOverflow*/, NULL);
    909925}
    910926
     
    11391155}
    11401156
    1141 uint32_t VBoxCmdVbvaCheckCompleted(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, bool fPingHost)
    1142 {
    1143     return vboxCmdVbvaCheckCompleted(pDevExt, pVbva, fPingHost, &VBoxCommonFromDeviceExt(pDevExt)->guestCtx, false /* fBufferOverflow */);
     1157uint32_t VBoxCmdVbvaCheckCompleted(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, bool fPingHost, uint32_t *pu32FenceSubmitted)
     1158{
     1159    return vboxCmdVbvaCheckCompleted(pDevExt, pVbva, fPingHost, &VBoxCommonFromDeviceExt(pDevExt)->guestCtx, false /* fBufferOverflow */, pu32FenceSubmitted);
    11441160}
    11451161
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.h

    r51260 r51266  
    216216VBOXCMDVBVA_HDR* VBoxCmdVbvaSubmitLock(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, uint32_t cbCmd);
    217217bool VBoxCmdVbvaPreempt(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, uint32_t u32FenceID);
    218 uint32_t VBoxCmdVbvaCheckCompleted(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, bool fPingHost);
     218uint32_t VBoxCmdVbvaCheckCompleted(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva, bool fPingHost, uint32_t *pu32FenceSubmitted);
    219219bool VBoxCmdVbvaCheckCompletedIrq(PVBOXMP_DEVEXT pDevExt, VBOXCMDVBVA *pVbva);
    220220
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp

    r51260 r51266  
    49684968
    49694969    PVBOXMP_DEVEXT pDevExt = (PVBOXMP_DEVEXT)hAdapter;
    4970     pCurrentFence->CurrentFence = VBoxCmdVbvaCheckCompleted(pDevExt, &pDevExt->CmdVbva, false);
     4970
     4971    WARN(("=>DxgkDdiQueryCurrentFenceNew"));
     4972
     4973    uint32_t u32FenceSubmitted = 0;
     4974    uint32_t u32FenceCompleted = 0;
     4975
     4976    LARGE_INTEGER DelayInterval;
     4977    DelayInterval.QuadPart = -10LL * 1000LL * 1000LL;
     4978
     4979    for (;;)
     4980    {
     4981        u32FenceCompleted = VBoxCmdVbvaCheckCompleted(pDevExt, &pDevExt->CmdVbva, false, &u32FenceSubmitted);
     4982        if (!u32FenceCompleted)
     4983        {
     4984            WARN(("VBoxCmdVbvaCheckCompleted failed"));
     4985            return STATUS_UNSUCCESSFUL;
     4986        }
     4987
     4988        if (u32FenceSubmitted == u32FenceCompleted)
     4989            break;
     4990
     4991        WARN(("uncompleted fences, u32FenceSubmitted(%d), u32FenceCompleted(%d)", u32FenceSubmitted, u32FenceCompleted));
     4992
     4993        NTSTATUS Status = KeDelayExecutionThread(KernelMode, FALSE, &DelayInterval);
     4994        if (Status != STATUS_SUCCESS)
     4995            WARN(("KeDelayExecutionThread failed %#x", Status));
     4996    }
     4997
     4998    pCurrentFence->CurrentFence = u32FenceCompleted;
     4999
     5000    WARN(("<=DxgkDdiQueryCurrentFenceNew"));
    49715001
    49725002    LOGF(("LEAVE, hAdapter(0x%x)", hAdapter));
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