[alsa-devel] [PATCH alsa-lib 07/12] pcm: hw: use helper function to query status/control data for calculation of available space on PCM buffer

Takashi Sakamoto o-takashi at sakamocchi.jp
Fri Jun 30 01:58:23 CEST 2017


When calculating available space on PCM buffer, positions of hw_ptr and
appl_ptr are required. When applications map staus and control data
successfully, they can calculate the space with architecture's support
for cache coherency. When failed, they should execute ioctl(2) with
SNDRV_PCM_IOCTL_SYNC_PTR command to query these positions to kernel
space.

This commit uses an added helper function for this purpose. For this call,
no need to update appl_ptr and avail_min in kernel space.

Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
---
 src/pcm/pcm_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
index 59ba33b5..c6abf170 100644
--- a/src/pcm/pcm_hw.c
+++ b/src/pcm/pcm_hw.c
@@ -1066,7 +1066,7 @@ static snd_pcm_sframes_t snd_pcm_hw_avail_update(snd_pcm_t *pcm)
 	snd_pcm_hw_t *hw = pcm->private_data;
 	snd_pcm_uframes_t avail;
 
-	sync_ptr(hw, 0);
+	query_state(hw);
 	avail = snd_pcm_mmap_avail(pcm);
 	switch (FAST_PCM_STATE(hw)) {
 	case SNDRV_PCM_STATE_RUNNING:
-- 
2.11.0



More information about the Alsa-devel mailing list