diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 31 |
2 files changed, 11 insertions, 21 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index c13023dded8f..9fd5c7a5a06d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -885,7 +885,6 @@ struct amdgpu_vm_id { | |||
885 | struct fence *first; | 885 | struct fence *first; |
886 | struct amdgpu_sync active; | 886 | struct amdgpu_sync active; |
887 | struct fence *last_flush; | 887 | struct fence *last_flush; |
888 | struct amdgpu_ring *last_user; | ||
889 | atomic64_t owner; | 888 | atomic64_t owner; |
890 | 889 | ||
891 | uint64_t pd_gpu_addr; | 890 | uint64_t pd_gpu_addr; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 06eb60950cef..d19e9386d97b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -237,6 +237,7 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, | |||
237 | i = ring->idx; | 237 | i = ring->idx; |
238 | do { | 238 | do { |
239 | struct fence *flushed; | 239 | struct fence *flushed; |
240 | bool same_ring = ring->idx == i; | ||
240 | 241 | ||
241 | id = vm->ids[i++]; | 242 | id = vm->ids[i++]; |
242 | if (i == AMDGPU_MAX_RINGS) | 243 | if (i == AMDGPU_MAX_RINGS) |
@@ -252,7 +253,7 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, | |||
252 | if (pd_addr != id->pd_gpu_addr) | 253 | if (pd_addr != id->pd_gpu_addr) |
253 | continue; | 254 | continue; |
254 | 255 | ||
255 | if (id->last_user != ring && | 256 | if (!same_ring && |
256 | (!id->last_flush || !fence_is_signaled(id->last_flush))) | 257 | (!id->last_flush || !fence_is_signaled(id->last_flush))) |
257 | continue; | 258 | continue; |
258 | 259 | ||
@@ -261,15 +262,9 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, | |||
261 | (!flushed || fence_is_later(updates, flushed))) | 262 | (!flushed || fence_is_later(updates, flushed))) |
262 | continue; | 263 | continue; |
263 | 264 | ||
264 | /* Good we can use this VMID */ | 265 | /* Good we can use this VMID. Remember this submission as |
265 | if (id->last_user == ring) { | 266 | * user of the VMID. |
266 | r = amdgpu_sync_fence(ring->adev, sync, | 267 | */ |
267 | id->first); | ||
268 | if (r) | ||
269 | goto error; | ||
270 | } | ||
271 | |||
272 | /* And remember this submission as user of the VMID */ | ||
273 | r = amdgpu_sync_fence(ring->adev, &id->active, fence); | 268 | r = amdgpu_sync_fence(ring->adev, &id->active, fence); |
274 | if (r) | 269 | if (r) |
275 | goto error; | 270 | goto error; |
@@ -306,7 +301,6 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, | |||
306 | id->pd_gpu_addr = pd_addr; | 301 | id->pd_gpu_addr = pd_addr; |
307 | 302 | ||
308 | list_move_tail(&id->list, &adev->vm_manager.ids_lru); | 303 | list_move_tail(&id->list, &adev->vm_manager.ids_lru); |
309 | id->last_user = ring; | ||
310 | atomic64_set(&id->owner, vm->client_id); | 304 | atomic64_set(&id->owner, vm->client_id); |
311 | vm->ids[ring->idx] = id; | 305 | vm->ids[ring->idx] = id; |
312 | 306 | ||
@@ -357,16 +351,13 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, | |||
357 | trace_amdgpu_vm_flush(pd_addr, ring->idx, vm_id); | 351 | trace_amdgpu_vm_flush(pd_addr, ring->idx, vm_id); |
358 | amdgpu_ring_emit_vm_flush(ring, vm_id, pd_addr); | 352 | amdgpu_ring_emit_vm_flush(ring, vm_id, pd_addr); |
359 | 353 | ||
354 | r = amdgpu_fence_emit(ring, &fence); | ||
355 | if (r) | ||
356 | return r; | ||
357 | |||
360 | mutex_lock(&adev->vm_manager.lock); | 358 | mutex_lock(&adev->vm_manager.lock); |
361 | if ((id->pd_gpu_addr == pd_addr) && (id->last_user == ring)) { | 359 | fence_put(id->last_flush); |
362 | r = amdgpu_fence_emit(ring, &fence); | 360 | id->last_flush = fence; |
363 | if (r) { | ||
364 | mutex_unlock(&adev->vm_manager.lock); | ||
365 | return r; | ||
366 | } | ||
367 | fence_put(id->last_flush); | ||
368 | id->last_flush = fence; | ||
369 | } | ||
370 | mutex_unlock(&adev->vm_manager.lock); | 361 | mutex_unlock(&adev->vm_manager.lock); |
371 | } | 362 | } |
372 | 363 | ||