summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_vm.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2014-02-20 10:47:05 +0100
committerChristian König <christian.koenig@amd.com>2014-03-03 11:03:35 +0100
commitfa68834342e992dcb58e6dd7d9dbe05c6b6b27d9 (patch)
treecbbb16839a0eb8ff533b893bed17ca9cbc97e90d /drivers/gpu/drm/radeon/radeon_vm.c
parentdrm/radeon: separate gart and vm functions (diff)
downloadlinux-fa68834342e992dcb58e6dd7d9dbe05c6b6b27d9.tar.xz
linux-fa68834342e992dcb58e6dd7d9dbe05c6b6b27d9.zip
drm/radeon: further cleanup vm flushing & fencing
Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_vm.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_vm.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c
index 433b1ebd07ea..516017689793 100644
--- a/drivers/gpu/drm/radeon/radeon_vm.c
+++ b/drivers/gpu/drm/radeon/radeon_vm.c
@@ -379,6 +379,27 @@ struct radeon_fence *radeon_vm_grab_id(struct radeon_device *rdev,
}
/**
+ * radeon_vm_flush - hardware flush the vm
+ *
+ * @rdev: radeon_device pointer
+ * @vm: vm we want to flush
+ * @ring: ring to use for flush
+ *
+ * Flush the vm (cayman+).
+ *
+ * Global and local mutex must be locked!
+ */
+void radeon_vm_flush(struct radeon_device *rdev,
+ struct radeon_vm *vm,
+ int ring)
+{
+ /* if we can't remember our last VM flush then flush now! */
+ /* XXX figure out why we have to flush all the time */
+ if (!vm->last_flush || true)
+ radeon_ring_vm_flush(rdev, ring, vm);
+}
+
+/**
* radeon_vm_fence - remember fence for vm
*
* @rdev: radeon_device pointer
@@ -394,14 +415,18 @@ void radeon_vm_fence(struct radeon_device *rdev,
struct radeon_vm *vm,
struct radeon_fence *fence)
{
- radeon_fence_unref(&rdev->vm_manager.active[vm->id]);
- rdev->vm_manager.active[vm->id] = radeon_fence_ref(fence);
-
radeon_fence_unref(&vm->fence);
vm->fence = radeon_fence_ref(fence);
+ radeon_fence_unref(&rdev->vm_manager.active[vm->id]);
+ rdev->vm_manager.active[vm->id] = radeon_fence_ref(fence);
+
radeon_fence_unref(&vm->last_id_use);
vm->last_id_use = radeon_fence_ref(fence);
+
+ /* we just flushed the VM, remember that */
+ if (!vm->last_flush)
+ vm->last_flush = radeon_fence_ref(fence);
}
/**