Commit 82e7d501 authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

ALSA: pcm: probe events when parameters are changed actually

At present, trace events are probed even if corresponding parameter is
not actually changed. This is inconvenient.

This commit improves the behaviour.
Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent f74ae15f
...@@ -278,11 +278,11 @@ static int constrain_mask_params(struct snd_pcm_substream *substream, ...@@ -278,11 +278,11 @@ static int constrain_mask_params(struct snd_pcm_substream *substream,
changed = snd_mask_refine(m, constrs_mask(constrs, k)); changed = snd_mask_refine(m, constrs_mask(constrs, k));
if (changed < 0) if (changed < 0)
return changed; return changed;
if (changed == 0)
trace_hw_mask_param(substream, k, 0, &old_mask, m); continue;
/* Set corresponding flag so that the caller gets it. */ /* Set corresponding flag so that the caller gets it. */
if (changed) trace_hw_mask_param(substream, k, 0, &old_mask, m);
params->cmask |= 1 << k; params->cmask |= 1 << k;
} }
...@@ -314,11 +314,11 @@ static int constrain_interval_params(struct snd_pcm_substream *substream, ...@@ -314,11 +314,11 @@ static int constrain_interval_params(struct snd_pcm_substream *substream,
changed = snd_interval_refine(i, constrs_interval(constrs, k)); changed = snd_interval_refine(i, constrs_interval(constrs, k));
if (changed < 0) if (changed < 0)
return changed; return changed;
if (changed == 0)
trace_hw_interval_param(substream, k, 0, &old_interval, i); continue;
/* Set corresponding flag so that the caller gets it. */ /* Set corresponding flag so that the caller gets it. */
if (changed) trace_hw_interval_param(substream, k, 0, &old_interval, i);
params->cmask |= 1 << k; params->cmask |= 1 << k;
} }
...@@ -409,29 +409,29 @@ static int constrain_params_by_rules(struct snd_pcm_substream *substream, ...@@ -409,29 +409,29 @@ static int constrain_params_by_rules(struct snd_pcm_substream *substream,
if (changed < 0) if (changed < 0)
return changed; return changed;
if (hw_is_mask(r->var)) {
trace_hw_mask_param(substream, r->var, k + 1,
&old_mask, hw_param_mask(params, r->var));
}
if (hw_is_interval(r->var)) {
trace_hw_interval_param(substream, r->var, k + 1,
&old_interval, hw_param_interval(params, r->var));
}
rstamps[k] = stamp;
/* /*
* When the parameters is changed, notify it to the caller * When the parameter is changed, notify it to the caller
* by corresponding returned bit, then preparing for next * by corresponding returned bit, then preparing for next
* iteration. * iteration.
*/ */
if (changed && r->var >= 0) { if (changed && r->var >= 0) {
if (hw_is_mask(r->var)) {
trace_hw_mask_param(substream, r->var,
k + 1, &old_mask,
hw_param_mask(params, r->var));
}
if (hw_is_interval(r->var)) {
trace_hw_interval_param(substream, r->var,
k + 1, &old_interval,
hw_param_interval(params, r->var));
}
params->cmask |= (1 << r->var); params->cmask |= (1 << r->var);
vstamps[r->var] = stamp; vstamps[r->var] = stamp;
again = true; again = true;
} }
stamp++; rstamps[k] = stamp++;
} }
/* Iterate to evaluate all rules till no parameters are changed. */ /* Iterate to evaluate all rules till no parameters are changed. */
...@@ -604,7 +604,7 @@ static int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm, ...@@ -604,7 +604,7 @@ static int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm,
const int *v; const int *v;
struct snd_mask old_mask; struct snd_mask old_mask;
struct snd_interval old_interval; struct snd_interval old_interval;
int err; int changed;
for (v = vars; *v != -1; v++) { for (v = vars; *v != -1; v++) {
/* Keep old parameter to trace. */ /* Keep old parameter to trace. */
...@@ -617,13 +617,15 @@ static int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm, ...@@ -617,13 +617,15 @@ static int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm,
old_interval = *hw_param_interval(params, *v); old_interval = *hw_param_interval(params, *v);
} }
if (*v != SNDRV_PCM_HW_PARAM_BUFFER_SIZE) if (*v != SNDRV_PCM_HW_PARAM_BUFFER_SIZE)
err = snd_pcm_hw_param_first(pcm, params, *v, NULL); changed = snd_pcm_hw_param_first(pcm, params, *v, NULL);
else else
err = snd_pcm_hw_param_last(pcm, params, *v, NULL); changed = snd_pcm_hw_param_last(pcm, params, *v, NULL);
if (snd_BUG_ON(err < 0)) if (snd_BUG_ON(changed < 0))
return err; return changed;
if (changed == 0)
continue;
/* Trace the parameter. */ /* Trace the changed parameter. */
if (hw_is_mask(*v)) { if (hw_is_mask(*v)) {
trace_hw_mask_param(pcm, *v, 0, &old_mask, trace_hw_mask_param(pcm, *v, 0, &old_mask,
hw_param_mask(params, *v)); hw_param_mask(params, *v));
......
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