VirtualBox

Ignore:
Timestamp:
Sep 10, 2019 9:01:42 AM (5 years ago)
Author:
vboxsync
Message:

Audio/AC97: Try to relax (EACS VRA / VRM) capabilities / checks to make it more compatible.

File:
1 edited

Legend:

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

    r80609 r80688  
    25362536
    25372537    /* Configure Extended Audio ID (EAID) + Control & Status (EACS) registers. */
    2538     uint16_t fEAID = AC97_EAID_REV1; /* Our hardware is AC'97 rev2.3 compliant. */
    2539     uint16_t fEACS = 0;
    2540 #ifdef VBOX_WITH_AC97_VRA
    2541     fEAID |= AC97_EAID_VRA; /* Variable Rate PCM Audio capable. */
    2542     fEACS |= AC97_EACS_VRA; /* Ditto. */
    2543 #endif
    2544 #ifdef VBOX_WITH_AC97_VRM
    2545     fEAID |= AC97_EAID_VRM; /* Variable Rate Mic-In Audio capable. */
    2546     fEACS |= AC97_EACS_VRM; /* Ditto. */
    2547 #endif
     2538    const uint16_t fEAID = AC97_EAID_REV1;                /* Our hardware is AC'97 rev2.3 compliant. */
     2539    const uint16_t fEACS = AC97_EAID_VRA | AC97_EAID_VRM; /* Variable Rate PCM Audio (VRA) + Mic-In (VRM) capable. */
    25482540
    25492541    ichac97MixerSet(pThis, AC97_Extended_Audio_ID,        fEAID);
    25502542    ichac97MixerSet(pThis, AC97_Extended_Audio_Ctrl_Stat, fEACS);
    2551     ichac97MixerSet(pThis, AC97_PCM_Front_DAC_Rate      , 0xbb80);
    2552     ichac97MixerSet(pThis, AC97_PCM_Surround_DAC_Rate   , 0xbb80);
    2553     ichac97MixerSet(pThis, AC97_PCM_LFE_DAC_Rate        , 0xbb80);
    2554     ichac97MixerSet(pThis, AC97_PCM_LR_ADC_Rate         , 0xbb80);
    2555     ichac97MixerSet(pThis, AC97_MIC_ADC_Rate            , 0xbb80);
     2543    ichac97MixerSet(pThis, AC97_PCM_Front_DAC_Rate      , 0xbb80 /* 48000 Hz by default */);
     2544    ichac97MixerSet(pThis, AC97_PCM_Surround_DAC_Rate   , 0xbb80 /* 48000 Hz by default */);
     2545    ichac97MixerSet(pThis, AC97_PCM_LFE_DAC_Rate        , 0xbb80 /* 48000 Hz by default */);
     2546    ichac97MixerSet(pThis, AC97_PCM_LR_ADC_Rate         , 0xbb80 /* 48000 Hz by default */);
     2547    ichac97MixerSet(pThis, AC97_MIC_ADC_Rate            , 0xbb80 /* 48000 Hz by default */);
    25562548
    25572549    if (pThis->uCodecModel == AC97_CODEC_AD1980)
     
    35073499                     * Handle VRA bits.
    35083500                     */
    3509 # ifndef VBOX_WITH_AC97_VRA
    3510                     if (u32Val & AC97_EACS_VRA)
     3501                    if (!(u32Val & AC97_EACS_VRA)) /* Check if VRA bit is not set. */
    35113502                    {
    3512                         u32Val &= ~AC97_EACS_VRA; /* Only clear VRA bit and keep the rest. */
    3513                         LogRel2(("AC97: Variable rate audio (VRA) is not supported, setting to 0x%x\n", u32Val));
     3503                        ichac97MixerSet(pThis, AC97_PCM_Front_DAC_Rate, 0xbb80); /* Set default (48000 Hz). */
     3504                        ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PO_INDEX], true /* fForce */);
     3505
     3506                        ichac97MixerSet(pThis, AC97_PCM_LR_ADC_Rate, 0xbb80); /* Set default (48000 Hz). */
     3507                        ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PI_INDEX], true /* fForce */);
    35143508                    }
    3515 
    3516                     ichac97MixerSet(pThis, AC97_PCM_Front_DAC_Rate, 0xbb80); /* Set default (48000 Hz). */
    3517                     ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PO_INDEX], true /* fForce */);
    3518 
    3519                     ichac97MixerSet(pThis, AC97_PCM_LR_ADC_Rate, 0xbb80); /* Set default (48000 Hz). */
    3520                     ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PI_INDEX], true /* fForce */);
    3521 # else
    3522 #  error            "Implement EACS VRA support!"
    3523 # endif
     3509                    else
     3510                        LogRel2(("AC97: Variable rate audio (VRA) is not supported\n"));
     3511
    35243512                    /*
    35253513                     * Handle VRM bits.
    35263514                     */
    3527 # ifndef VBOX_WITH_AC97_VRM
    3528                     if (u32Val & AC97_EACS_VRM)
     3515                    if (!(u32Val & AC97_EACS_VRM)) /* Check if VRM bit is not set. */
    35293516                    {
    3530                         u32Val &= ~AC97_EACS_VRM; /* Only clear VRM bit and keep the rest. */
    3531                         LogRel2(("AC97: Variable rate microphone audio (VRM) is not supported, setting to 0x%x\n", u32Val));
     3517                        ichac97MixerSet(pThis, AC97_MIC_ADC_Rate, 0xbb80); /* Set default (48000 Hz). */
     3518                        ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_MC_INDEX], true /* fForce */);
    35323519                    }
    3533 
    3534                     ichac97MixerSet(pThis, AC97_MIC_ADC_Rate, 0xbb80); /* Set default (48000 Hz). */
    3535                     ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_MC_INDEX], true /* fForce */);
    3536 # else
    3537 #  error            "Implement EACS VRM support!"
    3538 # endif
     3520                    else
     3521                        LogRel2(("AC97: Variable rate microphone audio (VRM) is not supported\n"));
     3522
    35393523                    LogRel2(("AC97: Setting extended audio control to %#x\n", u32Val));
    3540 
    35413524                    ichac97MixerSet(pThis, AC97_Extended_Audio_Ctrl_Stat, u32Val);
    35423525#else /* !IN_RING3 */
     
    35483531                    if (ichac97MixerGet(pThis, AC97_Extended_Audio_Ctrl_Stat) & AC97_EACS_VRA)
    35493532                    {
     3533                        LogRel2(("AC97: Setting front DAC rate to 0x%x\n", u32Val));
    35503534                        ichac97MixerSet(pThis, uPortIdx, u32Val);
    3551                         LogRel2(("AC97: Setting front DAC rate to 0x%x\n", u32Val));
     3535                        ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PO_INDEX], true /* fForce */);
    35523536                    }
    35533537                    else
    35543538                        LogRel2(("AC97: Setting front DAC rate (0x%x) when VRA is not set is forbidden, ignoring\n", u32Val));
    3555 
    3556                     /* Note: Some guest OSes seem to ignore our codec capabilities (EACS VRA) and try to
    3557                      *       set the VRA rate nevertheless. So re-open the output stream in any case to avoid
    3558                      *       breaking playback. */
    3559                     ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PO_INDEX], true /* fForce */);
    35603539#else
    35613540                    rc = VINF_IOM_R3_IOPORT_WRITE;
     
    35663545                    if (ichac97MixerGet(pThis, AC97_Extended_Audio_Ctrl_Stat) & AC97_EACS_VRM)
    35673546                    {
     3547                        LogRel2(("AC97: Setting microphone ADC rate to 0x%x\n", u32Val));
    35683548                        ichac97MixerSet(pThis, uPortIdx, u32Val);
    3569                         LogRel2(("AC97: Setting microphone ADC rate to 0x%x\n", u32Val));
     3549                        ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_MC_INDEX], true /* fForce */);
    35703550                    }
    35713551                    else
    35723552                        LogRel2(("AC97: Setting microphone ADC rate (0x%x) when VRM is not set is forbidden, ignoring\n",
    35733553                                 u32Val));
    3574 
    3575                     /* Note: Some guest OSes seem to ignore our codec capabilities (EACS VRM) and try to
    3576                      *       set the VRM rate nevertheless. So re-open the mic-in stream in any case to avoid
    3577                      *       breaking recording.*/
    3578                     ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_MC_INDEX], true /* fForce */);
    35793554#else
    35803555                    rc = VINF_IOM_R3_IOPORT_WRITE;
     
    35853560                    if (ichac97MixerGet(pThis, AC97_Extended_Audio_Ctrl_Stat) & AC97_EACS_VRA)
    35863561                    {
     3562                        LogRel2(("AC97: Setting line-in ADC rate to 0x%x\n", u32Val));
    35873563                        ichac97MixerSet(pThis, uPortIdx, u32Val);
    3588                         LogRel2(("AC97: Setting line-in ADC rate to 0x%x\n", u32Val));
     3564                        ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PI_INDEX], true /* fForce */);
    35893565                    }
    35903566                    else
    35913567                        LogRel2(("AC97: Setting line-in ADC rate (0x%x) when VRA is not set is forbidden, ignoring\n", u32Val));
    3592 
    3593                     /* Note: Some guest OSes seem to ignore our codec capabilities (EACS VRA) and try to
    3594                      *       set the VRA rate nevertheless. So re-open the line-in stream in any case to avoid
    3595                      *       breaking recording.*/
    3596                     ichac97R3StreamReOpen(pThis, &pThis->aStreams[AC97SOUNDSOURCE_PI_INDEX], true /* fForce */);
    35973568#else
    35983569                    rc = VINF_IOM_R3_IOPORT_WRITE;
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