VirtualBox

Changeset 89853 in vbox


Ignore:
Timestamp:
Jun 23, 2021 1:19:38 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145310
Message:

DevHda: Added a StatDmaSkippedPendingBcis statistics counter like AC97 already has, and added a @todo trying to guess why we're skipping (== screwing up) DMA periods when BCIS is set. bugref:9890

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

Legend:

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

    r89849 r89853  
    51075107                                   "Number of bytes of silence added to cope with underruns.", "Stream%u/DMABufferSilence", idxStream);
    51085108        }
     5109        PDMDevHlpSTAMRegisterF(pDevIns, &pThisCC->aStreams[idxStream].State.StatDmaSkippedPendingBcis, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT,
     5110                               "DMA transfer period skipped because of BCIS pending.", "Stream%u/DMASkippedPendingBCIS", idxStream);
     5111
    51095112        PDMDevHlpSTAMRegisterF(pDevIns, &pThisCC->aStreams[idxStream].State.offRead, STAMTYPE_U64, STAMVISIBILITY_USED, STAMUNIT_BYTES,
    51105113                               "Virtual internal buffer read position.",    "Stream%u/offRead", idxStream);
  • trunk/src/VBox/Devices/Audio/DevHdaStream.cpp

    r89848 r89853  
    12111211 * @param   pThis           The shared HDA device state.
    12121212 * @param   pStreamShared   HDA stream to update (shared).
     1213 * @param   pStreamR3       HDA stream to update (ring-3).
    12131214 * @param   uSD             The stream ID (for asserting).
    12141215 * @param   tsNowNs         The current RTTimeNano() value.
    12151216 * @param   pszFunction     The function name (for logging).
    12161217 */
    1217 DECLINLINE(bool) hdaR3StreamDoDmaPrologue(PHDASTATE pThis, PHDASTREAM pStreamShared, uint8_t uSD,
     1218DECLINLINE(bool) hdaR3StreamDoDmaPrologue(PHDASTATE pThis, PHDASTREAM pStreamShared, PHDASTREAMR3 pStreamR3, uint8_t uSD,
    12181219                                          uint64_t tsNowNs, const char *pszFunction)
    12191220{
     
    12361237    else
    12371238    {
     1239        /** @todo r=bird: This is a bit fishy.  We should make effort the reschedule
     1240         *        the transfer immediately after the guest clears the interrupt.
     1241         *        The same fishy code is present in AC'97 with just a little
     1242         *        explanation as here, see {9890#c95}.
     1243         *
     1244         *        The reasoning is probably that the developer noticed some windows
     1245         *        versions don't like having their BCIS interrupts bundled.  There were
     1246         *        comments to that effect elsewhere, probably as a result of a fixed
     1247         *        uTimerHz approach to DMA scheduling.  However, pausing DMA for a
     1248         *        period isn't going to help us with the host backends, as they don't
     1249         *        pause and will want samples ASAP.  So, we should at least unpause
     1250         *        DMA as quickly as we possible when BCIS is cleared.  We might even
     1251         *        not skip it iff the DMA work here doesn't involve raising any IOC,
     1252         *        which is possible although unlikely. */
    12381253        Log3(("%s: [SD%RU8] BCIS bit set, skipping transfer\n", pszFunction, uSD));
     1254        STAM_REL_COUNTER_INC(&pStreamR3->State.StatDmaSkippedPendingBcis);
     1255        Log(("%s: [SD%RU8] BCIS bit set, skipping transfer\n", pszFunction, uSD));
    12391256# ifdef HDA_STRICT
    12401257        /* Timing emulation bug or guest is misbehaving -- let me know. */
     
    13871404     * Common prologue.
    13881405     */
    1389     if (hdaR3StreamDoDmaPrologue(pThis, pStreamShared, uSD, tsNowNs, "hdaR3StreamDoDmaInput"))
     1406    if (hdaR3StreamDoDmaPrologue(pThis, pStreamShared, pStreamR3, uSD, tsNowNs, "hdaR3StreamDoDmaInput"))
    13901407    { /* likely */ }
    13911408    else
     
    15961613     * Common prologue.
    15971614     */
    1598     if (hdaR3StreamDoDmaPrologue(pThis, pStreamShared, uSD, tsNowNs, "hdaR3StreamDoDmaOutput"))
     1615    if (hdaR3StreamDoDmaPrologue(pThis, pStreamShared, pStreamR3, uSD, tsNowNs, "hdaR3StreamDoDmaOutput"))
    15991616    { /* likely */ }
    16001617    else
  • trunk/src/VBox/Devices/Audio/DevHdaStream.h

    r89844 r89853  
    290290        /** Number of bytes involved in unresolved flow errors. */
    291291        STAMCOUNTER             StatDmaFlowErrorBytes;
     292        /** DMA skipped because buffer interrupt pending. */
     293        STAMCOUNTER             StatDmaSkippedPendingBcis;
    292294
    293295        STAMPROFILE             StatStart;
     
    298300    /** Debug bits. */
    299301    HDASTREAMDEBUG              Dbg;
    300     uint64_t                    au64Alignment[2+4];
     302    uint64_t                    au64Alignment[1+4];
    301303} HDASTREAMR3;
    302304AssertCompileSizeAlignment(HDASTREAMR3, 64);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette