-
Notifications
You must be signed in to change notification settings - Fork 335
[BUG] Baytrail/CherryTrail: samples are not played in correct order #1215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@mengdonglin @RanderWang I'm sure this is dw-dma DMA buffer R/W pointer related. The DMA on BYT does not support HW LLI mode and LLI must be programmed via SW. There have also been some recent commits to the DMA driver that should be bisected. The issue here is that the DMA HW read period (data that is be sent to SSP) is being written by the FW pipeline at the same time. i.e. we are reading and writing the same period at the same time. Some trace should show this. This is obviously working in HW LLI mode for non BYT platforms. |
@ranj063 @xiulipan @lgirdwood What has changed since issue #1107 has been fixed? Are you saying there is another regression? The only problem with noise I was aware of was problem with SRC #1161. |
@tlauda @lgirdwood I did some bisecting and for me the problems start way back: |
@tlauda @lgirdwood @juimonen
And we have fixed similar issue once. I think this maybe caused by the recent change to the pipeline. But as 9a6a38a is something related to the mixer component. I will try to use some pass through pipeline to check if it is related to the mixer component first. |
@juimonen to rule out the mixer as a suspect, can you try a simple host->vol->dai pipeline on BYT? |
@xiulipan @tomek @ranj063 @lgirdwood I got simplified topology (without mixer) from Ranjani and it plays cleanly with master. The basic rt5651 topology with mixer has metallic sound with master. I have some unreliability in my setup so sometimes I get just low level rumble. Anyway it is quite clear that there's some issues with mixer component (or the whole pipeline including it). |
@juimonen What is the stream format vs. dai format? Can you get me verbose FW logs? It looks like some kind of mismatch in frame_fmt between mixer and volume components. |
@tlauda can someone please tell me how to enable TRACEV? |
@juimonen make menuconfig and select verbose traces. |
@tlauda doesn't work with docker so the "CI way"... that's the only setup I have atm. Where is the menuconfig inventing this? can I add it by hand to some file. I cna't add it to .config because they get always regenerated. |
@tlauda ok got it working by editing src/lib/Kconfig here's the log from mixer pipeline with metallic sound: here's the log with simple pipeline with clean sound: |
@juimonen You can do it with docker. You can just run what you would like with docker. Docker used map for the device. With the sof-byt-rt5651.tplg that is |
@xiulipan @juimonen to restate, the issue is there is a race starting or synchronizing the DW-DMA HW wrt the rest of the pipeline. Consider the SSP DMA buffer B with two periods p0, p1. On failure, the pipeline is writing to p0 whilst the DMA is simultaneously reading from p0. Normal operation is that pipeline writes to p0 whilst DMA reads p1. The ordering PCM data from @plbossart is a big hint here as the DMA engine will prefetch p0 or p1 (and copy to the internal DMA FIFO) in multiples of DMA burst size. This will show a mixture of old and new data aligned on burst size multiples. It is also worth checking the host DMA side too given the scheduling updates. @juimonen can you resend logs of good and bad using the same simple pipeline topology. Just an excerpt is needed showing copying of about 20 periods. |
@lgirdwood here's only bad log. I just can't get the clean thing out of this. Don't know if it is the excessive logging or something, but I booted the device 10 times, always bad. |
@juimonen So now also the simple topology doesn't work without noise? |
@tlauda there is something really strange with the system. I'm not sure how I get my device in to this low rumble mode, but for e.g. now I can play simple topology clean with master. I'm sorry about this confusion but I'm also myself confused, is it that our CI scripts are not making clean builds when I jump around in git history or is my device borked... really unreliable results |
@ranj063 if you try what @xiulipan said today in bug scrub: try aplay -i and use space to pause/resume, you can get the mixer topology also to play clean sometimes. I think this is something what @lgirdwood described so host or dai dma is getting confused. Mixer topology is just bigger so it gets to "metallic" more often. |
@juimonen thanks for the log, but it needs verbose trace enabled to see the R/W pointer or they may need manually added to trace. It would be good to see the timing and R/W pointer at trigger start and then when the pipeline is next scheduled (as this could be scheduled too soon).
Something stands out that needs checking.
The period size should be 1ms (SSP DMA interrupt is ~1ms) but we appear to write 0x208 bytes when I would expect 0xc0 bytes. |
I've been trying to log the dai write vs. dma read pointers and at least to me it seems that dma read pointer is always behind the dai writer (so not at least not overlapping with the current write period). I'm checking this in dw_dma_copy where dai has written a period and is updating pointers for dma (sar register value is not inside current_ptr + bytes). I've also tried to fiddle around cache_writeback because the error sounds like buffer corruption, but without luck. If someone has time I could really use extra eye balls or good advice... |
Fixed by #1247. |
@Jiangxinx Please help to check if this issue is fixed by #1247 on Baytrail. |
@mengdonglin @tlauda according to @stevyan this is still an issue for playback but not capture on BYT. |
@lgirdwood Does @stevyan use the right topology? Note that only Dhw:0,0 works for now, Dhw:0,1 is media pipe and still needs topology changes. |
@wenqingfu yes for me the hw0:0 device is working with @tlauda topology. |
@tlauda have not been following fw PR's closely, but do you have the PR also for the pause/resume fix? I think that would be very good for rc2... |
@tlauda, cool and thanks! |
works for me with byt-mb + rt5651! |
Describe the bug
When playing samples that are incremented by one from a sample to the other, the output shows discontinuities of 96 samples, see
baytrail.xlsx
. With regular sine waves this has the net effect of adding noise.
This clearly points to bad buffer/pointer management or scheduling issues.
To Reproduce
Configure Minnowboard, use kernel topic/sof-dev and firmware v1.3-rc
connect LogicPro on SSP pins (bclk, fs, dac)
unzip and play file
cnt_1024_left.pcm.gz
aplay -Dhw:1,0 -c2 -r48000 -f dat cnt_1024_left.pcm
grab results with LogicPro and check the decoded values (should be similar to excel sheet provided above)
Expected behavior
samples are expected to be played in order, with wrap-around at 1024
Impact
showstopper
Environment
kernel f3adfd6
firmware eac4a73
2) Name of the topology file
sof-byt-nocodec.tplg (or any byt topology, doesn't matter)
All Baytrail and cherrytrail platforms. The measurements are only seen when the connector is exposed, e.g. on Minnowboard.
The text was updated successfully, but these errors were encountered: