Skip to content

topology: increase number of periods for low latency pipeline - #1247

Merged
lgirdwood merged 1 commit into
thesofproject:masterfrom
tlauda:topic/low-latency-ppl-periods
Apr 16, 2019
Merged

lgirdwood merged 1 commit into
thesofproject:masterfrom
tlauda:topic/low-latency-ppl-periods

Conversation

@tlauda

@tlauda tlauda commented Apr 9, 2019

Copy link
Copy Markdown
Contributor

Increases number of periods for low latency playback pipeline
from 1 to 2 for volume and mixer components. 1 period
is not good enough to have continuous DMA transfer across
the whole pipeline, especially with the new copy flow,
which requires playback pipeline preload.

Signed-off-by: Tomasz Lauda tomasz.lauda@linux.intel.com

Increases number of periods for low latency playback pipeline
from 1 to 2 for volume and mixer components. 1 period
is not good enough to have continuous DMA transfer across
the whole pipeline, especially with the new copy flow,
which requires playback pipeline preload.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
@juimonen

juimonen commented Apr 9, 2019

Copy link
Copy Markdown

@tlauda did this fix the "metallic" sound?

@plbossart

plbossart commented Apr 9, 2019 via email

Copy link
Copy Markdown
Member

@juimonen

Copy link
Copy Markdown

@tlauda @plbossart I can confirm that this fixes the metallic sound on minnowboard with first playback. But if you use "aplay -i" and resume/pause the pipeline couple of times, you will get the same metallic sound as before. So now this behaves more like @ranj063 simplified pipeline, but the issue is still there. So somehow the dma pointers get out of sync...

Shouldn't we get xrun if the pipeline can't keep up with the dma?

@xiulipan

Copy link
Copy Markdown
Contributor

SOFCI TEST

@tlauda

tlauda commented Apr 10, 2019 •

Copy link
Copy Markdown
Contributor Author

@plbossart We don't increase latency, just the buffers inside the pipe. Host and Dai already had 2 periods. I'm truly amazed that it worked previously with just 1 period buffers inside the pipeline. Probably just because we had this "workaround" in the Dai to move buffer pointer before the start, but still it was pure luck that we didn't observe any glitches nor xruns.

@juimonen Pause/release is another issue and I'm gonna fix it in another PR.

@plbossart

plbossart commented Apr 10, 2019 via email

Copy link
Copy Markdown
Member

@tlauda

tlauda commented Apr 10, 2019

Copy link
Copy Markdown
Contributor Author

On 4/10/19 3:41 AM, Tomasz Lauda wrote: @plbossart https://github.com/plbossart We don't increase latency, just the buffers inside the pipe. Host and Dai already had 2 periods. I'm truly amazed that it worked previously with just 1 period buffers inside the pipeline. Probably just because we had this "workaround" in the Dai to move buffer pointer before the start, but still it was pure luck that we didn't observe any glitches nor xruns.
Humm, how does increasing the number of buffers not increase the latency? I must be missing something here, for elements that don't add new samples such as volumes in theory they could take the data from the host 'read-only' period and stick into the DAI 'write-only' period.

Let's take our example pipeline: host - vol - mixer - vol - dai.
Dai needs at least two periods of data to properly start transfer without any glitches, because after triggering first period it instantly starts copying the next period.
So the first pipeline copy for render is so called "preload copy" and it should copy the whole buffer (2 periods in our case). Unfortunately we don't have large enough buffers across the pipeline to do it.
As for latency, we will still copy the same amount of data per millisecond as previously, just with the larger buffers to make sure we don't mess up our read and write pointers.

@juimonen

Copy link
Copy Markdown

@tlauda did you try the "aplay -i" with pause/resume from space bar? you still get the metallic sound like every third time... should we preload the buffers with pause/resume also? or something similar...

@tlauda

tlauda commented Apr 10, 2019

Copy link
Copy Markdown
Contributor Author

@juimonen No, for pause/release the data is already there. The root cause is that buffer pointer alignment with next linked list item is done only for block transfers and not the manual linked list. I will have it fixed in the separate PR.

@plbossart

Copy link
Copy Markdown
Member

@tlauda so you're saying this change only impacts the start, right?

I must still be missing something. It was my understanding that the direction was to start the DAI first, possibly with zero-value outputs and at some point start pushing mixed data in the output (I believe it's how the closed-source firmware worked and clearly remember the need to track the delta between interface start and insertion of data for cross-timestamp support). It looks like now we have valid data pushed out as soon as the SSP starts?

@tlauda

tlauda commented Apr 10, 2019

Copy link
Copy Markdown
Contributor Author

@plbossart I'm not sure how it was done for closed source, but yes, instead of changing the start pointer of dai component and pushing out zeroes we are transferring valid data right away. Also we need to take into consideration how we are currently not limited to period size copy as it was before. We are now copying as much data as possible for every component by reading DMA read and write pointers, which eliminated many "workarounds" around e.g. pause/release.
To sum up, this change doesn't increase nor affect any latency in terms of DSP processing.

@plbossart

Copy link
Copy Markdown
Member

Thanks @tlauda for the explanations, much appreciated. I hope this solution is not going to bite us when we enable the on-demand SSP clocks (which means DMA transfers even in the absence of data) but that's for another day.

@jajanusz
jajanusz self-requested a review April 12, 2019 08:02

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xiulipan CI failure on BYT nocodec. can you check.

@xiulipan

Copy link
Copy Markdown
Contributor

@lgirdwood
Used to be some regression from #1250 fixed by thesofproject/linux#816

If you would like to rebase and retest, there will be four platform fail due to the ABI issues: thesofproject/linux#822

There are a lot of regressions happen last week and CI have a unstable code base for testing.

@lgirdwood
lgirdwood merged commit 68f2726 into thesofproject:master Apr 16, 2019
@tlauda
tlauda deleted the topic/low-latency-ppl-periods branch November 22, 2019 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants