Re: hw_ptr_interrupt removal broke interrupt pointer updates

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

 



On Wed, 27 Jan 2010, Clemens Ladisch wrote:

> Jaroslav Kysela wrote:
>> On Wed, 27 Jan 2010, Clemens Ladisch wrote:
>>> A somewhat unrelated issue:  Both old and new code assume that
>>> hw_ptr==0 is a period boundary, but that is not true if the boundary
>>> is not an integer multiple of the period size, and the pointer wraps.
>>> I'm not sure what happens then.
>>
>> I'm not exactly sure what you're talking about. Where is the
>> hw_ptr==0 assumption?
>
> This code, which tries to align hw_ptr_interrupt to a period boundary:
>
> 	runtime->hw_ptr_interrupt = new_hw_ptr -
> 			(new_hw_ptr % runtime->period_size);

I see. It is really problem, because if hw_ptr_interrupt shifts, then the 
condition
 		delta = runtime->hw_ptr_interrupt + runtime->period_size;
                 if (delta > new_hw_ptr) {

is not accurate and might cause unwanted issues.

The simple fix for 64-bit archs is to use "boundary = buffer_size * 
period_size" expression to setup the boundary variable properly.

I added code to find the lowest common multiple for 32-bit archs.

The patch is:

http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=7910b4a1db63fefc3d291853d33c34c5b6352e8e

 					Thanks,
 						Jaroslav

-----
Jaroslav Kysela <perex@xxxxxxxx>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

_______________________________________________
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