From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> To: broonie@kernel.org Cc: vkoul@kernel.org, perex@perex.cz, tiwai@suse.com, lgirdwood@gmail.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, ckeepax@opensource.cirrus.com, Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Subject: [RFC PATCH v2 3/6] ALSA: compress: add flags to snd_compr_caps to expose dsp caps Date: Tue, 21 Jul 2020 18:00:04 +0100 [thread overview] Message-ID: <20200721170007.4554-4-srinivas.kandagatla@linaro.org> (raw) In-Reply-To: <20200721170007.4554-1-srinivas.kandagatla@linaro.org> Some of the DSPs like Qualcomm QDSP has ablity to change decoders dynamically on a single stream, This could be used for features like Cross Fade or gapless with different codec profile tracks. Exposing such features in flags variable of compress caps descriptor would provide userspace more flexibity in usings dsp features. For now only one flag of switching decoders is added which is used in subsequent patches. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> --- include/uapi/sound/compress_offload.h | 7 ++++++- sound/core/compress_offload.c | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/include/uapi/sound/compress_offload.h b/include/uapi/sound/compress_offload.h index c46286113a4b..43c78cdf492c 100644 --- a/include/uapi/sound/compress_offload.h +++ b/include/uapi/sound/compress_offload.h @@ -88,6 +88,9 @@ enum snd_compr_direction { SND_COMPRESS_CAPTURE }; +/* DSP can switch decoder in a single Stream while doing gapless */ +#define SND_COMPR_CAP_FLAGS_DSP_CAN_SWITCH_DECODER ((__u32) 0x00000001) + /** * struct snd_compr_caps - caps descriptor * @codecs: pointer to array of codecs @@ -97,6 +100,7 @@ enum snd_compr_direction { * @min_fragments: min fragments supported by DSP * @max_fragments: max fragments supported by DSP * @num_codecs: number of codecs supported + * @flags: flags to expose various DSP capabilities * @reserved: reserved field */ struct snd_compr_caps { @@ -107,7 +111,8 @@ struct snd_compr_caps { __u32 min_fragments; __u32 max_fragments; __u32 codecs[MAX_NUM_CODECS]; - __u32 reserved[11]; + __u32 flags; + __u32 reserved[10]; } __attribute__((packed, aligned(4))); /** diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index 184722643c97..abebd5fee2d2 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c @@ -590,12 +590,32 @@ static int snd_compress_check_input(struct snd_compr_params *params) } +static bool snd_compr_can_dsp_switch_decoder(struct snd_compr_stream *stream) +{ + struct snd_compr_caps caps; + + if (!stream->ops->get_caps) + return false; + + memset(&caps, 0, sizeof(caps)); + if (stream->ops->get_caps(stream, &caps)) + return false; + + if (caps.flags & SND_COMPR_CAP_FLAGS_DSP_CAN_SWITCH_DECODER) + return true; + + return false; +} + static int snd_compr_set_codec_params(struct snd_compr_stream *stream, unsigned long arg) { struct snd_codec *params; int retval; + if (!snd_compr_can_dsp_switch_decoder(stream)) + return -ENOTSUPP; + if (!stream->ops->set_codec_params) return -EPERM; -- 2.21.0
WARNING: multiple messages have this Message-ID (diff)
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> To: broonie@kernel.org Cc: alsa-devel@alsa-project.org, ckeepax@opensource.cirrus.com, tiwai@suse.com, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, vkoul@kernel.org, Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Subject: [RFC PATCH v2 3/6] ALSA: compress: add flags to snd_compr_caps to expose dsp caps Date: Tue, 21 Jul 2020 18:00:04 +0100 [thread overview] Message-ID: <20200721170007.4554-4-srinivas.kandagatla@linaro.org> (raw) In-Reply-To: <20200721170007.4554-1-srinivas.kandagatla@linaro.org> Some of the DSPs like Qualcomm QDSP has ablity to change decoders dynamically on a single stream, This could be used for features like Cross Fade or gapless with different codec profile tracks. Exposing such features in flags variable of compress caps descriptor would provide userspace more flexibity in usings dsp features. For now only one flag of switching decoders is added which is used in subsequent patches. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> --- include/uapi/sound/compress_offload.h | 7 ++++++- sound/core/compress_offload.c | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/include/uapi/sound/compress_offload.h b/include/uapi/sound/compress_offload.h index c46286113a4b..43c78cdf492c 100644 --- a/include/uapi/sound/compress_offload.h +++ b/include/uapi/sound/compress_offload.h @@ -88,6 +88,9 @@ enum snd_compr_direction { SND_COMPRESS_CAPTURE }; +/* DSP can switch decoder in a single Stream while doing gapless */ +#define SND_COMPR_CAP_FLAGS_DSP_CAN_SWITCH_DECODER ((__u32) 0x00000001) + /** * struct snd_compr_caps - caps descriptor * @codecs: pointer to array of codecs @@ -97,6 +100,7 @@ enum snd_compr_direction { * @min_fragments: min fragments supported by DSP * @max_fragments: max fragments supported by DSP * @num_codecs: number of codecs supported + * @flags: flags to expose various DSP capabilities * @reserved: reserved field */ struct snd_compr_caps { @@ -107,7 +111,8 @@ struct snd_compr_caps { __u32 min_fragments; __u32 max_fragments; __u32 codecs[MAX_NUM_CODECS]; - __u32 reserved[11]; + __u32 flags; + __u32 reserved[10]; } __attribute__((packed, aligned(4))); /** diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index 184722643c97..abebd5fee2d2 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c @@ -590,12 +590,32 @@ static int snd_compress_check_input(struct snd_compr_params *params) } +static bool snd_compr_can_dsp_switch_decoder(struct snd_compr_stream *stream) +{ + struct snd_compr_caps caps; + + if (!stream->ops->get_caps) + return false; + + memset(&caps, 0, sizeof(caps)); + if (stream->ops->get_caps(stream, &caps)) + return false; + + if (caps.flags & SND_COMPR_CAP_FLAGS_DSP_CAN_SWITCH_DECODER) + return true; + + return false; +} + static int snd_compr_set_codec_params(struct snd_compr_stream *stream, unsigned long arg) { struct snd_codec *params; int retval; + if (!snd_compr_can_dsp_switch_decoder(stream)) + return -ENOTSUPP; + if (!stream->ops->set_codec_params) return -EPERM; -- 2.21.0
next prev parent reply other threads:[~2020-07-21 17:03 UTC|newest] Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-21 17:00 [RFC PATCH v2 0/6] ALSA: compress: add support to change codec profile in gapless playback Srinivas Kandagatla 2020-07-21 17:00 ` Srinivas Kandagatla 2020-07-21 17:00 ` [RFC PATCH v2 1/6] ALSA: compress: move codec parameter check to a function Srinivas Kandagatla 2020-07-21 17:00 ` Srinivas Kandagatla 2020-07-21 19:56 ` Pierre-Louis Bossart 2020-07-21 19:56 ` Pierre-Louis Bossart 2020-07-21 17:00 ` [RFC PATCH v2 2/6] ALSA: compress: add new ioctl for setting codec parameters Srinivas Kandagatla 2020-07-21 17:00 ` Srinivas Kandagatla 2020-07-21 20:05 ` Pierre-Louis Bossart 2020-07-21 20:05 ` Pierre-Louis Bossart 2020-07-22 8:59 ` Srinivas Kandagatla 2020-07-22 8:59 ` Srinivas Kandagatla 2020-07-22 15:36 ` Pierre-Louis Bossart 2020-07-22 15:36 ` Pierre-Louis Bossart 2020-07-23 4:47 ` Vinod Koul 2020-07-23 4:47 ` Vinod Koul 2020-07-23 13:17 ` Pierre-Louis Bossart 2020-07-23 13:17 ` Pierre-Louis Bossart 2020-07-21 17:00 ` Srinivas Kandagatla [this message] 2020-07-21 17:00 ` [RFC PATCH v2 3/6] ALSA: compress: add flags to snd_compr_caps to expose dsp caps Srinivas Kandagatla 2020-07-21 17:00 ` [RFC PATCH v2 4/6] ASoC: compress: add snd_soc_dai_compr_set_codec_params() Srinivas Kandagatla 2020-07-21 17:00 ` Srinivas Kandagatla 2020-07-21 17:00 ` [RFC PATCH v2 5/6] ALSA: compress: bump the version Srinivas Kandagatla 2020-07-21 17:00 ` Srinivas Kandagatla 2020-07-21 17:00 ` [RFC PATCH v2 6/6] ASoC: q6asm-dai: add support to set_codec_params Srinivas Kandagatla 2020-07-21 17:00 ` Srinivas Kandagatla 2020-07-21 20:09 ` Pierre-Louis Bossart 2020-07-21 20:09 ` Pierre-Louis Bossart 2020-07-22 8:59 ` Srinivas Kandagatla 2020-07-22 8:59 ` Srinivas Kandagatla 2020-07-22 14:04 ` Daniel Baluta 2020-07-22 14:04 ` Daniel Baluta 2020-07-23 12:38 ` [RFC PATCH v2 0/6] ALSA: compress: add support to change codec profile in gapless playback Takashi Iwai 2020-07-23 12:38 ` Takashi Iwai 2020-07-23 13:05 ` Vinod Koul 2020-07-23 13:05 ` Vinod Koul 2020-07-23 13:17 ` Takashi Iwai 2020-07-23 13:17 ` Takashi Iwai 2020-07-23 15:56 ` Vinod Koul 2020-07-23 15:56 ` Vinod Koul 2020-07-23 20:33 ` Takashi Iwai 2020-07-23 20:33 ` Takashi Iwai 2020-08-06 11:08 ` Vinod Koul 2020-08-06 11:08 ` Vinod Koul 2020-08-06 16:28 ` Takashi Iwai 2020-08-06 16:28 ` Takashi Iwai
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200721170007.4554-4-srinivas.kandagatla@linaro.org \ --to=srinivas.kandagatla@linaro.org \ --cc=alsa-devel@alsa-project.org \ --cc=broonie@kernel.org \ --cc=ckeepax@opensource.cirrus.com \ --cc=lgirdwood@gmail.com \ --cc=linux-kernel@vger.kernel.org \ --cc=perex@perex.cz \ --cc=tiwai@suse.com \ --cc=vkoul@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.