Skip to content

snd_pcm_delay() reporting unexpected values #4781

Description

@kv2019i

While testing a new extension to alsa-conformance-test to report PCM delay values, I noticed MTL on hda-generic tplg, is reporting odd seeming values (negative delays).

Environment

kernel: 66ee247 (sof-dev)
SOF: 6c188298b958 (SOF main)
platform: MTL
topoplogy: sof-hda-generic-4ch.tplg

Expected outcome

Definition of the PCM delay in alsa-lib is as follows:

 * For playback the delay is defined as the time that a frame that is written * to the PCM stream shortly after this call will take to be actually * audible. It is as such the overall latency from the write call to the final 

Actual outcome

Negative values reported even if no underrun/overrun condition is seen on the stream. It seems the link position is ahead of the host position, which can't be correct for playback.

Ways to test

Example error

aplay -Dhw:0,0 -traw -fdat /dev/zero

Output from the kernel RD patch:

[ 2106.387543] sof-audio-pci-intel-mtl 0000:00:1f.3: pcm_delay: d=4611686018427387542, tmp=362, pos=1052, hw_ptr=0, start=690,llp=0
[ 2106.468925] sof-audio-pci-intel-mtl 0000:00:1f.3: pcm_delay: d=4611686018427383829, tmp=4267, pos=4958, hw_ptr=192, start=690,llp=0
[ 2106.469404] sof-audio-pci-intel-mtl 0000:00:1f.3: pcm_delay: d=4611686018427387742, tmp=4290, pos=4981, hw_ptr=4128, start=690,llp=0
[ 2106.553960] sof-audio-pci-intel-mtl 0000:00:1f.3: pcm_delay: d=4611686018427383683, tmp=8349, pos=9039, hw_ptr=4128, start=690,llp=0
[ 2106.554421] sof-audio-pci-intel-mtl 0000:00:1f.3: pcm_delay: d=4611686018427387741, tmp=8371, pos=9062, hw_ptr=8208, start=690,llp=0
[ 2106.638929] sof-audio-pci-intel-mtl 0000:00:1f.3: pcm_delay: d=4611686018427383684, tmp=12428, pos=13118, hw_ptr=8208, start=690,llp=0

Output from alsa_conformance_test ("alsa_conformance_test -Phw:0,0 --debug")

TIME_DIFF(s) HW_LEVEL PLAYED DIFF RATE DELAY
0.000037840 288 192 192 5073995.771670 4611686018427388022
0.000080551 240 240 48 595895.767899 4611686018427388018
0.000994502 432 288 48 48265.362966 4611686018427388210
0.001015976 384 336 48 47245.210517 4611686018427388162
0.000983345 336 384 48 48812.980185 4611686018427388114

Metadata

Metadata

Labels

HDAApplies to HD-Audio bus for codec connectionMTLApplies to Meteor Lake platform.P1Blocker bugs or important featuresSDWApplies to SoundWire bus for codec connectionTGLApplies to Tiger Lake platformbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions