Commit 527b9ad5 authored by Jaroslav Kysela's avatar Jaroslav Kysela

ALSA CVS update - Takashi Iwai <tiwai@suse.de>

PCM Midlevel
- added the support of stack dump at xrun.
  enabled by writing to /proc/asound/card*/pcm*/xrun_debug proc file.
  built only when CONFIG_SND_DEBUG is set.
parent 44f062bb
...@@ -427,6 +427,10 @@ struct _snd_pcm_str { ...@@ -427,6 +427,10 @@ struct _snd_pcm_str {
snd_minor_t *reg; snd_minor_t *reg;
snd_info_entry_t *proc_root; snd_info_entry_t *proc_root;
snd_info_entry_t *proc_info_entry; snd_info_entry_t *proc_info_entry;
#ifdef CONFIG_SND_DEBUG
unsigned int xrun_debug: 1;
snd_info_entry_t *proc_xrun_debug_entry;
#endif
}; };
struct _snd_pcm { struct _snd_pcm {
......
...@@ -390,6 +390,22 @@ static void snd_pcm_substream_proc_status_read(snd_info_entry_t *entry, snd_info ...@@ -390,6 +390,22 @@ static void snd_pcm_substream_proc_status_read(snd_info_entry_t *entry, snd_info
snd_iprintf(buffer, "appl_ptr : %ld\n", runtime->control->appl_ptr); snd_iprintf(buffer, "appl_ptr : %ld\n", runtime->control->appl_ptr);
} }
#ifdef CONFIG_SND_DEBUG
static void snd_pcm_xrun_debug_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
{
snd_pcm_str_t *pstr = (snd_pcm_str_t *)entry->private_data;
snd_iprintf(buffer, "%d\n", pstr->xrun_debug);
}
static void snd_pcm_xrun_debug_write(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
{
snd_pcm_str_t *pstr = (snd_pcm_str_t *)entry->private_data;
char line[64];
if (!snd_info_get_line(buffer, line, sizeof(line)))
pstr->xrun_debug = !!simple_strtoul(line, NULL, 10);
}
#endif
static int snd_pcm_stream_proc_init(snd_pcm_str_t *pstr) static int snd_pcm_stream_proc_init(snd_pcm_str_t *pstr)
{ {
snd_pcm_t *pcm = pstr->pcm; snd_pcm_t *pcm = pstr->pcm;
...@@ -416,11 +432,31 @@ static int snd_pcm_stream_proc_init(snd_pcm_str_t *pstr) ...@@ -416,11 +432,31 @@ static int snd_pcm_stream_proc_init(snd_pcm_str_t *pstr)
} }
pstr->proc_info_entry = entry; pstr->proc_info_entry = entry;
#ifdef CONFIG_SND_DEBUG
if ((entry = snd_info_create_card_entry(pcm->card, "xrun_debug", pstr->proc_root)) != NULL) {
entry->c.text.read_size = 64;
entry->c.text.read = snd_pcm_xrun_debug_read;
entry->c.text.write_size = 64;
entry->c.text.write = snd_pcm_xrun_debug_write;
entry->private_data = pstr;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
entry = NULL;
}
}
pstr->proc_xrun_debug_entry = entry;
#endif
return 0; return 0;
} }
static int snd_pcm_stream_proc_done(snd_pcm_str_t *pstr) static int snd_pcm_stream_proc_done(snd_pcm_str_t *pstr)
{ {
#ifdef CONFIG_SND_DEBUG
if (pstr->proc_xrun_debug_entry) {
snd_info_unregister(pstr->proc_xrun_debug_entry);
pstr->proc_xrun_debug_entry = NULL;
}
#endif
if (pstr->proc_info_entry) { if (pstr->proc_info_entry) {
snd_info_unregister(pstr->proc_info_entry); snd_info_unregister(pstr->proc_info_entry);
pstr->proc_info_entry = NULL; pstr->proc_info_entry = NULL;
......
...@@ -158,6 +158,15 @@ static inline int snd_pcm_update_hw_ptr_post(snd_pcm_substream_t *substream, ...@@ -158,6 +158,15 @@ static inline int snd_pcm_update_hw_ptr_post(snd_pcm_substream_t *substream,
snd_pcm_stop(substream, snd_pcm_stop(substream,
runtime->status->state == SNDRV_PCM_STATE_DRAINING ? runtime->status->state == SNDRV_PCM_STATE_DRAINING ?
SNDRV_PCM_STATE_SETUP : SNDRV_PCM_STATE_XRUN); SNDRV_PCM_STATE_SETUP : SNDRV_PCM_STATE_XRUN);
#ifdef CONFIG_SND_DEBUG
if (substream->pstr->xrun_debug) {
snd_printd(KERN_DEBUG "XRUN: pcmC%dD%d%c\n",
substream->pcm->card->number,
substream->pcm->device,
substream->stream ? 'c' : 'p');
dump_stack();
}
#endif
return -EPIPE; return -EPIPE;
} }
if (avail >= runtime->control->avail_min) if (avail >= runtime->control->avail_min)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment