VirtualBox

Changeset 70246 in vbox for trunk/src


Ignore:
Timestamp:
Dec 20, 2017 6:01:54 PM (7 years ago)
Author:
vboxsync
Message:

Audio/HDA: Use a dedicated fRunning flag for a stream, as the RUN bit of SDnCTL does not necessarily reflect the current (internal) state.

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

Legend:

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

    r70142 r70246  
    14821482    /* Some guests tend to write SDnSTS even if the stream is not running.
    14831483     * So make sure to check if the RUN bit is set first. */
    1484     const bool fInRun = RT_BOOL(HDA_STREAM_REG(pThis, CTL, pStream->u8SD) & HDA_SDCTL_RUN);
    1485 
    1486     Log3Func(("[SD%RU8] fRun=%RTbool %R[sdsts]\n", pStream->u8SD, fInRun, v));
     1484    const bool fRunning = pStream->State.fRunning;
     1485
     1486    Log3Func(("[SD%RU8] fRunning=%RTbool %R[sdsts]\n", pStream->u8SD, fRunning, v));
    14871487
    14881488    PHDASTREAMPERIOD pPeriod = &pStream->State.Period;
     
    15041504            hdaStreamPeriodEnd(pPeriod);
    15051505
    1506             if (fInRun)
     1506            if (fRunning)
    15071507                hdaStreamPeriodBegin(pPeriod, hdaWalClkGetCurrent(pThis) /* Use current wall clock time */);
    15081508        }
  • trunk/src/VBox/Devices/Audio/DevHDACommon.cpp

    r70132 r70246  
    659659            PHDASTREAM pStream = &pThis->aStreams[i];
    660660
    661             if (!(HDA_STREAM_REG(pThis, CTL, pStream->u8SD) & HDA_SDCTL_RUN))
     661            if (!pStream->State.fRunning)
    662662                continue;
    663663
  • trunk/src/VBox/Devices/Audio/HDAStream.cpp

    r70202 r70246  
    5555
    5656    pStream->State.fInReset = false;
     57    pStream->State.fRunning = false;
    5758#ifdef HDA_USE_DMA_ACCESS_HANDLER
    5859    RTListInit(&pStream->State.lstDMAHandlers);
     
    354355
    355356# ifdef VBOX_STRICT
    356     AssertReleaseMsg(!RT_BOOL(HDA_STREAM_REG(pThis, CTL, uSD) & HDA_SDCTL_RUN),
    357                      ("[SD%RU8] Cannot reset stream while in running state\n", uSD));
     357    AssertReleaseMsg(!pStream->State.fRunning, ("[SD%RU8] Cannot reset stream while in running state\n", uSD));
    358358# endif
    359359
     
    475475    }
    476476
     477    if (RT_SUCCESS(rc))
     478    {
     479        pStream->State.fRunning = fEnable;
     480    }
     481
    477482    LogFunc(("[SD%RU8] rc=%Rrc\n", pStream->u8SD, rc));
    478483    return rc;
     
    741746
    742747    /* Stream not running? */
    743     if (!(HDA_STREAM_REG(pThis, CTL, pStream->u8SD) & HDA_SDCTL_RUN))
    744     {
    745         Log3Func(("[SD%RU8] RUN bit not set\n", pStream->u8SD));
     748    if (!pStream->State.fRunning)
     749    {
     750        Log3Func(("[SD%RU8] Not running\n", pStream->u8SD));
    746751        fProceed = false;
    747752    }
  • trunk/src/VBox/Devices/Audio/HDAStream.h

    r70132 r70246  
    118118     *  in reset mode and therefore not acccessible by the guest. */
    119119    volatile bool           fInReset;
     120        /** Flag indicating if the stream is in running state or not. */
     121        volatile bool                   fRunning;
    120122    /** Unused, padding. */
    121     uint32_t                Padding0;
     123    uint8_t                 Padding0[3];
    122124    /** Critical section to serialize access. */
    123125    RTCRITSECT              CritSect;
     
    191193    /** Stream descriptor number (SDn). */
    192194    uint8_t                  u8SD;
    193     uint8_t                  Padding0[7];
     195        /** Current channel index.
     196         *  For a stereo stream, this is u8Channel + 1. */
     197    uint8_t                  u8Channel;
    194198    /** DMA base address (SDnBDPU - SDnBDPL). */
    195199    uint64_t                 u64BDLBase;
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