thesofproject / sof

Sound Open Firmware
Other
533 stars 308 forks source link

[BUG]The first frame of recording is dirty data #5619

Open lenghonglin opened 2 years ago

lenghonglin commented 2 years ago

Describe the bug The first frame of recording is dirty data. host copy use dummy-copy

To Reproduce capture

Reproduction Rate 100%

Impact will produce dirty data.

Environment

image the question is host->dma_buffer is updated after copy data to ringbuffer, for first frame, the data is dirty data.

Is this a normal phenomenon? Why is it designed this way?

dbaluta commented 2 years ago

@paulstelian97 have a look at this once you have some spare cycles.

lenghonglin commented 2 years ago

@paulstelian97 hello, could you have a look

paulstelian97 commented 2 years ago

I will look at this when I have some spare time on my hand, but I make no promise of how soon it will happen.

dbaluta commented 2 years ago

@lenghonglin since we are very busy can you help us further investigate this issue?

Is the first frame of recording dirty data or just zeroes?

Are you using latest SOF code?

is this commit relevant?

commit 87e4f5aad80c22a1e82fa2bf78133640e39b8741
Author: Daniel Baluta <daniel.baluta@nxp.com>
Date:   Mon Aug 17 17:09:29 2020 +0300

    host: Fix first period not being copied to/from host
lenghonglin commented 2 years ago

dirty data not zero data.

the sof version is v1.8

and my point is we should update host->dma_buffer and then copy host->dma_buffer to ringbuffer.

@dbaluta

lgirdwood commented 2 years ago

Does dummy_copy need to bzero() buffers prior to starting ?

lenghonglin commented 2 years ago

https://github.com/thesofproject/sof/blob/7b5aa7281370c287a16600c7b010279c3fd81def/src/audio/host.c#L926 look here

lgirdwood commented 2 years ago

https://github.com/thesofproject/sof/blob/7b5aa7281370c287a16600c7b010279c3fd81def/src/audio/host.c#L926

look here

@lenghonglin does your platform need to writeback or invalidate any cache here ?

lenghonglin commented 2 years ago

https://github.com/thesofproject/sof/blob/7b5aa7281370c287a16600c7b010279c3fd81def/src/audio/host.c#L926

look here

@lenghonglin does your platform need to writeback or invalidate any cache here ?

i wanna know why update copy host->dma_buffer to ringbuffer and then update host->dma_buffer

lgirdwood commented 2 years ago

https://github.com/thesofproject/sof/blob/7b5aa7281370c287a16600c7b010279c3fd81def/src/audio/host.c#L926

look here

@lenghonglin does your platform need to writeback or invalidate any cache here ?

i wanna know why update copy host->dma_buffer to ringbuffer and then update host->dma_buffer

Sorry, not following. Do you mean the host ALSA ring buffer to DSP DMA ring buffer ?

lenghonglin commented 2 years ago

https://github.com/thesofproject/sof/blob/7b5aa7281370c287a16600c7b010279c3fd81def/src/audio/host.c#L926

look here

@lenghonglin does your platform need to writeback or invalidate any cache here ?

i wanna know why update copy host->dma_buffer to ringbuffer and then update host->dma_buffer

Sorry, not following. Do you mean the host ALSA ring buffer to DSP DMA ring buffer ?

Yes

lgirdwood commented 2 years ago

@lenghonglin can you confirm the platform - I think we had a similar bug on Intel a while back but this has been fixed for a long time unless we have a new regression ?