On 09/22/2014 03:36 PM, Alexander E. Patrakov wrote:
22.09.2014 19:20, Lars-Peter Clausen wrote:
Does this mean the those sound card can report DMA_RESIDUE_GRANULARITY_BURST and driver use readl in pcm pointer callback ?
A few PCI sound cards use SG buffer including hda
It seem that pulseaudio expect the driver support DMA_RESIDUE_GRANULARITY_BURST for rewind/ timer scheduling
Yes. This is why we set the BATCH flag if the granularity is not DMA_RESIDUE_GRANULARITY_BURST so for example pulse audio can disable timer scheduling.
For the record, disabling timer-based scheduling is IMHO a matter of further discussion. As long as there is enough safeguard, I think that timer-based scheduling can still be used, and is useful. A living proof is the whole story with the snd-usb-audio driver where (justified) addition of the BATCH flag was perceived as a performance regression and not as a fix to some real and obvious problem.
I do agree that such devices need to be marked up with the BATCH flag, so that PulseAudio chooses reasonable hardware parameters.
When I tried things it looks like it was more than just the safeguard threshold. It looked as if the algorithm that adjusts the wake-up time gets confused if the granularity is not good enough and just wakes up at the wrong point which leads to glitches. This can probably be fixed though by modifying the algorithm to take the granularity into account.
- Lars