[PATCH 4/6] drm/amd/amdgpu: Pin bos from imported dma-bufs to GTT.
raof at ubuntu.com
raof at ubuntu.com
Wed Mar 29 00:27:18 UTC 2017
From: Christopher James Halse Rogers <christopher.halse.rogers at canonical.com>
Attempting to migrate the bo will break the sharing of the buffer.
Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers at canonical.com>
CC: amd-gfx at lists.freedesktop.org
---
drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c
index 3826d5aea0a6..3c84ec5c6ac8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c
@@ -74,6 +74,17 @@ amdgpu_gem_prime_import_sg_table(struct drm_device *dev,
if (ret)
return ERR_PTR(ret);
+ /* Imported bo must be pinned to GTT, as moving it breaks sharing */
+ ret = amdgpu_bo_reserve(bo, false);
+ if (ret)
+ return ERR_PTR(ret);
+
+ ret = amdgpu_bo_pin(bo, AMDGPU_GEM_DOMAIN_GTT, NULL);
+ if (ret)
+ return ERR_PTR(ret);
+
+ amdgpu_bo_unreserve(bo);
+
bo->prime_shared_count = 1;
return &bo->gem_base;
}
--
2.11.0
More information about the amd-gfx
mailing list