[Sound-open-firmware] [PATCH] topology: SRC: Use 4ms for topology scheduling and increase buffers

Seppo Ingalsuo seppo.ingalsuo at linux.intel.com
Fri Sep 8 08:37:02 CEST 2017



On 07.09.2017 19:17, Pierre-Louis Bossart wrote:
> On 9/7/17 8:28 AM, Liam Girdwood wrote:
>> SRC should be scheduled on at least 4ms tick. Increase buffers to
>> deal with 2 times output rate.
>
> It's ok to increase buffer sizes to account for the varying sizes 
> between input/output, but why would the scheduling be impacted? 4ms is 
> a very large tick, this makes no sense to me.

Yes, you are right that the scheduling for this pipeline could be kept 2 
ms while buffer size would be increased to fit the SRC output block 
size. For 44.1 kHz to 48 kHz conversion the SRC produces 160 samples 
blocks at 48 kHz side every ~3.3ms. This change can be restored after 
the configuration errors check code in SRC params() is improved. I will 
work with that.

Thanks,
Seppo

>
>>
>> Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
>> ---
>>   topology/reef-bxt-nocodec.m4   | 10 +++++-----
>>   topology/reef-byt-nocodec.m4   |  4 ++--
>>   topology/reef-byt-rt5640.m4    |  4 ++--
>>   topology/reef-byt-rt5651.m4    |  4 ++--
>>   topology/reef-cht-nocodec.m4   |  8 ++++----
>>   topology/reef-hsw-rt5640.m4    | 10 +++++-----
>>   topology/sof/pipe-pcm-media.m4 | 10 ++++++----
>>   7 files changed, 26 insertions(+), 24 deletions(-)
>>
>> diff --git a/topology/reef-bxt-nocodec.m4 b/topology/reef-bxt-nocodec.m4
>> index 2028323..486d4ea 100644
>> --- a/topology/reef-bxt-nocodec.m4
>> +++ b/topology/reef-bxt-nocodec.m4
>> @@ -40,14 +40,14 @@ 
>> PIPELINE_PCM_ADD(sof/pipe-low-latency-playback.m4, 1, 0, 2, s32le, 
>> 48, 1000, 0,
>>   PIPELINE_PCM_ADD(sof/pipe-low-latency-capture.m4, 2, 1, 2, s32le, 
>> 48, 1000, 0, 0, 0, 2)
>>     # PCM Media Playback pipeline 3 on PCM 2 using max 2 channels of 
>> s32le.
>> -# Schedule 96 frames per 2000us deadline on core 0 with priority 1
>> +# Schedule 192 frames per 4000us deadline on core 0 with priority 1
>>   # Use DMAC 0 channel 3 for PCM audio playback data
>> -PIPELINE_PCM_ADD(sof/pipe-pcm-media.m4, 3, 2, 2, s32le, 96, 2000, 1, 
>> 0, 0, 3)
>> +PIPELINE_PCM_ADD(sof/pipe-pcm-media.m4, 3, 2, 2, s32le, 192, 4000, 
>> 1, 0, 0, 3)
>>     # PCM Media Playback pipeline 4 on PCM 3 using max 2 channels of 
>> s32le.
>> -# Schedule 96 frames per 2000us deadline on core 0 with priority 1
>> -# Use DMAC 0 channel 4 for PCM audio playback data
>> -PIPELINE_PCM_ADD(sof/pipe-pcm-media.m4, 4, 3, 2, s32le, 96, 2000, 1, 
>> 0, 0, 4)
>> +# Schedule 192 frames per 4000us deadline on core 0 with priority 1
>> +# Use DMAC 0 channel 3 for PCM audio playback data
>> +PIPELINE_PCM_ADD(sof/pipe-pcm-media.m4, 3, 2, 2, s32le, 192, 4000, 
>> 1, 0, 0, 4)
>>     # Tone Playback pipeline 5 using max 2 channels of s32le.
>>   # Schedule 192 frames per 4000us deadline on core 0 with priority 2
>> diff --git a/topology/reef-byt-nocodec.m4 b/topology/reef-byt-nocodec.m4
>> index 1c3cf5f..938666d 100644
>> --- a/topology/reef-byt-nocodec.m4
>> +++ b/topology/reef-byt-nocodec.m4
>> @@ -38,9 +38,9 @@ PIPELINE_PCM_ADD(sof/pipe-low-latency-playback.m4, 
>> 1, 0, 2, s32le, 48, 1000, 0,
>>   PIPELINE_PCM_ADD(sof/pipe-low-latency-capture.m4, 2, 1, 2, s32le, 
>> 48, 1000, 0, 0, 0, 2)
>>     # PCM Media Playback pipeline 3 on PCM 2 using max 2 channels of 
>> s32le.
>> -# Schedule 96 frames per 2000us deadline on core 0 with priority 1
>> +# Schedule 192 frames per 4000us deadline on core 0 with priority 1
>>   # Use DMAC 0 channel 3 for PCM audio playback data
>> -PIPELINE_PCM_ADD(sof/pipe-pcm-media.m4, 3, 2, 2, s32le, 96, 2000, 1, 
>> 0, 0, 3)
>> +PIPELINE_PCM_ADD(sof/pipe-pcm-media.m4, 3, 2, 2, s32le, 192, 4000, 
>> 1, 0, 0, 3)
>>     # Tone Playback pipeline 5 using max 2 channels of s32le.
>>   # Schedule 192 frames per 4000us deadline on core 0 with priority 2
>> diff --git a/topology/reef-byt-rt5640.m4 b/topology/reef-byt-rt5640.m4
>> index 9855f1a..05743e2 100644
>> --- a/topology/reef-byt-rt5640.m4
>> +++ b/topology/reef-byt-rt5640.m4
>> @@ -38,9 +38,9 @@ PIPELINE_PCM_ADD(sof/pipe-low-latency-playback.m4, 
>> 1, 0, 2, s32le, 48, 1000, 0,
>>   PIPELINE_PCM_ADD(sof/pipe-low-latency-capture.m4, 2, 1, 2, s32le, 
>> 48, 1000, 0, 0, 0, 2)
>>     # PCM Media Playback pipeline 3 on PCM 2 using max 2 channels of 
>> s32le.
>> -# Schedule 96 frames per 2000us deadline on core 0 with priority 1
>> +# Schedule 192 frames per 4000us deadline on core 0 with priority 1
>>   # Use DMAC 0 channel 3 for PCM audio playback data
>> -PIPELINE_PCM_ADD(sof/pipe-pcm-media.m4, 3, 2, 2, s32le, 96, 2000, 1, 
>> 0, 0, 3)
>> +PIPELINE_PCM_ADD(sof/pipe-pcm-media.m4, 3, 2, 2, s32le, 192, 4000, 
>> 1, 0, 0, 3)
>>     # Tone Playback pipeline 5 using max 2 channels of s32le.
>>   # Schedule 192 frames per 4000us deadline on core 0 with priority 2
>> diff --git a/topology/reef-byt-rt5651.m4 b/topology/reef-byt-rt5651.m4
>> index 1b492b7..cb9dcc2 100644
>> --- a/topology/reef-byt-rt5651.m4
>> +++ b/topology/reef-byt-rt5651.m4
>> @@ -38,9 +38,9 @@ PIPELINE_PCM_ADD(sof/pipe-low-latency-playback.m4, 
>> 1, 0, 2, s32le, 48, 1000, 0,
>>   PIPELINE_PCM_ADD(sof/pipe-low-latency-capture.m4, 2, 1, 2, s32le, 
>> 48, 1000, 0, 0, 0, 2)
>>     # PCM Media Playback pipeline 3 on PCM 2 using max 2 channels of 
>> s32le.
>> -# Schedule 96 frames per 2000us deadline on core 0 with priority 1
>> +# Schedule 192 frames per 4000us deadline on core 0 with priority 1
>>   # Use DMAC 0 channel 3 for PCM audio playback data
>> -PIPELINE_PCM_ADD(sof/pipe-pcm-media.m4, 3, 2, 2, s32le, 96, 2000, 1, 
>> 0, 0, 3)
>> +PIPELINE_PCM_ADD(sof/pipe-pcm-media.m4, 3, 2, 2, s32le, 192, 4000, 
>> 1, 0, 0, 3)
>>     # Tone Playback pipeline 5 using max 2 channels of s32le.
>>   # Schedule 192 frames per 4000us deadline on core 0 with priority 2
>> diff --git a/topology/reef-cht-nocodec.m4 b/topology/reef-cht-nocodec.m4
>> index ead0f75..52e8d50 100644
>> --- a/topology/reef-cht-nocodec.m4
>> +++ b/topology/reef-cht-nocodec.m4
>> @@ -37,10 +37,10 @@ 
>> PIPELINE_PCM_ADD(sof/pipe-low-latency-playback.m4, 1, 0, 2, s32le, 
>> 48, 1000, 0,
>>   # Use DMAC 0 channel 2 for PCM audio capture data
>>   PIPELINE_PCM_ADD(sof/pipe-low-latency-capture.m4, 2, 1, 2, s32le, 
>> 48, 1000, 0, 0, 0, 2)
>>   -# PCM Media Playback pipeline 4 on PCM 3 using max 2 channels of 
>> s32le.
>> -# Schedule 96 frames per 2000us deadline on core 0 with priority 1
>> -# Use DMAC 0 channel 4 for PCM audio playback data
>> -PIPELINE_PCM_ADD(sof/pipe-pcm-media.m4, 4, 3, 2, s32le, 96, 2000, 1, 
>> 0, 0, 4)
>> +# PCM Media Playback pipeline 3 on PCM 2 using max 2 channels of s32le.
>> +# Schedule 192 frames per 4000us deadline on core 0 with priority 1
>> +# Use DMAC 0 channel 3 for PCM audio playback data
>> +PIPELINE_PCM_ADD(sof/pipe-pcm-media.m4, 3, 2, 2, s32le, 192, 4000, 
>> 1, 0, 0, 3)
>>     # Tone Playback pipeline 5 using max 2 channels of s32le.
>>   # Schedule 192 frames per 4000us deadline on core 0 with priority 2
>> diff --git a/topology/reef-hsw-rt5640.m4 b/topology/reef-hsw-rt5640.m4
>> index e4d9392..af18633 100644
>> --- a/topology/reef-hsw-rt5640.m4
>> +++ b/topology/reef-hsw-rt5640.m4
>> @@ -40,14 +40,14 @@ 
>> PIPELINE_PCM_ADD(sof/pipe-low-latency-playback.m4, 1, 0, 2, s32le, 
>> 48, 1000, 0,
>>   PIPELINE_PCM_ADD(sof/pipe-low-latency-capture.m4, 2, 1, 2, s32le, 
>> 48, 1000, 0, 0, 0, 2)
>>     # PCM Media Playback pipeline 3 on PCM 2 using max 2 channels of 
>> s32le.
>> -# Schedule 96 frames per 2000us deadline on core 0 with priority 1
>> +# Schedule 192 frames per 4000us deadline on core 0 with priority 1
>>   # Use DMAC 0 channel 3 for PCM audio playback data
>> -PIPELINE_PCM_ADD(sof/pipe-pcm-media.m4, 3, 2, 2, s32le, 96, 2000, 1, 
>> 0, 0, 3)
>> +PIPELINE_PCM_ADD(sof/pipe-pcm-media.m4, 3, 2, 2, s32le, 192, 4000, 
>> 1, 0, 0, 3)
>>     # PCM Media Playback pipeline 4 on PCM 3 using max 2 channels of 
>> s32le.
>> -# Schedule 96 frames per 2000us deadline on core 0 with priority 1
>> -# Use DMAC 0 channel 4 for PCM audio playback data
>> -PIPELINE_PCM_ADD(sof/pipe-pcm-media.m4, 4, 3, 2, s32le, 96, 2000, 1, 
>> 0, 0, 4)
>> +# Schedule 192 frames per 4000us deadline on core 0 with priority 1
>> +# Use DMAC 0 channel 3 for PCM audio playback data
>> +PIPELINE_PCM_ADD(sof/pipe-pcm-media.m4, 3, 2, 2, s32le, 192, 4000, 
>> 1, 0, 0, 4)
>>     # Tone Playback pipeline 5 using max 2 channels of s32le.
>>   # Schedule 192 frames per 4000us deadline on core 0 with priority 2
>> diff --git a/topology/sof/pipe-pcm-media.m4 
>> b/topology/sof/pipe-pcm-media.m4
>> index bde9dd2..97958cd 100644
>> --- a/topology/sof/pipe-pcm-media.m4
>> +++ b/topology/sof/pipe-pcm-media.m4
>> @@ -73,12 +73,14 @@ W_PGA(0, PCM PCM_ID Playback Volume, 
>> PIPELINE_FORMAT, 2, 2, 2)
>>   # "SRC 0" has 2 sink and source periods.
>>   W_SRC(0, PIPELINE_FORMAT, 2, 2, media_src_conf, 2)
>>   -# Media Buffers
>> -W_BUFFER(0, COMP_BUFFER_SIZE(2,
>> +# Media Source Buffers to SRC, make them big enough to deal with 2 * 
>> rate.
>> +W_BUFFER(0, COMP_BUFFER_SIZE(4,
>>       COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, 
>> SCHEDULE_FRAMES))
>> -W_BUFFER(1,COMP_BUFFER_SIZE(2,
>> +W_BUFFER(1,COMP_BUFFER_SIZE(4,
>>       COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, 
>> SCHEDULE_FRAMES))
>> -W_BUFFER(2, COMP_BUFFER_SIZE(2,
>> +
>> +# Buffer B2 is on fixed rate sink side of SRC. Set it 1.5 * rate.
>> +W_BUFFER(2, COMP_BUFFER_SIZE(3,
>>       COMP_SAMPLE_SIZE(PIPELINE_FORMAT), PIPELINE_CHANNELS, 
>> SCHEDULE_FRAMES))
>>     #
>>
>
> _______________________________________________
> Sound-open-firmware mailing list
> Sound-open-firmware at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware
>



More information about the Sound-open-firmware mailing list