[PATCH RFC 12/21] ALSA: pcm: add tracepoints for selection process of hardware parameters at SNDRV_PCM_IOCTL_HW_PARAMS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Results of ioctl(2) with SNDRV_PCM_IOCTL_HW_REFINE and
SNDRV_PCM_IOCTL_HW_PARAMS are different, because the latter has single
value for several parameters; e.g. channels of PCM substream. Selection
of the single value is done independently of application of constraints
and rules. It's helpful for developers to trace the selection process

This commit adds tracepoints to snd_pcm_hw_params_choose() for the
purpose.

Signed-off-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
---
 sound/core/pcm_native.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 2c5a4d9..47af1a8 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -555,11 +555,35 @@ static int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm,
 	const int *v;
 	int err;
 
+	struct snd_interval __maybe_unused old_interval;
+	struct snd_mask __maybe_unused old_mask;
+
 	for (v = vars; *v != -1; v++) {
+		/* Keep old parameter to trace. */
+		if (trace_hw_params_mask_enabled()) {
+			if (hw_is_mask(*v))
+				old_mask = *hw_param_mask(params, *v);
+		}
+		if (trace_hw_params_interval_enabled()) {
+			if (hw_is_interval(*v))
+				old_interval = *hw_param_interval(params, *v);
+		}
+
 		if (*v != SNDRV_PCM_HW_PARAM_BUFFER_SIZE)
 			err = snd_pcm_hw_param_first(pcm, params, *v, NULL);
 		else
 			err = snd_pcm_hw_param_last(pcm, params, *v, NULL);
+
+		/* Trace the parameter. */
+		if (hw_is_mask(*v)) {
+			trace_hw_params_mask(pcm, *v, -1, &old_mask,
+					     hw_param_mask(params, *v));
+		}
+		if (hw_is_interval(*v)) {
+			trace_hw_params_interval(pcm, *v, -1, &old_interval,
+						 hw_param_interval(params, *v));
+		}
+
 		if (snd_BUG_ON(err < 0))
 			return err;
 	}
-- 
2.9.3

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux