VirtualBox

Ignore:
Timestamp:
Dec 2, 2019 11:50:22 PM (5 years ago)
Author:
vboxsync
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
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