Changeset 82328 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Dec 2, 2019 5:05:58 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r82325 r82328 651 651 static void ichac97R3BDLEDumpAll(PAC97STATE pThis, uint64_t u64BDLBase, uint16_t cBDLE); 652 652 # endif 653 static bool ichac97R3TimerSet(PPDMDEVINS pDevIns, PAC97STATE pThis, PAC97STREAM pStream, uint64_t tsExpire, bool fForce);653 DECLINLINE(void) ichac97R3TimerSet(PPDMDEVINS pDevIns, PAC97STATE pThis, PAC97STREAM pStream, uint64_t cTicksToDeadline); 654 654 #endif /* IN_RING3 */ 655 655 … … 2606 2606 { 2607 2607 ichac97R3StreamTransferUpdate(pDevIns, pThis, pStream, pStream->Regs.picb << 1); /** @todo r=andy Assumes 16-bit samples. */ 2608 2609 ichac97R3TimerSet(pDevIns, pThis, pStream, 2610 PDMDevHlpTimerGet(pDevIns, RT_SAFE_SUBSCRIPT8(pThis->ahTimers, pStream->u8SD)) 2611 + pStream->State.cTransferTicks, 2612 false /* fForce */); 2608 ichac97R3TimerSet(pDevIns, pThis, pStream, pStream->State.cTransferTicks); 2613 2609 } 2614 2610 … … 2620 2616 * Sets the virtual device timer to a new expiration time. 2621 2617 * 2622 * @returns Whether the new expiration time was set or not.2623 2618 * @param pDevIns The device instance. 2624 2619 * @param pThis AC'97 state. 2625 2620 * @param pStream AC'97 stream to set timer for. 2626 * @param tsExpire New (virtual) expiration time to set. 2627 * @param fForce Whether to force setting the expiration time or not. 2628 * 2629 * @remark This function takes all active AC'97 streams and their 2630 * current timing into account. This is needed to make sure 2631 * that all streams can match their needed timing. 2632 * 2633 * To achieve this, the earliest (lowest) timestamp of all 2634 * active streams found will be used for the next scheduling slot. 2635 * 2636 * Forcing a new expiration time will override the above mechanism. 2637 */ 2638 static bool ichac97R3TimerSet(PPDMDEVINS pDevIns, PAC97STATE pThis, PAC97STREAM pStream, uint64_t tsExpire, bool fForce) 2639 { 2640 AssertPtrReturn(pThis, false); 2641 AssertPtrReturn(pStream, false); 2642 2643 RT_NOREF(fForce); 2644 2645 uint64_t tsExpireMin = tsExpire; 2646 2647 TMTIMERHANDLE const hTimer = RT_SAFE_SUBSCRIPT8(pThis->ahTimers, pStream->u8SD); 2648 /** @todo r=bird: This is rather silly given that all three callers just did 2649 * TimerGet + interval. */ 2650 const uint64_t tsNow = PDMDevHlpTimerGet(pDevIns, hTimer); 2651 2652 /* Make sure to not go backwards in time, as this will assert in TMTimerSet(). */ 2653 if (tsExpireMin < tsNow) 2654 tsExpireMin = tsNow; 2655 2656 int rc = PDMDevHlpTimerSet(pDevIns, hTimer, tsExpireMin); 2657 AssertRCReturn(rc, false); 2658 2659 return true; 2621 * @param cTicksToDeadline The number of ticks to the new deadline. 2622 * 2623 * @remarks This used to be more complicated a long time ago... 2624 */ 2625 DECLINLINE(void) ichac97R3TimerSet(PPDMDEVINS pDevIns, PAC97STATE pThis, PAC97STREAM pStream, uint64_t cTicksToDeadline) 2626 { 2627 int rc = PDMDevHlpTimerSetRelative(pDevIns, RT_SAFE_SUBSCRIPT8(pThis->ahTimers, pStream->u8SD), 2628 cTicksToDeadline, NULL /*pu64Now*/); 2629 AssertRC(rc); 2660 2630 } 2661 2631 … … 3147 3117 /* Arm the timer for this stream. */ 3148 3118 /** @todo r=bird: This function returns bool, not VBox status! */ 3149 int rc2 = ichac97R3TimerSet(pDevIns, pThis, pStream, 3150 PDMDevHlpTimerGet(pDevIns, RT_SAFE_SUBSCRIPT8(pThis->ahTimers, 3151 pStream->u8SD)) 3152 + pStream->State.cTransferTicks, 3153 false /* fForce */); 3154 AssertRC(rc2); 3119 ichac97R3TimerSet(pDevIns, pThis, pStream, pStream->State.cTransferTicks); 3155 3120 } 3156 3121 } … … 3640 3605 3641 3606 rc2 = ichac97R3StreamEnable(pThis, pStream, fEnable); 3607 AssertRC(rc2); 3642 3608 if ( fEnable 3643 3609 && RT_SUCCESS(rc2)) … … 3645 3611 /* Re-arm the timer for this stream. */ 3646 3612 /** @todo r=bird: This function returns bool, not VBox status! */ 3647 rc2 = ichac97R3TimerSet(pDevIns, pThis, pStream, 3648 PDMDevHlpTimerGet(pDevIns, RT_SAFE_SUBSCRIPT8(pThis->ahTimers, pStream->u8SD)) 3649 + pStream->State.cTransferTicks, 3650 false /* fForce */); 3651 } 3652 3653 AssertRC(rc2); 3613 ichac97R3TimerSet(pDevIns, pThis, pStream, pStream->State.cTransferTicks); 3614 } 3615 3654 3616 /* Keep going. */ 3655 3617 }
Note:
See TracChangeset
for help on using the changeset viewer.