From: Jaroslav Kysela <perex@perex.cz>
To: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: linux-sound@vger.kernel.org, Takashi Iwai <tiwai@suse.de>
Subject: Re: [PATCH 1/2] ALSA: pcm: reinvent the stream synchronization ID API
Date: Tue, 7 May 2024 10:38:17 +0200 [thread overview]
Message-ID: <086b421b-2456-4d49-a709-69d4ffdd30c7@perex.cz> (raw)
In-Reply-To: <20240507030414.GA413281@workstation.local>
On 07. 05. 24 5:04, Takashi Sakamoto wrote:
>> +/**
>> + * is sync id (clock id) empty?
>> + */
>> +static inline bool pcm_sync_empty(const unsigned char *sync)
>> +{
>> + return strnlen((const char *)sync, 16) == 0;
>> +}
>> +
>
> For the sound card indexed by 0, it is problematic, since in the later
> change, the first element of array has 0.
Oops. It was a thinko. I replaced this with a full zero comparison in v3 of
this patch.
...
>> @@ -420,7 +414,8 @@ struct snd_pcm_hw_params {
>> unsigned int rate_num; /* R: rate numerator */
>> unsigned int rate_den; /* R: rate denominator */
>> snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */
>> - unsigned char reserved[64]; /* reserved for future */
>> + unsigned char sync[16]; /* R: synchronization ID (perfect sync - one clock source) */
>> + unsigned char reserved[48]; /* reserved for future */
>> };
>>
>> enum {
>
> As long as I checked, the above change are safe for
> backward-compatibility and compat ioctl. They keep the same size of
> structure and the same offset of member in each of i386/ILP32/LP64 data
> models,
Thank you for this verification and review.
>> + *(__u32 *)runtime->sync = cpu_to_le32(substream->pcm->card->number);
>> + memset(runtime->sync + 4, 0, sizeof(runtime->sync) - 4);
>> + strncpy(runtime->sync + 4, "P16V", 4);
>
> The serialization would not keep the same data before the change, since
> the third, fourth, and fifth elements are 0x31, 0x36, and 0x56, instead
> of 0x10, 0x56, and 0x00.
It does not matter. See the extended comment for snd_pcm_set_sync_per_card in
v3. The ID should be used only for a comparison among PCM devices without any
interpretation.
Thank you,
Jaroslav
--
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
next prev parent reply other threads:[~2024-05-07 8:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-06 15:11 [PATCH 0/2] ALSA: pcm: reinvent the stream synchronization ID API Jaroslav Kysela
2024-05-06 15:11 ` [PATCH 1/2] " Jaroslav Kysela
2024-05-07 3:04 ` Takashi Sakamoto
2024-05-07 8:38 ` Jaroslav Kysela [this message]
2024-05-06 15:11 ` [PATCH 2/2] ALSA: pcm: optimize and clarify stream sychronization " Jaroslav Kysela
2024-05-07 3:04 ` Takashi Sakamoto
2024-05-07 3:04 ` [PATCH 0/2] ALSA: pcm: reinvent the stream synchronization " Takashi Sakamoto
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=086b421b-2456-4d49-a709-69d4ffdd30c7@perex.cz \
--to=perex@perex.cz \
--cc=linux-sound@vger.kernel.org \
--cc=o-takashi@sakamocchi.jp \
--cc=tiwai@suse.de \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).