All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pcm: Fix channel map query when there are lots of maps
@ 2014-06-08  9:58 Anssi Hannula
  2014-06-08 10:03 ` Takashi Iwai
  0 siblings, 1 reply; 3+ messages in thread
From: Anssi Hannula @ 2014-06-08  9:58 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

On most HDA Intel HDMI devices, the channel map list is approx. 500 ints
in size, making the 256-sized buffer used by
snd_pcm_query_chmaps_from_hw() too small and causing the query to fail
(NULL result to caller, ENOMEM).

Bump the buffer size to 2048 ints.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
---

Found while writing XBMC support.

I don't like just bumping the buffer size, so I hope you have some idea
of a better solution?
I guess one way would be just to retry with a dynamically allocated
bigger buffer on ENOMEM, if there is nothing better...

 src/pcm/pcm_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
index 9ff83a9..ed83197 100644
--- a/src/pcm/pcm_hw.c
+++ b/src/pcm/pcm_hw.c
@@ -1051,7 +1051,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev,
 {
 	snd_ctl_t *ctl;
 	snd_ctl_elem_id_t *id;
-	unsigned int tlv[256], *start;
+	unsigned int tlv[2048], *start;
 	snd_pcm_chmap_query_t **map;
 	int i, ret, nums;
 
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pcm: Fix channel map query when there are lots of maps
  2014-06-08  9:58 [PATCH] pcm: Fix channel map query when there are lots of maps Anssi Hannula
@ 2014-06-08 10:03 ` Takashi Iwai
  2014-06-08 13:53   ` Anssi Hannula
  0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2014-06-08 10:03 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: alsa-devel

At Sun,  8 Jun 2014 12:58:56 +0300,
Anssi Hannula wrote:
> 
> On most HDA Intel HDMI devices, the channel map list is approx. 500 ints
> in size, making the 256-sized buffer used by
> snd_pcm_query_chmaps_from_hw() too small and causing the query to fail
> (NULL result to caller, ENOMEM).
> 
> Bump the buffer size to 2048 ints.
> 
> Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
> ---
> 
> Found while writing XBMC support.
> 
> I don't like just bumping the buffer size, so I hope you have some idea
> of a better solution?
> I guess one way would be just to retry with a dynamically allocated
> bigger buffer on ENOMEM, if there is nothing better...

For user-space, this stack size doesn't matter too much, I suppose.
Unless we'll hit really too big size, I guess we can keep in this
way.  So, I applied it as is.


thanks,

Takashi


> 
>  src/pcm/pcm_hw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
> index 9ff83a9..ed83197 100644
> --- a/src/pcm/pcm_hw.c
> +++ b/src/pcm/pcm_hw.c
> @@ -1051,7 +1051,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev,
>  {
>  	snd_ctl_t *ctl;
>  	snd_ctl_elem_id_t *id;
> -	unsigned int tlv[256], *start;
> +	unsigned int tlv[2048], *start;
>  	snd_pcm_chmap_query_t **map;
>  	int i, ret, nums;
>  
> -- 
> 1.8.4.5
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pcm: Fix channel map query when there are lots of maps
  2014-06-08 10:03 ` Takashi Iwai
@ 2014-06-08 13:53   ` Anssi Hannula
  0 siblings, 0 replies; 3+ messages in thread
From: Anssi Hannula @ 2014-06-08 13:53 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

08.06.2014 13:03, Takashi Iwai kirjoitti:
> At Sun,  8 Jun 2014 12:58:56 +0300,
> Anssi Hannula wrote:
>>
>> On most HDA Intel HDMI devices, the channel map list is approx. 500 ints
>> in size, making the 256-sized buffer used by
>> snd_pcm_query_chmaps_from_hw() too small and causing the query to fail
>> (NULL result to caller, ENOMEM).
>>
>> Bump the buffer size to 2048 ints.
>>
>> Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
>> ---
>>
>> Found while writing XBMC support.
>>
>> I don't like just bumping the buffer size, so I hope you have some idea
>> of a better solution?
>> I guess one way would be just to retry with a dynamically allocated
>> bigger buffer on ENOMEM, if there is nothing better...
> 
> For user-space, this stack size doesn't matter too much, I suppose.
> Unless we'll hit really too big size, I guess we can keep in this
> way.  So, I applied it as is.

OK.

I'm a bit afraid about HDMI 2.x, though, with its reported 32 channel
audio support... but I guess we can tackle that when we actually know
how exactly it works and get driver support.


> 
> thanks,
> 
> Takashi
> 
> 
>>
>>  src/pcm/pcm_hw.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
>> index 9ff83a9..ed83197 100644
>> --- a/src/pcm/pcm_hw.c
>> +++ b/src/pcm/pcm_hw.c
>> @@ -1051,7 +1051,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev,
>>  {
>>  	snd_ctl_t *ctl;
>>  	snd_ctl_elem_id_t *id;
>> -	unsigned int tlv[256], *start;
>> +	unsigned int tlv[2048], *start;
>>  	snd_pcm_chmap_query_t **map;
>>  	int i, ret, nums;
>>  
>> -- 
>> 1.8.4.5
>>


-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-08 13:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-08  9:58 [PATCH] pcm: Fix channel map query when there are lots of maps Anssi Hannula
2014-06-08 10:03 ` Takashi Iwai
2014-06-08 13:53   ` Anssi Hannula

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.