diff options
author | Samuel Pitoiset <samuel.pitoiset@gmail.com> | 2017-02-09 05:33:37 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-02-09 11:29:44 -0500 |
commit | fad061270ac43ff9eed315f0eae7c40b694592de (patch) | |
tree | 8d3b407141622c4addc4898b9b9c4192d332c30e /drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |
parent | 38fc4856ad98f230bc91da0421dec69e4aee40f8 (diff) |
drm/amdgpu: report the number of bytes moved at buffer creation
Like ttm_bo_validate(), ttm_bo_init() might need to move BO and
the number of bytes moved by TTM should be reported. This can help
the throttle buffer migration mechanism to make a better decision.
v2: fix computation
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 993c003a42e4..be80a4a68d7b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |||
@@ -323,6 +323,7 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev, | |||
323 | struct amdgpu_bo *bo; | 323 | struct amdgpu_bo *bo; |
324 | enum ttm_bo_type type; | 324 | enum ttm_bo_type type; |
325 | unsigned long page_align; | 325 | unsigned long page_align; |
326 | u64 initial_bytes_moved; | ||
326 | size_t acc_size; | 327 | size_t acc_size; |
327 | int r; | 328 | int r; |
328 | 329 | ||
@@ -401,10 +402,15 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev, | |||
401 | locked = ww_mutex_trylock(&bo->tbo.ttm_resv.lock); | 402 | locked = ww_mutex_trylock(&bo->tbo.ttm_resv.lock); |
402 | WARN_ON(!locked); | 403 | WARN_ON(!locked); |
403 | } | 404 | } |
405 | |||
406 | initial_bytes_moved = atomic64_read(&adev->num_bytes_moved); | ||
404 | r = ttm_bo_init(&adev->mman.bdev, &bo->tbo, size, type, | 407 | r = ttm_bo_init(&adev->mman.bdev, &bo->tbo, size, type, |
405 | &bo->placement, page_align, !kernel, NULL, | 408 | &bo->placement, page_align, !kernel, NULL, |
406 | acc_size, sg, resv ? resv : &bo->tbo.ttm_resv, | 409 | acc_size, sg, resv ? resv : &bo->tbo.ttm_resv, |
407 | &amdgpu_ttm_bo_destroy); | 410 | &amdgpu_ttm_bo_destroy); |
411 | amdgpu_cs_report_moved_bytes(adev, | ||
412 | atomic64_read(&adev->num_bytes_moved) - initial_bytes_moved); | ||
413 | |||
408 | if (unlikely(r != 0)) { | 414 | if (unlikely(r != 0)) { |
409 | if (!resv) | 415 | if (!resv) |
410 | ww_mutex_unlock(&bo->tbo.resv->lock); | 416 | ww_mutex_unlock(&bo->tbo.resv->lock); |