[PATCH 03/27] libcamera: dma_buf_allocator: Favour udmabuf over cma heap allocations

Nicolas Dufresne nicolas at ndufresne.ca
Fri Apr 25 21:16:40 CEST 2025


Le vendredi 25 avril 2025 à 17:37 +0300, Laurent Pinchart a écrit :
> On Fri, Apr 25, 2025 at 09:07:46AM -0400, Nicolas Dufresne wrote:
> > Le jeudi 24 avril 2025 à 14:51 +0100, Bryan O'Donoghue a écrit :
> > > Thinking about this patch.
> > > 
> > > A user on a system such as imx/hantro is free to configure the system to 
> > > support CMA and UDMABuf.
> > > 
> > > If you never pass that buffer to the video encoder - where the encoder 
> > > requires phys contig/cma heap memory - then you probably want udmabuf.
> > > 
> > > The reverse is also true.
> > > 
> > > Its almost use-case specific. If you want the encoder you need CMA and 
> > > if you just want to say - display the output in cheese you want UDMAbuf.
> > 
> > That is hardware specific. There is some encoders with an iommu that
> > can emit page fault on CPU cached pages, and so can handle UDMABuf
> > fully in hardware. i.MX8 series, not so much.
> 
> Is that on IOMMU that can clean dirty cache entries (with support from
> the OS, through a fault) ? I wasn't aware of such hardware. It's
> interesting (at least in theory, I wonder what performance you can get
> out of that). Is there any example you can give ?

If its a page fault, its not fully HW right ? That is my understanding,
hopefully not too off though. In short, this works with integrated GPU
encoders. The performance would be atrocious if it was simply flushing
ahead time.

> 
> > > Probably the right thing to do is to leave CMA heap as default and leave 
> > > it to the system designer to configure the system as they wish.
> > > 
> > > In my case, switching off the CMA heap or perhaps a libcamera config/env 
> > > variable to specify which to use...
> > 
> > As we target "Desktop like" with the software ISP, there is no system
> > designer in that process. Unless you consider the user to be as such.
> > That being said, you can quirk it based on which CSI receiver brand in
> > use if you don't want to try one and cascade to the other if one fails.


More information about the libcamera-devel mailing list