aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2015-07-20 15:47:30 +0200
committerAlex Deucher <alexander.deucher@amd.com>2015-08-17 16:50:16 -0400
commitfc8fa5e428ae937f79a36ccbe303fa871ffbbbf7 (patch)
treee7e6ae145c851c7507335041b71f5807d9b9a69f /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
parentcf6f1d39496e9b5dd62953f8dca9f995d80ab4ff (diff)
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>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 0c8c9904d880..1e895b979ec6 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);
}