diff options
author | Christian König <christian.koenig@amd.com> | 2018-04-05 08:46:41 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-05-15 14:43:05 -0400 |
commit | f1018f50d48395b4a189bf8ea9af1e4441209cfd (patch) | |
tree | 2a7ed2dacb6d19a08126be82428d64b3ff633f84 | |
parent | c11d8afe10228e4621acfcb8f302255ea8567a1e (diff) |
drm/amdgpu: use ctx bytes_moved
Instead of the global (inaccurate) counter.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index d7d7ce1507ec..de69ab12bb55 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | |||
@@ -412,7 +412,6 @@ static bool amdgpu_cs_try_evict(struct amdgpu_cs_parser *p, | |||
412 | struct amdgpu_bo_list_entry *candidate = p->evictable; | 412 | struct amdgpu_bo_list_entry *candidate = p->evictable; |
413 | struct amdgpu_bo *bo = candidate->robj; | 413 | struct amdgpu_bo *bo = candidate->robj; |
414 | struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); | 414 | struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); |
415 | u64 initial_bytes_moved, bytes_moved; | ||
416 | bool update_bytes_moved_vis; | 415 | bool update_bytes_moved_vis; |
417 | uint32_t other; | 416 | uint32_t other; |
418 | 417 | ||
@@ -436,18 +435,15 @@ static bool amdgpu_cs_try_evict(struct amdgpu_cs_parser *p, | |||
436 | continue; | 435 | continue; |
437 | 436 | ||
438 | /* Good we can try to move this BO somewhere else */ | 437 | /* Good we can try to move this BO somewhere else */ |
439 | amdgpu_ttm_placement_from_domain(bo, other); | ||
440 | update_bytes_moved_vis = | 438 | update_bytes_moved_vis = |
441 | adev->gmc.visible_vram_size < adev->gmc.real_vram_size && | 439 | adev->gmc.visible_vram_size < adev->gmc.real_vram_size && |
442 | bo->tbo.mem.mem_type == TTM_PL_VRAM && | 440 | bo->tbo.mem.mem_type == TTM_PL_VRAM && |
443 | bo->tbo.mem.start < adev->gmc.visible_vram_size >> PAGE_SHIFT; | 441 | bo->tbo.mem.start < adev->gmc.visible_vram_size >> PAGE_SHIFT; |
444 | initial_bytes_moved = atomic64_read(&adev->num_bytes_moved); | 442 | amdgpu_ttm_placement_from_domain(bo, other); |
445 | r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx); | 443 | r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx); |
446 | bytes_moved = atomic64_read(&adev->num_bytes_moved) - | 444 | p->bytes_moved += ctx.bytes_moved; |
447 | initial_bytes_moved; | ||
448 | p->bytes_moved += bytes_moved; | ||
449 | if (update_bytes_moved_vis) | 445 | if (update_bytes_moved_vis) |
450 | p->bytes_moved_vis += bytes_moved; | 446 | p->bytes_moved_vis += ctx.bytes_moved; |
451 | 447 | ||
452 | if (unlikely(r)) | 448 | if (unlikely(r)) |
453 | break; | 449 | break; |