drm: omapdrm: Export correct scatterlist for TILER backed BOs
authorIvaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Fri, 19 Nov 2021 08:06:20 +0000 (10:06 +0200)
committerTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Wed, 8 Dec 2021 08:04:25 +0000 (10:04 +0200)
commitfe4d0b6317e35a9a371d1107c9b753becc81e968
tree5b70ed58afb249840e838c346bddc953d40f3e15
parentf8378c0403813fd7cdf0eb5cb878b1ff290046c4
drm: omapdrm: Export correct scatterlist for TILER backed BOs

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@gmail.com>
Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1637309180-31032-1-git-send-email-ivo.g.dimitrov.75@gmail.com
drivers/gpu/drm/omapdrm/omap_gem.c
drivers/gpu/drm/omapdrm/omap_gem.h
drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c