[PATCH] drm/amdgpu: set f_mapping on exported DMA-bufs
Alex Deucher
alexdeucher at gmail.com
Tue Nov 14 15:51:55 UTC 2017
On Tue, Nov 14, 2017 at 7:13 AM, Christian König
<ckoenig.leichtzumerken at gmail.com> wrote:
> Otherwise we can't correctly CPU map TTM buffers.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
Acked-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c
> index 90af8e82b16a..ae9c106979d7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c
> @@ -169,10 +169,14 @@ struct dma_buf *amdgpu_gem_prime_export(struct drm_device *dev,
> int flags)
> {
> struct amdgpu_bo *bo = gem_to_amdgpu_bo(gobj);
> + struct dma_buf *buf;
>
> if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm) ||
> bo->flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID)
> return ERR_PTR(-EPERM);
>
> - return drm_gem_prime_export(dev, gobj, flags);
> + buf = drm_gem_prime_export(dev, gobj, flags);
> + if (!IS_ERR(buf))
> + buf->file->f_mapping = dev->anon_inode->i_mapping;
> + return buf;
> }
> --
> 2.11.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
More information about the amd-gfx
mailing list