alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: Jaroslav Kysela <perex@perex.cz>, <broonie@kernel.org>, <tiwai@suse.com>
Cc: <alsa-devel@alsa-project.org>,
	<amadeuszx.slawinski@linux.intel.com>,
	<pierre-louis.bossart@linux.intel.com>, <hdegoede@redhat.com>
Subject: Re: [PATCH v2 02/17] ALSA: pcm: Honor subformat when configuring substream
Date: Thu, 21 Sep 2023 10:59:01 +0200	[thread overview]
Message-ID: <7ee7a0e5-aaf4-acc0-16a2-1f73a2e6fa40@intel.com> (raw)
In-Reply-To: <2a249c19-d045-f3c4-3b8a-898ecd278abc@perex.cz>

On 2023-09-21 8:41 AM, Jaroslav Kysela wrote:
> On 18. 09. 23 15:39, Cezary Rojewski wrote:
>> Substream value is currently hardcoded to SNDRV_PCM_SUBFORMAT_STD.
>> Update the constraint procedure so that subformat selection is not
>> ignored. Case STD is always supported as most PCMs do not care about
>> subformat.
>>
>> Suggested-by: Jaroslav Kysela <perex@perex.cz>
> 
> Better Co-developed mark. Also I would move whole code to the first 
> patch. It does not make sense to split the mandatory code.
> 
> Another option is to increase the protocol version to the separate patch 
> where all necessary code changes are applied (for MSBITS_MAX). But it 
> may break backports, so the change should be aligned with the SUBFMT 
> defines.

While most of my feedback is below, if we decide that "subformat as 
first class citizen" approach is good-to-go, this patch gets 
re-authorized in v3 as the input on the constraint part from your end is 
major.

>> +    struct snd_mask *sfmask;
> 
> m_rw -> sfmask renaming. I prefer universal name to allow easy reuse in 
> future.

Ack.

>> +        for (sf = hw->subformats; sf->mask && !found; sf++) {
> 
> My proposal [1] defined SNDRV_PCM_FORMAT_CONSTRAINT_END value not 
> relying to zero format (which is U8) and zero subformat to skip the 
> MSBIT_MAX setting bellow. After some thought, if the driver sets 
> SNDRV_PCM_SUBFORMAT_MSBITS_STD, the result will be similar, thus the 
> mask can be zero and the code may be reduced. So no objection for this 
> change.
> 
>> +        if (!found && snd_pcm_format_linear(f))
>> +            snd_mask_set(&m, (__force 
>> unsigned)SNDRV_PCM_SUBFORMAT_MSBITS_MAX);
>> +    }
>> +exit:
>> +    return snd_mask_refine(sfmask, &m);
>> +}
>> +
>> +static int snd_pcm_hw_constraint_subformats(struct snd_pcm_runtime 
>> *runtime,
>> +                       unsigned int cond,
>> +                       struct snd_pcm_hardware *hw)
>> +{
> 
> Because your change does not assume that this constraint is called from 
> the drivers, the comments and EXPORT_SYMBOL() lines were removed from 
> the original proposal [1]. I believe that the standalone constraint is 
> better at this time - reduce code, the use of the subformat extension is 
> not mandatory.

Thank you for thorough feedback, Jaroslav. This is much appreciated. 
Before I comment on the rest of the comments, let me provide a summary:
I believe that most of the subject comes down to: subformat as 
mainstream API -or- subformat as niche API.

If the general opinion of the developers is: let's go for the latter 
until we have more users, I have no problem with merging the patches 1 & 
2 and addressing most of the review in 1:1 fashion as indeed many parts 
of the proposed API lose their purpose.

My view is different as I'd like subformat to become mainstream. To be 
honest, the object that allowed it to happen has been suggested by you 
Jaroslav - the struct made of { format; mask; }. It allows to describe 
what subformat _is_ in explicit fashion and by being exposed in 
snd_pcm_hardware becomes standard part of the API. As previously 
suggested, I believe it could replace ->msbits in future too.


Question to the fellow developers: What's your take on the subject?


Kind regards,
Czarek

> [1] 
> https://lore.kernel.org/alsa-devel/20230912162526.7138-1-perex@perex.cz/
>      
> https://lore.kernel.org/alsa-devel/20230913103716.67315-1-perex@perex.cz/
> 

  reply	other threads:[~2023-09-21  9:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-18 13:39 [PATCH v2 00/17] ALSA/ASoC: hda: Address format selection limitations and ambiguity Cezary Rojewski
2023-09-18 13:39 ` [PATCH v2 01/17] ALSA: pcm: Introduce MSBITS subformat interface Cezary Rojewski
2023-09-21  6:25   ` Jaroslav Kysela
2023-11-14 20:09     ` Cezary Rojewski
2023-09-18 13:39 ` [PATCH v2 02/17] ALSA: pcm: Honor subformat when configuring substream Cezary Rojewski
2023-09-21  6:41   ` Jaroslav Kysela
2023-09-21  8:59     ` Cezary Rojewski [this message]
2023-09-23 10:55   ` kernel test robot
2023-09-18 13:39 ` [PATCH v2 03/17] ALSA: hda: Honor subformat when querying PCMs Cezary Rojewski
2023-09-18 13:39 ` [PATCH v2 04/17] ASoC: pcm: Honor subformat when configuring runtime Cezary Rojewski
2023-09-19 12:50   ` Mark Brown
2023-09-21  6:57   ` Jaroslav Kysela
2023-09-18 13:39 ` [PATCH v2 05/17] ALSA: hda: Upgrade stream-format infrastructure Cezary Rojewski
2023-09-18 13:39 ` [PATCH v2 06/17] ALSA: hda: Switch to new stream-format interface Cezary Rojewski
2023-09-18 13:39 ` [PATCH v2 07/17] ALSA: hda/hdmi: " Cezary Rojewski
2023-09-18 13:39 ` [PATCH v2 08/17] ALSA: hda/ca0132: " Cezary Rojewski
2023-09-18 13:39 ` [PATCH v2 09/17] ASoC: codecs: hda: " Cezary Rojewski
2023-09-18 13:39 ` [PATCH v2 10/17] ASoC: codecs: hdac_hda: " Cezary Rojewski
2023-09-18 13:39 ` [PATCH v2 11/17] ASoC: codecs: hdac_hdmi: " Cezary Rojewski
2023-09-18 13:39 ` [PATCH v2 12/17] ASoC: Intel Skylake: " Cezary Rojewski
2023-09-18 13:39 ` [PATCH v2 13/17] ASoC: SOF: Intel: " Cezary Rojewski
2023-09-18 13:39 ` [PATCH v2 14/17] ASoC: Intel: avs: " Cezary Rojewski
2023-09-18 13:39 ` [PATCH v2 15/17] ALSA: hda: Drop snd_hdac_calc_stream_format() Cezary Rojewski
2023-09-18 15:11   ` kernel test robot
2023-09-18 13:39 ` [PATCH v2 16/17] ASoC: Intel: avs: Kill S24_LE in HDAudio streaming Cezary Rojewski
2023-09-18 13:39 ` [PATCH v2 17/17] ASoC: Intel: avs: Unhardcode HDAudio BE DAI drivers description Cezary Rojewski

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=7ee7a0e5-aaf4-acc0-16a2-1f73a2e6fa40@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --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;
as well as URLs for NNTP newsgroup(s).