Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Jaroslav Kysela <perex@perex.cz>
Cc: linux-sound@vger.kernel.org, "Takashi Iwai" <tiwai@suse.de>,
	"Mark Brown" <broonie@kernel.org>,
	"Shengjiu Wang" <shengjiu.wang@gmail.com>,
	"Nicolas Dufresne" <nicolas@ndufresne.ca>,
	"Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>,
	"Pierre-Louis Bossart" <pierre-louis.bossart@linux.intel.com>,
	"Vinod Koul" <vkoul@kernel.org>
Subject: Re: [PATCH v3] ALSA: compress_offload: introduce passthrough operation mode
Date: Mon, 24 Jun 2024 15:19:24 +0200	[thread overview]
Message-ID: <878qyupjfn.wl-tiwai@suse.de> (raw)
In-Reply-To: <20240621164915.410946-1-perex@perex.cz>

On Fri, 21 Jun 2024 18:49:15 +0200,
Jaroslav Kysela wrote:
>  /**
>   * struct snd_compr_runtime: runtime stream description
>   * @state: stream state
> @@ -54,6 +70,11 @@ struct snd_compr_runtime {
>  	dma_addr_t dma_addr;
>  	size_t dma_bytes;
>  	struct snd_dma_buffer *dma_buffer_p;
> +
> +	u32 active_tasks;
> +	u32 total_tasks;
> +	u64 task_seqno;
> +	struct list_head tasks;

Those new fields deserve for some more comments (at least mentioning
that those are for passthrough operations).

> --- a/sound/core/Kconfig
> +++ b/sound/core/Kconfig
> @@ -59,6 +59,10 @@ config SND_CORE_TEST
>  config SND_COMPRESS_OFFLOAD
>  	tristate
>  
> +config SND_COMPRESS_PASSTHROUGH
> +	select DMA_BUF
> +	tristate

I suppose this is a boolean?

> --- a/sound/core/compress_offload.c
> +++ b/sound/core/compress_offload.c
(snip)
> @@ -85,6 +92,8 @@ static int snd_compr_open(struct inode *inode, struct file *f)
>  		dirn = SND_COMPRESS_PLAYBACK;
>  	else if ((f->f_flags & O_ACCMODE) == O_RDONLY)
>  		dirn = SND_COMPRESS_CAPTURE;
> +	else if ((f->f_flags & O_ACCMODE) == O_RDWR)
> +		dirn = SND_COMPRESS_PASSTHROUGH;
>  	else
>  		return -EINVAL;

Shouldn't it be safer to give an error for a RW access unless the
driver supports the passthrough mode?

> @@ -939,6 +988,262 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream)
>  	return snd_compress_wait_for_drain(stream);
>  }
>  
> +#if IS_ENABLED(CONFIG_SND_COMPRESS_PASSTHROUGH)
> +
> +static struct snd_compr_task_runtime *
> +		snd_compr_find_task(struct snd_compr_stream *stream, __u64 seqno)

Please fix indentation.

> +void snd_compr_task_finished(struct snd_compr_stream *stream,
> +			    struct snd_compr_task_runtime *task)
> +{
> +	guard(mutex)(&stream->device->lock);
> +	if (!snd_BUG_ON(stream->runtime->active_tasks == 0))
> +		stream->runtime->active_tasks--;
> +	task->state = SND_COMPRESS_TASK_STATE_FINISHED;
> +	wake_up(&stream->runtime->sleep);
> +}
> +EXPORT_SYMBOL(snd_compr_task_finished);

Let's use EXPORT_SYMBOL_GPL() for a new function.


thanks,

Takashi

  parent reply	other threads:[~2024-06-24 13:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-21 16:49 [PATCH v3] ALSA: compress_offload: introduce passthrough operation mode Jaroslav Kysela
2024-06-24  7:13 ` Pierre-Louis Bossart
2024-06-24 15:58   ` Jaroslav Kysela
2024-06-25  6:06     ` Pierre-Louis Bossart
2024-06-25 11:48       ` Jaroslav Kysela
2024-06-25 12:36         ` Pierre-Louis Bossart
2024-06-25 13:00           ` Jaroslav Kysela
2024-06-25 13:48             ` Pierre-Louis Bossart
2024-06-24 13:19 ` Takashi Iwai [this message]
2024-06-24 13:59   ` Jaroslav Kysela
2024-06-25  1:58 ` Shengjiu Wang

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=878qyupjfn.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=nicolas@ndufresne.ca \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=shengjiu.wang@gmail.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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox