VirtualBox

Ignore:
Timestamp:
Dec 17, 2015 10:32:08 AM (9 years ago)
Author:
vboxsync
Message:

Audio/HDA: Try to fix stream initialization / reset handling for >= 2 VCPUs.

File:
1 edited

Legend:

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

    r59161 r59172  
    14851485    AssertPtrReturn(pStrmSt, VERR_INVALID_POINTER);
    14861486
     1487#ifdef VBOX_STRICT
     1488    AssertReleaseMsg(!RT_BOOL(HDA_STREAM_REG(pThis, CTL, u8Strm) & HDA_REG_FIELD_FLAG_MASK(SDCTL, RUN)),
     1489                     ("Cannot initialize stream %RU8 while in running state\n", u8Strm));
     1490#endif
     1491
    14871492    pStrmSt->u8Strm     = u8Strm;
    14881493    pStrmSt->u64BaseDMA = RT_MAKE_U64(HDA_STREAM_REG(pThis, BDPL, u8Strm),
     
    15831588    AssertReturnVoid(u8Strm <= 7); /** @todo Use a define for MAX_STREAMS! */
    15841589
    1585     /*
    1586      * Stop the stream and wait until our internal processing is done.
    1587      */
    1588     int rc2 = hdaStreamStop(pStrmSt);
    1589     if (RT_FAILURE(rc2))
    1590     {
    1591         AssertReleaseMsgFailed(("HDA: Unable to stop stream %RU8, rc=%Rrc\n", pStrmSt->u8Strm, rc2));
    1592         return;
    1593     }
     1590#ifdef VBOX_STRICT
     1591    AssertReleaseMsg(!RT_BOOL(HDA_STREAM_REG(pThis, CTL, u8Strm) & HDA_REG_FIELD_FLAG_MASK(SDCTL, RUN)),
     1592                     ("Cannot reset stream %RU8 while in running state\n", u8Strm));
     1593#endif
    15941594
    15951595    /*
     
    16001600
    16011601    /*
    1602      * First, initialize the internal stream state.
     1602     * First, reset the internal stream state.
    16031603     */
    1604     rc2 = hdaStreamInit(pThis, pStrmSt, u8Strm);
    1605     AssertRC(rc2);
     1604    pStrmSt->u8Strm     = u8Strm;
     1605    pStrmSt->u64BaseDMA = 0;
     1606    pStrmSt->u32CBL     = 0;
     1607    pStrmSt->u16FMT     = 0;
     1608    pStrmSt->u16FIFOS   = 0;
     1609    pStrmSt->u16LVI     = 0;
    16061610
    16071611    /*
    1608      * Second, initialize registers.
     1612     * Second, initialize the registers.
    16091613     */
    16101614    HDA_STREAM_REG(pThis, STS,   u8Strm) = 0;
     
    16121616     * bits are reserved for stream number 18.2.33, resets SDnCTL except SRST bit. */
    16131617    HDA_STREAM_REG(pThis, CTL,   u8Strm) = 0x40000 | (HDA_STREAM_REG(pThis, CTL, u8Strm) & HDA_REG_FIELD_FLAG_MASK(SDCTL, SRST));
    1614 
    16151618    /* ICH6 defines default values (0x77 for input and 0xBF for output descriptors) of FIFO size. 18.2.39. */
    16161619    HDA_STREAM_REG(pThis, FIFOS, u8Strm) = u8Strm < 4 ? HDA_SDINFIFO_120B : HDA_SDONFIFO_192B;
     
    16241627    HDA_STREAM_REG(pThis, BDPL,  u8Strm) = 0;
    16251628
     1629    /* Report that we're done resetting this stream. */
     1630    HDA_STREAM_REG(pThis, CTL,   u8Strm) = 0;
     1631
    16261632    LogFunc(("[SD%RU8]: Reset\n", u8Strm));
    16271633
    16281634    /* Exit reset mode. */
    16291635    ASMAtomicXchgBool(&pStrmSt->State.fInReset, false);
    1630 
    1631     /*
    1632      * Start stream again.
    1633      */
    1634     rc2 = hdaStreamStart(pStrmSt);
    1635     AssertRC(rc2);
    16361636}
    16371637
     
    19971997    {
    19981998#ifdef IN_RING3
     1999        /*
     2000         * Only (re-)initialize the stream when not running.
     2001         */
     2002        if (!fRun && !fInRun)
     2003        {
     2004            int rc2 = hdaStreamInit(pThis, pStrmSt, u8Strm);
     2005            AssertRC(rc2);
     2006        }
     2007
    19992008        /*
    20002009         * We enter here to change DMA states only.
     
    20362045            }
    20372046        }
    2038 
    2039         if (pStrmSt)
    2040         {
    2041             int rc2 = hdaStreamInit(pThis, pStrmSt, u8Strm);
    2042             AssertRC(rc2);
    2043         }
    2044 
    20452047#else /* !IN_RING3 */
    20462048        return VINF_IOM_R3_MMIO_WRITE;
     
    41544156
    41554157        if (pStrmSt)
    4156         {
    4157             /* hdaStreamReset prevents changing the SRST bit, so we force it to zero here. */
    4158             HDA_STREAM_REG(pThis, CTL, u8Strm) = 0;
    4159 
    41604158            hdaStreamReset(pThis, pStrmSt, u8Strm);
    4161         }
    41624159    }
    41634160
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