public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Shengjiu Wang <shengjiu.wang@gmail.com>
Cc: Mark Brown <broonie@kernel.org>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	Shengjiu Wang <shengjiu.wang@nxp.com>,
	sakari.ailus@iki.fi, tfiga@chromium.org,
	m.szyprowski@samsung.com, mchehab@kernel.org,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Xiubo.Lee@gmail.com, festevam@gmail.com, nicoleotsuka@gmail.com,
	lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com,
	alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [RFC PATCH v2 0/7] Add audio support in v4l2 framework
Date: Thu, 24 Aug 2023 19:03:09 +0200	[thread overview]
Message-ID: <87wmxk8jaq.wl-tiwai@suse.de> (raw)
In-Reply-To: <CAA+D8AN34-NVrgksRAG014PuHGUssTm0p-KR-HYGe+Pt8Yejxg@mail.gmail.com>

On Wed, 23 Aug 2023 16:33:19 +0200,
Shengjiu Wang wrote:
> 
> On Fri, Aug 11, 2023 at 7:05 PM Shengjiu Wang <shengjiu.wang@gmail.com> wrote:
> >
> > Hi Mark, Takashi
> >
> > On Thu, Aug 3, 2023 at 9:11 PM Shengjiu Wang <shengjiu.wang@gmail.com> wrote:
> > >
> > > On Thu, Aug 3, 2023 at 1:28 AM Mark Brown <broonie@kernel.org> wrote:
> > > >
> > > > On Wed, Aug 02, 2023 at 10:41:43PM +0800, Shengjiu Wang wrote:
> > > >
> > > > > Currently the ASRC in ALSA is to connect to another I2S device as
> > > > > a sound card.  But we'd like to the ASRC can be used by user space directly
> > > > > that user space application can get the output after conversion from ASRC.
> > > >
> > > > That sort of use case would be handled via DPCM at the minute, though
> > > > persuading it to connect two front ends together might be fun (which is
> > > > the sort of reason why we want to push digital information down into
> > > > DAPM and make everything a component).
> > >
> > > Thanks.
> > >
> > > ASRC M2M case needs to run as fast as possible, no sync clock control.
> > > If use sound card to handle ASRC M2M case,  the user application
> > > should be aplay/arecord, then we need to consider xrun issue, buffer
> > > may timeout, sync between aplay and arecord,  these should't be
> > > considered by pure memory to memory operation.
> > >
> > > DPCM may achitect all the audio things in components and sound
> > > card,  it is good. but for the M2M case, it is complcated. not sure
> > > it is doable.
> > >
> >
> > Beside the concern in previous mail,
> >
> > DPCM needs to separate ASRC to be two substreams (playback and capture).
> >
> > But the ASRC needs the sample rate & format of input and output first
> > then start conversion.
> >
> > If the playback controls the rate & format of input,  capture substream
> > controls the rate & format of output,  as a result
> > one substream needs to get information(dma buffer address, size...
> > rate, format) from another substream, then start both substreams in the
> > last substream. How to synchronize these two substreams is a problem.
> > One stream can be released but another stream doesn't know .
> >
> > So I don't think it is a good idea to use DPCM for pure M2M case.
> >
> > So can I persuade you to consider the V4L2 solution?
> >
> 
> Just a summary:
> 
> Basic M2M conversion can work with DPCM, I have tried with some
> workaround to make it work.
> 
> But there are several issues:
> 1. Need to create sound cards.  ASRC module support multi instances, then
> need to create multi sound cards for each instance.

Hm, why can't it be multiple PCM instances instead?

> 2. The ASRC is an entirety but with DPCM we need to separate input port and
> output port to playback substream and capture stream. Synchronous between
> playback substream and capture substream is a problem.
> How to start them and stop them at the same time.

This could be done by enforcing the full duplex and linking the both
PCM streams, I suppose.

> 3. How to handle the xrun issue. pause or resume. which are brought by ALSA.

Doesn't V4L2 handle the overrun/underrun at all?  Also, no resume
support?

Pause and resume are optional in ALSA frame work, you don't need to
implement them unless you want/need.

> So shall we make the decision that we can go to the V4L2 solution?

Honestly speaking, I don't mind much whether it's implemented in V2L4
or not -- at least for the kernel part, we can reorganize / refactor
things internally.  But, the biggest remaining question to me is
whether this user-space interface is the most suitable one.  Is it
well defined, usable and maintained for the audio applications?  Or
is it meant to be a stop-gap for a specific use case?


thanks,

Takashi

  reply	other threads:[~2023-08-24 17:03 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25  6:12 [RFC PATCH v2 0/7] Add audio support in v4l2 framework Shengjiu Wang
2023-07-25  6:12 ` [RFC PATCH v2 1/7] ASoC: fsl_asrc: define functions for memory to memory usage Shengjiu Wang
2023-08-01 13:58   ` Daniel Baluta
2023-07-25  6:12 ` [RFC PATCH v2 2/7] ASoC: fsl_easrc: " Shengjiu Wang
2023-07-25  6:12 ` [RFC PATCH v2 3/7] ASoC: fsl_asrc: move fsl_asrc_common.h to include/sound Shengjiu Wang
2023-07-25  6:12 ` [RFC PATCH v2 4/7] media: v4l2: Add audio capture and output support Shengjiu Wang
2023-07-28  7:59   ` Tomasz Figa
2023-07-28 15:24     ` Mark Brown
2023-08-01  9:47     ` Shengjiu Wang
2023-08-02  7:19       ` Tomasz Figa
2023-07-25  6:12 ` [RFC PATCH v2 5/7] media: imx: fsl_asrc: Add memory to memory driver Shengjiu Wang
2023-08-01 14:15   ` Daniel Baluta
2023-07-25  6:12 ` [RFC PATCH v2 6/7] ASoC: fsl_asrc: register m2m platform device Shengjiu Wang
2023-07-25  6:12 ` [RFC PATCH v2 7/7] ASoC: fsl_easrc: " Shengjiu Wang
2023-08-02  7:32 ` [RFC PATCH v2 0/7] Add audio support in v4l2 framework Hans Verkuil
2023-08-02 11:22   ` Takashi Iwai
2023-08-02 12:02     ` Shengjiu Wang
2023-08-02 12:08       ` Takashi Iwai
2023-08-02 14:41         ` Shengjiu Wang
2023-08-02 17:28           ` Mark Brown
2023-08-03 13:11             ` Shengjiu Wang
2023-08-11 11:05               ` Shengjiu Wang
2023-08-23 14:33                 ` Shengjiu Wang
2023-08-24 17:03                   ` Takashi Iwai [this message]
2023-08-24 20:21                     ` Mark Brown
2023-08-25  3:46                       ` Shengjiu Wang
2023-08-25 13:54                         ` Takashi Iwai
2023-08-25 14:15                           ` Hans Verkuil
2023-08-30  3:11                             ` Shengjiu Wang
2023-08-31 20:41                     ` Nicolas Dufresne
2023-08-02 12:09       ` Mark Brown
2023-08-02 12:28       ` Hans Verkuil
2023-08-04 12:19         ` Shengjiu Wang
2023-08-04 12:34           ` Hans Verkuil

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=87wmxk8jaq.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=Xiubo.Lee@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=festevam@gmail.com \
    --cc=hverkuil@xs4all.nl \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@kernel.org \
    --cc=nicoleotsuka@gmail.com \
    --cc=perex@perex.cz \
    --cc=sakari.ailus@iki.fi \
    --cc=shengjiu.wang@gmail.com \
    --cc=shengjiu.wang@nxp.com \
    --cc=tfiga@chromium.org \
    --cc=tiwai@suse.com \
    /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