[PATCH 3/3] drm/exynos: clone new sgt instead of creating from pages
Inki Dae
inki.dae at samsung.com
Wed Nov 7 08:39:01 PST 2012
2012/11/7 Prathyush K <prathyush.k at samsung.com>
> 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 at samsung.com>
> ---
> 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);
>
I think it's good idea but may need review enough. Let me sleep on it.
Thanks,
Inki Dae
> 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 at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20121108/3130551a/attachment.html>
More information about the dri-devel
mailing list