drm/amdgpu: no updates shouldn't cause vm flush v2

v2 (chk): split fix from original patch

Signed-off-by: monk.liu <monk.liu@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
This commit is contained in:
Christian König 2015-07-20 15:47:30 +02:00 committed by Alex Deucher
parent cf6f1d3949
commit fc8fa5e428
1 changed files with 6 additions and 4 deletions

View File

@ -200,13 +200,15 @@ void amdgpu_vm_flush(struct amdgpu_ring *ring,
{ {
uint64_t pd_addr = amdgpu_bo_gpu_offset(vm->page_directory); uint64_t pd_addr = amdgpu_bo_gpu_offset(vm->page_directory);
struct amdgpu_vm_id *vm_id = &vm->ids[ring->idx]; struct amdgpu_vm_id *vm_id = &vm->ids[ring->idx];
struct amdgpu_fence *flushed_updates = vm_id->flushed_updates;
if (pd_addr != vm_id->pd_gpu_addr || !vm_id->flushed_updates || if (pd_addr != vm_id->pd_gpu_addr || !flushed_updates ||
amdgpu_fence_is_earlier(vm_id->flushed_updates, updates)) { (updates && amdgpu_fence_is_earlier(flushed_updates, updates))) {
trace_amdgpu_vm_flush(pd_addr, ring->idx, vm_id->id); trace_amdgpu_vm_flush(pd_addr, ring->idx, vm_id->id);
amdgpu_fence_unref(&vm_id->flushed_updates); vm_id->flushed_updates = amdgpu_fence_ref(
vm_id->flushed_updates = amdgpu_fence_ref(updates); amdgpu_fence_later(flushed_updates, updates));
amdgpu_fence_unref(&flushed_updates);
vm_id->pd_gpu_addr = pd_addr; vm_id->pd_gpu_addr = pd_addr;
amdgpu_ring_emit_vm_flush(ring, vm_id->id, vm_id->pd_gpu_addr); amdgpu_ring_emit_vm_flush(ring, vm_id->id, vm_id->pd_gpu_addr);
} }