VirtualBox

Changeset 88938 in vbox for trunk/src/VBox/Devices/Audio


Ignore:
Timestamp:
May 7, 2021 6:22:22 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
144273
Message:

DevAC97: Made VBOX_WITH_AUDIO_AC97_ASYNC_IO non-optional. bugref:9890

File:
1 edited

Legend:

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

    r88937 r88938  
    325325typedef AC97BMREGS *PAC97BMREGS;
    326326
    327 #ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    328327/**
    329328 * Asynchronous I/O state for an AC'97 stream.
     
    347346/** Pointer to the async I/O state for an AC'97 stream. */
    348347typedef AC97STREAMSTATEAIO *PAC97STREAMSTATEAIO;
    349 #endif
    350348
    351349
     
    364362    /** The stream's current configuration. */
    365363    PDMAUDIOSTREAMCFG       Cfg; //+108
    366 #ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    367364    /** Asynchronous I/O state members. */
    368365    AC97STREAMSTATEAIO      AIO;
    369 #endif
    370366    /** Timestamp of the last DMA data transfer. */
    371367    uint64_t                tsTransferLast;
     
    454450
    455451
    456 #ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    457452/**
    458453 * Asynchronous I/O thread context (arguments).
     
    471466/** Pointer to the context for an async I/O thread. */
    472467typedef AC97STREAMTHREADCTX *PAC97STREAMTHREADCTX;
    473 #endif
    474468
    475469/**
     
    699693                                                         PDMAUDIODIR enmDir, PDMAUDIODSTSRCUNION dstSrc);
    700694
    701 # ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    702695static int                ichac97R3StreamAsyncIOCreate(PAC97STATE pThis, PAC97STATER3 pThisCC, PAC97STREAM pStream, PAC97STREAMR3 pStreamCC);
    703696static int                ichac97R3StreamAsyncIODestroy(PAC97STATE pThis, PAC97STREAMR3 pStreamCC);
     
    705698static void               ichac97R3StreamAsyncIOUnlock(PAC97STREAMR3 pStreamCC);
    706699/*static void               ichac97R3StreamAsyncIOEnable(PAC97STREAM pStream, bool fEnable); Unused */
    707 # endif
    708700
    709701DECLINLINE(PDMAUDIODIR)   ichac97GetDirFromSD(uint8_t uSD);
     
    984976
    985977    int rc = VINF_SUCCESS;
    986 
    987 # ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    988978    if (fEnable)
    989979        rc = ichac97R3StreamAsyncIOCreate(pThis, pThisCC, pStream, pStreamCC);
    990980    if (RT_SUCCESS(rc))
     981    {
    991982        ichac97R3StreamAsyncIOLock(pStreamCC);
    992 # endif
    993 
    994     if (fEnable)
    995     {
    996         if (pStreamCC->State.pCircBuf)
    997             RTCircBufReset(pStreamCC->State.pCircBuf);
    998 
    999         rc = ichac97R3StreamOpen(pDevIns, pThis, pThisCC, pStream, pStreamCC, false /* fForce */);
    1000 
    1001         if (RT_LIKELY(!pStreamCC->Dbg.Runtime.fEnabled))
    1002         { /* likely */ }
     983        if (fEnable)
     984        {
     985            if (pStreamCC->State.pCircBuf)
     986                RTCircBufReset(pStreamCC->State.pCircBuf);
     987
     988            rc = ichac97R3StreamOpen(pDevIns, pThis, pThisCC, pStream, pStreamCC, false /* fForce */);
     989
     990            if (RT_LIKELY(!pStreamCC->Dbg.Runtime.fEnabled))
     991            { /* likely */ }
     992            else
     993            {
     994                if (!AudioHlpFileIsOpen(pStreamCC->Dbg.Runtime.pFileStream))
     995                {
     996                    int rc2 = AudioHlpFileOpen(pStreamCC->Dbg.Runtime.pFileStream, AUDIOHLPFILE_DEFAULT_OPEN_FLAGS,
     997                                               &pStreamCC->State.Cfg.Props);
     998                    AssertRC(rc2);
     999                }
     1000
     1001                if (!AudioHlpFileIsOpen(pStreamCC->Dbg.Runtime.pFileDMA))
     1002                {
     1003                    int rc2 = AudioHlpFileOpen(pStreamCC->Dbg.Runtime.pFileDMA, AUDIOHLPFILE_DEFAULT_OPEN_FLAGS,
     1004                                               &pStreamCC->State.Cfg.Props);
     1005                    AssertRC(rc2);
     1006                }
     1007            }
     1008        }
    10031009        else
    1004         {
    1005             if (!AudioHlpFileIsOpen(pStreamCC->Dbg.Runtime.pFileStream))
    1006             {
    1007                 int rc2 = AudioHlpFileOpen(pStreamCC->Dbg.Runtime.pFileStream, AUDIOHLPFILE_DEFAULT_OPEN_FLAGS,
    1008                                            &pStreamCC->State.Cfg.Props);
    1009                 AssertRC(rc2);
    1010             }
    1011 
    1012             if (!AudioHlpFileIsOpen(pStreamCC->Dbg.Runtime.pFileDMA))
    1013             {
    1014                 int rc2 = AudioHlpFileOpen(pStreamCC->Dbg.Runtime.pFileDMA, AUDIOHLPFILE_DEFAULT_OPEN_FLAGS,
    1015                                            &pStreamCC->State.Cfg.Props);
    1016                 AssertRC(rc2);
    1017             }
    1018         }
    1019     }
    1020     else
    1021         rc = ichac97R3StreamClose(pStream);
    1022 
    1023     if (RT_SUCCESS(rc))
    1024     {
    1025         /* First, enable or disable the stream and the stream's sink, if any. */
    1026         rc = AudioMixerSinkEnable(ichac97R3IndexToSink(pThisCC, pStream->u8SD), fEnable);
    1027     }
    1028 
    1029 # ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    1030     ichac97R3StreamAsyncIOUnlock(pStreamCC);
    1031 # endif
     1010            rc = ichac97R3StreamClose(pStream);
     1011
     1012        if (RT_SUCCESS(rc))
     1013        {
     1014            /* First, enable or disable the stream and the stream's sink, if any. */
     1015            rc = AudioMixerSinkEnable(ichac97R3IndexToSink(pThisCC, pStream->u8SD), fEnable);
     1016        }
     1017
     1018        ichac97R3StreamAsyncIOUnlock(pStreamCC);
     1019    }
    10321020
    10331021    /* Make sure to leave the lock before (eventually) starting the timer. */
    10341022    ichac97R3StreamUnlock(pStreamCC);
    1035 
    10361023    LogFunc(("[SD%RU8] fEnable=%RTbool, rc=%Rrc\n", pStream->u8SD, fEnable, rc));
    10371024    return rc;
     
    11471134    AssertRC(rc2);
    11481135
    1149 # ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    11501136    rc2 = ichac97R3StreamAsyncIODestroy(pThis, pStreamCC);
    11511137    AssertRC(rc2);
    1152 # else
    1153     RT_NOREF(pThis);
    1154 # endif
    11551138
    11561139    if (RT_LIKELY(!pStreamCC->Dbg.Runtime.fEnabled))
     
    13311314}
    13321315
    1333 # ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    13341316
    13351317/**
     
    15541536}
    15551537#endif
    1556 # endif /* VBOX_WITH_AUDIO_AC97_ASYNC_IO */
    15571538
    15581539# ifdef LOG_ENABLED
     
    15941575 *
    15951576 * This routine is called by both, the synchronous and the asynchronous
    1596  * (VBOX_WITH_AUDIO_AC97_ASYNC_IO), implementations.
     1577 * implementations.
    15971578 *
    15981579 * When running synchronously, the device DMA transfers *and* the mixer sink
     
    16271608    if (pStreamCC->State.Cfg.enmDir == PDMAUDIODIR_OUT) /* Output (SDO). */
    16281609    {
    1629 # ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    16301610        if (fInTimer)
    1631 # endif
    16321611        {
    16331612            const uint32_t cbStreamFree = ichac97R3StreamGetFree(pStreamCC);
     
    16511630        Log3Func(("[SD%RU8] fInTimer=%RTbool\n", pStream->u8SD, fInTimer));
    16521631
    1653 # ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    16541632        rc2 = ichac97R3StreamAsyncIONotify(pStreamCC);
    16551633        AssertRC(rc2);
    1656 # endif
    1657 
    1658 # ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
     1634
    16591635        if (!fInTimer) /* In async I/O thread */
    16601636        {
    1661 # endif
    16621637            const uint32_t cbSinkWritable     = AudioMixerSinkGetWritable(pSink);
    16631638            const uint32_t cbStreamReadable   = ichac97R3StreamGetUsed(pStreamCC);
     
    16721647                AssertRC(rc2);
    16731648            }
    1674 # ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    1675         }
    1676 #endif
     1649        }
    16771650        /* When running synchronously, update the associated sink here.
    16781651         * Otherwise this will be done in the async I/O thread. */
     
    16821655    else /* Input (SDI). */
    16831656    {
    1684 # ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    16851657        if (!fInTimer)
    16861658        {
    1687 # endif
    16881659            rc2 = AudioMixerSinkUpdate(pSink);
    16891660            AssertRC(rc2);
     
    17081679                AssertRC(rc2);
    17091680            }
    1710 # ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    17111681        }
    17121682        else /* fInTimer */
    17131683        {
    1714 # endif
    1715 
    1716 # ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
     1684
    17171685            const uint64_t tsNowNs = RTTimeNanoTS();
    17181686            if (tsNowNs - pStreamCC->State.tsLastUpdateNs >= pStreamCC->State.Cfg.Device.cMsSchedulingHint * RT_NS_1MS)
     
    17231691                pStreamCC->State.tsLastUpdateNs = tsNowNs;
    17241692            }
    1725 # endif
    17261693
    17271694            const uint32_t cbStreamUsed = ichac97R3StreamGetUsed(pStreamCC);
     
    17331700                AssertRC(rc2);
    17341701            }
    1735 # ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    1736         }
    1737 # endif
     1702        }
    17381703    }
    17391704}
     
    42474212        return rc;
    42484213
    4249 # ifdef VBOX_WITH_AUDIO_AC97_ASYNC_IO
    4250     LogRel(("AC97: Asynchronous I/O enabled\n"));
    4251 # endif
    4252 
    42534214    /*
    42544215     * Attach drivers.  We ASSUME they are configured consecutively without any
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette