Freescale / libimxdmabuffer

Library for allocating and managing physically contiguous memory ("DMA memory" or "DMA buffers") on i.MX devices
GNU Lesser General Public License v2.1
19 stars 12 forks source link

ion: Cache detected ion heaps mask. #5

Closed dougnazar closed 1 year ago

dougnazar commented 2 years ago

This could be called a dozen times or so per file played and should be static after booting.

dv1 commented 2 years ago

I suppose the heap mask does not change, so caching this would not cause problems?

dougnazar commented 2 years ago

I don't believe so. The CMA regions are usually specified in the device tree and although I didn't look to see if there was support for dynamically modifying the CMAs, I did check the ION code and all it does on startup is loop through the existing CMAs and add them as ION DMA heaps.

I suppose the other option is to push the detection up to when the allocator is created and override the passed in mask there. That'll limit it to one query per pipeline I think, but anybody playing games with +/- memory zones should probably be stopping all programs that might be using them first.

I noticed since on my setup I have 2 CMAs, one dedicated for GPU and was getting errors since it was trying to allocate from the smaller general CMA first.