Changeset 75606 in vbox
- Timestamp:
- Nov 20, 2018 10:26:04 AM (6 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 6 edited
-
Audio/DevHDA.cpp (modified) (3 diffs)
-
Audio/DevHDA.h (modified) (1 diff)
-
Audio/DevIchAc97.cpp (modified) (17 diffs)
-
Audio/DrvHostCoreAudio.cpp (modified) (1 diff)
-
Audio/HDAStream.cpp (modified) (5 diffs)
-
testcase/tstDeviceStructSizeRC.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevHDA.cpp
r75422 r75606 1551 1551 LogRelMax2(64, ("HDA: Stream #%RU8 interrupt lagging behind (expected %uus, got %uus), trying to catch up ...\n", 1552 1552 pStream->u8SD, 1553 (TMTimerGetFreq(pThis->pTimer[pStream->u8SD]) / pThis->u 16TimerHz) / 1000,(tsNow - pStream->State.tsTransferLast) / 1000));1553 (TMTimerGetFreq(pThis->pTimer[pStream->u8SD]) / pThis->uTimerHz) / 1000,(tsNow - pStream->State.tsTransferLast) / 1000)); 1554 1554 1555 1555 cTicksToNext = 0; … … 2927 2927 hdaR3TimerSet(pThis, pStream, 2928 2928 TMTimerGet(pThis->pTimer[pStream->u8SD]) 2929 + TMTimerGetFreq(pThis->pTimer[pStream->u8SD]) / pStream->pHDAState->u 16TimerHz,2929 + TMTimerGetFreq(pThis->pTimer[pStream->u8SD]) / pStream->pHDAState->uTimerHz, 2930 2930 true /* fForce */); 2931 2931 } … … 4933 4933 4934 4934 4935 rc = CFGMR3QueryU16Def(pCfg, "TimerHz", &pThis->u 16TimerHz, HDA_TIMER_HZ_DEFAULT /* Default value, if not set. */);4935 rc = CFGMR3QueryU16Def(pCfg, "TimerHz", &pThis->uTimerHz, HDA_TIMER_HZ_DEFAULT /* Default value, if not set. */); 4936 4936 if (RT_FAILURE(rc)) 4937 4937 return PDMDEV_SET_ERROR(pDevIns, rc, 4938 4938 N_("HDA configuration error: failed to read Hertz (Hz) rate as unsigned integer")); 4939 4939 4940 if (pThis->u 16TimerHz != HDA_TIMER_HZ_DEFAULT)4941 LogRel(("HDA: Using custom device timer rate (%RU16Hz)\n", pThis->u 16TimerHz));4940 if (pThis->uTimerHz != HDA_TIMER_HZ_DEFAULT) 4941 LogRel(("HDA: Using custom device timer rate (%RU16Hz)\n", pThis->uTimerHz)); 4942 4942 4943 4943 rc = CFGMR3QueryBoolDef(pCfg, "PosAdjustEnabled", &pThis->fPosAdjustEnabled, true); -
trunk/src/VBox/Devices/Audio/DevHDA.h
r71730 r75606 203 203 uint8_t u8IRQL; 204 204 /** The device timer Hz rate. Defaults to HDA_TIMER_HZ_DEFAULT. */ 205 uint16_t u 16TimerHz;205 uint16_t uTimerHz; 206 206 /** Padding for alignment. */ 207 207 uint8_t au8Padding3[3]; -
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r74066 r75606 51 51 52 52 /** Default timer frequency (in Hz). */ 53 #define AC97_TIMER_HZ 20053 #define AC97_TIMER_HZ_DEFAULT 200 54 54 55 55 /** Maximum FIFO size (in bytes). */ … … 472 472 /** Number of active (running) SDn streams. */ 473 473 uint8_t cStreamsActive; 474 #ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS475 474 /** Flag indicating whether the timer is active or not. */ 476 475 bool fTimerActive; 477 uint8_t u8Padding1[2]; 476 /** The device timer Hz rate. Defaults to AC97_TIMER_HZ_DEFAULT_DEFAULT. */ 477 uint16_t uTimerHz; 478 478 /** The timer for pumping data thru the attached LUN drivers - RCPtr. */ 479 479 PTMTIMERRC pTimerRC; … … 487 487 * Used to calculate the time actually elapsed between two timer callbacks. */ 488 488 uint64_t uTimerTS; 489 #endif490 489 #ifdef VBOX_WITH_STATISTICS 491 490 STAMPROFILE StatTimer; … … 636 635 637 636 static DECLCALLBACK(void) ichac97R3Reset(PPDMDEVINS pDevIns); 638 # ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS 637 639 638 static int ichac97R3TimerStart(PAC97STATE pThis); 640 639 static int ichac97R3TimerMaybeStart(PAC97STATE pThis); … … 643 642 static void ichac97R3TimerMain(PAC97STATE pThis); 644 643 static DECLCALLBACK(void) ichac97R3Timer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser); 645 # endif 644 646 645 static void ichac97R3DoTransfers(PAC97STATE pThis); 647 646 … … 877 876 ichac97R3StreamUnlock(pStream); 878 877 879 # ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS880 878 /* Second, see if we need to start or stop the timer. */ 881 879 if (!fEnable) … … 883 881 else 884 882 ichac97R3TimerMaybeStart(pThis); 885 # endif886 883 887 884 LogFunc(("[SD%RU8] cStreamsActive=%RU8, fEnable=%RTbool, rc=%Rrc\n", pStream->u8SD, pThis->cStreamsActive, fEnable, rc)); … … 1214 1211 1215 1212 PAC97STREAMSTATEAIO pAIO = &pCtx->pStream->State.AIO; 1216 1217 PRTCIRCBUF pCircBuf = pStream->State.pCircBuf;1218 AssertPtr(pCircBuf);1219 1220 PAUDMIXSINK pMixSink = ichac97R3IndexToSink(pThis, pStream->u8SD);1221 AssertPtr(pMixSink);1222 1213 1223 1214 ASMAtomicXchgBool(&pAIO->fStarted, true); … … 1926 1917 1927 1918 /* Set scheduling hint (if available). */ 1928 if (pThis-> cTimerTicks)1929 pCfg->Device.uSchedulingHintMs = 1000 /* ms */ / (TMTimerGetFreq(pThis->pTimerR3) / pThis->cTimerTicks);1919 if (pThis->uTimerHz) 1920 pCfg->Device.uSchedulingHintMs = 1000 /* ms */ / pThis->uTimerHz; 1930 1921 1931 1922 switch (pStream->u8SD) … … 2413 2404 # endif /* Unused */ 2414 2405 2415 # ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS2416 2417 2406 /** 2418 2407 * Starts the internal audio device timer. … … 2584 2573 ichac97R3TimerMain(pThis); 2585 2574 } 2586 2587 # endif /* !VBOX_WITH_AUDIO_AC97_CALLBACKS */2588 2575 2589 2576 /** … … 3744 3731 AudioMixerSinkReset(pThis->pSinkOut); 3745 3732 3746 # ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS3747 3733 /* 3748 3734 * Stop the timer, if any. … … 3751 3737 3752 3738 pThis->cStreamsActive = 0; 3753 # endif3754 3739 } 3755 3740 … … 4014 3999 PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE); 4015 4000 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 4016 # ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS 4017 pThis->pTimerRC = TMTimerRCPtr(pThis->pTimerR3); 4018 # endif 4001 pThis->pTimerRC = TMTimerRCPtr(pThis->pTimerR3); 4019 4002 } 4020 4003 … … 4085 4068 N_("AC'97 configuration error: Querying \"Codec\" as string failed")); 4086 4069 4087 # ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS 4088 uint16_t uTimerHz; 4089 rc = CFGMR3QueryU16Def(pCfg, "TimerHz", &uTimerHz, AC97_TIMER_HZ /* Default value, if not set. */); 4070 rc = CFGMR3QueryU16Def(pCfg, "TimerHz", &pThis->uTimerHz, AC97_TIMER_HZ_DEFAULT /* Default value, if not set. */); 4090 4071 if (RT_FAILURE(rc)) 4091 4072 return PDMDEV_SET_ERROR(pDevIns, rc, 4092 4073 N_("AC'97 configuration error: failed to read Hertz (Hz) rate as unsigned integer")); 4093 4074 4094 if (uTimerHz != AC97_TIMER_HZ) 4095 LogRel(("AC97: Using custom device timer rate (%RU16Hz)\n", uTimerHz)); 4096 # endif 4075 if (pThis->uTimerHz != AC97_TIMER_HZ_DEFAULT) 4076 LogRel(("AC97: Using custom device timer rate (%RU16Hz)\n", pThis->uTimerHz)); 4097 4077 4098 4078 rc = CFGMR3QueryBoolDef(pCfg, "DebugEnabled", &pThis->Dbg.fEnabled, false); … … 4354 4334 ichac97R3Reset(pDevIns); 4355 4335 4356 # ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS4357 4336 if (RT_SUCCESS(rc)) 4358 4337 { … … 4374 4353 AssertRCReturn(rc, rc); 4375 4354 4376 pThis->cTimerTicks = TMTimerGetFreq(pThis->pTimerR3) / uTimerHz;4355 pThis->cTimerTicks = TMTimerGetFreq(pThis->pTimerR3) / pThis->uTimerHz; 4377 4356 pThis->uTimerTS = TMTimerGet(pThis->pTimerR3); 4378 LogFunc(("Timer ticks=%RU64 (%RU16 Hz)\n", pThis->cTimerTicks, uTimerHz)); 4379 } 4380 # else /* !VBOX_WITH_AUDIO_AC97_CALLBACKS */ 4381 if (RT_SUCCESS(rc)) 4382 { 4383 PAC97DRIVER pDrv; 4384 RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node) 4385 { 4386 /* Only register primary driver. 4387 * The device emulation does the output multiplexing then. */ 4388 if (!(pDrv->fFlags & PDMAUDIODRVFLAGS_PRIMARY)) 4389 continue; 4390 4391 PDMAUDIOCBRECORD AudioCallbacks[2]; 4392 4393 AC97CALLBACKCTX Ctx = { pThis, pDrv }; 4394 4395 AudioCallbacks[0].enmType = PDMAUDIOCALLBACKTYPE_INPUT; 4396 AudioCallbacks[0].pfnCallback = ac97CallbackInput; 4397 AudioCallbacks[0].pvCtx = &Ctx; 4398 AudioCallbacks[0].cbCtx = sizeof(AC97CALLBACKCTX); 4399 4400 AudioCallbacks[1].enmType = PDMAUDIOCALLBACKTYPE_OUTPUT; 4401 AudioCallbacks[1].pfnCallback = ac97CallbackOutput; 4402 AudioCallbacks[1].pvCtx = &Ctx; 4403 AudioCallbacks[1].cbCtx = sizeof(AC97CALLBACKCTX); 4404 4405 rc = pDrv->pConnector->pfnRegisterCallbacks(pDrv->pConnector, AudioCallbacks, RT_ELEMENTS(AudioCallbacks)); 4406 if (RT_FAILURE(rc)) 4407 break; 4408 } 4409 } 4410 # endif /* VBOX_WITH_AUDIO_AC97_CALLBACKS */ 4357 LogFunc(("Timer ticks=%RU64 (%RU16 Hz)\n", pThis->cTimerTicks, pThis->uTimerHz)); 4358 } 4411 4359 4412 4360 # ifdef VBOX_WITH_STATISTICS -
trunk/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp
r75318 r75606 1596 1596 } 1597 1597 1598 rc = RTCircBufCreate(&pCAStream->pCircBuf, PDMAUDIOSTREAMCFG_F2B(pCfgReq, 4096)); /** @todo Make this configurable. */1598 rc = RTCircBufCreate(&pCAStream->pCircBuf, PDMAUDIOSTREAMCFG_F2B(pCfgReq, pCfgReq->Backend.cfBufferSize)); 1599 1599 if (RT_FAILURE(rc)) 1600 1600 return rc; -
trunk/src/VBox/Devices/Audio/HDAStream.cpp
r74037 r75606 198 198 199 199 /* Set scheduling hint (if available). */ 200 if (pThis->u 16TimerHz)201 pCfg->Device.uSchedulingHintMs = 1000 /* ms */ / pThis->u 16TimerHz;200 if (pThis->uTimerHz) 201 pCfg->Device.uSchedulingHintMs = 1000 /* ms */ / pThis->uTimerHz; 202 202 203 203 /* (Re-)Allocate the stream's internal DMA buffer, based on the PCM properties we just got above. */ … … 274 274 { 275 275 /* Make sure that the chosen Hz rate dividable by the stream's rate. */ 276 if (pStream->State.Cfg.Props.uHz % pThis->u 16TimerHz != 0)276 if (pStream->State.Cfg.Props.uHz % pThis->uTimerHz != 0) 277 277 LogRel(("HDA: Device timer (%RU32) does not fit to stream #RU8 timing (%RU32)\n", 278 pThis->u 16TimerHz, pStream->State.Cfg.Props.uHz));278 pThis->uTimerHz, pStream->State.Cfg.Props.uHz)); 279 279 280 280 /* Figure out how many transfer fragments we're going to use for this stream. */ … … 369 369 /* Calculate the bytes we need to transfer to / from the stream's DMA per iteration. 370 370 * This is bound to the device's Hz rate and thus to the (virtual) timing the device expects. */ 371 pStream->State.cbTransferChunk = (pStream->State.Cfg.Props.uHz / pThis->u 16TimerHz) * pStream->State.cbFrameSize;371 pStream->State.cbTransferChunk = (pStream->State.Cfg.Props.uHz / pThis->uTimerHz) * pStream->State.cbFrameSize; 372 372 Assert(pStream->State.cbTransferChunk); 373 373 Assert(pStream->State.cbTransferChunk % pStream->State.cbFrameSize == 0); … … 382 382 pStream->State.tsLastUpdateNs = 0; 383 383 384 const uint64_t cTicksPerHz = TMTimerGetFreq(pStream->pTimer) / pThis->u 16TimerHz;384 const uint64_t cTicksPerHz = TMTimerGetFreq(pStream->pTimer) / pThis->uTimerHz; 385 385 386 386 /* Calculate the timer ticks per byte for this stream. */ … … 398 398 LogFunc(("[SD%RU8] Timer %uHz (%RU64 ticks per Hz), cTicksPerByte=%RU64, cbTransferChunk=%RU32, cTransferTicks=%RU64, " \ 399 399 "cbTransferSize=%RU32\n", 400 pStream->u8SD, pThis->u 16TimerHz, cTicksPerHz, pStream->State.cTicksPerByte,400 pStream->u8SD, pThis->uTimerHz, cTicksPerHz, pStream->State.cTicksPerByte, 401 401 pStream->State.cbTransferChunk, pStream->State.cTransferTicks, pStream->State.cbTransferSize)); 402 402 -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
r75586 r75606 1917 1917 GEN_CHECK_OFF(AC97STATE, StreamOut); 1918 1918 GEN_CHECK_OFF(AC97STATE, cStreamsActive); 1919 #ifndef VBOX_WITH_AUDIO_AC97_CALLBACKS1920 1919 GEN_CHECK_OFF(AC97STATE, pTimerR3); 1921 1920 GEN_CHECK_OFF(AC97STATE, pTimerR0); 1922 1921 GEN_CHECK_OFF(AC97STATE, pTimerRC); 1923 1922 GEN_CHECK_OFF(AC97STATE, fTimerActive); 1924 GEN_CHECK_OFF(AC97STATE, u 8Padding1);1923 GEN_CHECK_OFF(AC97STATE, uTimerHz); 1925 1924 GEN_CHECK_OFF(AC97STATE, cTimerTicks); 1926 1925 GEN_CHECK_OFF(AC97STATE, uTimerTS); 1927 #endif1928 1926 #ifdef VBOX_WITH_STATISTICS 1929 1927 GEN_CHECK_OFF(AC97STATE, StatTimer);
Note:
See TracChangeset
for help on using the changeset viewer.

