aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@suse.cz>2006-04-24 15:57:16 -0400
committerJaroslav Kysela <perex@suse.cz>2006-04-27 15:10:40 -0400
commit61fb63c096a2e88b87742eaecfe88912b89f57cf (patch)
tree7cbc136c070079b41473feb26bcb60211e9f5d11
parenta2bbbc0c3c9554ac70e96ec3effae60124f0f009 (diff)
[ALSA] PCM core - introduce CONFIG_SND_PCM_XRUN_DEBUG
This patch makes the XRUN (overrun/underrun) notification code optional. Signed-off-by: Jaroslav Kysela <perex@suse.cz>
-rw-r--r--sound/core/Kconfig10
-rw-r--r--sound/core/pcm.c6
-rw-r--r--sound/core/pcm_lib.c6
3 files changed, 16 insertions, 6 deletions
diff --git a/sound/core/Kconfig b/sound/core/Kconfig
index 8efc1b12f3a8..f3a07fb2e690 100644
--- a/sound/core/Kconfig
+++ b/sound/core/Kconfig
@@ -171,3 +171,13 @@ config SND_DEBUG_DETECT
171 help 171 help
172 Say Y here to enable extra-verbose log messages printed when 172 Say Y here to enable extra-verbose log messages printed when
173 detecting devices. 173 detecting devices.
174
175config SND_PCM_XRUN_DEBUG
176 bool "Enable PCM ring buffer overrun/underrun debugging"
177 default n
178 depends on SND_DEBUG
179 help
180 Say Y to enable the PCM ring buffer overrun/underrun debugging.
181 It is usually not required, but if you have trouble with
182 sound clicking when system is loaded, it may help to determine
183 the process or driver which causes the scheduling gaps.
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 122e10a61ab9..48007a54c8b7 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -436,7 +436,7 @@ static void snd_pcm_substream_proc_status_read(struct snd_info_entry *entry,
436 snd_iprintf(buffer, "appl_ptr : %ld\n", runtime->control->appl_ptr); 436 snd_iprintf(buffer, "appl_ptr : %ld\n", runtime->control->appl_ptr);
437} 437}
438 438
439#ifdef CONFIG_SND_DEBUG 439#ifdef CONFIG_SND_PCM_XRUN_DEBUG
440static void snd_pcm_xrun_debug_read(struct snd_info_entry *entry, 440static void snd_pcm_xrun_debug_read(struct snd_info_entry *entry,
441 struct snd_info_buffer *buffer) 441 struct snd_info_buffer *buffer)
442{ 442{
@@ -480,7 +480,7 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
480 } 480 }
481 pstr->proc_info_entry = entry; 481 pstr->proc_info_entry = entry;
482 482
483#ifdef CONFIG_SND_DEBUG 483#ifdef CONFIG_SND_PCM_XRUN_DEBUG
484 if ((entry = snd_info_create_card_entry(pcm->card, "xrun_debug", 484 if ((entry = snd_info_create_card_entry(pcm->card, "xrun_debug",
485 pstr->proc_root)) != NULL) { 485 pstr->proc_root)) != NULL) {
486 entry->c.text.read_size = 64; 486 entry->c.text.read_size = 64;
@@ -501,7 +501,7 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
501 501
502static int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr) 502static int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr)
503{ 503{
504#ifdef CONFIG_SND_DEBUG 504#ifdef CONFIG_SND_PCM_XRUN_DEBUG
505 if (pstr->proc_xrun_debug_entry) { 505 if (pstr->proc_xrun_debug_entry) {
506 snd_info_unregister(pstr->proc_xrun_debug_entry); 506 snd_info_unregister(pstr->proc_xrun_debug_entry);
507 pstr->proc_xrun_debug_entry = NULL; 507 pstr->proc_xrun_debug_entry = NULL;
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 230a940d00bd..eedc6cb038bb 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -130,7 +130,7 @@ void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_ufram
130static void xrun(struct snd_pcm_substream *substream) 130static void xrun(struct snd_pcm_substream *substream)
131{ 131{
132 snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); 132 snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
133#ifdef CONFIG_SND_DEBUG 133#ifdef CONFIG_SND_PCM_XRUN_DEBUG
134 if (substream->pstr->xrun_debug) { 134 if (substream->pstr->xrun_debug) {
135 snd_printd(KERN_DEBUG "XRUN: pcmC%dD%d%c\n", 135 snd_printd(KERN_DEBUG "XRUN: pcmC%dD%d%c\n",
136 substream->pcm->card->number, 136 substream->pcm->card->number,
@@ -204,7 +204,7 @@ static inline int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *subs
204 delta = hw_ptr_interrupt - new_hw_ptr; 204 delta = hw_ptr_interrupt - new_hw_ptr;
205 if (delta > 0) { 205 if (delta > 0) {
206 if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) { 206 if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) {
207#ifdef CONFIG_SND_DEBUG 207#ifdef CONFIG_SND_PCM_XRUN_DEBUG
208 if (runtime->periods > 1 && substream->pstr->xrun_debug) { 208 if (runtime->periods > 1 && substream->pstr->xrun_debug) {
209 snd_printd(KERN_ERR "Unexpected hw_pointer value [1] (stream = %i, delta: -%ld, max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream, (long) delta, runtime->buffer_size / 2); 209 snd_printd(KERN_ERR "Unexpected hw_pointer value [1] (stream = %i, delta: -%ld, max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream, (long) delta, runtime->buffer_size / 2);
210 if (substream->pstr->xrun_debug > 1) 210 if (substream->pstr->xrun_debug > 1)
@@ -249,7 +249,7 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream)
249 delta = old_hw_ptr - new_hw_ptr; 249 delta = old_hw_ptr - new_hw_ptr;
250 if (delta > 0) { 250 if (delta > 0) {
251 if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) { 251 if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) {
252#ifdef CONFIG_SND_DEBUG 252#ifdef CONFIG_SND_PCM_XRUN_DEBUG
253 if (runtime->periods > 2 && substream->pstr->xrun_debug) { 253 if (runtime->periods > 2 && substream->pstr->xrun_debug) {
254 snd_printd(KERN_ERR "Unexpected hw_pointer value [2] (stream = %i, delta: -%ld, max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream, (long) delta, runtime->buffer_size / 2); 254 snd_printd(KERN_ERR "Unexpected hw_pointer value [2] (stream = %i, delta: -%ld, max jitter = %ld): wrong interrupt acknowledge?\n", substream->stream, (long) delta, runtime->buffer_size / 2);
255 if (substream->pstr->xrun_debug > 1) 255 if (substream->pstr->xrun_debug > 1)