-
-
Couldn't load subscription status.
- Fork 390
Description
I tested using HDMI capturing with audio on Radxa Rock 5b plus with RK3588 hdmiin, with default config with 6.1.x kernel (Streaming with RKMPP), only video capture works without any issue, but when combining audio and video, there is continuous stream of alsa overruns with popping sound.
here is ffmpeg output
nice -10 ffmpeg -loglevel warning -stats -f alsa -i hw:3 -vf "fps=60" -c:a aac -f rtsp rtsp://localhost:8554/stream
[alsa @ 0xaaab184f1230] ALSA buffer xrun.
Last message repeated 3122 times times
[aist#0:0/pcm_s16le @ 0xaaab185052b0] Guessed Channel Layout: stereo
[out#0/rtsp @ 0xaaab185050a0] Nothing was written into output file, because at least one of its streams received no packets.
size= 0kB time=N/A bitrate=N/A speed=N/A
corresponding kernel messages (this keeps repeating)
[ 232.926984] dma-pl330 fed10000.dma-controller: pl330_submit_req:1726 Try increasing mcbufsz (440/256)
[ 232.926987] dma-pl330 fed10000.dma-controller: fill_queue:2267 Bad Desc(1736)
after searching on web, increasing MCODE_BUFF_PER_REQ help, which prompt me to increase this from default 256 to 512,
however this unveils another issue with i2s-tdm
here is ffmpeg output
nice -10 ffmpeg -loglevel warning -stats -f alsa -i hw:3 -vf "fps=60" -c:a aac -f rtsp rtsp://localhost:8554/stream
[aist#0:0/pcm_s16le @ 0xaaab060094e0] Guessed Channel Layout: stereo
[alsa @ 0xaaab05ff5230] ALSA buffer xrun.ed=0.934x
Last message repeated 1 times=N/A speed=0.955x
corresponding kernel messages (this keeps repeating)
[ 658.168000] dma-pl330 fed10000.dma-controller: Reset Channel-2 CS-20400f FTC-2000
[ 658.168512] rockchip-i2s-tdm fddf8000.i2s: RX FIFO Overrun
to fix this issue
looking other's patch on rk3308? I also increased MAXBURST_PER_FIFO from 8 to 16.
Which I tested on rock-5b-plus with 1080p60 HDMI capture with audio 48000Hz now finally works.
I propose to add the following patch to fix this issue
drivers/dma/pl330.c | 2 +-
sound/soc/rockchip/rockchip_i2s_tdm.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 7adc43bdac2a..009f88b2792f 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -245,11 +245,11 @@ enum pl330_byteswap {
* With 256 bytes, we can do more than 2.5MB and 5MB xfers per req
* at 1byte/burst for P<->M and M<->M respectively.
* For typical scenario, at 1word/burst, 10MB and 20MB xfers per req
* should be enough for P<->M and M<->M respectively.
*/
-#define MCODE_BUFF_PER_REQ 256
+#define MCODE_BUFF_PER_REQ 512
/* Use this _only_ to wait on transient states */
#define UNTIL(t, s) while (!(_state(t) & (s))) cpu_relax();
#ifdef PL330_DEBUG_MCGEN
diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c
index ce832212b0be..385504c5d44e 100644
--- a/sound/soc/rockchip/rockchip_i2s_tdm.c
+++ b/sound/soc/rockchip/rockchip_i2s_tdm.c
@@ -67,11 +67,11 @@
#define MULTIPLEX_CH_MAX 10
#define CLK_PPM_MIN (-1000)
#define CLK_PPM_MAX (1000)
#define CLK_SHIFT_RATE_HZ_MAX 5
#define MAXBURST 16
-#define MAXBURST_PER_FIFO 8
+#define MAXBURST_PER_FIFO 16
#define DEPTH_PER_FIFO 32
#define WAIT_TIME_MS_MAX 10000
#define TRCM_TXRX 0
#define TRCM_TX 1