[alsa-devel] [PATCH 5/6] compress: add the core file

Takashi Iwai tiwai at suse.de
Tue Nov 29 08:31:47 CET 2011

At Mon, 28 Nov 2011 15:19:53 -0600,
Pierre-Louis Bossart wrote:
> > A general note: it's not necessarily to split playback and capture
> > devices.  For example, rawmidi has a single device for full-duplex.
> > In the case of PCM, we had to split them because of mmap.  The mmap
> > for the capture was supposed not to be read-only, some apps may want
> > to add mark on the buffer.  
> Beats me why an app would want to write anything into the capture ring
> buffer. Do you have an example of this use case? Maybe there's a similar
> need for compressed data. Thanks!

I don't remember exactly, as it was a discussion over 10 years ago.
My vague memory says that it's for marking the position in the buffer
where the read was finished or so...

I think the only possible problem is a case when the device is opened
via O_RDWR for full-duplex.  When you want mmap in that case, it's
difficult to get two different maps for read and write.  You may pass
different PROT_* flags to distinguish between read and write buffers,
but this will really limit the permission.  That was the argument.

In other words, if the driver doesn't accept O_RDWR but only either
O_RDONLY or O_WRONLY, there shouldn't be any problem.



More information about the Alsa-devel mailing list