6.3.2's io-audio broken again

Hello, All!

Somewhere between 6.3.0SP2 and 6.3.2 releases io-audio (or libasound.so)
became broken again.
My audio driver spreads, that it can support large frag sizes, since it
supports 6 channels with 32 bits per sample:

PCM capabilities looks like:

drv->pcm_capture_caps.min_fragsize = 256;
drv->pcm_capture_caps.max_fragsize = 128 * 1024;
drv->pcm_capture_caps.max_dma_size = 32 * 128 * 1024;

When I trying to play 8 bit, mono, 11025Hz audio stream the following occurs
(I’m using plugins while playing this audio stream in QSA to reconstitute
the source stream to supported stream parameters, which are 16 bit, stereo,
48000Khz minimum):

When application requests frag_size=2048, maximum frags=8 and plugin returns
to application that it has frags=7, frag_size=2048, while driver has been
called with the following arguments:

Nov 15 09:17:32 1 7 0 config->dmabuf.size=249648
Nov 15 09:17:32 1 7 0 config->mode.block.frag_size=35664
Nov 15 09:17:32 1 7 0 config->mode.block.frags_total=7

Sound is played and all is ok.

When application requests frag_size=32768, maximum frags=8 and plugin
returns to application that it has frags=2, frag_size=7526, while driver has
been requested to allocate buffers with the following parameters:

Nov 15 09:15:08 1 7 0 config->dmabuf.size=262144
Nov 15 09:15:08 1 7 0 config->mode.block.frag_size=131072
Nov 15 09:15:08 1 7 0 config->mode.block.frags_total=2

And nothing works. After that.snd_pcm_plugin_write() always returns UNDERRUN
condition during writes. And this is understandable, because written data
count is much smaller than the frag size. Why this happens and how to avoid
this ?

Looks like io-audio or libasound trying to fix dma buffer size to 256Kb now
and this is the root of this problem. This look like someone put hardware
dma buffer size limitation checks (which is common for many hardware -
limitation for the dma buffer size to 65536 samples, which is 256Kb in case
of 16 bit stereo mode) into the high level API code instead of the driver
code.

Anyway after the plugin_setup call, application must obtain correct frag
sizes !

Thanks for attention.

With best regards, Mike Gorchak. E-mail: mike@malva.ua