multi-channel playback regression
Hi Takashi,
When doing multi-channel playback tests on IbexPeak, I found that the following patch makes the playback enter an infinite loop, repeatedly playing a range of ~0.5s audio content. (Seems that some buffer pointer can never advance.)
Thanks,
Fengguang
---
79452f0a28aa5a40522c487b42a5fc423647ad98
Author: Takashi Iwai <[email protected]> Date: Wed Jul 22 12:51:51 2009 +0200
ALSA: pcm - Fix regressions with VMware
VMware tends to report PCM positions and period updates at utterly wrong timing. This screws up the recent PCM core code that tries to correct the position based on the irq timing.
Now, when a backward irq position is detected, skip the update instead of rebasing. (This is almost the old behavior before 2.6.30.)
sound/core/pcm_lib.c +9 -1
@@ -244,18 +244,27 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) delta = new_hw_ptr - hw_ptr_interrupt; }if (delta <0 ) { - delta += runtime->buffer_size; +if (runtime->periods ==1 ) + delta += runtime->buffer_size;if (delta <0 ) {hw_ptr_error (substream,"Unexpected hw_pointer value " "(stream=%i, pos=%ld, intr_ptr=%ld)\n" , substream->stream, (long )pos, (long )hw_ptr_interrupt); +#if 1 +/* simply skipping the hwptr update seems more +* robust in some cases, e.g. on VMware with +* inaccurate timer source +*/ +return 0 ;/* skip this update */ +#else /* rebase to interrupt position */ hw_base = new_hw_ptr = hw_ptr_interrupt;/* align hw_base to buffer_size */ hw_base -= hw_base % runtime->buffer_size;
At Thu, 23 Jul 2009 14:53:45 +0800,
Quoted 7 lines · Wu Fengguang
Hi Takashi,
When doing multi-channel playback tests on IbexPeak, I found that the following patch makes the playback enter an infinite loop, repeatedly playing a range of ~0.5s audio content. (Seems that some buffer pointer can never advance.)
Could you set 1 to /proc/asound/card0/pcm0p/xrun_debug and give the messages? Also, please show /proc/.../pcm0p/sub0/hw_params, too.
The change affects only the code path for the problematic hardware that reports wrong DMA position. So, if this change regresses, it means that the device has been already problematic from the beginning...
Takashi
Quoted 50 lines
Thanks,
Fengguang
---
79452f0a28aa5a40522c487b42a5fc423647ad98Author: Takashi Iwai <[email protected]> Date: Wed Jul 22 12:51:51 2009 +0200ALSA: pcm - Fix regressions with VMware
VMware tends to report PCM positions and period updates at utterly wrong timing. This screws up the recent PCM core code that tries to correct the position based on the irq timing.
Now, when a backward irq position is detected, skip the update instead of rebasing. (This is almost the old behavior before 2.6.30.)
Signed-off-by Takashi Iwai <[email protected]>sound/core/pcm_lib.c +9
-1@@ -244,18 +244,27 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) delta = new_hw_ptr - hw_ptr_interrupt; }if (delta <0 ) { - delta += runtime->buffer_size; +if (runtime->periods ==1 ) + delta += runtime->buffer_size;if (delta <0 ) {hw_ptr_error (substream,"Unexpected hw_pointer value " "(stream=%i, pos=%ld, intr_ptr=%ld)\n" , substream->stream, (long )pos, (long )hw_ptr_interrupt); +#if 1 +/* simply skipping the hwptr update seems more +* robust in some cases, e.g. on VMware with +* inaccurate timer source +*/ +return 0 ;/* skip this update */ +#else /* rebase to interrupt position */ hw_base = new_hw_ptr = hw_ptr_interrupt;/* align hw_base to buffer_size */ hw_base -= hw_base % runtime->buffer_size;
Quoted 5 lines · Takashi Iwai
At Thu, 23 Jul 2009 14:53:45 +0800,
Quoted 3 lines · Wu Fengguang
Hi Takashi,
Quoted 7 lines
Quoted 4 lines
When doing multi-channel playback tests on IbexPeak, I found that the following patch makes the playback enter an infinite loop, repeatedly playing a range of ~0.5s audio content. (Seems that some buffer pointer can never advance.)
Could you set 1 to
/proc/asound/card0/pcm0p/xrun_debugand give the messages? Also, please show/proc/.../pcm0p/sub0/hw_params, too.
echo 1 > /proc/asound/card0/pcm0p/xrun_debug
(no error messages, will test it with the patch)
% cat /proc/asound/card0/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 8
rate: 48000 (48000/1)period_size: 1024buffer_size: 4096
Quoted 4 lines
The change affects only the code path for the problematic hardware that reports wrong DMA position. So, if this change regresses, it means that the device has been already problematic from the beginning...
Very likely..
Quoted 50 lines
Quoted 50 lines
Thanks,
Fengguang
---
79452f0a28aa5a40522c487b42a5fc423647ad98Author: Takashi Iwai <[email protected]> Date: Wed Jul 22 12:51:51 2009 +0200ALSA: pcm - Fix regressions with VMware
VMware tends to report PCM positions and period updates at utterly wrong timing. This screws up the recent PCM core code that tries to correct the position based on the irq timing.
Now, when a backward irq position is detected, skip the update instead of rebasing. (This is almost the old behavior before 2.6.30.)
Signed-off-by Takashi Iwai <[email protected]>sound/core/pcm_lib.c +9
-1@@ -244,18 +244,27 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) delta = new_hw_ptr - hw_ptr_interrupt; }if (delta <0 ) { - delta += runtime->buffer_size; +if (runtime->periods ==1 ) + delta += runtime->buffer_size;if (delta <0 ) {hw_ptr_error (substream,"Unexpected hw_pointer value " "(stream=%i, pos=%ld, intr_ptr=%ld)\n" , substream->stream, (long )pos, (long )hw_ptr_interrupt); +#if 1 +/* simply skipping the hwptr update seems more +* robust in some cases, e.g. on VMware with +* inaccurate timer source +*/ +return 0 ;/* skip this update */ +#else /* rebase to interrupt position */ hw_base = new_hw_ptr = hw_ptr_interrupt;/* align hw_base to buffer_size */ hw_base -= hw_base % runtime->buffer_size;
Quoted 10 lines · Takashi Iwai
At Thu, 23 Jul 2009 14:53:45 +0800,
Quoted 7 lines · Wu Fengguang
Hi Takashi,
When doing multi-channel playback tests on IbexPeak, I found that the following patch makes the playback enter an infinite loop, repeatedly playing a range of ~0.5s audio content. (Seems that some buffer pointer can never advance.)
Quoted 7 lines
Could you set 1 to
/proc/asound/card0/pcm0p/xrun_debugand give the messages? Also, please show/proc/.../pcm0p/sub0/hw_params, too.The change affects only the code path for the problematic hardware that reports wrong DMA position. So, if this change regresses, it means that the device has been already problematic from the beginning...
I caught some messages:
# speaker-test -c8 -twav -D surround71
speaker-test 1.0.16
Playback device is surround71
Stream parameters are 48000Hz, S16_LE, 8 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 16 to 4096
Period size range from 8 to 2048
Using max buffer size 4096
Periods = 4
was set period_size = 1024
was set buffer_size = 4096
0 - Front Left
^C
% cat /proc/asound/card0/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 8
rate: 48000 (48000/1)period_size: 1024buffer_size: 4096
[ 382.621466] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x10 [ 382.629314] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x2, stream=0x5, channel=0, format=0x17 [ 382.644691] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x3, stream=0x5, channel=2, format=0x17 [ 382.656644] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x4, stream=0x5, channel=4, format=0x17 [ 382.672593] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x5, stream=0x5, channel=6, format=0x17 [ 382.863277] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1, intr_ptr=4096) [ 382.885281] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1064, intr_ptr=4096) [ 382.906399] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2080, intr_ptr=4096) [ 382.927436] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3092, intr_ptr=4096) [ 382.948556] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=12, intr_ptr=4096) [ 382.969675] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1025, intr_ptr=4096) [ 382.991708] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2088, intr_ptr=4096) [ 383.012827] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3104, intr_ptr=4096) [ 383.033863] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=20, intr_ptr=4096) [ 383.054983] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1036, intr_ptr=4096) [ 387.886967] __ratelimit: 226 callbacks suppressed [ 387.889543] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=20, intr_ptr=4096) [ 387.908087] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1036, intr_ptr=4096) [ 387.929206] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2049, intr_ptr=4096) [ 387.951239] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3112, intr_ptr=4096) [ 387.972358] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=32, intr_ptr=4096) [ 387.993561] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1052, intr_ptr=4096) [ 388.014680] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2068, intr_ptr=4096) [ 388.035717] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3080, intr_ptr=4096) [ 388.057584] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=36, intr_ptr=4096) [ 388.078703] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1052, intr_ptr=4096) [ 392.910772] __ratelimit: 226 callbacks suppressed [ 392.913025] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=40, intr_ptr=4096) [ 392.931891] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1056, intr_ptr=4096) [ 392.952846] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2064, intr_ptr=4096) [ 392.974047] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3084, intr_ptr=4096) [ 392.995167] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1, intr_ptr=4096) [ 393.017201] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1064, intr_ptr=4096) [ 393.038320] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2080, intr_ptr=4096) [ 393.059521] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3100, intr_ptr=4096) [ 393.080561] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=16, intr_ptr=4096) [ 393.101761] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1036, intr_ptr=4096) [ 397.933743] __ratelimit: 226 callbacks suppressed [ 397.939240] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=20, intr_ptr=4096) [ 397.954697] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1025, intr_ptr=4096) [ 397.976647] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2084, intr_ptr=4096) [ 397.997600] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3092, intr_ptr=4096) [ 398.018719] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=12, intr_ptr=4096) [ 398.039839] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1025, intr_ptr=4096) [ 398.061788] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2084, intr_ptr=4096) [ 398.082741] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3092, intr_ptr=4096) [ 398.103862] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=12, intr_ptr=4096) [ 398.124981] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1025, intr_ptr=4096) [ 400.777479] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x2 [ 400.786903] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x3 [ 400.795795] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x4 [ 400.804357] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x5
Quoted 54 lines
Takashi
Quoted 50 lines
Thanks,
Fengguang
---
79452f0a28aa5a40522c487b42a5fc423647ad98Author: Takashi Iwai <[email protected]> Date: Wed Jul 22 12:51:51 2009 +0200ALSA: pcm - Fix regressions with VMware
VMware tends to report PCM positions and period updates at utterly wrong timing. This screws up the recent PCM core code that tries to correct the position based on the irq timing.
Now, when a backward irq position is detected, skip the update instead of rebasing. (This is almost the old behavior before 2.6.30.)
Signed-off-by Takashi Iwai <[email protected]>sound/core/pcm_lib.c +9
-1@@ -244,18 +244,27 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) delta = new_hw_ptr - hw_ptr_interrupt; }if (delta <0 ) { - delta += runtime->buffer_size; +if (runtime->periods ==1 ) + delta += runtime->buffer_size;if (delta <0 ) {hw_ptr_error (substream,"Unexpected hw_pointer value " "(stream=%i, pos=%ld, intr_ptr=%ld)\n" , substream->stream, (long )pos, (long )hw_ptr_interrupt); +#if 1 +/* simply skipping the hwptr update seems more +* robust in some cases, e.g. on VMware with +* inaccurate timer source +*/ +return 0 ;/* skip this update */ +#else /* rebase to interrupt position */ hw_base = new_hw_ptr = hw_ptr_interrupt;/* align hw_base to buffer_size */ hw_base -= hw_base % runtime->buffer_size;
At Thu, 23 Jul 2009 15:22:53 +0800,
Quoted 15 lines · Wu Fengguang
Quoted 13 lines · Takashi Iwai
At Thu, 23 Jul 2009 14:53:45 +0800,
Quoted 7 lines · Wu Fengguang
Hi Takashi,
When doing multi-channel playback tests on IbexPeak, I found that the following patch makes the playback enter an infinite loop, repeatedly playing a range of ~0.5s audio content. (Seems that some buffer pointer can never advance.)
Could you set 1 to
/proc/asound/card0/pcm0p/xrun_debugand give the messages? Also, please show/proc/.../pcm0p/sub0/hw_params, too.
Quoted 6 lines
Quoted 4 lines
The change affects only the code path for the problematic hardware that reports wrong DMA position. So, if this change regresses, it means that the device has been already problematic from the beginning...
I caught some messages:
Is this with the patched (as is on sound git tree) kernel? What if changing from #if 1 to #if 0?
thanks,
Takashi
Quoted 138 lines
# speaker-test -c8 -twav -D surround71speaker-test 1.0.16
Playback device is surround71
Stream parameters are 48000Hz,S16_LE, 8 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 16 to 4096
Period size range from 8 to 2048
Using max buffer size 4096
Periods = 4
was setperiod_size= 1024
was setbuffer_size= 4096
0 - Front Left
^C% cat
/proc/asound/card0/pcm0p/sub0/hw_params
access:MMAP_INTERLEAVED
format:S16_LE
subformat: STD
channels: 8
rate: 48000 (48000/1)period_size: 1024buffer_size: 4096[ 382.621466] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x10 [ 382.629314] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x2, stream=0x5, channel=0, format=0x17 [ 382.644691] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x3, stream=0x5, channel=2, format=0x17 [ 382.656644] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x4, stream=0x5, channel=4, format=0x17 [ 382.672593] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x5, stream=0x5, channel=6, format=0x17 [ 382.863277] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1, intr_ptr=4096) [ 382.885281] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1064, intr_ptr=4096) [ 382.906399] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2080, intr_ptr=4096) [ 382.927436] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3092, intr_ptr=4096) [ 382.948556] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=12, intr_ptr=4096) [ 382.969675] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1025, intr_ptr=4096) [ 382.991708] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2088, intr_ptr=4096) [ 383.012827] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3104, intr_ptr=4096) [ 383.033863] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=20, intr_ptr=4096) [ 383.054983] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1036, intr_ptr=4096) [ 387.886967] __ratelimit: 226 callbacks suppressed [ 387.889543] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=20, intr_ptr=4096) [ 387.908087] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1036, intr_ptr=4096) [ 387.929206] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2049, intr_ptr=4096) [ 387.951239] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3112, intr_ptr=4096) [ 387.972358] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=32, intr_ptr=4096) [ 387.993561] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1052, intr_ptr=4096) [ 388.014680] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2068, intr_ptr=4096) [ 388.035717] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3080, intr_ptr=4096) [ 388.057584] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=36, intr_ptr=4096) [ 388.078703] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1052, intr_ptr=4096) [ 392.910772] __ratelimit: 226 callbacks suppressed [ 392.913025] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=40, intr_ptr=4096) [ 392.931891] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1056, intr_ptr=4096) [ 392.952846] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2064, intr_ptr=4096) [ 392.974047] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3084, intr_ptr=4096) [ 392.995167] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1, intr_ptr=4096) [ 393.017201] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1064, intr_ptr=4096) [ 393.038320] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2080, intr_ptr=4096) [ 393.059521] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3100, intr_ptr=4096) [ 393.080561] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=16, intr_ptr=4096) [ 393.101761] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1036, intr_ptr=4096) [ 397.933743] __ratelimit: 226 callbacks suppressed [ 397.939240] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=20, intr_ptr=4096) [ 397.954697] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1025, intr_ptr=4096) [ 397.976647] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2084, intr_ptr=4096) [ 397.997600] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3092, intr_ptr=4096) [ 398.018719] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=12, intr_ptr=4096) [ 398.039839] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1025, intr_ptr=4096) [ 398.061788] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2084, intr_ptr=4096) [ 398.082741] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3092, intr_ptr=4096) [ 398.103862] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=12, intr_ptr=4096) [ 398.124981] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1025, intr_ptr=4096) [ 400.777479] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x2 [ 400.786903] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x3 [ 400.795795] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x4 [ 400.804357] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x5Quoted 54 lines
Takashi
Quoted 50 lines
Thanks,
Fengguang
---
79452f0a28aa5a40522c487b42a5fc423647ad98Author: Takashi Iwai <[email protected]> Date: Wed Jul 22 12:51:51 2009 +0200ALSA: pcm - Fix regressions with VMware
VMware tends to report PCM positions and period updates at utterly wrong timing. This screws up the recent PCM core code that tries to correct the position based on the irq timing.
Now, when a backward irq position is detected, skip the update instead of rebasing. (This is almost the old behavior before 2.6.30.)
Signed-off-by Takashi Iwai <[email protected]>sound/core/pcm_lib.c +9
-1@@ -244,18 +244,27 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) delta = new_hw_ptr - hw_ptr_interrupt; }if (delta <0 ) { - delta += runtime->buffer_size; +if (runtime->periods ==1 ) + delta += runtime->buffer_size;if (delta <0 ) {hw_ptr_error (substream,"Unexpected hw_pointer value " "(stream=%i, pos=%ld, intr_ptr=%ld)\n" , substream->stream, (long )pos, (long )hw_ptr_interrupt); +#if 1 +/* simply skipping the hwptr update seems more +* robust in some cases, e.g. on VMware with +* inaccurate timer source +*/ +return 0 ;/* skip this update */ +#else /* rebase to interrupt position */ hw_base = new_hw_ptr = hw_ptr_interrupt;/* align hw_base to buffer_size */ hw_base -= hw_base % runtime->buffer_size;
Quoted 17 lines · Takashi Iwai
At Thu, 23 Jul 2009 15:22:53 +0800,
Quoted 15 lines · Wu Fengguang
Quoted 13 lines · Takashi Iwai
At Thu, 23 Jul 2009 14:53:45 +0800,
Quoted 7 lines · Wu Fengguang
Hi Takashi,
When doing multi-channel playback tests on IbexPeak, I found that the following patch makes the playback enter an infinite loop, repeatedly playing a range of ~0.5s audio content. (Seems that some buffer pointer can never advance.)
Could you set 1 to
/proc/asound/card0/pcm0p/xrun_debugand give the messages? Also, please show/proc/.../pcm0p/sub0/hw_params, too.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
The change affects only the code path for the problematic hardware that reports wrong DMA position. So, if this change regresses, it means that the device has been already problematic from the beginning...
I caught some messages:
Is this with the patched (as is on sound git tree) kernel?
Yes, it's unmodified latest git tree.
Quoted 1 line
What if changing from #if 1 to #if 0?
This makes 8-channel playback work again.
Thanks,
Fengguang
Quoted 139 lines
Quoted 139 lines
# speaker-test -c8 -twav -D surround71speaker-test 1.0.16
Playback device is surround71
Stream parameters are 48000Hz,S16_LE, 8 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 16 to 4096
Period size range from 8 to 2048
Using max buffer size 4096
Periods = 4
was setperiod_size= 1024
was setbuffer_size= 4096
0 - Front Left
^C% cat
/proc/asound/card0/pcm0p/sub0/hw_params
access:MMAP_INTERLEAVED
format:S16_LE
subformat: STD
channels: 8
rate: 48000 (48000/1)period_size: 1024buffer_size: 4096[ 382.621466] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x10 [ 382.629314] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x2, stream=0x5, channel=0, format=0x17 [ 382.644691] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x3, stream=0x5, channel=2, format=0x17 [ 382.656644] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x4, stream=0x5, channel=4, format=0x17 [ 382.672593] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x5, stream=0x5, channel=6, format=0x17 [ 382.863277] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1, intr_ptr=4096) [ 382.885281] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1064, intr_ptr=4096) [ 382.906399] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2080, intr_ptr=4096) [ 382.927436] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3092, intr_ptr=4096) [ 382.948556] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=12, intr_ptr=4096) [ 382.969675] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1025, intr_ptr=4096) [ 382.991708] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2088, intr_ptr=4096) [ 383.012827] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3104, intr_ptr=4096) [ 383.033863] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=20, intr_ptr=4096) [ 383.054983] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1036, intr_ptr=4096) [ 387.886967] __ratelimit: 226 callbacks suppressed [ 387.889543] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=20, intr_ptr=4096) [ 387.908087] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1036, intr_ptr=4096) [ 387.929206] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2049, intr_ptr=4096) [ 387.951239] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3112, intr_ptr=4096) [ 387.972358] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=32, intr_ptr=4096) [ 387.993561] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1052, intr_ptr=4096) [ 388.014680] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2068, intr_ptr=4096) [ 388.035717] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3080, intr_ptr=4096) [ 388.057584] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=36, intr_ptr=4096) [ 388.078703] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1052, intr_ptr=4096) [ 392.910772] __ratelimit: 226 callbacks suppressed [ 392.913025] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=40, intr_ptr=4096) [ 392.931891] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1056, intr_ptr=4096) [ 392.952846] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2064, intr_ptr=4096) [ 392.974047] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3084, intr_ptr=4096) [ 392.995167] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1, intr_ptr=4096) [ 393.017201] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1064, intr_ptr=4096) [ 393.038320] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2080, intr_ptr=4096) [ 393.059521] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3100, intr_ptr=4096) [ 393.080561] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=16, intr_ptr=4096) [ 393.101761] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1036, intr_ptr=4096) [ 397.933743] __ratelimit: 226 callbacks suppressed [ 397.939240] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=20, intr_ptr=4096) [ 397.954697] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1025, intr_ptr=4096) [ 397.976647] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2084, intr_ptr=4096) [ 397.997600] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3092, intr_ptr=4096) [ 398.018719] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=12, intr_ptr=4096) [ 398.039839] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1025, intr_ptr=4096) [ 398.061788] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=2084, intr_ptr=4096) [ 398.082741] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=3092, intr_ptr=4096) [ 398.103862] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=12, intr_ptr=4096) [ 398.124981] ALSA sound/core/pcm_lib.c:254: PCM: Unexpected hw_pointer value (stream=0, pos=1025, intr_ptr=4096) [ 400.777479] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x2 [ 400.786903] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x3 [ 400.795795] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x4 [ 400.804357] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x5Quoted 54 lines
Takashi
Quoted 50 lines
Thanks,
Fengguang
---
79452f0a28aa5a40522c487b42a5fc423647ad98Author: Takashi Iwai <[email protected]> Date: Wed Jul 22 12:51:51 2009 +0200ALSA: pcm - Fix regressions with VMware
VMware tends to report PCM positions and period updates at utterly wrong timing. This screws up the recent PCM core code that tries to correct the position based on the irq timing.
Now, when a backward irq position is detected, skip the update instead of rebasing. (This is almost the old behavior before 2.6.30.)
Signed-off-by Takashi Iwai <[email protected]>sound/core/pcm_lib.c +9
-1@@ -244,18 +244,27 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) delta = new_hw_ptr - hw_ptr_interrupt; }if (delta <0 ) { - delta += runtime->buffer_size; +if (runtime->periods ==1 ) + delta += runtime->buffer_size;if (delta <0 ) {hw_ptr_error (substream,"Unexpected hw_pointer value " "(stream=%i, pos=%ld, intr_ptr=%ld)\n" , substream->stream, (long )pos, (long )hw_ptr_interrupt); +#if 1 +/* simply skipping the hwptr update seems more +* robust in some cases, e.g. on VMware with +* inaccurate timer source +*/ +return 0 ;/* skip this update */ +#else /* rebase to interrupt position */ hw_base = new_hw_ptr = hw_ptr_interrupt;/* align hw_base to buffer_size */ hw_base -= hw_base % runtime->buffer_size;
Jaroslav Kysela
maintainerQuoted 7 lines · Wu Fengguang
Quoted 1 line
Is this with the patched (as is on sound git tree) kernel?
Yes, it's unmodified latest git tree.
Quoted 1 line
What if changing from #if 1 to #if 0?
This makes 8-channel playback work again.
Can we check if we running under VMWare at runtime?
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
At Thu, 23 Jul 2009 15:56:20 +0800,
Quoted 26 lines · Wu Fengguang
Quoted 24 lines · Takashi Iwai
At Thu, 23 Jul 2009 15:22:53 +0800,
Quoted 21 lines · Wu Fengguang
Quoted 10 lines · Takashi Iwai
At Thu, 23 Jul 2009 14:53:45 +0800,
Quoted 7 lines · Wu Fengguang
Hi Takashi,
When doing multi-channel playback tests on IbexPeak, I found that the following patch makes the playback enter an infinite loop, repeatedly playing a range of ~0.5s audio content. (Seems that some buffer pointer can never advance.)
Quoted 7 lines
Could you set 1 to
/proc/asound/card0/pcm0p/xrun_debugand give the messages? Also, please show/proc/.../pcm0p/sub0/hw_params, too.The change affects only the code path for the problematic hardware that reports wrong DMA position. So, if this change regresses, it means that the device has been already problematic from the beginning...
I caught some messages:
Quoted 7 lines
Quoted 1 line
Is this with the patched (as is on sound git tree) kernel?
Yes, it's unmodified latest git tree.
Quoted 1 line
What if changing from #if 1 to #if 0?
This makes 8-channel playback work again.
OK, then could you apply the patch below, and do
"echo 9 > /proc/../xrun_debug", then gather the messages with both #if 1 and #if 0? This will record the each snd_pcm_period_elpased() so beware that you may get flood of messages.
thanks,
Takashi
---
sound/core/pcm_lib.c +25 -0
@@ -233,6 +233,18 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream)xrun (substream);return -EPIPE ; } +if (xrun_debug (substream,8 )) { +char name[16 ]; +pcm_debug_name (substream, name,sizeof (name)); +snd_printd ("period_update: %s: pos=0x%x/0x%x/0x%x, " +"hwptr=0x%lx, hw_base=0x%lx, hw_intr=0x%lx\n" , + name, pos, + (int )runtime->period_size, + (int )runtime->buffer_size, + (long )old_hw_ptr, + (long )runtime->hw_ptr_base, + (long )runtime->hw_ptr_interrupt); + } hw_base = runtime->hw_ptr_base; new_hw_ptr = hw_base + pos; hw_ptr_interrupt = runtime->hw_ptr_interrupt + runtime->period_size;
@@ -353,6 +365,19 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream)xrun (substream);return -EPIPE ; } +if (xrun_debug (substream,16 )) { +char name[16 ]; +pcm_debug_name (substream, name,sizeof (name)); +snd_printd ("hw_update: %s: pos=0x%x/0x%x/0x%x, " +"hwptr=0x%lx, hw_base=0x%lx, hw_intr=0x%lx\n" , + name, pos, + (int )runtime->period_size, + (int )runtime->buffer_size, + (long )old_hw_ptr, + (long )runtime->hw_ptr_base, + (long )runtime->hw_ptr_interrupt); + } + hw_base = runtime->hw_ptr_base; new_hw_ptr = hw_base + pos;
At Thu, 23 Jul 2009 10:14:27 +0200 (CEST),
Quoted 5 lines · Jaroslav Kysela
Quoted 2 lines · Wu Fengguang
Quoted 1 line
Is this with the patched (as is on sound git tree) kernel?
Quoted 7 lines
Quoted 5 lines
Yes, it's unmodified latest git tree.
Quoted 1 line
What if changing from #if 1 to #if 0?
This makes 8-channel playback work again.
Can we check if we running under VMWare at runtime?
No idea. But, an option to allow to choose manually might be usefl for other broken hardwares that require a similar fallback like VMware, although this doesn't conflict with the automatic detection of vmware.
Takashi
Quoted 32 lines · Takashi Iwai
At Thu, 23 Jul 2009 15:56:20 +0800,
Quoted 30 lines · Wu Fengguang
Quoted 17 lines · Takashi Iwai
At Thu, 23 Jul 2009 15:22:53 +0800,
Quoted 15 lines · Wu Fengguang
Quoted 13 lines · Takashi Iwai
At Thu, 23 Jul 2009 14:53:45 +0800,
Quoted 7 lines · Wu Fengguang
Hi Takashi,
When doing multi-channel playback tests on IbexPeak, I found that the following patch makes the playback enter an infinite loop, repeatedly playing a range of ~0.5s audio content. (Seems that some buffer pointer can never advance.)
Could you set 1 to
/proc/asound/card0/pcm0p/xrun_debugand give the messages? Also, please show/proc/.../pcm0p/sub0/hw_params, too.Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
The change affects only the code path for the problematic hardware that reports wrong DMA position. So, if this change regresses, it means that the device has been already problematic from the beginning...
I caught some messages:
Is this with the patched (as is on sound git tree) kernel?
Yes, it's unmodified latest git tree.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
What if changing from #if 1 to #if 0?
This makes 8-channel playback work again.
OK, then could you apply the patch below, and do
"echo 9 >/proc/../xrun_debug", then gather the messages with both #if 1 and #if 0? This will record the eachsnd_pcm_period_elpased()so beware that you may get flood of messages.
OK, but for now this box is doing something else that cannot interrupted. So I'll try the patch some time later. Sorry.
Thanks,
Fengguang
Quoted 44 lines
---
sound/core/pcm_lib.c +25
-0@@ -233,6 +233,18 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream)xrun (substream);return -EPIPE ; } +if (xrun_debug (substream,8 )) { +char name[16 ]; +pcm_debug_name (substream, name,sizeof (name)); +snd_printd ("period_update: %s: pos=0x%x/0x%x/0x%x, " +"hwptr=0x%lx, hw_base=0x%lx, hw_intr=0x%lx\n" , + name, pos, + (int )runtime->period_size, + (int )runtime->buffer_size, + (long )old_hw_ptr, + (long )runtime->hw_ptr_base, + (long )runtime->hw_ptr_interrupt); + } hw_base = runtime->hw_ptr_base; new_hw_ptr = hw_base + pos; hw_ptr_interrupt = runtime->hw_ptr_interrupt + runtime->period_size;@@ -353,6 +365,19 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream)xrun (substream);return -EPIPE ; } +if (xrun_debug (substream,16 )) { +char name[16 ]; +pcm_debug_name (substream, name,sizeof (name)); +snd_printd ("hw_update: %s: pos=0x%x/0x%x/0x%x, " +"hwptr=0x%lx, hw_base=0x%lx, hw_intr=0x%lx\n" , + name, pos, + (int )runtime->period_size, + (int )runtime->buffer_size, + (long )old_hw_ptr, + (long )runtime->hw_ptr_base, + (long )runtime->hw_ptr_interrupt); + } + hw_base = runtime->hw_ptr_base; new_hw_ptr = hw_base + pos;
At Thu, 23 Jul 2009 16:33:08 +0800,
Quoted 38 lines · Wu Fengguang
Quoted 36 lines · Takashi Iwai
At Thu, 23 Jul 2009 15:56:20 +0800,
Quoted 33 lines · Wu Fengguang
Quoted 17 lines · Takashi Iwai
At Thu, 23 Jul 2009 15:22:53 +0800,
Quoted 15 lines · Wu Fengguang
Quoted 13 lines · Takashi Iwai
At Thu, 23 Jul 2009 14:53:45 +0800,
Quoted 7 lines · Wu Fengguang
Hi Takashi,
When doing multi-channel playback tests on IbexPeak, I found that the following patch makes the playback enter an infinite loop, repeatedly playing a range of ~0.5s audio content. (Seems that some buffer pointer can never advance.)
Could you set 1 to
/proc/asound/card0/pcm0p/xrun_debugand give the messages? Also, please show/proc/.../pcm0p/sub0/hw_params, too.Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
The change affects only the code path for the problematic hardware that reports wrong DMA position. So, if this change regresses, it means that the device has been already problematic from the beginning...
I caught some messages:
Is this with the patched (as is on sound git tree) kernel?
Yes, it's unmodified latest git tree.
Quoted 1 line
What if changing from #if 1 to #if 0?
This makes 8-channel playback work again.
Quoted 7 lines
Quoted 4 lines
OK, then could you apply the patch below, and do
"echo 9 >/proc/../xrun_debug", then gather the messages with both #if 1 and #if 0? This will record the eachsnd_pcm_period_elpased()so beware that you may get flood of messages.OK, but for now this box is doing something else that cannot interrupted. So I'll try the patch some time later. Sorry.
Sure, no problem.
Meanwhile, I'm thinking applying the debug-print patch now. Any objection?
Takashi
Jaroslav Kysela
maintainerQuoted 4 lines · Takashi Iwai
Sure, no problem.
Meanwhile, I'm thinking applying the debug-print patch now. Any objection?
Nope. Thanks.
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
Jaroslav Kysela
maintainerQuoted 11 lines · Takashi Iwai
At Thu, 23 Jul 2009 10:14:27 +0200 (CEST),
Quoted 9 lines · Jaroslav Kysela
Quoted 6 lines · Wu Fengguang
Quoted 1 line
Is this with the patched (as is on sound git tree) kernel?
Yes, it's unmodified latest git tree.
Quoted 1 line
What if changing from #if 1 to #if 0?
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
This makes 8-channel playback work again.
Can we check if we running under VMWare at runtime?
No idea. But, an option to allow to choose manually might be usefl for other broken hardwares that require a similar fallback like VMware, although this doesn't conflict with the automatic detection of vmware.
Yes, maybe a sysfs attribute might be useful.
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
At Thu, 23 Jul 2009 10:39:04 +0200 (CEST),
Quoted 16 lines · Jaroslav Kysela
Quoted 13 lines · Takashi Iwai
At Thu, 23 Jul 2009 10:14:27 +0200 (CEST),
Quoted 11 lines · Jaroslav Kysela
Quoted 7 lines · Wu Fengguang
Quoted 1 line
Is this with the patched (as is on sound git tree) kernel?
Yes, it's unmodified latest git tree.
Quoted 1 line
What if changing from #if 1 to #if 0?
This makes 8-channel playback work again.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Can we check if we running under VMWare at runtime?
No idea. But, an option to allow to choose manually might be usefl for other broken hardwares that require a similar fallback like VMware, although this doesn't conflict with the automatic detection of vmware.
Yes, maybe a sysfs attribute might be useful.
How about the patch below?
This is in sound-unstable tree fix/pcm-hwptr-debug branch.
Takashi
===
Quoted 1 line
From
c1506998c994ed10f637d5dde5f4f54ebc1563f3Mon Sep 17 00:00:00 2001
From: Takashi Iwai <[email protected]>
Date: Thu, 23 Jul 2009 13:17:50 +0200
Subject: [PATCH] ALSA: pcm - Add sysfs entry to control PCM bogus update filtering
It turned out that the VMware regression fix in the commit 79452f0a28aa5a40522c487b42a5fc423647ad98 introduces another problem for IbexPeak with multi-channels.
This patch adds the new flag and a corresponding sysfs entry to allow to control this behavior dynamically.
--- include/sound/pcm.h | 2 ++ sound/core/pcm.c | 34 +++++++++++++++++++++++++++++----- sound/core/pcm_lib.c | 15 +++++++-------- 3 files changed, 38 insertions(+), 13 deletions(-)
include/sound/pcm.h +2 -0
@@ -438,6 +438,8 @@ struct snd_pcm {#if defined(CONFIG_SND_PCM_OSS ) || defined(CONFIG_SND_PCM_OSS_MODULE )struct snd_pcm_oss oss;#endif +/* misc flags */ + unsigned int filter_bogus_irq:1; };struct snd_pcm_notify {
sound/core/pcm.c +29 -5
@@ -942,12 +942,35 @@ static ssize_t show_pcm_class(struct device *dev,return snprintf (buf,PAGE_SIZE ,"%s\n" , str); } -static struct device_attribute pcm_attrs = -__ATTR (pcm_class,S_IRUGO , show_pcm_class,NULL ); +static ssize_t show_pcm_bogus_irq (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct snd_pcm *pcm =dev_get_drvdata (dev); +if (!pcm) +return 0 ; +return sprintf (buf,"%d" , pcm->filter_bogus_irq); +} + +static ssize_t store_pcm_bogus_irq (struct device *dev, +struct device_attribute *attr, +const char *buf,size_t count) +{ +struct snd_pcm *pcm =dev_get_drvdata (dev); +if (!pcm) +return -ENXIO ; + pcm->filter_bogus_irq = !!simple_strtoul (buf,NULL ,0 ); +return count; +} + +static struct device_attribute pcm_attrs[2 ] = { +__ATTR (pcm_class,S_IRUGO , show_pcm_class,NULL ), +__ATTR (pcm_bogus_irq,S_IWUSR |S_IRUGO , + show_pcm_bogus_irq, store_pcm_bogus_irq), +};static int snd_pcm_dev_register (struct snd_device *device) { -int cidx, err; +int cidx, i, err;struct snd_pcm_substream *substream;struct snd_pcm_notify *notify;char str[16 ];
@@ -992,8 +1015,9 @@ static int snd_pcm_dev_register(struct snd_device *device)mutex_unlock (®ister_mutex);return err; } -snd_add_device_sysfs_file (devtype, pcm->card, pcm->device, - &pcm_attrs); +for (i =0 ; i <ARRAY_SIZE (pcm_attrs); i++) +snd_add_device_sysfs_file (devtype, pcm->card, + pcm->device, &pcm_attrs[i]);for (substream = pcm->streams[cidx].substream; substream; substream = substream->next)snd_pcm_timer_init (substream); }
sound/core/pcm_lib.c +7 -8
@@ -264,19 +264,18 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream)"(stream=%i, pos=%ld, intr_ptr=%ld)\n" , substream->stream, (long )pos, (long)hw_ptr_interrupt); -#if 1 -/* simply skipping the hwptr update seems more -* robust in some cases, e.g. on VMware with -* inaccurate timer source -*/ -return 0 ;/* skip this update */ -#else +if (substream->pcm->filter_bogus_irq) { +/* simply skipping the hwptr update seems more +* robust in some cases, e.g. on VMware with +* inaccurate timer source +*/ +return 0 ;/* skip this update */ + }/* rebase to interrupt position */ hw_base = new_hw_ptr = hw_ptr_interrupt;/* align hw_base to buffer_size */ hw_base -= hw_base % runtime->buffer_size; delta =0 ; -#endif }else { hw_base += runtime->buffer_size;if (hw_base >= runtime->boundary)
Signature · 1 line
1.6.3.3
At Thu, 23 Jul 2009 13:29:21 +0200,
Quoted 26 lines · I wrote:
At Thu, 23 Jul 2009 10:39:04 +0200 (CEST),
Quoted 23 lines · Jaroslav Kysela
Quoted 19 lines · Takashi Iwai
At Thu, 23 Jul 2009 10:14:27 +0200 (CEST),
Quoted 5 lines · Jaroslav Kysela
Quoted 2 lines · Wu Fengguang
Quoted 1 line
Is this with the patched (as is on sound git tree) kernel?
Quoted 7 lines
Quoted 5 lines
Yes, it's unmodified latest git tree.
Quoted 1 line
What if changing from #if 1 to #if 0?
This makes 8-channel playback work again.
Can we check if we running under VMWare at runtime?
No idea. But, an option to allow to choose manually might be usefl for other broken hardwares that require a similar fallback like VMware, although this doesn't conflict with the automatic detection of vmware.
Quoted 4 lines
Quoted 1 line
Yes, maybe a sysfs attribute might be useful.
How about the patch below?
This is in sound-unstable tree fix/pcm-hwptr-debug branch.
And VMware check patch is below.
Note that it's totally untested and I'm really not sure whether this works...
This patch is also on fix/pcm-hwptr-debug branch of sound-unstable tree.
thanks,
Takashi
===
Quoted 1 line
From
f5a9b7ddd3bd3db496f93ef2a4f1b95531d28a51Mon Sep 17 00:00:00 2001
From: Takashi Iwai <[email protected]>
Date: Thu, 23 Jul 2009 13:24:49 +0200
Subject: [PATCH] ALSA: pcm - Add VMware workaround
Enable the VMware workaround again by checking boot_cpu_data x86_hyper_vendor field.
--- sound/core/pcm.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
sound/core/pcm.c +9 -0
@@ -28,6 +28,10 @@#include <sound/pcm.h> #include <sound/control.h> #include <sound/info.h> +/* for VMware check */ +#ifdef CONFIG_X86 +#include <asm/processor.h> +#endif MODULE_AUTHOR ("Jaroslav Kysela <[email protected]>, Abramo Bagnara <[email protected]>" );MODULE_DESCRIPTION ("Midlevel PCM code for ALSA." );
@@ -730,6 +734,11 @@ int snd_pcm_new(struct snd_card *card, const char *id, int device,snd_pcm_free (pcm);return err; } +#ifdef CONFIG_X86 +/* workaround for VMware */ +if (boot_cpu_data.x86_hyper_vendor ==X86_HYPER_VENDOR_VMWARE ) + pcm->filter_bogus_irq =1 ; +#endif if (rpcm) *rpcm = pcm;return 0 ;
Signature · 1 line
1.6.3.3
At Thu, 23 Jul 2009 10:37:45 +0200 (CEST),
Quoted 9 lines · Jaroslav Kysela
Quoted 4 lines · Takashi Iwai
Sure, no problem.
Meanwhile, I'm thinking applying the debug-print patch now. Any objection?
Nope. Thanks.
OK, merged now.
thanks,
Takashi
Quoted 25 lines · Takashi Iwai
At Thu, 23 Jul 2009 10:39:04 +0200 (CEST),
Quoted 23 lines · Jaroslav Kysela
Quoted 19 lines · Takashi Iwai
At Thu, 23 Jul 2009 10:14:27 +0200 (CEST),
Quoted 5 lines · Jaroslav Kysela
Quoted 2 lines · Wu Fengguang
Quoted 1 line
Is this with the patched (as is on sound git tree) kernel?
Quoted 7 lines
Quoted 5 lines
Yes, it's unmodified latest git tree.
Quoted 1 line
What if changing from #if 1 to #if 0?
This makes 8-channel playback work again.
Can we check if we running under VMWare at runtime?
No idea. But, an option to allow to choose manually might be usefl for other broken hardwares that require a similar fallback like VMware, although this doesn't conflict with the automatic detection of vmware.
Quoted 4 lines
Quoted 1 line
Yes, maybe a sysfs attribute might be useful.
How about the patch below?
This is in sound-unstable tree fix/pcm-hwptr-debug branch.
Thanks,
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
At Thu, 23 Jul 2009 15:56:20 +0800,
Quoted 26 lines · Wu Fengguang
Quoted 24 lines · Takashi Iwai
At Thu, 23 Jul 2009 15:22:53 +0800,
Quoted 21 lines · Wu Fengguang
Quoted 10 lines · Takashi Iwai
At Thu, 23 Jul 2009 14:53:45 +0800,
Quoted 7 lines · Wu Fengguang
Hi Takashi,
When doing multi-channel playback tests on IbexPeak, I found that the following patch makes the playback enter an infinite loop, repeatedly playing a range of ~0.5s audio content. (Seems that some buffer pointer can never advance.)
Quoted 7 lines
Could you set 1 to
/proc/asound/card0/pcm0p/xrun_debugand give the messages? Also, please show/proc/.../pcm0p/sub0/hw_params, too.The change affects only the code path for the problematic hardware that reports wrong DMA position. So, if this change regresses, it means that the device has been already problematic from the beginning...
I caught some messages:
Quoted 7 lines
Quoted 1 line
Is this with the patched (as is on sound git tree) kernel?
Yes, it's unmodified latest git tree.
Quoted 1 line
What if changing from #if 1 to #if 0?
This makes 8-channel playback work again.
Mea culpa, that was a bug in my code :<
The patch below fixes the issue. Already merged on GIT trees and snapshot tarballs.
Sorry for inconvenience!
Takashi
===
Quoted 1 line
From
947ca210f1df7656e19890832cb71fc3bdd88707Mon Sep 17 00:00:00 2001
From: Takashi Iwai <[email protected]>
Date: Thu, 23 Jul 2009 16:21:08 +0200
Subject: [PATCH] ALSA: pcm - Fix hwptr buffer-size overlap bug
The fix 79452f0a28aa5a40522c487b42a5fc423647ad98 introduced another bug due to the missing offset for the overlapped hwptr. When the hwptr goes back to zero, the delta value has to be corrected with the buffer size. Otherwise this causes looping sounds.
--- sound/core/pcm_lib.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
sound/core/pcm_lib.c +1 -1
@@ -256,7 +256,7 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) delta = new_hw_ptr - hw_ptr_interrupt; }if (delta <0 ) { -if (runtime->periods ==1 ) +if (runtime->periods ==1 || new_hw_ptr < old_hw_ptr) delta += runtime->buffer_size;if (delta <0 ) { hw_ptr_error(substream,
Signature · 1 line
1.6.3.3
Jaroslav Kysela
maintainerQuoted 4 lines · Takashi Iwai
Subject: [PATCH] ALSA: pcm - Fix hwptr buffer-size overlap bug
The fix
79452f0a28aa5a40522c487b42a5fc423647ad98introduced another bug due to the missing offset for the overlapped hwptr.
Please, use patch names (subject) rather than SHA commit IDs. They are not stable in all cases until Linus merges content to it's tree.
Thanks,
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
At Thu, 23 Jul 2009 16:36:22 +0200 (CEST),
Quoted 10 lines · Jaroslav Kysela
Quoted 4 lines · Takashi Iwai
Subject: [PATCH] ALSA: pcm - Fix hwptr buffer-size overlap bug
The fix
79452f0a28aa5a40522c487b42a5fc423647ad98introduced another bug due to the missing offset for the overlapped hwptr.Please, use patch names (subject) rather than SHA commit IDs. They are not stable in all cases until Linus merges content to it's tree.
The commit IDs are stable since I basically never rebase the sound tree. (The sound-unstable tree might be occasionally rebased, though.)
Takashi
Quoted 32 lines · Takashi Iwai
At Thu, 23 Jul 2009 15:56:20 +0800,
Quoted 30 lines · Wu Fengguang
Quoted 17 lines · Takashi Iwai
At Thu, 23 Jul 2009 15:22:53 +0800,
Quoted 15 lines · Wu Fengguang
Quoted 13 lines · Takashi Iwai
At Thu, 23 Jul 2009 14:53:45 +0800,
Quoted 7 lines · Wu Fengguang
Hi Takashi,
When doing multi-channel playback tests on IbexPeak, I found that the following patch makes the playback enter an infinite loop, repeatedly playing a range of ~0.5s audio content. (Seems that some buffer pointer can never advance.)
Could you set 1 to
/proc/asound/card0/pcm0p/xrun_debugand give the messages? Also, please show/proc/.../pcm0p/sub0/hw_params, too.Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
The change affects only the code path for the problematic hardware that reports wrong DMA position. So, if this change regresses, it means that the device has been already problematic from the beginning...
I caught some messages:
Is this with the patched (as is on sound git tree) kernel?
Yes, it's unmodified latest git tree.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
What if changing from #if 1 to #if 0?
This makes 8-channel playback work again.
OK, then could you apply the patch below, and do
"echo 9 >/proc/../xrun_debug", then gather the messages with both #if 1 and #if 0? This will record the eachsnd_pcm_period_elpased()so beware that you may get flood of messages.
#if 1:
[ 153.528838] ALSA sound/pci/hda/hda_intel.c:1572: azx_pcm_prepare: bufsize=0x10000, format=0x17 [ 153.539220] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x6 [ 153.547079] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x10 [ 153.553516] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x2, stream=0x5, channel=0, format=0x17 [ 153.561866] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x3, stream=0x5, channel=2, format=0x17 [ 153.577811] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x4, stream=0x5, channel=4, format=0x17 [ 153.589784] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x5, stream=0x5, channel=6, format=0x17 [ 153.642717] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x424/0x400/0x1000, hwptr=0x30, hw_base=0x0, hw_intr=0x0 [ 153.663835] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x81c/0x400/0x1000, hwptr=0x504, hw_base=0x0, hw_intr=0x400 [ 153.685037] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc18/0x400/0x1000, hwptr=0x900, hw_base=0x0, hw_intr=0x800 [ 153.706074] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 153.711340] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=12, intr_ptr=4096) [ 153.727194] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x401/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 153.732021] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=1025, intr_ptr=4096) [ 153.749226] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x828/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 153.755063] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=2088, intr_ptr=4096) [ 153.770180] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc18/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 153.776051] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=3096, intr_ptr=4096) [ 153.791216] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 153.796843] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=12, intr_ptr=4096) [ 153.812335] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x401/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 153.817645] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=1025, intr_ptr=4096) [ 153.834368] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x828/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 153.839568] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=2088, intr_ptr=4096) [ 153.855571] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc24/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 153.860594] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=3108, intr_ptr=4096) [ 153.876607] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x18/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 153.882398] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=24, intr_ptr=4096) [ 153.897726] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x410/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 153.903329] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=1040, intr_ptr=4096) [ 153.918929] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x80c/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 153.940132] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc08/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 153.961334] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x1/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 153.983117] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x41c/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 154.004320] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x818/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 154.025357] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc0c/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 154.046476] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x1/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 154.068509] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x428/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 154.089628] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x820/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 154.110747] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc18/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 154.131784] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 154.152904] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x401/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 154.174854] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x824/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 154.196056] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc20/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 154.217175] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x18/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 154.238378] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x414/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 154.259581] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x810/0x400/0x1000, hwptr=0xd20, hw_base=0x0, hw_intr=0xc00 [ 154.276638] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x2 [ 154.280154] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x3 [ 154.283272] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x4 [ 154.286708] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x5
#if 0:
[ 134.711304] ALSA sound/pci/hda/hda_intel.c:1572: azx_pcm_prepare: bufsize=0x10000, format=0x17 [ 134.715334] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x6 [ 134.718908] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x10 [ 134.722513] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x2, stream=0x5, channel=0, format=0x17 [ 134.735110] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x3, stream=0x5, channel=2, format=0x17 [ 134.747054] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x4, stream=0x5, channel=4, format=0x17 [ 134.759029] ALSA sound/pci/hda/hda_codec.c:1080: hda_codec_setup_stream: NID=0x5, stream=0x5, channel=6, format=0x17 [ 134.828646] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x424/0x400/0x1000, hwptr=0x30, hw_base=0x0, hw_intr=0x0 [ 134.849746] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x81c/0x400/0x1000, hwptr=0x530, hw_base=0x0, hw_intr=0x400 [ 134.870949] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc18/0x400/0x1000, hwptr=0x900, hw_base=0x0, hw_intr=0x800 [ 134.892068] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x10/0x400/0x1000, hwptr=0xcf8, hw_base=0x0, hw_intr=0xc00 [ 134.897113] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=16, intr_ptr=4096) [ 134.913271] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x40c/0x400/0x1000, hwptr=0x11d0, hw_base=0x1000, hw_intr=0x1000 [ 134.934390] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x801/0x400/0x1000, hwptr=0x1518, hw_base=0x1000, hw_intr=0x1400 [ 134.956256] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc20/0x400/0x1000, hwptr=0x1908, hw_base=0x1000, hw_intr=0x1800 [ 134.977374] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x18/0x400/0x1000, hwptr=0x1d00, hw_base=0x1000, hw_intr=0x1c00 [ 134.982350] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=24, intr_ptr=8192) [ 134.998413] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x40c/0x400/0x1000, hwptr=0x21fc, hw_base=0x2000, hw_intr=0x2000 [ 135.019532] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x801/0x400/0x1000, hwptr=0x2518, hw_base=0x2000, hw_intr=0x2400 [ 135.041481] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc24/0x400/0x1000, hwptr=0x28e0, hw_base=0x2000, hw_intr=0x2800 [ 135.062683] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x20/0x400/0x1000, hwptr=0x2d08, hw_base=0x2000, hw_intr=0x2c00 [ 135.068446] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=32, intr_ptr=12288) [ 135.083720] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x414/0x400/0x1000, hwptr=0x3204, hw_base=0x3000, hw_intr=0x3000 [ 135.104839] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x80c/0x400/0x1000, hwptr=0x3520, hw_base=0x3000, hw_intr=0x3400 [ 135.126624] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc24/0x400/0x1000, hwptr=0x390c, hw_base=0x3000, hw_intr=0x3800 [ 135.147826] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x20/0x400/0x1000, hwptr=0x3d08, hw_base=0x3000, hw_intr=0x3c00 [ 135.152970] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=32, intr_ptr=16384) [ 135.168780] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x410/0x400/0x1000, hwptr=0x4200, hw_base=0x4000, hw_intr=0x4000 [ 135.189899] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x808/0x400/0x1000, hwptr=0x44f0, hw_base=0x4000, hw_intr=0x4400 [ 135.211102] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc01/0x400/0x1000, hwptr=0x4918, hw_base=0x4000, hw_intr=0x4800 [ 135.233133] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x28/0x400/0x1000, hwptr=0x4d10, hw_base=0x4000, hw_intr=0x4c00 [ 135.238880] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=40, intr_ptr=20480) [ 135.254171] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x41c/0x400/0x1000, hwptr=0x520c, hw_base=0x5000, hw_intr=0x5000 [ 135.275290] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x814/0x400/0x1000, hwptr=0x5528, hw_base=0x5000, hw_intr=0x5400 [ 135.296492] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc10/0x400/0x1000, hwptr=0x58f8, hw_base=0x5000, hw_intr=0x5800 [ 135.317612] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x8/0x400/0x1000, hwptr=0x5cf0, hw_base=0x5000, hw_intr=0x5c00 [ 135.323218] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=8, intr_ptr=24576) [ 135.338815] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x401/0x400/0x1000, hwptr=0x61c8, hw_base=0x6000, hw_intr=0x6000 [ 135.360764] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x824/0x400/0x1000, hwptr=0x64e0, hw_base=0x6000, hw_intr=0x6400 [ 135.381884] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc1c/0x400/0x1000, hwptr=0x6930, hw_base=0x6000, hw_intr=0x6800 [ 135.402920] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x10/0x400/0x1000, hwptr=0x6d24, hw_base=0x6000, hw_intr=0x6c00 [ 135.408153] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=16, intr_ptr=28672) [ 135.424122] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x40c/0x400/0x1000, hwptr=0x71d0, hw_base=0x7000, hw_intr=0x7000 [ 135.445242] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x801/0x400/0x1000, hwptr=0x7518, hw_base=0x7000, hw_intr=0x7400 [ 135.467275] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc28/0x400/0x1000, hwptr=0x7910, hw_base=0x7000, hw_intr=0x7800 [ 135.488394] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x20/0x400/0x1000, hwptr=0x7d34, hw_base=0x7000, hw_intr=0x7c00 [ 135.494543] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=32, intr_ptr=32768) [ 135.509514] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x418/0x400/0x1000, hwptr=0x8208, hw_base=0x8000, hw_intr=0x8000 [ 135.530715] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x814/0x400/0x1000, hwptr=0x8528, hw_base=0x8000, hw_intr=0x8400 [ 135.552500] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc2c/0x400/0x1000, hwptr=0x8914, hw_base=0x8000, hw_intr=0x8800 [ 135.573702] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x28/0x400/0x1000, hwptr=0x8d10, hw_base=0x8000, hw_intr=0x8c00 [ 135.579475] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=40, intr_ptr=36864) [ 135.594741] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x41c/0x400/0x1000, hwptr=0x920c, hw_base=0x9000, hw_intr=0x9000 [ 135.615859] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x814/0x400/0x1000, hwptr=0x9528, hw_base=0x9000, hw_intr=0x9400 [ 135.636979] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc0c/0x400/0x1000, hwptr=0x98c8, hw_base=0x9000, hw_intr=0x9800 [ 135.658181] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x8/0x400/0x1000, hwptr=0x9cf0, hw_base=0x9000, hw_intr=0x9c00 [ 135.663829] ALSA sound/core/pcm_lib.c:266: PCM: Unexpected hw_pointer value (stream=0, pos=8, intr_ptr=40960) [ 135.679383] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x401/0x400/0x1000, hwptr=0xa1c8, hw_base=0xa000, hw_intr=0xa000 [ 135.701083] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x818/0x400/0x1000, hwptr=0xa500, hw_base=0xa000, hw_intr=0xa400 [ 135.722038] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc08/0x400/0x1000, hwptr=0xa91c, hw_base=0xa000, hw_intr=0xa800 [ 135.744070] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x2c/0x400/0x1000, hwptr=0xace8, hw_base=0xa000, hw_intr=0xac00 [ 135.765273] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x428/0x400/0x1000, hwptr=0xb110, hw_base=0xb000, hw_intr=0xb000 [ 135.786143] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x814/0x400/0x1000, hwptr=0xb528, hw_base=0xb000, hw_intr=0xb400 [ 135.807344] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc10/0x400/0x1000, hwptr=0xb8f8, hw_base=0xb000, hw_intr=0xb800 [ 135.828548] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc/0x400/0x1000, hwptr=0xbd20, hw_base=0xb000, hw_intr=0xbc00 [ 135.849750] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x408/0x400/0x1000, hwptr=0xc0f0, hw_base=0xc000, hw_intr=0xc000 [ 135.871783] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x82c/0x400/0x1000, hwptr=0xc4e8, hw_base=0xc000, hw_intr=0xc400 [ 135.892904] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc24/0x400/0x1000, hwptr=0xc938, hw_base=0xc000, hw_intr=0xc800 [ 135.914105] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x20/0x400/0x1000, hwptr=0xcd34, hw_base=0xc000, hw_intr=0xcc00 [ 135.935308] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x41c/0x400/0x1000, hwptr=0xd130, hw_base=0xd000, hw_intr=0xd000 [ 135.956510] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x818/0x400/0x1000, hwptr=0xd500, hw_base=0xd000, hw_intr=0xd400 [ 135.977630] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc10/0x400/0x1000, hwptr=0xd8f8, hw_base=0xd000, hw_intr=0xd800 [ 135.998749] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x8/0x400/0x1000, hwptr=0xdd1c, hw_base=0xd000, hw_intr=0xdc00 [ 136.019952] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x401/0x400/0x1000, hwptr=0xe118, hw_base=0xe000, hw_intr=0xe000 [ 136.041901] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x824/0x400/0x1000, hwptr=0xe50c, hw_base=0xe000, hw_intr=0xe400 [ 136.063103] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc20/0x400/0x1000, hwptr=0xe908, hw_base=0xe000, hw_intr=0xe800 [ 136.084223] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x18/0x400/0x1000, hwptr=0xed00, hw_base=0xe000, hw_intr=0xec00 [ 136.105343] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x410/0x400/0x1000, hwptr=0xf150, hw_base=0xf000, hw_intr=0xf000 [ 136.126462] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x808/0x400/0x1000, hwptr=0xf4f0, hw_base=0xf000, hw_intr=0xf400 [ 136.147665] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0xc01/0x400/0x1000, hwptr=0xf808, hw_base=0xf000, hw_intr=0xf800 [ 136.169615] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x24/0x400/0x1000, hwptr=0xfd0c, hw_base=0xf000, hw_intr=0xfc00 [ 136.190817] ALSA sound/core/pcm_lib.c:246: period_update: pcmC0D0p:0: pos=0x420/0x400/0x1000, hwptr=0x10000, hw_base=0x10000, hw_intr=0x10000 [ 136.204346] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x2 [ 136.208197] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x3 [ 136.211853] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x4 [ 136.214855] ALSA sound/pci/hda/hda_codec.c:1093: hda_codec_cleanup_stream: NID=0x5
root@hp ~#
Quoted 50 lines
thanks,
Takashi
---
sound/core/pcm_lib.c +25
-0@@ -233,6 +233,18 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream)xrun (substream);return -EPIPE ; } +if (xrun_debug (substream,8 )) { +char name[16 ]; +pcm_debug_name (substream, name,sizeof (name)); +snd_printd ("period_update: %s: pos=0x%x/0x%x/0x%x, " +"hwptr=0x%lx, hw_base=0x%lx, hw_intr=0x%lx\n" , + name, pos, + (int )runtime->period_size, + (int )runtime->buffer_size, + (long )old_hw_ptr, + (long )runtime->hw_ptr_base, + (long )runtime->hw_ptr_interrupt); + } hw_base = runtime->hw_ptr_base; new_hw_ptr = hw_base + pos; hw_ptr_interrupt = runtime->hw_ptr_interrupt + runtime->period_size;@@ -353,6 +365,19 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream)xrun (substream);return -EPIPE ; } +if (xrun_debug (substream,16 )) { +char name[16 ]; +pcm_debug_name (substream, name,sizeof (name)); +snd_printd ("hw_update: %s: pos=0x%x/0x%x/0x%x, " +"hwptr=0x%lx, hw_base=0x%lx, hw_intr=0x%lx\n" , + name, pos, + (int )runtime->period_size, + (int )runtime->buffer_size, + (long )old_hw_ptr, + (long )runtime->hw_ptr_base, + (long )runtime->hw_ptr_interrupt); + } + hw_base = runtime->hw_ptr_base; new_hw_ptr = hw_base + pos;
Quoted 32 lines · Takashi Iwai
At Thu, 23 Jul 2009 15:56:20 +0800,
Quoted 30 lines · Wu Fengguang
Quoted 17 lines · Takashi Iwai
At Thu, 23 Jul 2009 15:22:53 +0800,
Quoted 15 lines · Wu Fengguang
Quoted 13 lines · Takashi Iwai
At Thu, 23 Jul 2009 14:53:45 +0800,
Quoted 7 lines · Wu Fengguang
Hi Takashi,
When doing multi-channel playback tests on IbexPeak, I found that the following patch makes the playback enter an infinite loop, repeatedly playing a range of ~0.5s audio content. (Seems that some buffer pointer can never advance.)
Could you set 1 to
/proc/asound/card0/pcm0p/xrun_debugand give the messages? Also, please show/proc/.../pcm0p/sub0/hw_params, too.Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
The change affects only the code path for the problematic hardware that reports wrong DMA position. So, if this change regresses, it means that the device has been already problematic from the beginning...
I caught some messages:
Is this with the patched (as is on sound git tree) kernel?
Yes, it's unmodified latest git tree.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
What if changing from #if 1 to #if 0?
This makes 8-channel playback work again.
Mea culpa, that was a bug in my code :<
The patch below fixes the issue. Already merged on GIT trees and snapshot tarballs.
Yes it works!
Thanks,
Fengguang
Quoted 31 lines
===
Quoted 1 line
From
947ca210f1df7656e19890832cb71fc3bdd88707Mon Sep 17 00:00:00 2001From: Takashi Iwai <[email protected]>
Date: Thu, 23 Jul 2009 16:21:08 +0200
Subject: [PATCH] ALSA: pcm - Fix hwptr buffer-size overlap bugThe fix
79452f0a28aa5a40522c487b42a5fc423647ad98introduced another bug due to the missing offset for the overlapped hwptr. When the hwptr goes back to zero, the delta value has to be corrected with the buffer size. Otherwise this causes looping sounds.Signed-off-by Takashi Iwai <[email protected]>--- sound/core/pcm_lib.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)sound/core/pcm_lib.c +1
-1@@ -256,7 +256,7 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) delta = new_hw_ptr - hw_ptr_interrupt; }if (delta <0 ) { -if (runtime->periods ==1 ) +if (runtime->periods ==1 || new_hw_ptr < old_hw_ptr) delta += runtime->buffer_size;if (delta <0 ) { hw_ptr_error(substream,Signature · 1 line
1.6.3.3