diff options
author | Jaroslav Kysela <perex@perex.cz> | 2009-05-28 05:21:52 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-05-29 05:47:36 -0400 |
commit | c62a01ad6e746fae9c93f51ea67e0abfd8d94b58 (patch) | |
tree | a334fb7283e7bf925e61c08dc926288890d2e616 /sound/core | |
parent | 8bea869c5e56234990e6bad92a543437115bfc18 (diff) |
ALSA: PCM midlevel: introduce mask for xrun_debug() macro
For debugging purposes, it is better to separate actions.
Bit-values:
1: show bad PCM ring buffer pointer
2: show also stack (to debug kernel latency issues)
4: check pointer against system jiffies
Example:
5: show bad PCM ring buffer pointer and do jiffies check
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/pcm_lib.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index adc2b0bd1132..25cb36710ef4 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -126,20 +126,20 @@ void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_ufram | |||
126 | } | 126 | } |
127 | 127 | ||
128 | #ifdef CONFIG_SND_PCM_XRUN_DEBUG | 128 | #ifdef CONFIG_SND_PCM_XRUN_DEBUG |
129 | #define xrun_debug(substream) ((substream)->pstr->xrun_debug) | 129 | #define xrun_debug(substream, mask) ((substream)->pstr->xrun_debug & (mask)) |
130 | #else | 130 | #else |
131 | #define xrun_debug(substream) 0 | 131 | #define xrun_debug(substream, mask) 0 |
132 | #endif | 132 | #endif |
133 | 133 | ||
134 | #define dump_stack_on_xrun(substream) do { \ | 134 | #define dump_stack_on_xrun(substream) do { \ |
135 | if (xrun_debug(substream) > 1) \ | 135 | if (xrun_debug(substream, 2)) \ |
136 | dump_stack(); \ | 136 | dump_stack(); \ |
137 | } while (0) | 137 | } while (0) |
138 | 138 | ||
139 | static void xrun(struct snd_pcm_substream *substream) | 139 | static void xrun(struct snd_pcm_substream *substream) |
140 | { | 140 | { |
141 | snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); | 141 | snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); |
142 | if (xrun_debug(substream)) { | 142 | if (xrun_debug(substream, 1)) { |
143 | snd_printd(KERN_DEBUG "XRUN: pcmC%dD%d%c\n", | 143 | snd_printd(KERN_DEBUG "XRUN: pcmC%dD%d%c\n", |
144 | substream->pcm->card->number, | 144 | substream->pcm->card->number, |
145 | substream->pcm->device, | 145 | substream->pcm->device, |
@@ -197,7 +197,7 @@ static int snd_pcm_update_hw_ptr_post(struct snd_pcm_substream *substream, | |||
197 | 197 | ||
198 | #define hw_ptr_error(substream, fmt, args...) \ | 198 | #define hw_ptr_error(substream, fmt, args...) \ |
199 | do { \ | 199 | do { \ |
200 | if (xrun_debug(substream)) { \ | 200 | if (xrun_debug(substream, 1)) { \ |
201 | if (printk_ratelimit()) { \ | 201 | if (printk_ratelimit()) { \ |
202 | snd_printd("PCM: " fmt, ##args); \ | 202 | snd_printd("PCM: " fmt, ##args); \ |
203 | } \ | 203 | } \ |
@@ -251,7 +251,7 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) | |||
251 | } | 251 | } |
252 | 252 | ||
253 | /* Do jiffies check only in xrun_debug mode */ | 253 | /* Do jiffies check only in xrun_debug mode */ |
254 | if (!xrun_debug(substream)) | 254 | if (!xrun_debug(substream, 4)) |
255 | goto no_jiffies_check; | 255 | goto no_jiffies_check; |
256 | 256 | ||
257 | /* Skip the jiffies check for hardwares with BATCH flag. | 257 | /* Skip the jiffies check for hardwares with BATCH flag. |
@@ -342,7 +342,7 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream) | |||
342 | new_hw_ptr = hw_base + pos; | 342 | new_hw_ptr = hw_base + pos; |
343 | } | 343 | } |
344 | /* Do jiffies check only in xrun_debug mode */ | 344 | /* Do jiffies check only in xrun_debug mode */ |
345 | if (xrun_debug(substream) && | 345 | if (xrun_debug(substream, 4) && |
346 | ((delta * HZ) / runtime->rate) > jdelta + HZ/100) { | 346 | ((delta * HZ) / runtime->rate) > jdelta + HZ/100) { |
347 | hw_ptr_error(substream, | 347 | hw_ptr_error(substream, |
348 | "hw_ptr skipping! " | 348 | "hw_ptr skipping! " |