diff mbox

[6/6] drm/radeon: Pin bos from imported dma-bufs to GTT.

Message ID 20170329002720.11445-7-raof@ubuntu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Christopher James Halse Rogers March 29, 2017, 12:27 a.m. UTC
From: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>

Attempting to migrate the bo will break the sharing of the buffer.

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
CC: amd-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/radeon/radeon_prime.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/radeon_prime.c b/drivers/gpu/drm/radeon/radeon_prime.c
index f3609c97496b..2dbbb4bd47b1 100644
--- a/drivers/gpu/drm/radeon/radeon_prime.c
+++ b/drivers/gpu/drm/radeon/radeon_prime.c
@@ -73,6 +73,16 @@  struct drm_gem_object *radeon_gem_prime_import_sg_table(struct drm_device *dev,
 	if (ret)
 		return ERR_PTR(ret);
 
+	ret = radeon_bo_reserve(bo, false);
+	if (ret)
+		return ERR_PTR(ret);
+
+	ret = radeon_bo_pin(bo, RADEON_GEM_DOMAIN_GTT, NULL);
+	radeon_bo_unreserve(bo);
+
+	if (ret)
+		return ERR_PTR(ret);
+
 	mutex_lock(&rdev->gem.mutex);
 	list_add_tail(&bo->list, &rdev->gem.objects);
 	mutex_unlock(&rdev->gem.mutex);