[3/3] drm/v3d: Fix prime imports of buffers from other drivers.
diff mbox series

Message ID 20181128230927.10951-3-eric@anholt.net
State New
Headers show
Series
  • [1/3] drm/v3d: Add support for submitting jobs to the TFU.
Related show

Commit Message

Eric Anholt Nov. 28, 2018, 11:09 p.m. UTC
v3d_bo_get_pages() checks this to decide to map the imported buffer
instead of the backing shmem file.  The caller was about to set this
value anyway, and there's no error path in between.  Ideally we
wouldn't even allocate the shmem file for our imports, but that's a
more invasive fix.

Signed-off-by: Eric Anholt <eric@anholt.net>
Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
Cc: Dave Emett <david.emett@broadcom.com>
---

I've been sitting on this one because I don't like it and was hoping
the shmem library would pan out.  This is a useful patch for now,
though.

 drivers/gpu/drm/v3d/v3d_bo.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Daniel Vetter Nov. 29, 2018, 9:38 a.m. UTC | #1
On Wed, Nov 28, 2018 at 03:09:27PM -0800, Eric Anholt wrote:
> v3d_bo_get_pages() checks this to decide to map the imported buffer
> instead of the backing shmem file.  The caller was about to set this
> value anyway, and there's no error path in between.  Ideally we
> wouldn't even allocate the shmem file for our imports, but that's a
> more invasive fix.
> 
> Signed-off-by: Eric Anholt <eric@anholt.net>
> Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
> Cc: Dave Emett <david.emett@broadcom.com>

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
> 
> I've been sitting on this one because I don't like it and was hoping
> the shmem library would pan out.  This is a useful patch for now,
> though.
> 
>  drivers/gpu/drm/v3d/v3d_bo.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_bo.c b/drivers/gpu/drm/v3d/v3d_bo.c
> index 54d96518a131..a08766d39eab 100644
> --- a/drivers/gpu/drm/v3d/v3d_bo.c
> +++ b/drivers/gpu/drm/v3d/v3d_bo.c
> @@ -293,6 +293,7 @@ v3d_prime_import_sg_table(struct drm_device *dev,
>  	bo->resv = attach->dmabuf->resv;
>  
>  	bo->sgt = sgt;
> +	obj->import_attach = attach;
>  	v3d_bo_get_pages(bo);
>  
>  	v3d_mmu_insert_ptes(bo);
> -- 
> 2.20.0.rc1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Emett Nov. 29, 2018, 5:37 p.m. UTC | #2
On Wed, 28 Nov 2018 at 23:09, Eric Anholt <eric@anholt.net> wrote:
>
> v3d_bo_get_pages() checks this to decide to map the imported buffer
> instead of the backing shmem file.  The caller was about to set this
> value anyway, and there's no error path in between.  Ideally we
> wouldn't even allocate the shmem file for our imports, but that's a
> more invasive fix.
>
> Signed-off-by: Eric Anholt <eric@anholt.net>
> Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
> Cc: Dave Emett <david.emett@broadcom.com>

Reviewed-by: Dave Emett <david.emett@broadcom.com>
> ---
>
> I've been sitting on this one because I don't like it and was hoping
> the shmem library would pan out.  This is a useful patch for now,
> though.
>
>  drivers/gpu/drm/v3d/v3d_bo.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/v3d/v3d_bo.c b/drivers/gpu/drm/v3d/v3d_bo.c
> index 54d96518a131..a08766d39eab 100644
> --- a/drivers/gpu/drm/v3d/v3d_bo.c
> +++ b/drivers/gpu/drm/v3d/v3d_bo.c
> @@ -293,6 +293,7 @@ v3d_prime_import_sg_table(struct drm_device *dev,
>         bo->resv = attach->dmabuf->resv;
>
>         bo->sgt = sgt;
> +       obj->import_attach = attach;
>         v3d_bo_get_pages(bo);
>
>         v3d_mmu_insert_ptes(bo);
> --
> 2.20.0.rc1
>

Patch
diff mbox series

diff --git a/drivers/gpu/drm/v3d/v3d_bo.c b/drivers/gpu/drm/v3d/v3d_bo.c
index 54d96518a131..a08766d39eab 100644
--- a/drivers/gpu/drm/v3d/v3d_bo.c
+++ b/drivers/gpu/drm/v3d/v3d_bo.c
@@ -293,6 +293,7 @@  v3d_prime_import_sg_table(struct drm_device *dev,
 	bo->resv = attach->dmabuf->resv;
 
 	bo->sgt = sgt;
+	obj->import_attach = attach;
 	v3d_bo_get_pages(bo);
 
 	v3d_mmu_insert_ptes(bo);