Skip to content

Commit 61fb63c

Browse files
author
Jaroslav Kysela
committed
[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>
1 parent a2bbbc0 commit 61fb63c

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

‎sound/core/Kconfig‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,13 @@ config SND_DEBUG_DETECT
171171
help
172172
Say Y here to enable extra-verbose log messages printed when
173173
detecting devices.
174+
175+
config 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.

‎sound/core/pcm.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ static void snd_pcm_substream_proc_status_read(struct snd_info_entry *entry,
436436
snd_iprintf(buffer, "appl_ptr : %ld\n", runtime->control->appl_ptr);
437437
}
438438

439-
#ifdef CONFIG_SND_DEBUG
439+
#ifdef CONFIG_SND_PCM_XRUN_DEBUG
440440
static void snd_pcm_xrun_debug_read(struct snd_info_entry *entry,
441441
struct snd_info_buffer *buffer)
442442
{
@@ -480,7 +480,7 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
480480
}
481481
pstr->proc_info_entry = entry;
482482

483-
#ifdef CONFIG_SND_DEBUG
483+
#ifdef CONFIG_SND_PCM_XRUN_DEBUG
484484
if ((entry = snd_info_create_card_entry(pcm->card, "xrun_debug",
485485
pstr->proc_root)) != NULL) {
486486
entry->c.text.read_size = 64;
@@ -501,7 +501,7 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
501501

502502
static int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr)
503503
{
504-
#ifdef CONFIG_SND_DEBUG
504+
#ifdef CONFIG_SND_PCM_XRUN_DEBUG
505505
if (pstr->proc_xrun_debug_entry) {
506506
snd_info_unregister(pstr->proc_xrun_debug_entry);
507507
pstr->proc_xrun_debug_entry = NULL;

‎sound/core/pcm_lib.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_ufram
130130
static void xrun(struct snd_pcm_substream *substream)
131131
{
132132
snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
133-
#ifdef CONFIG_SND_DEBUG
133+
#ifdef CONFIG_SND_PCM_XRUN_DEBUG
134134
if (substream->pstr->xrun_debug) {
135135
snd_printd(KERN_DEBUG "XRUN: pcmC%dD%d%c\n",
136136
substream->pcm->card->number,
@@ -204,7 +204,7 @@ static inline int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *subs
204204
delta = hw_ptr_interrupt - new_hw_ptr;
205205
if (delta > 0) {
206206
if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) {
207-
#ifdef CONFIG_SND_DEBUG
207+
#ifdef CONFIG_SND_PCM_XRUN_DEBUG
208208
if (runtime->periods > 1 && substream->pstr->xrun_debug) {
209209
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);
210210
if (substream->pstr->xrun_debug > 1)
@@ -249,7 +249,7 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream)
249249
delta = old_hw_ptr - new_hw_ptr;
250250
if (delta > 0) {
251251
if ((snd_pcm_uframes_t)delta < runtime->buffer_size / 2) {
252-
#ifdef CONFIG_SND_DEBUG
252+
#ifdef CONFIG_SND_PCM_XRUN_DEBUG
253253
if (runtime->periods > 2 && substream->pstr->xrun_debug) {
254254
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);
255255
if (substream->pstr->xrun_debug > 1)

0 commit comments

Comments
 (0)