<br><br><div class="gmail_quote">2012/11/7 Prathyush K <span dir="ltr"><<a href="mailto:prathyush.k@samsung.com" target="_blank">prathyush.k@samsung.com</a>></span><br><blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">
During map_dma_buf, a new sgt needs to be created before being mapped to<br>
another device's address space. Currently, this sgt is created from<br>
the pages of the gem buffer everytime by calling dma_get_sgtable. This<br>
will be time consuming if the map/unmap calls are done repeatedly for<br>
very large buffers.<br>
<br>
Instead, we can just clone the sgt which was already created during<br>
buffer allocation and create the new sgt. This is done by calling<br>
'sg_clone_table'. This will be much faster than creating from pages.<br>
<br>
Signed-off-by: Prathyush K <<a href="mailto:prathyush.k@samsung.com">prathyush.k@samsung.com</a>><br>
---<br>
 drivers/gpu/drm/exynos/exynos_drm_dmabuf.c |   10 +++++++---<br>
 1 files changed, 7 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c<br>
index d9307bd..56efdd5 100644<br>
--- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c<br>
+++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c<br>
@@ -40,10 +40,14 @@ static struct sg_table *exynos_get_sgt(struct drm_device *drm_dev,<br>
        if (!sgt)<br>
                goto out;<br>
<br>
-       ret = dma_get_sgtable(drm_dev->dev, sgt, buf->kvaddr,<br>
-                               buf->dma_addr, buf->size);<br>
+       if (!buf->sgt) {<br>
+               DRM_ERROR("sgt is null.\n");<br>
+               goto err_free_sgt;<br>
+       }<br>
+<br>
+       ret = sg_clone_table(buf->sgt, sgt, GFP_KERNEL);<br></blockquote><div> </div><div>I think it's good idea but may need review enough. Let me sleep on it.</div><div> </div><div>Thanks,</div><div>Inki Dae</div>
<div> </div><div> </div><blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">
        if (ret < 0) {<br>
-               DRM_ERROR("failed to get sgtable.\n");<br>
+               DRM_ERROR("failed to clone sgtable.\n");<br>
                goto err_free_sgt;<br>
        }<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
1.7.0.4<br>
<br>
_______________________________________________<br>
dri-devel mailing list<br>
<a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/dri-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
</font></span></blockquote></div><br>