Commit 593b2635 authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/radeon: fix VMID use tracking

Otherwise we allocate a new VMID on nearly every submit.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 45ab1e07
...@@ -867,6 +867,8 @@ struct radeon_vm { ...@@ -867,6 +867,8 @@ struct radeon_vm {
struct radeon_fence *fence; struct radeon_fence *fence;
/* last flush or NULL if we still need to flush */ /* last flush or NULL if we still need to flush */
struct radeon_fence *last_flush; struct radeon_fence *last_flush;
/* last use of vmid */
struct radeon_fence *last_id_use;
}; };
struct radeon_vm_manager { struct radeon_vm_manager {
......
...@@ -713,7 +713,7 @@ struct radeon_fence *radeon_vm_grab_id(struct radeon_device *rdev, ...@@ -713,7 +713,7 @@ struct radeon_fence *radeon_vm_grab_id(struct radeon_device *rdev,
unsigned i; unsigned i;
/* check if the id is still valid */ /* check if the id is still valid */
if (vm->fence && vm->fence == rdev->vm_manager.active[vm->id]) if (vm->last_id_use && vm->last_id_use == rdev->vm_manager.active[vm->id])
return NULL; return NULL;
/* we definately need to flush */ /* we definately need to flush */
...@@ -769,6 +769,9 @@ void radeon_vm_fence(struct radeon_device *rdev, ...@@ -769,6 +769,9 @@ void radeon_vm_fence(struct radeon_device *rdev,
radeon_fence_unref(&vm->fence); radeon_fence_unref(&vm->fence);
vm->fence = radeon_fence_ref(fence); vm->fence = radeon_fence_ref(fence);
radeon_fence_unref(&vm->last_id_use);
vm->last_id_use = radeon_fence_ref(fence);
} }
/** /**
...@@ -1303,6 +1306,8 @@ void radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm) ...@@ -1303,6 +1306,8 @@ void radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm)
{ {
vm->id = 0; vm->id = 0;
vm->fence = NULL; vm->fence = NULL;
vm->last_flush = NULL;
vm->last_id_use = NULL;
mutex_init(&vm->mutex); mutex_init(&vm->mutex);
INIT_LIST_HEAD(&vm->list); INIT_LIST_HEAD(&vm->list);
INIT_LIST_HEAD(&vm->va); INIT_LIST_HEAD(&vm->va);
...@@ -1341,5 +1346,6 @@ void radeon_vm_fini(struct radeon_device *rdev, struct radeon_vm *vm) ...@@ -1341,5 +1346,6 @@ void radeon_vm_fini(struct radeon_device *rdev, struct radeon_vm *vm)
} }
radeon_fence_unref(&vm->fence); radeon_fence_unref(&vm->fence);
radeon_fence_unref(&vm->last_flush); radeon_fence_unref(&vm->last_flush);
radeon_fence_unref(&vm->last_id_use);
mutex_unlock(&vm->mutex); mutex_unlock(&vm->mutex);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment