Message ID | 20250304105723.10579-1-srinivas.kandagatla@linaro.org (mailing list archive) |
---|---|
Headers | show |
Series | ASoC: q6apm: fix under runs and fragment sizes | expand |
On Tue, Mar 04, 2025 at 10:57:17AM +0000, Srinivas Kandagatla wrote: > From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > > On Qualcomm Audioreach setup, some of the audio artifacts are seen in > both recording and playback. These patches fix issues by > 1. Adjusting the fragment size that dsp can service. > 2. schedule available playback buffers in time for dsp to not hit under runs > 3. remove some of the manual calculations done to get hardware pointer. > > With these patches, am able to see Audio quality improvements. > > Any testing would be appreciated. This fixes the playback and capture issues with Pipewire, including the heavily distorted, choppy playback when pavucontrol is open. Turns out that the pavucontrol volume meters reduces the output sink quantum size from the default 1024 to 256, which was too low with v2 but now seems to work. Unfortunately, this series still regresses Pulseaudio as capture is now choppy (e.g. when recording using parecord). During our off-list debugging sessions you suggested reducing the max capture period size (that this series increases) to 6144 (same as min) and that fixed the Pulseaudio capture issue. In v3 the, the max period is again increased to 65536 which appears to break Pulseaudio capture. > Changes since v2: > - dropped patch which is causing regression with pluseaudio. > - setup period sizes only for capture path > - fix underruns/overruns in dsp pipelines. > - add fixes tag > - add patch to fix buffer alignment Johan
On 04/03/2025 17:04, Johan Hovold wrote: > On Tue, Mar 04, 2025 at 10:57:17AM +0000, Srinivas Kandagatla wrote: >> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> >> >> On Qualcomm Audioreach setup, some of the audio artifacts are seen in >> both recording and playback. These patches fix issues by >> 1. Adjusting the fragment size that dsp can service. >> 2. schedule available playback buffers in time for dsp to not hit under runs >> 3. remove some of the manual calculations done to get hardware pointer. >> >> With these patches, am able to see Audio quality improvements. >> >> Any testing would be appreciated. > > This fixes the playback and capture issues with Pipewire, including the > heavily distorted, choppy playback when pavucontrol is open. Turns out > that the pavucontrol volume meters reduces the output sink quantum size > from the default 1024 to 256, which was too low with v2 but now seems to > work. > > Unfortunately, this series still regresses Pulseaudio as capture is now > choppy (e.g. when recording using parecord). > > During our off-list debugging sessions you suggested reducing the max > capture period size (that this series increases) to 6144 (same as min) > and that fixed the Pulseaudio capture issue. In v3 the, the max period > is again increased to 65536 which appears to break Pulseaudio capture. I have verified pulseaudio on my side as well, the 64 byte alignment should have fixed the issue on the pulseaudio side. Did you pick up the [PATCH v3 4/6] ASoC: qdsp6: q6apm-dai: set correct period and buffer alignment. patch in your tests? thanks, Srini > >> Changes since v2: >> - dropped patch which is causing regression with pluseaudio. >> - setup period sizes only for capture path >> - fix underruns/overruns in dsp pipelines. >> - add fixes tag >> - add patch to fix buffer alignment > > Johan
On Tue, Mar 04, 2025 at 05:12:20PM +0000, Srinivas Kandagatla wrote: > On 04/03/2025 17:04, Johan Hovold wrote: > > Unfortunately, this series still regresses Pulseaudio as capture is now > > choppy (e.g. when recording using parecord). > > > > > During our off-list debugging sessions you suggested reducing the max > > capture period size (that this series increases) to 6144 (same as min) > > and that fixed the Pulseaudio capture issue. In v3 the, the max period > > is again increased to 65536 which appears to break Pulseaudio capture. > > I have verified pulseaudio on my side as well, the 64 byte alignment > should have fixed the issue on the pulseaudio side. > > Did you pick up the [PATCH v3 4/6] ASoC: qdsp6: q6apm-dai: set correct > period and buffer alignment. patch in your tests? Yes, I'm running with the full series applied. I tested PA on the X13s (and PW on the T14s). Johan
On Tue, Mar 04, 2025 at 06:19:53PM +0100, Johan Hovold wrote: > On Tue, Mar 04, 2025 at 05:12:20PM +0000, Srinivas Kandagatla wrote: > > On 04/03/2025 17:04, Johan Hovold wrote: > > > > Unfortunately, this series still regresses Pulseaudio as capture is now > > > choppy (e.g. when recording using parecord). > > > > > > During our off-list debugging sessions you suggested reducing the max > > > capture period size (that this series increases) to 6144 (same as min) > > > and that fixed the Pulseaudio capture issue. In v3 the, the max period > > > is again increased to 65536 which appears to break Pulseaudio capture. > > > > I have verified pulseaudio on my side as well, the 64 byte alignment > > should have fixed the issue on the pulseaudio side. > > > > Did you pick up the [PATCH v3 4/6] ASoC: qdsp6: q6apm-dai: set correct > > period and buffer alignment. patch in your tests? > > Yes, I'm running with the full series applied. I tested PA on the X13s > (and PW on the T14s). I just tested PA on the T14s and it has the same problem with choppy recording with this series applied. As with the (amended) v2, setting the max capture period size to 6144 appears to make the problem go away. Johan
On Wed, Mar 05, 2025 at 10:06:52AM +0100, Johan Hovold wrote: > On Tue, Mar 04, 2025 at 06:19:53PM +0100, Johan Hovold wrote: > > On Tue, Mar 04, 2025 at 05:12:20PM +0000, Srinivas Kandagatla wrote: > > > On 04/03/2025 17:04, Johan Hovold wrote: > > > > > > Unfortunately, this series still regresses Pulseaudio as capture is now > > > > choppy (e.g. when recording using parecord). > > > > > > > > During our off-list debugging sessions you suggested reducing the max > > > > capture period size (that this series increases) to 6144 (same as min) > > > > and that fixed the Pulseaudio capture issue. In v3 the, the max period > > > > is again increased to 65536 which appears to break Pulseaudio capture. > > > > > > I have verified pulseaudio on my side as well, the 64 byte alignment > > > should have fixed the issue on the pulseaudio side. > > > > > > Did you pick up the [PATCH v3 4/6] ASoC: qdsp6: q6apm-dai: set correct > > > period and buffer alignment. patch in your tests? > > > > Yes, I'm running with the full series applied. I tested PA on the X13s > > (and PW on the T14s). > > I just tested PA on the T14s and it has the same problem with > choppy recording with this series applied. > > As with the (amended) v2, setting the max capture period size to 6144 > appears to make the problem go away. Actually, there may still be some distortion also with the max period size capped at 6144 with PA (there's a hint of it breaking up as with the non-modified v3). At least the PW recording sounded cleaner, even if I guess there could be other causes for this. Johan
Hi Srini, On 3/4/25 10:57, srinivas.kandagatla@linaro.org wrote: > From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > > On Qualcomm Audioreach setup, some of the audio artifacts are seen in > both recording and playback. These patches fix issues by > 1. Adjusting the fragment size that dsp can service. > 2. schedule available playback buffers in time for dsp to not hit under runs > 3. remove some of the manual calculations done to get hardware pointer. > > With these patches, am able to see Audio quality improvements. > > Any testing would be appreciated. This totally breaks audio on SDM845, and often results in a hard-crash to crashdump mode on my OnePlus 6. Unfortunately I can't get UART logs right now. But I imagine this is reproducible on RB3. Kind regards, > > thanks, > Srini > > Changes since v2: > - dropped patch which is causing regression with pluseaudio. > - setup period sizes only for capture path > - fix underruns/overruns in dsp pipelines. > - add fixes tag > - add patch to fix buffer alignment > > Changes since v1: > - added new patches to fix the fragment size, pointer > calculations > - updated to schedule only available buffers. > > Srinivas Kandagatla (6): > ASoC: q6apm-dai: schedule all available frames to avoid dsp under-runs > ASoC: q6apm: add q6apm_get_hw_pointer helper > ASoC: q6apm-dai: make use of q6apm_get_hw_pointer > ASoC: qdsp6: q6apm-dai: set correct period and buffer alignment. > ASoC: qdsp6: q6apm-dai: fix capture pipeline overruns. > ASoC: qdsp6: q6apm-dai: fix playback dsp pipeline underruns > > sound/soc/qcom/qdsp6/q6apm-dai.c | 63 +++++++++++++++++--------------- > sound/soc/qcom/qdsp6/q6apm.c | 18 ++++++++- > sound/soc/qcom/qdsp6/q6apm.h | 3 ++ > 3 files changed, 53 insertions(+), 31 deletions(-) >
On 05/03/2025 22:17, Caleb Connolly wrote: > Hi Srini, > > On 3/4/25 10:57, srinivas.kandagatla@linaro.org wrote: >> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> >> >> On Qualcomm Audioreach setup, some of the audio artifacts are seen in >> both recording and playback. These patches fix issues by >> 1. Adjusting the fragment size that dsp can service. >> 2. schedule available playback buffers in time for dsp to not hit >> under runs >> 3. remove some of the manual calculations done to get hardware pointer. >> >> With these patches, am able to see Audio quality improvements. >> >> Any testing would be appreciated. > > This totally breaks audio on SDM845, and often results in a hard-crash > to crashdump mode on my OnePlus 6. Its not possible.. as SDM845 is Elite DSP architecture, all of these patches changes are very specific to Audioreach DSP architecture. Could you please share the crash logs if you have any. It highly likely that something else is triggering the hard-crash that you reported. thanks, Srini > > Unfortunately I can't get UART logs right now. But I imagine this is > reproducible on RB3. > > Kind regards, >> >> thanks, >> Srini >> >> Changes since v2: >> - dropped patch which is causing regression with pluseaudio. >> - setup period sizes only for capture path >> - fix underruns/overruns in dsp pipelines. >> - add fixes tag >> - add patch to fix buffer alignment >> >> Changes since v1: >> - added new patches to fix the fragment size, pointer >> calculations >> - updated to schedule only available buffers. >> >> Srinivas Kandagatla (6): >> ASoC: q6apm-dai: schedule all available frames to avoid dsp under-runs >> ASoC: q6apm: add q6apm_get_hw_pointer helper >> ASoC: q6apm-dai: make use of q6apm_get_hw_pointer >> ASoC: qdsp6: q6apm-dai: set correct period and buffer alignment. >> ASoC: qdsp6: q6apm-dai: fix capture pipeline overruns. >> ASoC: qdsp6: q6apm-dai: fix playback dsp pipeline underruns >> >> sound/soc/qcom/qdsp6/q6apm-dai.c | 63 +++++++++++++++++--------------- >> sound/soc/qcom/qdsp6/q6apm.c | 18 ++++++++- >> sound/soc/qcom/qdsp6/q6apm.h | 3 ++ >> 3 files changed, 53 insertions(+), 31 deletions(-) >> >
On 04/03/2025 11:57, srinivas.kandagatla@linaro.org wrote: > From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > > On Qualcomm Audioreach setup, some of the audio artifacts are seen in > both recording and playback. These patches fix issues by > 1. Adjusting the fragment size that dsp can service. > 2. schedule available playback buffers in time for dsp to not hit under runs > 3. remove some of the manual calculations done to get hardware pointer. > > With these patches, am able to see Audio quality improvements. > > Any testing would be appreciated. Worked well for my pipewire setup on T14s and X1E8100 CRD. Tested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof
On Thu, Mar 06, 2025 at 01:15:43PM +0000, Srinivas Kandagatla wrote: > > > On 05/03/2025 22:17, Caleb Connolly wrote: > > Hi Srini, > > > > On 3/4/25 10:57, srinivas.kandagatla@linaro.org wrote: > > > From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > > > > > > On Qualcomm Audioreach setup, some of the audio artifacts are seen in > > > both recording and playback. These patches fix issues by > > > 1. Adjusting the fragment size that dsp can service. > > > 2. schedule available playback buffers in time for dsp to not hit > > > under runs > > > 3. remove some of the manual calculations done to get hardware pointer. > > > > > > With these patches, am able to see Audio quality improvements. > > > > > > Any testing would be appreciated. > > > > This totally breaks audio on SDM845, and often results in a hard-crash > > to crashdump mode on my OnePlus 6. > > Its not possible.. as SDM845 is Elite DSP architecture, all of these patches > changes are very specific to Audioreach DSP architecture. > > Could you please share the crash logs if you have any. It highly likely that > something else is triggering the hard-crash that you reported. I will try reproducing this on RB3 today in the evening. > > thanks, > Srini > > > > Unfortunately I can't get UART logs right now. But I imagine this is > > reproducible on RB3. > > > > Kind regards, > > > > > > thanks, > > > Srini > > > > > > Changes since v2: > > > - dropped patch which is causing regression with pluseaudio. > > > - setup period sizes only for capture path > > > - fix underruns/overruns in dsp pipelines. > > > - add fixes tag > > > - add patch to fix buffer alignment > > > > > > Changes since v1: > > > - added new patches to fix the fragment size, pointer > > > calculations > > > - updated to schedule only available buffers. > > > > > > Srinivas Kandagatla (6): > > > ASoC: q6apm-dai: schedule all available frames to avoid dsp under-runs > > > ASoC: q6apm: add q6apm_get_hw_pointer helper > > > ASoC: q6apm-dai: make use of q6apm_get_hw_pointer > > > ASoC: qdsp6: q6apm-dai: set correct period and buffer alignment. > > > ASoC: qdsp6: q6apm-dai: fix capture pipeline overruns. > > > ASoC: qdsp6: q6apm-dai: fix playback dsp pipeline underruns > > > > > > sound/soc/qcom/qdsp6/q6apm-dai.c | 63 +++++++++++++++++--------------- > > > sound/soc/qcom/qdsp6/q6apm.c | 18 ++++++++- > > > sound/soc/qcom/qdsp6/q6apm.h | 3 ++ > > > 3 files changed, 53 insertions(+), 31 deletions(-) > > > > >
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> On Qualcomm Audioreach setup, some of the audio artifacts are seen in both recording and playback. These patches fix issues by 1. Adjusting the fragment size that dsp can service. 2. schedule available playback buffers in time for dsp to not hit under runs 3. remove some of the manual calculations done to get hardware pointer. With these patches, am able to see Audio quality improvements. Any testing would be appreciated. thanks, Srini Changes since v2: - dropped patch which is causing regression with pluseaudio. - setup period sizes only for capture path - fix underruns/overruns in dsp pipelines. - add fixes tag - add patch to fix buffer alignment Changes since v1: - added new patches to fix the fragment size, pointer calculations - updated to schedule only available buffers. Srinivas Kandagatla (6): ASoC: q6apm-dai: schedule all available frames to avoid dsp under-runs ASoC: q6apm: add q6apm_get_hw_pointer helper ASoC: q6apm-dai: make use of q6apm_get_hw_pointer ASoC: qdsp6: q6apm-dai: set correct period and buffer alignment. ASoC: qdsp6: q6apm-dai: fix capture pipeline overruns. ASoC: qdsp6: q6apm-dai: fix playback dsp pipeline underruns sound/soc/qcom/qdsp6/q6apm-dai.c | 63 +++++++++++++++++--------------- sound/soc/qcom/qdsp6/q6apm.c | 18 ++++++++- sound/soc/qcom/qdsp6/q6apm.h | 3 ++ 3 files changed, 53 insertions(+), 31 deletions(-)