Skip to contentSkip to conversation

Direct use of the DMA buffer?

DISCUSSION Pavel Hofman 3 participants 5 messages Feb 19, 2012 – Feb 20, 2012 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hello,

Please excuse my ignorance, but is it possible for an application to directly use/output to the DMA buffer allocated by the kernel in hw_params? Something like using the actual DMA buffer in the snd_pcm_writei function, without copying the data in alsa-lib/driver PCM midle layer (?), just managing the pointers.

Only a theoretical question though, no plans on my side :)

Thanks a lot for even a short No :-)

Best regards,

Pavel.

#1 lore raw
Quoted 3 lines · Pavel Hofman

Please excuse my ignorance, but is it possible for an application to directly use/output to the DMA buffer allocated by the kernel in hw_params?

Set one of the SND_PCM_ACCESS_MMAP_* access types and then use snd_pcm_mmap_begin/commit.

Regards,
Clemens

#2 lore raw

Dne 20.2.2012 09:11, Clemens Ladisch napsal(a):

Quoted 8 lines
Quoted 3 lines · Pavel Hofman

Please excuse my ignorance, but is it possible for an application to directly use/output to the DMA buffer allocated by the kernel in hw_params?

Set one of the SND_PCM_ACCESS_MMAP_* access types and then use snd_pcm_mmap_begin/commit.

Clemens, thanks a lot for the information. How does it work when the alsa-lib chain contains plugins, such as plug, rate, etc.? I would assume the application circumvents these.

Thanks a lot.

Pavel.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 7 lines · Pavel Hofman

Dne 20.2.2012 09:11, Clemens Ladisch napsal(a):

Quoted 5 lines
Quoted 3 lines · Pavel Hofman

Please excuse my ignorance, but is it possible for an application to directly use/output to the DMA buffer allocated by the kernel in hw_params?

Quoted 7 lines
Quoted 3 lines

Set one of the SND_PCM_ACCESS_MMAP_* access types and then use snd_pcm_mmap_begin/commit.

Clemens, thanks a lot for the information. How does it work when the alsa-lib chain contains plugins, such as plug, rate, etc.? I would assume the application circumvents these.

Nope. The mmap commit mechanism was introduced to keep the plugin interface functional. The direct mmap access to the DMA buffer is only applied for the direct hw: devices. If a plugin is used inside alsa-lib, the application talks to the plugin chain (it means that an intermediate buffer for samples can be allocated to let things working).

Jaroslav

Signature · 3 lines
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.
#5 lore raw
In reply to a message not in the archive

Dne 20.2.2012 10:21, Jaroslav Kysela napsal(a):

Quoted 11 lines
Quoted 4 lines

Clemens, thanks a lot for the information. How does it work when the alsa-lib chain contains plugins, such as plug, rate, etc.? I would assume the application circumvents these.

Nope. The mmap commit mechanism was introduced to keep the plugin interface functional. The direct mmap access to the DMA buffer is only applied for the direct hw: devices. If a plugin is used inside alsa-lib, the application talks to the plugin chain (it means that an intermediate buffer for samples can be allocated to let things working).

Jaroslav, thanks a lot for the clarification.

Pavel.