[Freedreno] [PATCH 2/2] drm/mediatek: Use struct dma_buf_map in GEM vmap ops
Thomas Zimmermann
tzimmermann at suse.de
Mon Nov 9 10:32:42 UTC 2020
Fixes a build failure with mediatek.
This change was supposed to be part of commit 49a3f51dfeee ("drm/gem:
Use struct dma_buf_map in GEM vmap ops and convert GEM backends"), but
mediatek was forgotten.
Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
Fixes: 49a3f51dfeee ("drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backends")
Cc: Thomas Zimmermann <tzimmermann at suse.de>
Cc: Christian König <christian.koenig at amd.com>
Cc: David Airlie <airlied at linux.ie>
Cc: Daniel Vetter <daniel at ffwll.ch>
Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Cc: Maxime Ripard <mripard at kernel.org>
Cc: Dave Airlie <airlied at redhat.com>
Cc: Lucas Stach <l.stach at pengutronix.de>
Cc: Russell King <linux+etnaviv at armlinux.org.uk>
Cc: Christian Gmeiner <christian.gmeiner at gmail.com>
Cc: Qiang Yu <yuq825 at gmail.com>
Cc: Ben Skeggs <bskeggs at redhat.com>
Cc: Rob Herring <robh at kernel.org>
Cc: Tomeu Vizoso <tomeu.vizoso at collabora.com>
Cc: Steven Price <steven.price at arm.com>
Cc: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Cc: Gerd Hoffmann <kraxel at redhat.com>
Cc: Alex Deucher <alexander.deucher at amd.com>
Cc: "Christian König" <christian.koenig at amd.com>
Cc: Sandy Huang <hjc at rock-chips.com>
Cc: "Heiko Stübner" <heiko at sntech.de>
Cc: Hans de Goede <hdegoede at redhat.com>
Cc: Sean Paul <sean at poorly.run>
Cc: Eric Anholt <eric at anholt.net>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo at gmail.com>
Cc: Melissa Wen <melissa.srw at gmail.com>
Cc: Haneen Mohammed <hamohammed.sa at gmail.com>
Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko at epam.com>
Cc: Sumit Semwal <sumit.semwal at linaro.org>
Cc: Emil Velikov <emil.velikov at collabora.com>
Cc: Marek Szyprowski <m.szyprowski at samsung.com>
Cc: Arunpravin <apaneers at amd.com>
Cc: Huang Rui <ray.huang at amd.com>
Cc: Luben Tuikov <luben.tuikov at amd.com>
Cc: Madhav Chauhan <madhav.chauhan at amd.com>
Cc: Nirmoy Das <Nirmoy.Das at amd.com>
Cc: Jason Gunthorpe <jgg at ziepe.ca>
Cc: Sam Ravnborg <sam at ravnborg.org>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: dri-devel at lists.freedesktop.org
Cc: etnaviv at lists.freedesktop.org
Cc: lima at lists.freedesktop.org
Cc: nouveau at lists.freedesktop.org
Cc: virtualization at lists.linux-foundation.org
Cc: spice-devel at lists.freedesktop.org
Cc: amd-gfx at lists.freedesktop.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-rockchip at lists.infradead.org
Cc: xen-devel at lists.xenproject.org
---
drivers/gpu/drm/mediatek/mtk_drm_gem.c | 20 ++++++++++++--------
drivers/gpu/drm/mediatek/mtk_drm_gem.h | 4 ++--
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
index cdd1a6e61564..28a2ee1336ef 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
@@ -240,23 +240,25 @@ struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
return &mtk_gem->base;
}
-void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj)
+int mtk_drm_gem_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map *map)
{
struct mtk_drm_gem_obj *mtk_gem = to_mtk_gem_obj(obj);
- struct sg_table *sgt;
+ struct sg_table *sgt = NULL;
unsigned int npages;
if (mtk_gem->kvaddr)
- return mtk_gem->kvaddr;
+ goto out;
sgt = mtk_gem_prime_get_sg_table(obj);
if (IS_ERR(sgt))
- return NULL;
+ return PTR_ERR(sgt);
npages = obj->size >> PAGE_SHIFT;
mtk_gem->pages = kcalloc(npages, sizeof(*mtk_gem->pages), GFP_KERNEL);
- if (!mtk_gem->pages)
- goto out;
+ if (!mtk_gem->pages) {
+ kfree(sgt);
+ return -ENOMEM;
+ }
drm_prime_sg_to_page_addr_arrays(sgt, mtk_gem->pages, NULL, npages);
@@ -265,13 +267,15 @@ void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj)
out:
kfree(sgt);
+ dma_buf_map_set_vaddr(map, mtk_gem->kvaddr);
- return mtk_gem->kvaddr;
+ return 0;
}
-void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
+void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, struct dma_buf_map *map)
{
struct mtk_drm_gem_obj *mtk_gem = to_mtk_gem_obj(obj);
+ void *vaddr = map->vaddr;
if (!mtk_gem->pages)
return;
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.h b/drivers/gpu/drm/mediatek/mtk_drm_gem.h
index ff9f976d9807..6da5ccb4b933 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_gem.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.h
@@ -45,7 +45,7 @@ int mtk_drm_gem_mmap_buf(struct drm_gem_object *obj,
struct sg_table *mtk_gem_prime_get_sg_table(struct drm_gem_object *obj);
struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
struct dma_buf_attachment *attach, struct sg_table *sg);
-void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj);
-void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
+int mtk_drm_gem_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map *map);
+void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, struct dma_buf_map *map);
#endif
--
2.29.2
More information about the Freedreno
mailing list