VirtualBox

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


Ignore:
Timestamp:
Dec 13, 2017 5:37:31 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
119666
Message:

Audio/HDA: Only do stream tagging when enabling a stream and use stream tags when doing lookups via hdaGetStreamFromSD(). Needd for macOS guests.

Location:
trunk/src/VBox/Devices/Audio
Files:
3 edited

Legend:

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

    r70013 r70117  
    13221322             uSD, fRun, fInRun, fReset, fInReset, u32Value));
    13231323
    1324     /*
    1325      * Extract the stream tag the guest wants to use for this specific
    1326      * stream descriptor (SDn). This only can happen if the stream is in a non-running
    1327      * state, so we're doing the lookup and assignment here.
    1328      *
    1329      * So depending on the guest OS, SD3 can use stream tag 4, for example.
    1330      */
    1331     uint8_t uTag = (u32Value >> HDA_SDCTL_NUM_SHIFT) & HDA_SDCTL_NUM_MASK;
    1332     if (uTag > HDA_MAX_TAGS)
    1333     {
    1334         LogFunc(("[SD%RU8] Warning: Invalid stream tag %RU8 specified!\n", uSD, uTag));
    1335 
    1336         DEVHDA_UNLOCK_BOTH(pThis);
    1337         return hdaRegWriteU24(pThis, iReg, u32Value);
    1338     }
    1339 
    1340     PHDATAG pTag = &pThis->aTags[uTag];
    1341     AssertPtr(pTag);
    1342 
    1343     LogFunc(("[SD%RU8] Using stream tag=%RU8\n", uSD, uTag));
    1344 
    1345     /* Assign new values. */
    1346     pTag->uTag    = uTag;
    1347     pTag->pStream = hdaGetStreamFromSD(pThis, uSD);
    1348 
    1349     PHDASTREAM pStream = pTag->pStream;
    1350     AssertPtr(pStream);
     1324    PHDASTREAM pStream = hdaGetStreamFromSD(pThis, uSD);
     1325    AssertPtr(pStream);   
    13511326
    13521327    if (fInReset)
     
    13941369
    13951370            hdaStreamLock(pStream);
     1371
     1372            /*
     1373             * Extract the stream tag the guest wants to use for this specific
     1374             * stream descriptor (SDn). This only can happen if the stream is in a non-running
     1375             * state, so we're doing the lookup and assignment here.
     1376             *
     1377             * So depending on the guest OS, SD3 can use stream tag 4, for example.
     1378             */
     1379            uint8_t uTag = (u32Value >> HDA_SDCTL_NUM_SHIFT) & HDA_SDCTL_NUM_MASK;
     1380
     1381            LogFunc(("[SD%RU8] Using stream tag=%RU8\n", uSD, uTag));
     1382
     1383            if (   !uTag
     1384                || uTag > HDA_MAX_TAGS)
     1385            {
     1386                LogRel(("HDA: Warning: Stream #%RU8 is using invalid stream tag %RU8, skipping SDCTL\n", uSD, uTag));
     1387
     1388                DEVHDA_UNLOCK_BOTH(pThis);
     1389                return hdaRegWriteU24(pThis, iReg, u32Value);
     1390            }
     1391
     1392            LogRel2(("HDA: Stream #%RU8 is stream tag %RU8\n", uSD, uTag));
     1393           
     1394            /* Our internal mapping table is zero-based. */
     1395            PHDATAG pTag = &pThis->aTags[uTag - 1];
     1396            AssertPtr(pTag);
     1397
     1398            /* Assign new values. */
     1399            pTag->uTag    = uTag;
     1400            pTag->pStream = pStream;
    13961401
    13971402# ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
  • trunk/src/VBox/Devices/Audio/DevHDACommon.cpp

    r70013 r70117  
    224224    }
    225225
     226    /* First, check if the SD# is in our tag mapping and return the
     227     * correlating stream instead.
     228     * 
     229     * Note that our internal table is zero-based. */
     230    PHDASTREAM pStream = pThis->aTags[uSD ? uSD - 1 : 0].pStream;
     231    if (pStream)
     232        return pStream;
     233
     234    /* No tagged stream found, just return the plain non-tagged SD# stream. */
    226235    return &pThis->aStreams[uSD];
    227236}
  • trunk/src/VBox/Devices/Audio/HDAStream.cpp

    r70073 r70117  
    242242
    243243        /** @todo Use a more dynamic fragment size? */
    244         uint8_t cFragments = pStream->u16LVI;
     244        uint8_t cFragments = pStream->u16LVI + 1;
    245245        if (cFragments <= 1)
    246246            cFragments = 2; /* At least two fragments (BDLEs) must be present. */
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