[RFC 0/8] rmk's Dove DRM/TDA19988 Cubox driver

Russell King - ARM Linux linux at arm.linux.org.uk
Sun May 19 04:25:52 PDT 2013


On Fri, May 17, 2013 at 01:33:45PM +0200, Jean-Francois Moine wrote:
> I quickly compared your dove drm driver and ours (Sebastian and me):
> 
> - CMA helper
> 
>   You don't use DRM_KMS_CMA_HELPER and DRM_GEM_CMA_HELPER which would
>   simplify some code.

Looking at the CMA helper code in DRM, it makes some fundamental errors:

1. It assumes the returned DMA address is a physical address.  This
   is not necessarily the case (there are a number of ARM platforms
   where this is most definitely not true.)  So:

        cma_obj->vaddr = dma_alloc_writecombine(drm->dev, size,
                        &cma_obj->paddr, GFP_KERNEL | __GFP_NOWARN);
...
        ret = remap_pfn_range(vma, vma->vm_start, cma_obj->paddr >> PAGE_SHIFT,
                        vma->vm_end - vma->vm_start, vma->vm_page_prot);

   is extremely broken.

2. If you use the CMA helper, then all your GEM objects must be CMA
   objects.  You can't combine different types of objects (eg, SHM-backed
   objects) with CMA objects.  This will be a massive performance
   regression with GPUs which can handle scatter-gathered SHM objects
   such as the Vivante GPU on the Armada 510.

So, for me, the last point especially is a very strong argument not to
use the DRM CMA helper.  Yes, I could switch to using the DMA coherent/
writecombine allocation API and thus make use of CMA, and that's
something I will be looking at.


More information about the dri-devel mailing list