Changeset 67423 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Jun 15, 2017 1:33:39 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 116150
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevHDA.cpp
r67421 r67423 6365 6365 Assert(pStrm->u8SD <= HDA_MAX_STREAMS); 6366 6366 6367 rc = SSMR3PutStructEx(pSSM, &pStrm->State, sizeof(HDASTREAMSTATE), 0 /*fFlags*/, g_aSSMStreamStateFields 6, NULL);6367 rc = SSMR3PutStructEx(pSSM, &pStrm->State, sizeof(HDASTREAMSTATE), 0 /*fFlags*/, g_aSSMStreamStateFields7, NULL); 6368 6368 AssertRCReturn(rc, rc); 6369 6369 … … 6409 6409 } 6410 6410 #endif 6411 6412 uint32_t cbCircBufSize = 0; 6413 uint32_t cbCircBufUsed = 0; 6414 6415 if (pStrm->State.pCircBuf) 6416 { 6417 cbCircBufSize = (uint32_t)RTCircBufSize(pStrm->State.pCircBuf); 6418 cbCircBufUsed = (uint32_t)RTCircBufUsed(pStrm->State.pCircBuf); 6419 } 6420 6421 rc = SSMR3PutU32(pSSM, cbCircBufSize); 6422 AssertRCReturn(rc, rc); 6423 6424 rc = SSMR3PutU32(pSSM, cbCircBufUsed); 6425 AssertRCReturn(rc, rc); 6426 6427 if (cbCircBufUsed) 6428 { 6429 /* 6430 * We now need to get the circular buffer's data without actually modifying 6431 * the internal read / used offsets -- otherwise we would end up with broken audio 6432 * data after saving the state. 6433 * 6434 * So get the current read offset and serialize the buffer data manually based on that. 6435 */ 6436 size_t cbCircBufOffRead = RTCircBufOffsetRead(pStrm->State.pCircBuf); 6437 6438 void *pvBuf; 6439 size_t cbBuf; 6440 RTCircBufAcquireReadBlock(pStrm->State.pCircBuf, cbCircBufUsed, &pvBuf, &cbBuf); 6441 6442 if (cbBuf) 6443 { 6444 size_t cbToRead = cbCircBufUsed; 6445 size_t cbEnd = 0; 6446 6447 if (cbCircBufUsed > cbCircBufOffRead) 6448 cbEnd = cbCircBufUsed - cbCircBufOffRead; 6449 6450 if (cbEnd) /* Save end of buffer first. */ 6451 { 6452 rc = SSMR3PutMem(pSSM, (uint8_t *)pvBuf + cbCircBufSize - cbEnd /* End of buffer */, cbEnd); 6453 AssertRCReturn(rc, rc); 6454 6455 Assert(cbToRead >= cbEnd); 6456 cbToRead -= cbEnd; 6457 } 6458 6459 if (cbToRead) /* Save remaining stuff at start of buffer (if any). */ 6460 { 6461 rc = SSMR3PutMem(pSSM, (uint8_t *)pvBuf - cbCircBufUsed /* Start of buffer */, cbToRead); 6462 AssertRCReturn(rc, rc); 6463 } 6464 } 6465 6466 RTCircBufReleaseReadBlock(pStrm->State.pCircBuf, 0 /* Don't advance read pointer -- see comment above */); 6467 } 6468 6469 Log2Func(("[SD%RU8] LPIB=%RU32, CBL=%RU32, LVI=%RU32\n", 6470 pStrm->u8SD, 6471 HDA_STREAM_REG(pThis, LPIB, pStrm->u8SD), HDA_STREAM_REG(pThis, CBL, pStrm->u8SD), HDA_STREAM_REG(pThis, LVI, pStrm->u8SD))); 6472 6473 #ifdef LOG_ENABLED 6474 hdaBDLEDumpAll(pThis, pStrm->u64BDLBase, pStrm->u16LVI + 1); 6475 #endif 6476 6411 6477 return rc; 6412 6478 } … … 6425 6491 SSMR3PutU32(pSSM, RT_ELEMENTS(pThis->au32Regs)); 6426 6492 SSMR3PutMem(pSSM, pThis->au32Regs, sizeof(pThis->au32Regs)); 6493 6494 /* Save the controller's base timestamp (for handling the WALCLK register). 6495 * This is needed to continue with correct time keeping on VM resume. */ 6496 SSMR3PutU64(pSSM, pThis->u64BaseTS); 6427 6497 6428 6498 /* Save number of streams. */
Note:
See TracChangeset
for help on using the changeset viewer.