All of lore.kernel.org
 help / color / mirror / Atom feed
* Buffer memory does not get allocated?
@ 2010-11-04 21:12 Radivoje Jovanovic
  2010-11-05  8:23 ` Clemens Ladisch
  0 siblings, 1 reply; 2+ messages in thread
From: Radivoje Jovanovic @ 2010-11-04 21:12 UTC (permalink / raw)
  To: alsa-devel

I am allocating memory for the buffers in my init call by doing:
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
snd_dma_continuous_data(GFP_KERNEL), 256*1024, 256*1024);

in my hw_params call I have:
ret= snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));

here is the output from my hw_params call:

called snd_pcm_lib_malloc_pages return=1
params_buffer_bytes(hw_params)=32768

Size of DMA area=32768

Buffer size in bytes=262144

Buffer virt address=9dc00000

Buffer phys address=0


Now I am not sure why is my buffer size bigger than my DMA area. I assume
that memory is not linear because of that and that is why I do not have phys
address to the buffer. How do I fix this?

Thanx
Ogi

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Buffer memory does not get allocated?
  2010-11-04 21:12 Buffer memory does not get allocated? Radivoje Jovanovic
@ 2010-11-05  8:23 ` Clemens Ladisch
  0 siblings, 0 replies; 2+ messages in thread
From: Clemens Ladisch @ 2010-11-05  8:23 UTC (permalink / raw)
  To: Radivoje Jovanovic; +Cc: alsa-devel

Radivoje Jovanovic wrote:
> I am allocating memory for the buffers in my init call by doing:
> snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
> snd_dma_continuous_data(GFP_KERNEL), 256*1024, 256*1024);
> 
> in my hw_params call I have:
> ret= snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
> 
> here is the output from my hw_params call:
> 
> called snd_pcm_lib_malloc_pages return=1
> params_buffer_bytes(hw_params)=32768
> Size of DMA area=32768
> Buffer size in bytes=262144
> Buffer virt address=9dc00000
> Buffer phys address=0
> 
> Now I am not sure why is my buffer size bigger than my DMA area.

You did not say which values are output, but 262144 is 256*1024, so this
is the preallocated buffer.  The DMA is what is actually used with the
current hw_params.

> I assume that memory is not linear because of that

SNDRV_DMA_TYPE_CONTINUOUS gives you continguous pages.

> and that is why I do not have phys address to the buffer.

It doesn't give you the physical address; it looks as if this memory is
intended to be accessed only by the CPU.

To get coherent memory with a DMA address for a specific device, use
SNDRV_DMA_TYPE_DEV.  (This must be supported by your architecture.)


Regards,
Clemens

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-05  8:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-04 21:12 Buffer memory does not get allocated? Radivoje Jovanovic
2010-11-05  8:23 ` Clemens Ladisch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.