VirtualBox

Changeset 88934 in vbox for trunk


Ignore:
Timestamp:
May 7, 2021 4:15:46 PM (4 years ago)
Author:
vboxsync
Message:

DevHda: Made VBOX_WITH_AUDIO_HDA_ASYNC_IO non-optional. bugref:9890

Location:
trunk/src/VBox/Devices
Files:
4 edited

Legend:

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

    r88919 r88934  
    13411341        STAM_REL_PROFILE_START_NS(&pStreamR3->State.StatReset, a);
    13421342        hdaStreamLock(pStreamShared);
    1343 
    1344 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    13451343        hdaR3StreamAsyncIOLock(pStreamR3);
    1346 # endif
     1344
    13471345        /* Deal with reset while running. */
    13481346        if (pStreamShared->State.fRunning)
     
    13551353        hdaR3StreamReset(pThis, pThisCC, pStreamShared, pStreamR3, uSD);
    13561354
    1357 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    13581355        hdaR3StreamAsyncIOUnlock(pStreamR3);
    1359 # endif
    13601356        hdaStreamUnlock(pStreamShared);
    13611357        STAM_REL_PROFILE_STOP_NS(&pStreamR3->State.StatReset, a);
     
    13751371
    13761372            int rc2 = VINF_SUCCESS;
    1377 
    1378 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    13791373            if (fRun)
    13801374                rc2 = hdaR3StreamAsyncIOCreate(pStreamR3);
    13811375
    13821376            hdaR3StreamAsyncIOLock(pStreamR3);
    1383 # endif
    13841377            if (fRun)
    13851378            {
     
    14661459            }
    14671460
    1468 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
     1461            /* Make sure to leave the lock before (eventually) starting the timer. */
    14691462            hdaR3StreamAsyncIOUnlock(pStreamR3);
    1470 # endif
    1471             /* Make sure to leave the lock before (eventually) starting the timer. */
    14721463            hdaStreamUnlock(pStreamShared);
    14731464            STAM_REL_PROFILE_STOP_NS((fRun ? &pStreamR3->State.StatStart : &pStreamR3->State.StatStop), r);
     
    28132804        PHDASTREAM const pStreamShared = &pThis->aStreams[idxStream];
    28142805        hdaStreamLock(pStreamShared);
    2815 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    28162806        hdaR3StreamAsyncIOLock(&pThisCC->aStreams[idxStream]);
    2817 # endif
    28182807
    28192808        /* We're doing this unconditionally, hope that's not problematic in any way... */
     
    28252814        hdaR3StreamReset(pThis, pThisCC, pStreamShared, &pThisCC->aStreams[idxStream], (uint8_t)idxStream);
    28262815
    2827 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    28282816        hdaR3StreamAsyncIOUnlock(&pThisCC->aStreams[idxStream]);
    2829 # endif
    28302817        hdaStreamUnlock(pStreamShared);
    28312818    }
     
    34113398        cbCircBuf = (uint32_t)RTCircBufSize(pStreamR3->State.pCircBuf);
    34123399
    3413 #ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    34143400        /* We take the AIO lock here and releases it after saving the buffer,
    34153401           otherwise the AIO thread could race us reading out the buffer data. */
    34163402        if (   !pStreamR3->State.AIO.fStarted
    34173403            || RT_SUCCESS(RTCritSectTryEnter(&pStreamR3->State.AIO.CritSect)))
    3418 #endif
    34193404        {
    34203405            cbCircBufUsed = (uint32_t)RTCircBufUsed(pStreamR3->State.pCircBuf);
    3421 #ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    34223406            if (cbCircBufUsed == 0 && pStreamR3->State.AIO.fStarted)
    34233407                RTCritSectLeave(&pStreamR3->State.AIO.CritSect);
    3424 #endif
    34253408        }
    34263409    }
     
    34453428        RTCircBufReleaseReadBlock(pStreamR3->State.pCircBuf, 0 /* Don't advance read pointer! */);
    34463429
    3447 #ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    34483430        if (pStreamR3->State.AIO.fStarted)
    34493431            RTCritSectLeave(&pStreamR3->State.AIO.CritSect);
    3450 #endif
    34513432    }
    34523433
     
    35163497            PHDASTREAMR3 pStreamR3 = &pThisCC->aStreams[i];
    35173498
    3518             int rc2;
    3519 #ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    35203499            /* Make sure to also create the async I/O thread before actually enabling the stream. */
    3521             rc2 = hdaR3StreamAsyncIOCreate(pStreamR3);
     3500            int rc2 = hdaR3StreamAsyncIOCreate(pStreamR3);
    35223501            AssertRC(rc2);
    35233502
    35243503            /* ... and enabling it. */
    35253504            hdaR3StreamAsyncIOEnable(pStreamR3, true /* fEnable */);
    3526 #endif
    35273505            /* (Re-)enable the stream. */
    35283506            rc2 = hdaR3StreamEnable(pThis, pStreamShared, pStreamR3, true /* fEnable */);
     
    49384916                                NULL /*pfnLoadPrep*/, hdaR3LoadExec, hdaR3LoadDone);
    49394917    AssertRCReturn(rc, rc);
    4940 
    4941 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    4942     LogRel(("HDA: Asynchronous I/O enabled\n"));
    4943 # endif
    49444918
    49454919    /*
  • trunk/src/VBox/Devices/Audio/DevHdaStream.cpp

    r88918 r88934  
    7979#endif
    8080
    81 #ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    8281    AssertPtr(pStreamR3->pHDAStateR3);
    8382    AssertPtr(pStreamR3->pHDAStateR3->pDevIns);
     
    8584                               RT_SRC_POS, "hda_sd#%RU8", pStreamShared->u8SD);
    8685    AssertRCReturn(rc, rc);
    87 #endif
    8886
    8987#ifdef DEBUG
     
    174172    int rc2;
    175173
    176 #ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    177174    rc2 = hdaR3StreamAsyncIODestroy(pStreamR3);
    178175    AssertRC(rc2);
    179 #endif
    180 
    181 #ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
     176
    182177    if (PDMCritSectIsInitialized(&pStreamShared->CritSect))
    183178    {
     
    185180        AssertRC(rc2);
    186181    }
    187 #endif
    188182
    189183    if (pStreamR3->State.pCircBuf)
     
    19551949 *
    19561950 * This routine is called by both, the synchronous and the asynchronous
    1957  * (VBOX_WITH_AUDIO_HDA_ASYNC_IO), implementations.
     1951 * implementations.
    19581952 *
    19591953 * When running synchronously, the device DMA transfers *and* the mixer sink
     
    20092003    {
    20102004        bool fDoRead; /* Whether to push data down the driver stack or not.  */
    2011 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    20122005        if (fInTimer)
    2013 # endif
    20142006        {
    20152007            /*
     
    20252017                Log(("hdaR3StreamUpdate: Warning! Stream #%u has insufficient space free: %u bytes, need %u.  Will try move data out of the buffer...\n",
    20262018                     pStreamShared->u8SD, cbStreamFree, cbPeriod));
    2027 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    20282019                int rc = RTCritSectTryEnter(&pStreamR3->State.AIO.CritSect);
    20292020                if (RT_SUCCESS(rc))
     
    20342025                else
    20352026                    RTThreadYield();
    2036 #else
    2037                 hdaR3StreamPushToMixer(pStreamShared, pStreamR3, pSink, tsNowNs);
    2038 #endif
    20392027                Log(("hdaR3StreamUpdate: Gained %u bytes.\n", hdaR3StreamGetFree(pStreamR3) - cbStreamFree));
    20402028
     
    20612049             * Do the DMA transfer.
    20622050             */
    2063 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    20642051            rc2 = PDMDevHlpCritSectEnter(pDevIns, &pStreamShared->CritSect, VERR_IGNORED);
    20652052            AssertRC(rc2);
    2066 # endif
    20672053
    20682054            uint64_t const offWriteBefore = pStreamR3->State.offWrite;
    20692055            hdaR3StreamDoDmaOutput(pDevIns, pThis, pStreamShared, pStreamR3, RT_MIN(cbStreamFree, cbPeriod), tsNowNs);
    20702056
    2071 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    20722057            rc2 = PDMDevHlpCritSectLeave(pDevIns, &pStreamShared->CritSect);
    20732058            AssertRC(rc2);
    2074 # endif
    20752059
    20762060            /*
     
    21132097            if (fDoRead)
    21142098            {
    2115 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    21162099                /* Notify the async I/O worker thread that there's work to do. */
    21172100                Log5Func(("Notifying AIO thread\n"));
    21182101                rc2 = hdaR3StreamAsyncIONotify(pStreamR3);
    21192102                AssertRC(rc2);
    2120 # endif
    21212103                /* Update last read timestamp for logging/debugging. */
    21222104                pStreamShared->State.tsLastReadNs = tsNowNs;
     
    21282110         * the mixer and in direction of the host audio devices.
    21292111         */
    2130 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    21312112        else
    2132 # else
    2133         if (fDoRead)
    2134 # endif
    21352113            hdaR3StreamPushToMixer(pStreamShared, pStreamR3, pSink, tsNowNs);
    21362114    }
     
    21462124         * from the mixer and into our internal DMA buffer.
    21472125         */
    2148 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    21492126        if (!fInTimer)
    2150 # endif
    21512127            hdaR3StreamPullFromMixer(pStreamShared, pStreamR3, pSink);
    2152 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    2153         else /* fInTimer */
    2154 # endif
     2128        else
    21552129        {
    21562130            /*
     
    21972171                Log(("hdaR3StreamUpdate: Warning! Stream #%u has insufficient data available: %u bytes, need %u.  Will try move pull more data into the buffer...\n",
    21982172                     pStreamShared->u8SD, cbStreamUsed, cbPeriod));
    2199 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    22002173                int rc = RTCritSectTryEnter(&pStreamR3->State.AIO.CritSect);
    22012174                if (RT_SUCCESS(rc))
     
    22062179                else
    22072180                    RTThreadYield();
    2208 #else
    2209                 hdaR3StreamPullFromMixer(pStreamShared, pStreamR3, pSink);
    2210 #endif
    22112181                Log(("hdaR3StreamUpdate: Gained %u bytes.\n", hdaR3StreamGetUsed(pStreamR3) - cbStreamUsed));
    22122182                cbStreamUsed = hdaR3StreamGetUsed(pStreamR3);
     
    22202190                    do
    22212191                    {
    2222 #ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    22232192                        RTCritSectEnter(&pStreamR3->State.AIO.CritSect);
    2224 #endif
    22252193                        cbStreamUsed = hdaR3StreamGetUsed(pStreamR3);
    22262194                        if (cbStreamUsed < cbPeriod)
     
    22412209                        }
    22422210
    2243 #ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    22442211                        RTCritSectLeave(&pStreamR3->State.AIO.CritSect);
    2245 #endif
    22462212                    } while (cbStreamUsed < cbPeriod);
    22472213                    if (cbSilence > 0)
     
    22602226            if (cbStreamUsed)
    22612227            {
    2262 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    22632228                rc2 = PDMDevHlpCritSectEnter(pDevIns, &pStreamShared->CritSect, VERR_IGNORED);
    22642229                AssertRC(rc2);
    2265 # endif
    22662230
    22672231                hdaR3StreamDoDmaInput(pDevIns, pThis, pStreamShared, pStreamR3,
    22682232                                      RT_MIN(cbStreamUsed, cbPeriod), fWriteSilence, tsNowNs);
    22692233
    2270 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    22712234                rc2 = PDMDevHlpCritSectLeave(pDevIns, &pStreamShared->CritSect);
    22722235                AssertRC(rc2);
    2273 # endif
    22742236            }
    22752237
    2276 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    22772238            /*
    22782239             * We should always kick the AIO thread.
     
    22852246            AssertRC(rc2);
    22862247            pStreamShared->State.tsLastReadNs = tsNowNs;
    2287 # endif
    22882248        }
    22892249    }
     
    23012261{
    23022262    AssertPtrReturnVoid(pStreamShared);
    2303 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    23042263    int rc2 = PDMCritSectEnter(&pStreamShared->CritSect, VINF_SUCCESS);
    23052264    AssertRC(rc2);
    2306 #endif
    23072265}
    23082266
     
    23162274{
    23172275    AssertPtrReturnVoid(pStreamShared);
    2318 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    23192276    int rc2 = PDMCritSectLeave(&pStreamShared->CritSect);
    23202277    AssertRC(rc2);
    2321 # endif
    23222278}
    23232279
     
    25312487
    25322488# endif /* HDA_USE_DMA_ACCESS_HANDLER */
    2533 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    25342489
    25352490/**
     
    27242679}
    27252680
    2726 # endif /* VBOX_WITH_AUDIO_HDA_ASYNC_IO */
    27272681#endif /* IN_RING3 */
  • trunk/src/VBox/Devices/Audio/DevHdaStream.h

    r88662 r88934  
    2626
    2727
    28 #ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    2928/**
    3029 * HDA stream's state for asynchronous I/O.
     
    4847/** Pointer to a HDA stream's asynchronous I/O state. */
    4948typedef HDASTREAMSTATEAIO *PHDASTREAMSTATEAIO;
    50 #endif
    5149
    5250/**
     
    268266    TMTIMERHANDLE               hTimer;
    269267
    270 #ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    271268    /** Pad the structure size to a 64 byte alignment. */
    272269    uint64_t                    au64Padding1[4];
     
    274271     * I/O thread and (basically) the guest. */
    275272    PDMCRITSECT                 CritSect;
    276 #endif
    277273} HDASTREAM;
    278274AssertCompileMemberAlignment(HDASTREAM, State.aBdl, 16);
     
    312308        RTLISTANCHORR3          lstDMAHandlers;
    313309#endif
    314 #ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    315310        /** Asynchronous I/O state members. */
    316311        HDASTREAMSTATEAIO       AIO;
    317 #endif
    318312        /** Size of the DMA buffer (pCircBuf) in bytes. */
    319313        uint32_t                StatDmaBufSize;
     
    378372 * @{
    379373 */
    380 # ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
    381374int                 hdaR3StreamAsyncIOCreate(PHDASTREAMR3 pStreamR3);
    382375void                hdaR3StreamAsyncIOLock(PHDASTREAMR3 pStreamR3);
     
    384377void                hdaR3StreamAsyncIOEnable(PHDASTREAMR3 pStreamR3, bool fEnable);
    385378int                 hdaR3StreamAsyncIONotify(PHDASTREAMR3 pStreamR3);
    386 # endif /* VBOX_WITH_AUDIO_HDA_ASYNC_IO */
    387379/** @} */
    388380
  • trunk/src/VBox/Devices/Config.kmk

    r88880 r88934  
    116116endif
    117117
    118 #
    119 # Enables asynchronous audio data handling
    120 # to speed up the actual DMA data routines and keeping up
    121 # audio processing out of EMT as much as possible.
    122 #
    123 # Disabled for AC'97 for now.
     118# AC'97 needs testing:
    124119#VBOX_AUDIO_DEFS  += VBOX_WITH_AUDIO_AC97_ASYNC_IO
    125 VBOX_AUDIO_DEFS += VBOX_WITH_AUDIO_HDA_ASYNC_IO
    126120VBOX_AUDIO_DEFS += VBOX_WITH_AUDIO_SB16_ASYNC_IO
    127121
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