VirtualBox

Changeset 82331 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Dec 2, 2019 11:50:22 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
135155
Message:

DevHDA: Converted timers to new style. Left some todos. bugref:9218

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

Legend:

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

    r82323 r82331  
    157157#define DEVHDA_LOCK_BOTH_RETURN(a_pDevIns, a_pThis, a_SD, a_rcBusy) \
    158158    do { \
    159         int rcLock = TMTimerLock((a_pThis)->pTimer[a_SD], (a_rcBusy)); \
    160         if (rcLock == VINF_SUCCESS) \
    161         { \
    162             rcLock = PDMDevHlpCritSectEnter((a_pDevIns), &(a_pThis)->CritSect, (a_rcBusy)); \
    163             if (rcLock == VINF_SUCCESS) \
    164                 break; \
    165             TMTimerUnlock((a_pThis)->pTimer[a_SD]); \
    166         } \
    167         AssertRC(rcLock); \
    168         return rcLock; \
     159        VBOXSTRICTRC rcLock = PDMDevHlpTimerLockClock2(pDevIns, (a_pThis)->ahTimers[a_SD], &(a_pThis)->CritSect,  (a_rcBusy)); \
     160        if (RT_LIKELY(rcLock == VINF_SUCCESS)) \
     161        {  /* likely */ } \
     162        else \
     163            return VBOXSTRICTRC_TODO(rcLock); \
    169164    } while (0)
    170165
     
    173168 */
    174169#define DEVHDA_UNLOCK_BOTH(a_pDevIns, a_pThis, a_SD) \
    175     do { \
    176         PDMDevHlpCritSectLeave((a_pDevIns), &(a_pThis)->CritSect); \
    177         TMTimerUnlock((a_pThis)->pTimer[a_SD]); \
    178     } while (0)
     170    PDMDevHlpTimerUnlockClock2(pDevIns, (a_pThis)->ahTimers[a_SD], &(a_pThis)->CritSect)
    179171
    180172
     
    14001392# endif
    14011393                /* (Re-)initialize the stream with current values. */
    1402                 rc2 = hdaR3StreamInit(pStream, pStream->u8SD);
     1394                rc2 = hdaR3StreamInit(pDevIns, pStream, pStream->u8SD);
    14031395                if (   RT_SUCCESS(rc2)
    14041396                    /* Any vital stream change occurred so that we need to (re-)add the stream to our setup?
     
    14351427                    AssertRC(rc2);
    14361428
    1437                     rc2 = hdaR3TimerSet(pThis, pStream, TMTimerGet(pThis->pTimer[pStream->u8SD]) + pStream->State.cTransferTicks,
     1429                    rc2 = hdaR3TimerSet(pDevIns, pThis, pStream,
     1430                                          PDMDevHlpTimerGet(pDevIns, pThis->ahTimers[pStream->u8SD])
     1431                                        + pStream->State.cTransferTicks,
    14381432                                        false /* fForce */);
    14391433                    AssertRC(rc2);
     
    15271521    HDA_PROCESS_INTERRUPT(pDevIns, pThis);
    15281522
    1529     const uint64_t tsNow = TMTimerGet(pThis->pTimer[uSD]);
     1523    const uint64_t tsNow = PDMDevHlpTimerGet(pDevIns, pThis->ahTimers[uSD]);
    15301524    Assert(tsNow >= pStream->State.tsTransferLast);
    15311525
     
    15451539
    15461540        if (cTicksElapsed <= cTicksToNext)
    1547         {
    15481541            cTicksToNext = cTicksToNext - cTicksElapsed;
    1549         }
    15501542        else /* Catch up. */
    15511543        {
     
    15551547            LogRelMax2(64, ("HDA: Stream #%RU8 interrupt lagging behind (expected %uus, got %uus), trying to catch up ...\n",
    15561548                            pStream->u8SD,
    1557                             (TMTimerGetFreq(pThis->pTimer[pStream->u8SD]) / pThis->uTimerHz) / 1000,(tsNow - pStream->State.tsTransferLast) / 1000));
     1549                            (PDMDevHlpTimerGetFreq(pDevIns, pThis->ahTimers[pStream->u8SD]) / pThis->uTimerHz) / 1000,
     1550                            (tsNow - pStream->State.tsTransferLast) / 1000));
    15581551
    15591552            cTicksToNext = 0;
     
    15751568            /* Re-arm the timer. */
    15761569            LogFunc(("Timer set SD%RU8\n", pStream->u8SD));
    1577             hdaR3TimerSet(pThis, pStream, tsNow + cTicksToNext, false /* fForce */);
     1570            hdaR3TimerSet(pDevIns, pThis, pStream, tsNow + cTicksToNext, false /* fForce */);
    15781571        }
    15791572    }
     
    28452838
    28462839/**
    2847  * Main routine for the stream's timer.
    2848  *
    2849  * @param   pDevIns             Device instance.
    2850  * @param   pTimer              Timer this callback was called for.
    2851  * @param   pvUser              Pointer to associated HDASTREAM.
     2840 * @callback_method_impl{FNTMTIMERDEV, Main routine for the stream's timer.}
    28522841 */
    28532842static DECLCALLBACK(void) hdaR3Timer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
    28542843{
    2855     PHDASTATE  pThis   = PDMDEVINS_2_DATA(pDevIns, PHDASTATE);
    2856     PHDASTREAM pStream = (PHDASTREAM)pvUser;
     2844    PHDASTATE       pThis   = PDMDEVINS_2_DATA(pDevIns, PHDASTATE);
     2845    PHDASTREAM      pStream = (PHDASTREAM)pvUser;
     2846    TMTIMERHANDLE   hTimer  = RT_SAFE_SUBSCRIPT8(pThis->ahTimers, pStream->u8SD);
    28572847    RT_NOREF(pTimer);
    28582848
    28592849    AssertPtr(pStream);
    28602850    Assert(PDMDevHlpCritSectIsOwner(pDevIns, &pThis->CritSect));
    2861     Assert(TMTimerIsLockOwner(pStream->pTimer));
    2862 
    2863     hdaR3StreamUpdate(pStream, true /* fInTimer */);
     2851    Assert(PDMDevHlpTimerIsLockOwner(pDevIns, hTimer));
     2852
     2853    hdaR3StreamUpdate(pDevIns, pStream, true /* fInTimer */);
    28642854
    28652855    /* Flag indicating whether to kick the timer again for a new data processing round. */
     
    28702860    if (fSinkActive)
    28712861    {
    2872         const bool fTimerScheduled = hdaR3StreamTransferIsScheduled(pStream);
     2862        const bool fTimerScheduled = hdaR3StreamTransferIsScheduled(pDevIns, pStream);
    28732863        Log3Func(("fSinksActive=%RTbool, fTimerScheduled=%RTbool\n", fSinkActive, fTimerScheduled));
    28742864        if (!fTimerScheduled)
    2875             hdaR3TimerSet(pThis, pStream,
    2876                             TMTimerGet(pThis->pTimer[pStream->u8SD])
    2877                           + TMTimerGetFreq(pThis->pTimer[pStream->u8SD]) / pStream->pHDAState->uTimerHz,
     2865            hdaR3TimerSet(pDevIns, pThis, pStream,
     2866                            PDMDevHlpTimerGet(pDevIns, hTimer)
     2867                          + PDMDevHlpTimerGetFreq(pDevIns, hTimer) / pStream->pHDAState->uTimerHz,
    28782868                          true /* fForce */);
    28792869    }
     
    35953585 * Does required post processing when loading a saved state.
    35963586 *
     3587 * @param   pDevIns             The device instance.
    35973588 * @param   pThis               Pointer to HDA state.
    35983589 */
    3599 static int hdaR3LoadExecPost(PHDASTATE pThis)
     3590static int hdaR3LoadExecPost(PPDMDEVINS pDevIns, PHDASTATE pThis)
    36003591{
    36013592    int rc = VINF_SUCCESS;
     
    36373628                hdaR3StreamRegisterDMAHandlers(pThis, pStream);
    36383629#endif
    3639                 if (hdaR3StreamTransferIsScheduled(pStream))
    3640                     hdaR3TimerSet(pThis, pStream, hdaR3StreamTransferGetNext(pStream), true /* fForce */);
     3630                if (hdaR3StreamTransferIsScheduled(pDevIns, pStream))
     3631                    hdaR3TimerSet(pDevIns, pThis, pStream, hdaR3StreamTransferGetNext(pStream), true /* fForce */);
    36413632
    36423633                /* Also keep track of the currently active streams. */
     
    37493740            /* Output */
    37503741            PHDASTREAM pStream = &pThis->aStreams[4];
    3751             rc = hdaR3StreamInit(pStream, 4 /* Stream descriptor, hardcoded */);
     3742            rc = hdaR3StreamInit(pDevIns, pStream, 4 /* Stream descriptor, hardcoded */);
    37523743            AssertRCReturn(rc, rc);
    37533744            rc = pHlp->pfnSSMGetStructEx(pSSM, &pStream->State.BDLE, sizeof(pStream->State.BDLE),
     
    37583749            /* Microphone-In */
    37593750            pStream = &pThis->aStreams[2];
    3760             rc = hdaR3StreamInit(pStream, 2 /* Stream descriptor, hardcoded */);
     3751            rc = hdaR3StreamInit(pDevIns, pStream, 2 /* Stream descriptor, hardcoded */);
    37613752            AssertRCReturn(rc, rc);
    37623753            rc = pHlp->pfnSSMGetStructEx(pSSM, &pStream->State.BDLE, sizeof(pStream->State.BDLE),
     
    37673758            /* Line-In */
    37683759            pStream = &pThis->aStreams[0];
    3769             rc = hdaR3StreamInit(pStream, 0 /* Stream descriptor, hardcoded */);
     3760            rc = hdaR3StreamInit(pDevIns, pStream, 0 /* Stream descriptor, hardcoded */);
    37703761            AssertRCReturn(rc, rc);
    37713762            rc = pHlp->pfnSSMGetStructEx(pSSM, &pStream->State.BDLE, sizeof(pStream->State.BDLE),
     
    38053796                }
    38063797
    3807                 rc = hdaR3StreamInit(pStream, idStream);
     3798                rc = hdaR3StreamInit(pDevIns, pStream, idStream);
    38083799                if (RT_FAILURE(rc))
    38093800                {
     
    39083899        rc = hdaR3LoadExecLegacy(pDevIns, pThis, pSSM, uVersion);
    39093900        if (RT_SUCCESS(rc))
    3910             rc = hdaR3LoadExecPost(pThis);
     3901            rc = hdaR3LoadExecPost(pDevIns, pThis);
    39113902        return rc;
    39123903    }
     
    39823973        }
    39833974
    3984         rc = hdaR3StreamInit(pStream, idStream);
     3975        rc = hdaR3StreamInit(pDevIns, pStream, idStream);
    39853976        if (RT_FAILURE(rc))
    39863977        {
     
    40734064    } /* for cStreams */
    40744065
    4075     rc = hdaR3LoadExecPost(pThis);
     4066    rc = hdaR3LoadExecPost(pDevIns, pThis);
    40764067    AssertRC(rc);
    40774068
     
    49614952
    49624953    /*
    4963      * Create all hardware streams.
     4954     * Create the per stream timers and the asso.
     4955     *
     4956     * We must the critical section for the timers as the device has a
     4957     * noop section associated with it.
     4958     *
     4959     * Note:  Use TMCLOCK_VIRTUAL_SYNC here, as the guest's HDA driver relies
     4960     *        on exact (virtual) DMA timing and uses DMA Position Buffers
     4961     *        instead of the LPIB registers.
    49644962     */
    49654963    static const char * const s_apszNames[] =
     
    49694967    };
    49704968    AssertCompile(RT_ELEMENTS(s_apszNames) == HDA_MAX_STREAMS);
     4969    for (size_t i = 0; i < HDA_MAX_STREAMS; i++)
     4970    {
     4971        rc = PDMDevHlpTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, hdaR3Timer, &pThis->aStreams[i],
     4972                                  TMTIMER_FLAGS_NO_CRIT_SECT, s_apszNames[i], &pThis->ahTimers[i]);
     4973        AssertRCReturn(rc, rc);
     4974
     4975        rc = PDMDevHlpTimerSetCritSect(pDevIns, pThis->ahTimers[i], &pThis->CritSect);
     4976        AssertRCReturn(rc, rc);
     4977    }
     4978
     4979    /*
     4980     * Create all hardware streams.
     4981     */
    49714982    for (uint8_t i = 0; i < HDA_MAX_STREAMS; ++i)
    49724983    {
    4973         /* Create the emulation timer (per stream).
    4974          *
    4975          * Note:  Use TMCLOCK_VIRTUAL_SYNC here, as the guest's HDA driver
    4976          *        relies on exact (virtual) DMA timing and uses DMA Position Buffers
    4977          *        instead of the LPIB registers.
    4978          */
    4979         rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, hdaR3Timer, &pThis->aStreams[i],
    4980                                     TMTIMER_FLAGS_NO_CRIT_SECT, s_apszNames[i], &pThis->pTimer[i]);
    4981         AssertRCReturn(rc, rc);
    4982 
    4983         /* Use our own critcal section for the device timer.
    4984          * That way we can control more fine-grained when to lock what. */
    4985         rc = TMR3TimerSetCritSect(pThis->pTimer[i], &pThis->CritSect);
    4986         AssertRCReturn(rc, rc);
    4987 
    49884984        rc = hdaR3StreamCreate(&pThis->aStreams[i], pThis, i /* u8SD */);
    49894985        AssertRCReturn(rc, rc);
  • trunk/src/VBox/Devices/Audio/DevHDA.h

    r82319 r82331  
    138138    /** Number of active (running) SDn streams. */
    139139    uint8_t                 cStreamsActive;
    140     /** The stream timers for pumping data thru the attached LUN drivers. */
    141     PTMTIMERR3              pTimer[HDA_MAX_STREAMS];
     140    /** The stream timers for pumping data thru the attached LUN drivers.
     141     * Duplicated in HDASTREAM::hTimer. */
     142    TMTIMERHANDLE           ahTimers[HDA_MAX_STREAMS];
    142143    /** Pointer to HDA codec to use. */
    143144    R3PTRTYPE(PHDACODEC)    pCodec;
  • trunk/src/VBox/Devices/Audio/DevHDACommon.cpp

    r82323 r82331  
    22/** @file
    33 * DevHDACommon.cpp - Shared HDA device functions.
     4 *
     5 * @todo r=bird: Shared with whom exactly?
    46 */
    57
     
    662664 *
    663665 * @returns Whether the new expiration time was set or not.
    664  * @param   pThis               HDA state.
    665  * @param   pStream             HDA stream to set timer for.
    666  * @param   tsExpire            New (virtual) expiration time to set.
    667  * @param   fForce              Whether to force setting the expiration time or not.
     666 * @param   pDevIns     The device instance.
     667 * @param   pThis       HDA state.
     668 * @param   pStream     HDA stream to set timer for.
     669 * @param   tsExpire    New (virtual) expiration time to set.
     670 * @param   fForce      Whether to force setting the expiration time or not.
    668671 *
    669672 * @remark  This function takes all active HDA streams and their
     
    676679 *          Forcing a new expiration time will override the above mechanism.
    677680 */
    678 bool hdaR3TimerSet(PHDASTATE pThis, PHDASTREAM pStream, uint64_t tsExpire, bool fForce)
    679 {
    680     AssertPtrReturn(pThis, false);
    681     AssertPtrReturn(pStream, false);
     681bool hdaR3TimerSet(PPDMDEVINS pDevIns, PHDASTATE pThis, PHDASTREAM pStream, uint64_t tsExpire, bool fForce)
     682{
     683    AssertPtr(pThis);
     684    AssertPtr(pStream);
    682685
    683686    uint64_t tsExpireMin = tsExpire;
     
    685688    if (!fForce)
    686689    {
    687         if (hdaR3StreamTransferIsScheduled(pStream))
    688             tsExpireMin = RT_MIN(tsExpireMin, hdaR3StreamTransferGetNext(pStream));
    689     }
    690 
    691     AssertPtr(pThis->pTimer[pStream->u8SD]);
    692 
    693     const uint64_t tsNow = TMTimerGet(pThis->pTimer[pStream->u8SD]);
     690        /** @todo r=bird: hdaR3StreamTransferIsScheduled() also does a
     691         * PDMDevHlpTimerGet(), so, some callers does one, this does, and then we do
     692         * right afterwards == very inefficient! */
     693        if (hdaR3StreamTransferIsScheduled(pDevIns, pStream))
     694        {
     695            uint64_t const tsNext = hdaR3StreamTransferGetNext(pStream);
     696            if (tsExpireMin > tsNext)
     697                tsExpireMin = tsNext;
     698        }
     699    }
     700
     701    const uint64_t tsNow = PDMDevHlpTimerGet(pDevIns, pStream->hTimer);
    694702
    695703    /*
     
    700708        tsExpireMin = tsNow;
    701709
    702     int rc = TMTimerSet(pThis->pTimer[pStream->u8SD], tsExpireMin);
    703     AssertRC(rc);
    704 
    705     return RT_SUCCESS(rc);
     710    int rc = PDMDevHlpTimerSet(pDevIns, pStream->hTimer, tsExpireMin);
     711    AssertRCReturn(rc, false);
     712
     713    return true;
    706714}
    707715
  • trunk/src/VBox/Devices/Audio/DevHDACommon.h

    r80692 r82331  
    653653 */
    654654#ifdef IN_RING3
    655 bool          hdaR3TimerSet(PHDASTATE pThis, PHDASTREAM pStream, uint64_t u64Expire, bool fForce);
    656 #endif /* IN_RING3 */
     655bool          hdaR3TimerSet(PPDMDEVINS pDevIns, PHDASTATE pThis, PHDASTREAM pStream, uint64_t u64Expire, bool fForce);
     656#endif
    657657/** @} */
    658658
  • trunk/src/VBox/Devices/Audio/HDAStream.cpp

    r82324 r82331  
    5454    pStream->pMixSink       = NULL;
    5555    pStream->pHDAState      = pThis;
    56     pStream->pTimer         = pThis->pTimer[u8SD];
    57     AssertPtr(pStream->pTimer);
     56    pStream->hTimer         = pThis->ahTimers[u8SD];
    5857
    5958    pStream->State.fInReset = false;
     
    189188 * @returns IPRT status code. VINF_NO_CHANGE if the stream does not need (re-)initialization because the stream's (hardware)
    190189 *          parameters did not change.
    191  * @param   pStream             HDA stream to initialize.
    192  * @param   uSD                 SD (stream descriptor) number to assign the HDA stream to.
    193  */
    194 int hdaR3StreamInit(PHDASTREAM pStream, uint8_t uSD)
     190 * @param   pDevIns The device instance.
     191 * @param   pStream HDA stream to initialize.
     192 * @param   uSD     SD (stream descriptor) number to assign the HDA stream to.
     193 */
     194int hdaR3StreamInit(PPDMDEVINS pDevIns, PHDASTREAM pStream, uint8_t uSD)
    195195{
    196196    AssertPtrReturn(pStream, VERR_INVALID_POINTER);
     
    464464                    pStream->State.cbTransferChunk = pStream->State.cbTransferSize;
    465465
    466                 const uint64_t cTicksPerHz = TMTimerGetFreq(pStream->pTimer) / pStream->State.uTimerHz;
     466                const uint64_t cTicksPerHz = PDMDevHlpTimerGetFreq(pDevIns, pStream->hTimer) / pStream->State.uTimerHz;
    467467
    468468                /* Calculate the timer ticks per byte for this stream. */
     
    715715/**
    716716 * Returns whether a next transfer for a given stream is scheduled or not.
     717 *
    717718 * This takes pending stream interrupts into account as well as the next scheduled
    718719 * transfer timestamp.
    719720 *
    720721 * @returns True if a next transfer is scheduled, false if not.
     722 * @param   pDevIns             The device instance.
    721723 * @param   pStream             HDA stream to retrieve schedule status for.
    722724 */
    723 bool hdaR3StreamTransferIsScheduled(PHDASTREAM pStream)
     725bool hdaR3StreamTransferIsScheduled(PPDMDEVINS pDevIns, PHDASTREAM pStream)
    724726{
    725727    if (pStream)
     
    735737            }
    736738
    737             const uint64_t tsNow = TMTimerGet(pStream->pTimer);
     739            const uint64_t tsNow = PDMDevHlpTimerGet(pDevIns, pStream->hTimer);
    738740            if (pStream->State.tsTransferNext > tsNow)
    739741            {
     
    908910 *
    909911 * @returns IPRT status code.
     912 * @param   pDevIns             The device instance.
    910913 * @param   pStream             HDA stream to update.
    911914 * @param   cbToProcessMax      How much data (in bytes) to process as maximum.
    912915 */
    913 int hdaR3StreamTransfer(PHDASTREAM pStream, uint32_t cbToProcessMax)
     916int hdaR3StreamTransfer(PPDMDEVINS pDevIns, PHDASTREAM pStream, uint32_t cbToProcessMax)
    914917{
    915918    AssertPtrReturn(pStream, VERR_INVALID_POINTER);
     
    945948    }
    946949
    947     const uint64_t tsNow = TMTimerGet(pStream->pTimer);
     950    const uint64_t tsNow = PDMDevHlpTimerGet(pDevIns, pStream->hTimer);
    948951
    949952    if (!pStream->State.tsTransferLast)
     
    13761379
    13771380        LogFunc(("Timer set SD%RU8\n", pStream->u8SD));
    1378         hdaR3TimerSet(pStream->pHDAState, pStream, tsTransferNext, false /* fForce */);
     1381        hdaR3TimerSet(pDevIns, pStream->pHDAState, pStream, tsTransferNext, false /* fForce */);
    13791382
    13801383        pStream->State.tsTransferNext = tsTransferNext;
     
    14131416 * (with fInTimer set to @c false).
    14141417 *
    1415  * @param   pStream             HDA stream to update.
    1416  * @param   fInTimer            Whether to this function was called from the timer
    1417  *                              context or an asynchronous I/O stream thread (if supported).
    1418  */
    1419 void hdaR3StreamUpdate(PHDASTREAM pStream, bool fInTimer)
     1418 * @param   pDevIns     The device instance.
     1419 * @param   pStream     HDA stream to update.
     1420 * @param   fInTimer    Whether to this function was called from the timer
     1421 *                      context or an asynchronous I/O stream thread (if supported).
     1422 */
     1423void hdaR3StreamUpdate(PPDMDEVINS pDevIns, PHDASTREAM pStream, bool fInTimer)
    14201424{
    14211425    if (!pStream)
     
    14461450            {
    14471451                /* Do the DMA transfer. */
    1448                 rc2 = hdaR3StreamTransfer(pStream, cbStreamFree);
     1452                rc2 = hdaR3StreamTransfer(pDevIns, pStream, cbStreamFree);
    14491453                AssertRC(rc2);
    14501454            }
     
    15671571            if (cbStreamUsed)
    15681572            {
    1569                 rc2 = hdaR3StreamTransfer(pStream, cbStreamUsed);
     1573                rc2 = hdaR3StreamTransfer(pDevIns, pStream, cbStreamUsed);
    15701574                AssertRC(rc2);
    15711575            }
     
    18231827    PHDASTREAMTHREADCTX pCtx = (PHDASTREAMTHREADCTX)pvUser;
    18241828    AssertPtr(pCtx);
    1825 
    18261829    PHDASTREAM pStream = pCtx->pStream;
     1830
    18271831    AssertPtr(pStream);
    1828 
    1829     PHDASTREAMSTATEAIO pAIO = &pCtx->pStream->State.AIO;
     1832    PHDASTREAMSTATEAIO pAIO = &pStream->State.AIO;
     1833
     1834    PPDMDEVINS pDevIns = pCtx->pThis->pDevInsR3;
    18301835
    18311836    ASMAtomicXchgBool(&pAIO->fStarted, true);
     
    18531858            }
    18541859
    1855             hdaR3StreamUpdate(pStream, false /* fInTimer */);
     1860            hdaR3StreamUpdate(pDevIns, pStream, false /* fInTimer */);
    18561861
    18571862            int rc3 = RTCritSectLeave(&pAIO->CritSect);
  • trunk/src/VBox/Devices/Audio/HDAStream.h

    r76565 r82331  
    188188
    189189/**
    190  * Structure for keeping a HDA stream (SDI / SDO).
     190 * An HDA stream (SDI / SDO).
    191191 *
    192  * Note: This HDA stream has nothing to do with a regular audio stream handled
    193  * by the audio connector or the audio mixer. This HDA stream is a serial data in/out
    194  * stream (SDI/SDO) defined in hardware and can contain multiple audio streams
    195  * in one single SDI/SDO (interleaving streams).
     192 * @note This HDA stream has nothing to do with a regular audio stream handled
     193 *       by the audio connector or the audio mixer. This HDA stream is a serial
     194 *       data in/out stream (SDI/SDO) defined in hardware and can contain
     195 *       multiple audio streams in one single SDI/SDO (interleaving streams).
    196196 *
    197197 * How a specific SDI/SDO is mapped to our internal audio streams relies on the
    198198 * stream channel mappings.
    199199 *
    200  * Contains only register values which do *not* change until a
    201  * stream reset occurs.
     200 * Contains only register values which do *not* change until a stream reset
     201 * occurs.
    202202 */
    203203typedef struct HDASTREAM
     
    235235    /** Pointer to HDA sink this stream is attached to. */
    236236    R3PTRTYPE(PHDAMIXERSINK) pMixSink;
     237    /** Stream's timer (copy of HDASTATE::ahTimers[u8SD]). */
     238    TMTIMERHANDLE            hTimer;
    237239    /** The stream'S critical section to serialize access. */
    238240    RTCRITSECT               CritSect;
    239     /** Pointer to the stream's timer. */
    240     PTMTIMERR3               pTimer;
    241241    /** Internal state of this stream. */
    242242    HDASTREAMSTATE           State;
    243243    /** Debug information. */
    244244    HDASTREAMDBGINFO         Dbg;
    245 } HDASTREAM, *PHDASTREAM;
     245} HDASTREAM;
     246/** Pointer to an HDA stream (SDI / SDO).  */
     247typedef HDASTREAM *PHDASTREAM;
    246248
    247249#ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
     
    263265int               hdaR3StreamCreate(PHDASTREAM pStream, PHDASTATE pThis, uint8_t u8SD);
    264266void              hdaR3StreamDestroy(PHDASTREAM pStream);
    265 int               hdaR3StreamInit(PHDASTREAM pStream, uint8_t uSD);
     267int               hdaR3StreamInit(PPDMDEVINS pDevIns, PHDASTREAM pStream, uint8_t uSD);
    266268void              hdaR3StreamReset(PHDASTATE pThis, PHDASTREAM pStream, uint8_t uSD);
    267269int               hdaR3StreamEnable(PHDASTREAM pStream, bool fEnable);
     
    270272uint32_t          hdaR3StreamGetFree(PHDASTREAM pStream);
    271273uint32_t          hdaR3StreamGetUsed(PHDASTREAM pStream);
    272 bool              hdaR3StreamTransferIsScheduled(PHDASTREAM pStream);
     274bool              hdaR3StreamTransferIsScheduled(PPDMDEVINS pDevIns, PHDASTREAM pStream);
    273275uint64_t          hdaR3StreamTransferGetNext(PHDASTREAM pStream);
    274 int               hdaR3StreamTransfer(PHDASTREAM pStream, uint32_t cbToProcessMax);
     276int               hdaR3StreamTransfer(PPDMDEVINS pDevIns, PHDASTREAM pStream, uint32_t cbToProcessMax);
    275277void              hdaR3StreamLock(PHDASTREAM pStream);
    276278void              hdaR3StreamUnlock(PHDASTREAM pStream);
    277279int               hdaR3StreamRead(PHDASTREAM pStream, uint32_t cbToRead, uint32_t *pcbRead);
    278280int               hdaR3StreamWrite(PHDASTREAM pStream, const void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten);
    279 void              hdaR3StreamUpdate(PHDASTREAM pStream, bool fAsync);
     281void              hdaR3StreamUpdate(PPDMDEVINS pDevIns, PHDASTREAM pStream, bool fAsync);
    280282# ifdef HDA_USE_DMA_ACCESS_HANDLER
    281283bool              hdaR3StreamRegisterDMAHandlers(PHDASTREAM pStream);
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