diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 633a32a48560..8c80381b1ea9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -207,24 +207,21 @@ void amdgpu_vm_flush(struct amdgpu_ring *ring, | |||
207 | uint64_t pd_addr = amdgpu_bo_gpu_offset(vm->page_directory); | 207 | uint64_t pd_addr = amdgpu_bo_gpu_offset(vm->page_directory); |
208 | struct amdgpu_vm_id *vm_id = &vm->ids[ring->idx]; | 208 | struct amdgpu_vm_id *vm_id = &vm->ids[ring->idx]; |
209 | struct fence *flushed_updates = vm_id->flushed_updates; | 209 | struct fence *flushed_updates = vm_id->flushed_updates; |
210 | bool is_earlier = false; | 210 | bool is_later; |
211 | 211 | ||
212 | if (flushed_updates && updates) { | 212 | if (!flushed_updates) |
213 | BUG_ON(flushed_updates->context != updates->context); | 213 | is_later = true; |
214 | is_earlier = (updates->seqno - flushed_updates->seqno <= | 214 | else if (!updates) |
215 | INT_MAX) ? true : false; | 215 | is_later = false; |
216 | } | 216 | else |
217 | 217 | is_later = fence_is_later(updates, flushed_updates); | |
218 | if (pd_addr != vm_id->pd_gpu_addr || !flushed_updates || | ||
219 | is_earlier) { | ||
220 | 218 | ||
219 | if (pd_addr != vm_id->pd_gpu_addr || is_later) { | ||
221 | trace_amdgpu_vm_flush(pd_addr, ring->idx, vm_id->id); | 220 | trace_amdgpu_vm_flush(pd_addr, ring->idx, vm_id->id); |
222 | if (is_earlier) { | 221 | if (is_later) { |
223 | vm_id->flushed_updates = fence_get(updates); | 222 | vm_id->flushed_updates = fence_get(updates); |
224 | fence_put(flushed_updates); | 223 | fence_put(flushed_updates); |
225 | } | 224 | } |
226 | if (!flushed_updates) | ||
227 | vm_id->flushed_updates = fence_get(updates); | ||
228 | vm_id->pd_gpu_addr = pd_addr; | 225 | vm_id->pd_gpu_addr = pd_addr; |
229 | amdgpu_ring_emit_vm_flush(ring, vm_id->id, vm_id->pd_gpu_addr); | 226 | amdgpu_ring_emit_vm_flush(ring, vm_id->id, vm_id->pd_gpu_addr); |
230 | } | 227 | } |