Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>,
	linux-sound@vger.kernel.org,
	Takashi Sakamoto <takaswie@kernel.org>
Subject: Re: [PATCH] ALSA: pcm: reinvent the stream synchronization ID API
Date: Thu, 02 May 2024 17:27:25 +0200	[thread overview]
Message-ID: <87o79oi68y.wl-tiwai@suse.de> (raw)
In-Reply-To: <a2fc16aa-387d-47e2-8000-1a502e6da7ac@perex.cz>

On Thu, 02 May 2024 10:02:36 +0200,
Jaroslav Kysela wrote:
> 
> On 02. 05. 24 9:31, Takashi Iwai wrote:
> > On Tue, 30 Apr 2024 18:10:12 +0200,
> > Jaroslav Kysela wrote:
> >> 
> >> Until the commit e11f0f90a626 ("ALSA: pcm: remove SNDRV_PCM_IOCTL1_INFO
> >> internal command"), there was a possibility to pass information
> >> about the synchronized streams to the user space. The mentioned
> >> commit removed blindly the appropriate code with an irrelevant comment.
> >> 
> >> The revert may be appropriate, but since this API was lost for several
> >> years without any complains, it's time to improve it. The hardware
> >> parameters may change the used stream clock source (e.g. USB hardware)
> >> so move this synchronization ID to hw_params as read-only field.
> > 
> > What's the benefit of moving to hw_params?  The current inquiry via
> > ioctl can also follow the dynamic change, no?  I'm not entirely
> > objecting to the idea, but need to understand better.
> 
> In the removed code, there was a comment from Abramo that this ioctl
> is not so much appropriate to carry this information because it
> depends on the runtime status. Also, this info ioctl is callable
> through the control API thus the result depends on the stream open
> state. The revert is just a simple solution, but given the fact that
> the API was suspended for several years, we can do this cleanup now
> IMHO.

OK, makes sense.

> >> It seems that pipewire can benefit from this API (disable adaptive
> >> resampling for perfectly synchronized PCM streams) now.
> > 
> > If the support by pipewire is planned, it'd be good to revive the
> > feature, yes.
> 
> Pipewire would like to be able to detect the synchronized streams and
> Wim is aware about sync_id API, but it does not work now without
> obsoleting this in alsa-lib. I think that we did a wrong job here.

OK.

> >> --- a/include/uapi/sound/asound.h
> >> +++ b/include/uapi/sound/asound.h
> > (snip)
> >> @@ -334,6 +334,7 @@ union snd_pcm_sync_id {
> >>   	unsigned char id[16];
> >>   	unsigned short id16[8];
> >>   	unsigned int id32[4];
> >> +	__u64 id64[2];
> >>   };
> > 
> > What's the reason for this __u64 addition?  For the easiness of
> > zero-compare?
> 
> Basically yes, but this extensions is aligned with other fields. Also,
> I think that it may be usable to work with 64-bit words here. Perhaps,
> other fields may use __uXX declarations, too.

IMO, if we are allowed to redesign, it'd be better to avoid a union
for an API call.  It's a nightmare if one needs a conversion of API
(e.g. between different endianess for emulator).


thanks,

Takashi

  reply	other threads:[~2024-05-02 15:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 16:10 [PATCH] ALSA: pcm: reinvent the stream synchronization ID API Jaroslav Kysela
2024-05-01 11:44 ` Takashi Sakamoto
2024-05-01 14:17   ` Jaroslav Kysela
2024-05-02  7:31 ` Takashi Iwai
2024-05-02  8:02   ` Jaroslav Kysela
2024-05-02 15:27     ` Takashi Iwai [this message]
2024-05-02 17:05       ` Jaroslav Kysela
2024-05-06  9:02 ` Amadeusz Sławiński
2024-05-06  9:12   ` Jaroslav Kysela

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=87o79oi68y.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=takaswie@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