Skip to content

[BUG] Byt low latency pipeline produces distortion with S24/S32 playback #1487

Closed

Description

@juimonen

Describe the bug
byt low latency playback pipe he:0,0 produces distortion with s24/s32 playback

To Reproduce
play s32 or s24 audio to hw:0,0
for e.g. like this in script file (play.sh 48000 test16bit.wav):
#!/bin/sh
FS=$1
BITS=32
ENDIAN=little
NCH=2
RAW=_tmp.raw
DEV=hw:0,0
sox "$2" -c $NCH -r $FS -b $BITS --endian $ENDIAN $RAW
time -p aplay -v -D$DEV -t raw -c $NCH -f S32_LE -r $FS $RAW --dump-hw-params
rm $RAW

Reproduction Rate
Always

Expected behavior
Clean sound

Impact
showstopper

Environment

  1. latest kernel, latest firmware
  2. topology:sof-byt-rt5682.tplg
  3. platform: byt
  4. always

Screenshots or console output
we have gaps around every 30ms
s32to00

Activity

  1. added
    bugSomething isn't working as expected
    on May 29, 2019
  2. juimonen commented on May 29, 2019

    @juimonen
    Author

    so obviously we have some buffer wrap issue somewhere...

  3. juimonen commented on May 29, 2019

    @juimonen
    Author

    btw the strange thing here is that I can play s24/s32 48khz just fine to media pipe hw:0,1...

  4. lgirdwood commented on May 29, 2019

    @lgirdwood
    Member

    @juimonen what does aplay -v show for both pipelines as this may relate to host period size.

  5. juimonen commented on May 31, 2019

    @juimonen
    Author

    @tlauda also this looks like some buffer wrap issue, but I think this is different to #1482? #1482 we are leaving stuff out and "catenating" buffer's together (so actually playback is shorter than it supposed to be). In this we are playing as long as it should be, but missing pieces from the waveform.

  6. tlauda commented on May 31, 2019

    @tlauda
    Contributor

    @juimonen Could you verify if the mixer uses the right processing function (mix_n_s32)?

  7. juimonen commented on Jun 3, 2019

    @juimonen
    Author

    @tlauda s32/s24 playback to hw:0,0 uses s32 mixer function (and produces distortion). "normal" aplay to hw:0,0 uses s16 mixer function. s32/s24 playback to hw:0,1 seems to use also s32 mixer function (but doesn't produce distortion).

  8. juimonen commented on Jun 3, 2019

    @juimonen
    Author

    @tlauda if I "rewind" fw code to 9be2694 before dw-dma overhaul and apply your a720164cd5ae4c4e656e0cb7d74b199cd9f3ee1a on top of it ->s32 playback to hw:0,0 works...

  9. juimonen commented on Jun 3, 2019

    @juimonen
    Author

    @tlauda sorry meant your (I cherry picked it): 5d554c5

  10. tlauda commented on Jun 3, 2019

    @tlauda
    Contributor

    @juimonen Can you bisect the faulty commit?

  11. juimonen commented on Jun 3, 2019

    @juimonen
    Author

    @tlauda attached verbose logs of s32 playback to hw00 (distortion) and hw01 (clean)

    test_play_s32_00.txt
    test_play_s32_01.txt

  12. juimonen commented on Jun 3, 2019

    @juimonen
    Author

    @tlauda bisected and the commit to break s24/s32 is e2b994e

  13. juimonen commented on Jun 3, 2019

    @juimonen
    Author

    @tlauda there's something really dodgy in the platform_dw_dma_set_transfer_size macro.... the old one before cleanup produces sane buffer size values... the new macro produces something like overflowed pointer values... I'm not totally sure I understand how this should work. If I change it the "old way": (lli->ctrl_hi = DW_CTLH_CLASS(class) | (size & DW_CTLH_BLOCK_TS_MASK)) things are working...

  14. juimonen commented on Jun 3, 2019

    @juimonen
    Author

    @tlauda so I mean I don't think you can replace a = b | c with a |= b and a |= c

  15. tlauda commented on Jun 3, 2019

    @tlauda
    Contributor

    Fixed by #1487.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions