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
Subject: Re: [PATCH] ALSA: pcm: clarify and fix default msbits value for all formats
Date: Fri, 23 Feb 2024 09:54:19 +0100	[thread overview]
Message-ID: <875xyf4l38.wl-tiwai@suse.de> (raw)
In-Reply-To: <87a5nr4lhn.wl-tiwai@suse.de>

On Fri, 23 Feb 2024 09:45:40 +0100,
Takashi Iwai wrote:
> 
> On Thu, 22 Feb 2024 19:59:14 +0100,
> Jaroslav Kysela wrote:
> > 
> > On 22. 02. 24 19:33, Takashi Iwai wrote:
> > > On Thu, 22 Feb 2024 18:36:49 +0100,
> > > Jaroslav Kysela wrote:
> > >> 
> > >> Return used most significant bits from sample bit-width rather than the whole
> > >> physical sample word size. The starting bit offset is defined in the format
> > >> itself.
> > >> 
> > >> The behaviour is not changed for 32-bit formats like S32_LE. But with this
> > >> change - msbits value 24 instead 32 is returned for 24-bit formats like S24_LE
> > >> etc.
> > >> 
> > >> Also, commit 2112aa034907 ("ALSA: pcm: Introduce MSBITS subformat interface")
> > >> compares sample bit-width not physical sample bit-width to reset MSBITS_MAX bit
> > >> from the subformat bitmask.
> > >> 
> > >> Probably no applications are using msbits value for other than S32_LE/U32_LE
> > >> formats, because no drivers are reducing msbits value for other formats (with
> > >> the msb offset) at the moment.
> > >> 
> > >> For sanity, increase PCM protocol version, letting the user space to detect
> > >> the changed behaviour.
> > >> 
> > >> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
> > > 
> > > Hmm, the idea is nice, but I hesitate to take this as is.
> > > 
> > > Basically the kernel should keep the backward compatibility, and this
> > > won't (although the feature is very minor).
> > > 
> > > IMO, it'd be safer to check user_pversion and applies the new behavior
> > > only with it being >= 2.0.17, for example.
> > 
> > It's not so easy. The user_pversion is detached from substream
> > (pcm_file structure) and propagating this value to all related
> > functions creates really ugly code.
> > 
> > If you won't accept this ASIS, I propose to add new flags to the
> > hw_params structure to alter the msbits behaviour. But I can hardly
> > see any impact to the user space. The affected format/msbits
> > combination was never used in the kernel drivers. It's more like a
> > clarification than a fix.
> 
> OK, then let's take this.  I checked the major sound backend apps, and
> they don't care about msbits, so the influence must be pretty low.

To be more exact, both PA and PW have the same code to check the
msbits but they merely set "alsa.resolution_bits" property, and it's
not referred in the standard configs.


Takashi

      reply	other threads:[~2024-02-23  8:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22 17:36 [PATCH] ALSA: pcm: clarify and fix default msbits value for all formats Jaroslav Kysela
2024-02-22 18:33 ` Takashi Iwai
2024-02-22 18:59   ` Jaroslav Kysela
2024-02-23  8:45     ` Takashi Iwai
2024-02-23  8:54       ` Takashi Iwai [this message]

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