drm/amdgpu: set f_mapping on exported DMA-bufs
Subsystems (2)
PATCH 1/1 drm/amdgpu: set f_mapping on exported DMA-bufs
Otherwise we can't correctly CPU map TTM buffers.
Signed-off-by Christian König <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c +5 -1
@@ -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; }
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 3 lines · Christian König
Otherwise we can't correctly CPU map TTM buffers.
Signed-off-by Christian König <[email protected]>
Acked-by Alex Deucher <[email protected]>
Quoted 27 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c +5
-2@@ -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
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel