• Paul Cercueil's avatar
    drm: Add support for GEM buffers backed by non-coherent memory · cf8ccbc7
    Paul Cercueil authored
    Having GEM buffers backed by non-coherent memory is interesting in the
    particular case where it is faster to render to a non-coherent buffer
    then sync the data cache, than to render to a write-combine buffer, and
    (by extension) much faster than using a shadow buffer. This is true for
    instance on some Ingenic SoCs, where even simple blits (e.g. memcpy)
    are about three times faster using this method.
    
    Add a 'map_noncoherent' flag to the drm_gem_cma_object structure, which
    can be set by the drivers when they create the dumb buffer.
    
    Since this really only applies to software rendering, disable this flag
    as soon as the CMA objects are exported via PRIME.
    
    v3: New patch. Now uses a simple 'map_noncoherent' flag to control how
        the objects are mapped, and use the new dma_mmap_pages function.
    
    v4: Make sure map_noncoherent is always disabled when creating GEM
        objects meant to be used with dma-buf.
    Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
    Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210523170415.90410-2-paul@crapouillou.net
    cf8ccbc7
drm_gem_cma_helper.c 16.9 KB