VirtualBox

Changeset 70316 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 22, 2017 12:58:24 PM (7 years ago)
Author:
vboxsync
Message:

Audio/HDA: Take pending stream interrupts into account in hdaStreamTransferIsScheduled() and do the refcounting in hdaRegWriteSDSTS(). That way a re-scheduling in hdaTimerMain() should not happen anymore when an interrupt is pending and thus should improve timing accuracy quite a bit.

Location:
trunk/src/VBox/Devices/Audio
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DevHDA.cpp

    r70278 r70316  
    14781478    }
    14791479
     1480    hdaStreamLock(pStream);
     1481
    14801482    uint32_t v = HDA_REG_IND(pThis, iReg);
    14811483
     
    15571559        /* Reset processed data counter. */
    15581560        pStream->State.cbTransferProcessed = 0;
     1561        pStream->State.tsTransferNext      = tsNow + cTicksToNext;
     1562
     1563        Assert(pStream->State.cTransferPendingInterrupts);
     1564        if (pStream->State.cTransferPendingInterrupts)
     1565            pStream->State.cTransferPendingInterrupts--;
    15591566
    15601567        /* Re-arm the timer. */
    15611568        hdaTimerSet(pThis, tsNow + cTicksToNext, false /* fForce */);
    15621569    }
     1570
     1571    hdaStreamUnlock(pStream);
    15631572
    15641573    DEVHDA_UNLOCK_BOTH(pThis);
  • trunk/src/VBox/Devices/Audio/HDAStream.cpp

    r70295 r70316  
    560560/**
    561561 * Returns whether a next transfer for a given stream is scheduled or not.
     562 * This takes pending stream interrupts into account as well as the next scheduled
     563 * transfer timestamp.
    562564 *
    563565 * @returns True if a next transfer is scheduled, false if not.
     
    572574
    573575    const bool fScheduled =    pStream->State.fRunning
    574                             && pStream->State.tsTransferNext > TMTimerGet(pStream->pHDAState->pTimer);
    575 
    576     Log3Func(("[SD%RU8] %RU64 -> %RTbool\n", pStream->u8SD, pStream->State.tsTransferNext, fScheduled));
     576                            && (   pStream->State.cTransferPendingInterrupts
     577                                || pStream->State.tsTransferNext > TMTimerGet(pStream->pHDAState->pTimer));
     578
     579    Log3Func(("[SD%RU8] tsTransferNext=%RU64, cTransferPendingInterrupts=%RU8 -> %RTbool\n",
     580              pStream->u8SD, pStream->State.tsTransferNext, fScheduled));
    577581
    578582    return fScheduled;
     
    10981102        hdaProcessInterrupt(pThis, __FUNCTION__);
    10991103#endif
    1100         pStream->State.cTransferPendingInterrupts--;
    11011104    }
    11021105    else /* Transfer still in-flight -- schedule the next timing slot. */
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