mbox series

[v3,0/6] ASoC: q6apm: fix under runs and fragment sizes

Message ID 20250304105723.10579-1-srinivas.kandagatla@linaro.org
Headers show
Series ASoC: q6apm: fix under runs and fragment sizes | expand

Message

Srinivas Kandagatla March 4, 2025, 10:57 a.m. UTC
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(-)

Comments

Caleb Connolly March 5, 2025, 10:17 p.m. UTC | #1
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(-)
>
Srinivas Kandagatla March 6, 2025, 1:15 p.m. UTC | #2
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(-)
>>
>
Krzysztof Kozlowski March 6, 2025, 1:56 p.m. UTC | #3
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