Re: [PATCH v3] drm: omapdrm: Export correct scatterlist for TILER backed BOs

From: Tomi Valkeinen
Date: Thu Dec 02 2021 - 04:13:26 EST


Hi,

On 19/11/2021 10:06, Ivaylo Dimitrov wrote:
Memory of BOs backed by TILER is not contiguous, but omap_gem_map_dma_buf()
exports it like it is. This leads to (possibly) invalid memory accesses if
another device imports such a BO.

Fix that by providing sg that correctly describes TILER memory layout.
Align TILER allocations to page, so importer to be able to correctly set
its MMU if have one. Set export size accounting for the alignment. Also,
make sure to destroy sg on unpin, as it is no longer valid.

Tested on Motorola Droid4 by using GPU (sgx540) to render.

Suggested-by: Matthijs van Duin <matthijsvanduin@xxxxxxxxx>
Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@xxxxxxxxx>
---
drivers/gpu/drm/omapdrm/omap_gem.c | 79 ++++++++++++++++++++++++++++++-
drivers/gpu/drm/omapdrm/omap_gem.h | 2 +
drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c | 34 ++-----------
3 files changed, 85 insertions(+), 30 deletions(-)

I'll pick this to my work branch which I use every day, and let it be there for a few days. If I don't see any issues, I'll push to drm-misc-next.

Tomi