diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index a85e75327456..e429829ae93d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |||
@@ -322,7 +322,7 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev, | |||
322 | struct amdgpu_bo *bo; | 322 | struct amdgpu_bo *bo; |
323 | enum ttm_bo_type type; | 323 | enum ttm_bo_type type; |
324 | unsigned long page_align; | 324 | unsigned long page_align; |
325 | u64 initial_bytes_moved; | 325 | u64 initial_bytes_moved, bytes_moved; |
326 | size_t acc_size; | 326 | size_t acc_size; |
327 | int r; | 327 | int r; |
328 | 328 | ||
@@ -398,8 +398,14 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev, | |||
398 | r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, type, | 398 | r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, type, |
399 | &bo->placement, page_align, !kernel, NULL, | 399 | &bo->placement, page_align, !kernel, NULL, |
400 | acc_size, sg, resv, &amdgpu_ttm_bo_destroy); | 400 | acc_size, sg, resv, &amdgpu_ttm_bo_destroy); |
401 | amdgpu_cs_report_moved_bytes(adev, | 401 | bytes_moved = atomic64_read(&adev->num_bytes_moved) - |
402 | atomic64_read(&adev->num_bytes_moved) - initial_bytes_moved); | 402 | initial_bytes_moved; |
403 | if (adev->mc.visible_vram_size < adev->mc.real_vram_size && | ||
404 | bo->tbo.mem.mem_type == TTM_PL_VRAM && | ||
405 | bo->tbo.mem.start < adev->mc.visible_vram_size >> PAGE_SHIFT) | ||
406 | amdgpu_cs_report_moved_bytes(adev, bytes_moved, bytes_moved); | ||
407 | else | ||
408 | amdgpu_cs_report_moved_bytes(adev, bytes_moved, 0); | ||
403 | 409 | ||
404 | if (unlikely(r != 0)) | 410 | if (unlikely(r != 0)) |
405 | return r; | 411 | return r; |