[oss-devel] Some questions about SNDCTL_DSP_SYNCSTART

Hannu Savolainen hannu at opensound.com
Mon Jun 9 01:31:49 EEST 2008


Hi,

Some critical zone should be added to the audio core so that two 
processes cannot call SNDCTL_DSP_SYNCSTART at the same time. In this way 
process 1 can do the SYNC_PREPARE and SYNC_TRIGGER calls without being 
disturbed by process 2.

The first SYNC_TRIGER call for given sound card should start all the 
sub-devices. Subsequent calls should not have any effect. I think this 
is handled by the drivers that implement the sync start feature.

Best regards,

Hannu
---------
Zakhar Levchenko wrote:
> I can't fully agree with this. Let's look again at my example with 3 
> subdevises (when two instances of handle_syncstart are executed in 
> parallel):
>
> SYNC_PREPARE for sub-device 1 (1st process)
> SYNC_PREPARE for sub-device 2 (1st process)
> SYNC_PREPARE for sub-device 3 (2nd process)
> ...
>
> The device driver gets three subsequent SYNC_PREPARE calls, how should 
> it guess for example that it should start simulateneoulsy subdevices 1 
> and 2 and then device 3, but not all 3 subdevices at the same time? 
> Yes, audio core invokes sync_control for correct devices, but this 
> operation is not atomic, handle_syncstart executed in parallel may 
> mess up things totally, the order in which device driver receives 
> these commands may be kind of random. Driver just can't distinguish 
> commands from different processes. It expects something like:
>
> SYNC_PREPARE for sub-device 1 (1st process)
> SYNC_PREPARE for sub-device 2 (1st process)
> SYNC_TRIGGER for sub-device 1 (1st process)
> SYNC_TRIGGER for sub-device 2 (1st process)
>
> SYNC_PREPARE for sub-device 3 (2nd process)
> SYNC_TRIGGER for sub-device 3 (2nd process)
>
> but probably not
>
> SYNC_PREPARE for sub-device 1 (1st process)
> SYNC_PREPARE for sub-device 2 (1st process)
> SYNC_PREPARE for sub-device 3 (2nd process)
> SYNC_TRIGGER for sub-device 1 (1st process)
> SYNC_TRIGGER for sub-device 3 (2nd process)
> SYNC_TRIGGER for sub-device 2 (1st process) 
>
> Regards,
>           Zakhar Levcehnko
>
>
>
> On 6/8/08, *Hannu Savolainen* <hannu at opensound.com 
> <mailto:hannu at opensound.com>> wrote:
>
>     Zakhar Levchenko kirjoitti:
>
>     > So device driver implementation of sync_control is supposed to check
>     > group id or something like that? Otherwise I can't see any way to
>     > separate devices from different groups.
>
>     Drivers don't need to check it. The audio core takes care of invoking
>     just the correct devices.
>
>
>     Best regards,
>
>     Hannu
>     _______________________________________________
>     oss-devel mailing list
>     oss-devel at mailman.opensound.com
>     <mailto:oss-devel at mailman.opensound.com>
>     http://mailman.opensound.com/mailman/listinfo/oss-devel
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> oss-devel mailing list
> oss-devel at mailman.opensound.com
> http://mailman.opensound.com/mailman/listinfo/oss-devel
>   



More information about the oss-devel mailing list