Skip to content

Noise issue when XRUN injection for playback #506

Closed

Description

@DarrenxWang

Summary:
Noise issue when XRUN injection for playback
No error in dmesg
the result is empty when run 'sudo ./sof-logger -l sof-apl.ldc-master-gcc'
error log:
0 1 VOLUME 60263494.947917 49.895832 volume.c:463 xro
0 2 COMP 60263497.552083 2.604167 ../../src/include/sof/audio/component.h:414 Xov
0 2 unknown 60263499.895833 2.343750 ../../src/include/sof/audio/component.h:415 value 65536
0 2 unknown 60263502.343750 2.447917 ../../src/include/sof/audio/component.h:416 value 384
0 1 PIPE 60263508.697917 6.354167 pipeline.c:903 ePU
0 1 unknown 60263510.885417 2.187500 pipeline.c:904 value 4
0 1 PIPE 60263513.645833 2.760417 pipeline.c:1198 pxr

Reproduce step:

  1. aplay -D hw:0,0 -c 2 -r 48000 -f s16_le Music/48California_Dreaming.wav -vv -i
  2. sudo ./xrun_injection.sh
  3. sudo ./sof-logger -l sof-apl.ldc-master-gcc -t > logger.txt

Test env:
sof-master: bc50ce1
soft-master: a1dfcb7
kernel sof-dev: 2996b7e8cd0d
tplg: sof-apl-pcm512x.tplg

Log:
logger.txt
dmesg.log

Activity

  1. added
    bugSomething isn't working as expected
    APLApplies to Apollolake platform
    P1Blocker bugs or important features
    on Oct 24, 2018
  2. mengdonglin commented on Oct 24, 2018

    @mengdonglin
    Collaborator

    @keqiaozhang Does GLK also have this issue?

  3. keqiaozhang commented on Oct 24, 2018

    @keqiaozhang
    Collaborator

    @mengdonglin
    Not sure whether we can do xrun injection on Yorp. For doing xrun injection, we need to enable the CONFIG_SND_PCM_XRUN_DEBUG in kernel config, but chrome is using the different way to build the kernel, I will give it a try tomorrow to see if we can enable XRUN_DEBUG in chrome kernel config.

  4. lgirdwood commented on Oct 25, 2018

    @lgirdwood
    Member

    @keqiaozhang please ask @cujomalainey if you get stuck enabling this on Chrome.

  5. keqiaozhang commented on Oct 25, 2018

    @keqiaozhang
    Collaborator

    Thanks @lgirdwood
    Today I checked the chrome kernel config, but there's no CONFIG_SND_PCM_XRUN_DEBUG item, so there may be some dependencies that need to be selected first.
    @cujomalainey Can you help on this, since "make menuconfig" doesn't work.

  6. added
    P2Critical bugs or normal features
    and removed
    P1Blocker bugs or important features
    on Oct 26, 2018
  7. cujomalainey commented on Oct 26, 2018

    @cujomalainey
    Contributor

    Apologies for the delay, I was flying back yesterday.
    To do menu config on chrome run the following ./chromeos/scripts/kernelconfig editconfig from the root of the kernel repo.

  8. ZhendanYang commented on Oct 29, 2018

    @ZhendanYang

    On CNL with nocodec has the similar error log:

    0      1   VOLUME 993921232.447917        71.250000             volume.c:463 	xro
    0      2     COMP 993921235.208333         2.760417 ../../src/include/sof/audio/component.h:418 	Xov
    0      2  unknown 993921238.125000         2.916667 ../../src/include/sof/audio/component.h:419 	value 65536
    0      2  unknown 993921240.989583         2.864583 ../../src/include/sof/audio/component.h:420 	value 192
    0      1     PIPE 993921248.281250         7.291667           pipeline.c:903 	ePU
    0      1  unknown 993921250.885417         2.604167           pipeline.c:904 	value 4
    0      1     PIPE 993921254.010417         3.125000           pipeline.c:1198	pxr
    

    Test env:
    sof-master: e101263
    soft-master: b5eb15
    kernel sof-dev: 03cadf8
    tplg: test-ssp0-mclk-0-I2S-volume-s16le-s16le-48k-24000k-nocodec.tplg

    logger.txt
    logger-t.txt

  9. lgirdwood commented on Oct 29, 2018

    @lgirdwood
    Member

    Looks like the volume component has had an overrun in each case (i.e. there is no space in the buffer)

  10. 10 remaining items

  11. bardliao commented on Nov 21, 2018

    @bardliao
    Collaborator

    @lgirdwood No, it doesn't always play correctly after the XRUN. I record the output by my cell phone and attach it for your reference. I hit the keyboard at around 2.8 sec in the recorded file, and XRUN happens after that.
    2018-11-21_08-54-36_8690.zip

  12. lgirdwood commented on Nov 21, 2018

    @lgirdwood
    Member

    @bardliao can you capture this will a line in cable on a PC/laptop (quality is bad from a phone). There are also guidelines for reporting audio quality issues that @mengdonglin recently updated. Please follow these on the website.

  13. bardliao commented on Nov 22, 2018

    @bardliao
    Collaborator

    @lgirdwood Thanks @keqiaozhang The recording file is attached. The file is done by loopback on GLK. We do xrun_injection in every 5 sec and there is a short pop when we do xrun_injection. Ideally, playback will recover after the short pop but sometimes it doesn't. We can see the spectrogram has changed after XRUN. I think we can invite firmware folks to check it.
    noise.zip

  14. markyang commented on Dec 3, 2018

    @markyang

    The content of xrun_injection.sh:

    #!/bin/bash 
    
    file=$(find /proc/asound/card0/ -name "*injection*")
    
    int=0
    while [ $int -lt 100000 ]
    do
    	for i in $file
    	do
    		echo 0 > $i
    	done
    	sleep 5
    	echo $int
    	let int++
    done
    
  15. mengdonglin commented on Dec 3, 2018

    @mengdonglin
    Collaborator

    @slawblauciak Here are the steps used by Bard to reproduce this issue:

    1. enable XRUN debug in chromeos-intel-pineview.flavour.config:
      +CONFIG_SND_DEBUG=y
      +CONFIG_SND_DEBUG_VERBOSE=y
      +CONFIG_SND_PCM_XRUN_DEBUG=y
    2. build and update kernel
    3. sudo su -switch to supper user
    4. aplay -Dhw:0,1 -f dat -c 2 audio.wav
    5. Inject xrun during the playback: echo 1 > /proc/asound/card0/pcm1p/sub0/xrun_injection

    @bardliao Thanks for sharing

  16. xiulipan commented on Dec 19, 2018

    @xiulipan
    Contributor

    @ranj063 @keyonjie @lgirdwood
    One hint from scheduler refine:
    For the pipeline_task, the pipeline_xrun_recover will schedule a task from pipeline_trigger COMP_TRIGGER_START that will be ignored since the xrun recovery is called from pipeline_task.

    Following is the workaround added by @tlauda f396500 #125 (discussion about the fix is here)

            /* for playback copy it here, because scheduling won't work
             * on this interrupt level
             */
            if (p->sched_comp->params.direction == SOF_IPC_STREAM_PLAYBACK) {
                    ret = pipeline_copy(p->sched_comp);
                    if (ret < 0) {
                            trace_pipe_error_with_ids(p, "pipeline_xrun_recover() "
                                                      "error: pipeline_copy() "
                                                      "failed, ret = %d", ret);
                            return ret;
                    }
            }

    So if the task is going to accepted running task to be added. You need to remove the above code or add more check in the pipeline_trigger

  17. mengdonglin commented on Dec 19, 2018

    @mengdonglin
    Collaborator

    This is a duplicate of issue reported by Google: #752
    It seems we may need a similar workaround of @tlauda to fix FW XRUN recovery or avoid XRUN on STOP/START.

  18. keqiaozhang commented on Dec 20, 2018

    @keqiaozhang
    Collaborator

    Verified that this issue is fixed on glk-005-drop-stable branch.
    Tested with: glk-005-drop-stable/4d7904d.

    @markyang
    Please help to confirm it on other platforms.

  19. markyang commented on Dec 20, 2018

    @markyang

    Summary:
    This issue cannot be reproduced on APL with PCM512x.

    Test steps:

    1. enable XRUN debug in .config:
      +CONFIG_SND_DEBUG=y
      +CONFIG_SND_DEBUG_VERBOSE=y
      +CONFIG_SND_PCM_XRUN_DEBUG=y
    2. build and update kernel
    3. aplay -Dhw:0,0 -c2 -fS32_LE -vv -i audio.wav
    4. sudo su switch to root # in a new terminal
    5. inject xrun during the playback: 
       echo 1 > /proc/asound/card0/pcm0p/sub0/xrun_injection
    

    Test env:
    sof master: da9ab07
    kernel sof-dev: cac0c10
    tplg: sof-apl-pcm512x.tplg

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

Metadata

Metadata

Labels

APLApplies to Apollolake platformCNLApplies to Cannonlake platformGLKApplies to Gemini Lake platformP2Critical bugs or normal featuresbugSomething isn't working as expectedduplicateThis issue or pull request already exists

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions