Re: [RFC] [PATCH 1/6] SoC Camera: add driver for OMAP1 camera interface

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

 



On Thursday, August 19, 2010 08:09:27 pm Janusz Krzysztofik wrote:
> Thursday 19 August 2010 14:16:21 Marin Mitov napisał(a):
> > On Thursday, August 19, 2010 02:39:47 pm Guennadi Liakhovetski wrote:
> > >
> > > No, I don't think you should go to the next power of 2 - that's too
> > > crude. Try rounding your buffer size to the page size, that should
> > > suffice.
> 
> Guennadi,
> If you have a look at how a device reserved memory is next allocated to a 
> driver with drivers/base/dma-coherent.c::dma_alloc_from_coherent(), then than 
> you may find my conclusion on a power of 2 as true:
> 
> int dma_alloc_from_coherent(struct device *dev, ssize_t size,
> 					dma_addr_t *dma_handle, void **ret)
> {
> ...
>         int order = get_order(size);
> ...
> 	pageno = bitmap_find_free_region(mem->bitmap, mem->size, order);
> ...
> }
> 
> 
> > Allocated coherent memory is always a power of 2.
> 
> Marin,
> For ARM, this seems true as long as allocated with the above from a device 
> assigned pool, but not true for a (pre)allocation from a generic system RAM. 
> See arch/arm/mm/dma-mapping.c::__dma_alloc_buffer(), where it looks like extra 
> pages are freed:
> 
> static struct page *__dma_alloc_buffer(struct device *dev, size_t size, gfp_t gfp)
> {
> 	unsigned long order = get_order(size);
> ...
> 	page = alloc_pages(gfp, order);
> ...
> 	split_page(page, order);
>         for (p = page + (size >> PAGE_SHIFT), e = page + (1 << order); p < e; p++)
>                 __free_page(p);
> ...
> }	

Thanks for the clarification.

Marin Mitov

> 
> 
> Thanks,
> Janusz
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux