[PATCH 3/3] drm/exynos: clone new sgt instead of creating from pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



During map_dma_buf, a new sgt needs to be created before being mapped to
another device's address space. Currently, this sgt is created from
the pages of the gem buffer everytime by calling dma_get_sgtable. This
will be time consuming if the map/unmap calls are done repeatedly for
very large buffers.

Instead, we can just clone the sgt which was already created during
buffer allocation and create the new sgt. This is done by calling
'sg_clone_table'. This will be much faster than creating from pages.

Signed-off-by: Prathyush K <prathyush.k@xxxxxxxxxxx>
---
 drivers/gpu/drm/exynos/exynos_drm_dmabuf.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
index d9307bd..56efdd5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
@@ -40,10 +40,14 @@ static struct sg_table *exynos_get_sgt(struct drm_device *drm_dev,
 	if (!sgt)
 		goto out;
 
-	ret = dma_get_sgtable(drm_dev->dev, sgt, buf->kvaddr,
-				buf->dma_addr, buf->size);
+	if (!buf->sgt) {
+		DRM_ERROR("sgt is null.\n");
+		goto err_free_sgt;
+	}
+
+	ret = sg_clone_table(buf->sgt, sgt, GFP_KERNEL);
 	if (ret < 0) {
-		DRM_ERROR("failed to get sgtable.\n");
+		DRM_ERROR("failed to clone sgtable.\n");
 		goto err_free_sgt;
 	}
 
-- 
1.7.0.4

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux