Re: [PATCH 3/3] ALSA: pcm: conditionally avoid mmap of control data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 16 May 2017 07:57:30 +0200,
Takashi Sakamoto wrote:
> 
> On May 16 2017 14:46, Takashi Iwai wrote:
> > In this case, the problem is that the mmap control allows the appl_ptr
> > being changed silently without interaction with the driver.  If the
> > driver requires some explicit action for changing the appl_ptr, it
> > won't work.
> 
> I think 'struct snd_pcm_ops.pointer' is available for this purpose, too.
> 
> static snd_pcm_sframes_t snd_pcm_playback_rewind(...)
> {
>     ...
>     hw_avail = snd_pcm_playback_hw_avail(runtime);
>     (->struct snd_pcm_ops.pointer())
>     ...
>     (rewind PCM frames)
>     ...
> +   substream->ops->pointer(...);
>     (->struct snd_pcm_ops.pointer())
>     ...
> }
> 
> If drivers need to handle event to update the appl_ptr, it records
> value of the appl_ptr, then compare it to current value to get the
> updates.

IIRC, the problem isn't about the forward / rewind but about the
normal data transfer.  In mmap mode, we transfer data on the mmap
buffer, and update appl_ptr via mmap control.  Both are done without
notification to the driver (which is intentional for avoiding the
context switching).

So we want to disable this optimization and always notify to the
driver.  Disabling mmap status/control is the straight hack as it
falls back to ioctl and then the driver can know the change.


Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux