drm/amdgpu: remove now unnecessary checks
vm_flush() now comes directly after vm_grab_id(). Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Christian König <christian.koenig@amd.com> Acked-by: Chunming Zhou <david1.zhou@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
1fbb2e9299
commit
3dab83bee1
@@ -885,7 +885,6 @@ struct amdgpu_vm_id {
|
|||||||
struct fence *first;
|
struct fence *first;
|
||||||
struct amdgpu_sync active;
|
struct amdgpu_sync active;
|
||||||
struct fence *last_flush;
|
struct fence *last_flush;
|
||||||
struct amdgpu_ring *last_user;
|
|
||||||
atomic64_t owner;
|
atomic64_t owner;
|
||||||
|
|
||||||
uint64_t pd_gpu_addr;
|
uint64_t pd_gpu_addr;
|
||||||
|
|||||||
@@ -237,6 +237,7 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
|
|||||||
i = ring->idx;
|
i = ring->idx;
|
||||||
do {
|
do {
|
||||||
struct fence *flushed;
|
struct fence *flushed;
|
||||||
|
bool same_ring = ring->idx == i;
|
||||||
|
|
||||||
id = vm->ids[i++];
|
id = vm->ids[i++];
|
||||||
if (i == AMDGPU_MAX_RINGS)
|
if (i == AMDGPU_MAX_RINGS)
|
||||||
@@ -252,7 +253,7 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
|
|||||||
if (pd_addr != id->pd_gpu_addr)
|
if (pd_addr != id->pd_gpu_addr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (id->last_user != ring &&
|
if (!same_ring &&
|
||||||
(!id->last_flush || !fence_is_signaled(id->last_flush)))
|
(!id->last_flush || !fence_is_signaled(id->last_flush)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -261,15 +262,9 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
|
|||||||
(!flushed || fence_is_later(updates, flushed)))
|
(!flushed || fence_is_later(updates, flushed)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Good we can use this VMID */
|
/* Good we can use this VMID. Remember this submission as
|
||||||
if (id->last_user == ring) {
|
* user of the VMID.
|
||||||
r = amdgpu_sync_fence(ring->adev, sync,
|
*/
|
||||||
id->first);
|
|
||||||
if (r)
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* And remember this submission as user of the VMID */
|
|
||||||
r = amdgpu_sync_fence(ring->adev, &id->active, fence);
|
r = amdgpu_sync_fence(ring->adev, &id->active, fence);
|
||||||
if (r)
|
if (r)
|
||||||
goto error;
|
goto error;
|
||||||
@@ -306,7 +301,6 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring,
|
|||||||
id->pd_gpu_addr = pd_addr;
|
id->pd_gpu_addr = pd_addr;
|
||||||
|
|
||||||
list_move_tail(&id->list, &adev->vm_manager.ids_lru);
|
list_move_tail(&id->list, &adev->vm_manager.ids_lru);
|
||||||
id->last_user = ring;
|
|
||||||
atomic64_set(&id->owner, vm->client_id);
|
atomic64_set(&id->owner, vm->client_id);
|
||||||
vm->ids[ring->idx] = id;
|
vm->ids[ring->idx] = id;
|
||||||
|
|
||||||
@@ -357,16 +351,13 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring,
|
|||||||
trace_amdgpu_vm_flush(pd_addr, ring->idx, vm_id);
|
trace_amdgpu_vm_flush(pd_addr, ring->idx, vm_id);
|
||||||
amdgpu_ring_emit_vm_flush(ring, vm_id, pd_addr);
|
amdgpu_ring_emit_vm_flush(ring, vm_id, pd_addr);
|
||||||
|
|
||||||
mutex_lock(&adev->vm_manager.lock);
|
|
||||||
if ((id->pd_gpu_addr == pd_addr) && (id->last_user == ring)) {
|
|
||||||
r = amdgpu_fence_emit(ring, &fence);
|
r = amdgpu_fence_emit(ring, &fence);
|
||||||
if (r) {
|
if (r)
|
||||||
mutex_unlock(&adev->vm_manager.lock);
|
|
||||||
return r;
|
return r;
|
||||||
}
|
|
||||||
|
mutex_lock(&adev->vm_manager.lock);
|
||||||
fence_put(id->last_flush);
|
fence_put(id->last_flush);
|
||||||
id->last_flush = fence;
|
id->last_flush = fence;
|
||||||
}
|
|
||||||
mutex_unlock(&adev->vm_manager.lock);
|
mutex_unlock(&adev->vm_manager.lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user