]> git.baikalelectronics.ru Git - kernel.git/commit
drm: Add support for GEM buffers backed by non-coherent memory
authorPaul Cercueil <paul@crapouillou.net>
Sun, 23 May 2021 17:04:13 +0000 (18:04 +0100)
committerPaul Cercueil <paul@crapouillou.net>
Tue, 25 May 2021 10:41:07 +0000 (11:41 +0100)
commitf01c96abb735e7a6e6b59d0e45a9d09e430bf8ca
treee1caa0c6dfe844c338b6f057a7ff6c967a7b2a12
parentb947dbd0905853d50e5aa639fdba7d62496e269b
drm: Add support for GEM buffers backed by non-coherent memory

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: Paul Cercueil <paul@crapouillou.net>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20210523170415.90410-2-paul@crapouillou.net
drivers/gpu/drm/drm_gem_cma_helper.c
include/drm/drm_gem_cma_helper.h