aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2017-02-26 15:34:42 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2017-02-26 15:34:42 -0500
commit8e22e1b3499a446df48c2b26667ca36c55bf864c (patch)
tree5329f98b3eb3c95a9dcbab0fa4f9b6e62f0e788d /drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
parent00d3c14f14d51babd8aeafd5fa734ccf04f5ca3d (diff)
parent64a577196d66b44e37384bc5c4d78c61f59d5b2a (diff)
Merge airlied/drm-next into drm-misc-next
Backmerge the main pull request to sync up with all the newly landed drivers. Otherwise we'll have chaos even before 4.12 started in earnest. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_object.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index d1aa291b2638..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
@@ -374,8 +375,10 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
374 * See https://bugs.freedesktop.org/show_bug.cgi?id=88758 375 * See https://bugs.freedesktop.org/show_bug.cgi?id=88758
375 */ 376 */
376 377
378#ifndef CONFIG_COMPILE_TEST
377#warning Please enable CONFIG_MTRR and CONFIG_X86_PAT for better performance \ 379#warning Please enable CONFIG_MTRR and CONFIG_X86_PAT for better performance \
378 thanks to write-combining 380 thanks to write-combining
381#endif
379 382
380 if (bo->flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC) 383 if (bo->flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC)
381 DRM_INFO_ONCE("Please enable CONFIG_MTRR and CONFIG_X86_PAT for " 384 DRM_INFO_ONCE("Please enable CONFIG_MTRR and CONFIG_X86_PAT for "
@@ -399,12 +402,20 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
399 locked = ww_mutex_trylock(&bo->tbo.ttm_resv.lock); 402 locked = ww_mutex_trylock(&bo->tbo.ttm_resv.lock);
400 WARN_ON(!locked); 403 WARN_ON(!locked);
401 } 404 }
405
406 initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
402 r = ttm_bo_init(&adev->mman.bdev, &bo->tbo, size, type, 407 r = ttm_bo_init(&adev->mman.bdev, &bo->tbo, size, type,
403 &bo->placement, page_align, !kernel, NULL, 408 &bo->placement, page_align, !kernel, NULL,
404 acc_size, sg, resv ? resv : &bo->tbo.ttm_resv, 409 acc_size, sg, resv ? resv : &bo->tbo.ttm_resv,
405 &amdgpu_ttm_bo_destroy); 410 &amdgpu_ttm_bo_destroy);
406 if (unlikely(r != 0)) 411 amdgpu_cs_report_moved_bytes(adev,
412 atomic64_read(&adev->num_bytes_moved) - initial_bytes_moved);
413
414 if (unlikely(r != 0)) {
415 if (!resv)
416 ww_mutex_unlock(&bo->tbo.resv->lock);
407 return r; 417 return r;
418 }
408 419
409 bo->tbo.priority = ilog2(bo->tbo.num_pages); 420 bo->tbo.priority = ilog2(bo->tbo.num_pages);
410 if (kernel) 421 if (kernel)