From: Christian König Date: Mon, 20 Jul 2015 13:47:30 +0000 (+0200) Subject: drm/amdgpu: no updates shouldn't cause vm flush v2 X-Git-Tag: v4.3-rc1~20^2~26^2~112 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fc8fa5e428ae937f79a36ccbe303fa871ffbbbf7;p=platform%2Fkernel%2Flinux-exynos.git drm/amdgpu: no updates shouldn't cause vm flush v2 v2 (chk): split fix from original patch Signed-off-by: monk.liu Signed-off-by: Christian König Reviewed-by: Jammy Zhou --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 0c8c990..1e895b9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -200,13 +200,15 @@ void amdgpu_vm_flush(struct amdgpu_ring *ring, { uint64_t pd_addr = amdgpu_bo_gpu_offset(vm->page_directory); 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 || - amdgpu_fence_is_earlier(vm_id->flushed_updates, updates)) { + if (pd_addr != vm_id->pd_gpu_addr || !flushed_updates || + (updates && amdgpu_fence_is_earlier(flushed_updates, updates))) { 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(updates); + vm_id->flushed_updates = amdgpu_fence_ref( + amdgpu_fence_later(flushed_updates, updates)); + amdgpu_fence_unref(&flushed_updates); vm_id->pd_gpu_addr = pd_addr; amdgpu_ring_emit_vm_flush(ring, vm_id->id, vm_id->pd_gpu_addr); }