summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/radeon/radeon_prime.c
diff options
context:
space:
mode:
authorMaarten Lankhorst <m.b.lankhorst@gmail.com>2013-06-27 13:38:18 +0200
committerDave Airlie <airlied@redhat.com>2013-06-28 11:55:11 +1000
commit280cf211867539a7b6912d3a3573ef692ae66b61 (patch)
tree9380d0da6dbcfc0457d456979acec81879dd3142 /drivers/gpu/drm/radeon/radeon_prime.c
parent5b0207bb59b26a8cb5b53f13c99c67eb0d2a7abb (diff)
drm/radeon: implement unpin function, v2
Changes since v1: - Fixup compiler warning in unpin function. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Reviewed-by: Jerome Glisse <jglisse@redhat.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_prime.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_prime.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_prime.c b/drivers/gpu/drm/radeon/radeon_prime.c
index 4940af7e75e6..65b9eabd5a2f 100644
--- a/drivers/gpu/drm/radeon/radeon_prime.c
+++ b/drivers/gpu/drm/radeon/radeon_prime.c
@@ -88,11 +88,19 @@ int radeon_gem_prime_pin(struct drm_gem_object *obj)
/* pin buffer into GTT */
ret = radeon_bo_pin(bo, RADEON_GEM_DOMAIN_GTT, NULL);
- if (ret) {
- radeon_bo_unreserve(bo);
- return ret;
- }
radeon_bo_unreserve(bo);
+ return ret;
+}
+
+void radeon_gem_prime_unpin(struct drm_gem_object *obj)
+{
+ struct radeon_bo *bo = gem_to_radeon_bo(obj);
+ int ret = 0;
- return 0;
+ ret = radeon_bo_reserve(bo, false);
+ if (unlikely(ret != 0))
+ return;
+
+ radeon_bo_unpin(bo);
+ radeon_bo_unreserve(bo);
}