Am 26.10.2017 um 20:11 schrieb Deucher, Alexander:
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf
Of Christian König
Sent: Thursday, October 26, 2017 12:06 PM
To: [email protected]
Subject: [PATCH 5/8] drm/amdgpu: don't use ttm_bo_move_ttm in
amdgpu_ttm_bind

From: Christian König <[email protected]>

Just unbind and rebind to force updates of the GART space.

This prevents forcing the BO to be idle.
Is there a chance something could change like the caching on a  rebind that we 
need to account for?

Not that I could think of.

The new placement should have identical attributes to the old one, just with GART space allocated.

Christian.


Alex

Signed-off-by: Christian König <[email protected]>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 24 ++++++++++++++++++-
-----
  1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 3045701..b40d2f3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -917,14 +917,26 @@ int amdgpu_ttm_bind(struct ttm_buffer_object
*bo, struct ttm_mem_reg *bo_mem)
        if (unlikely(r))
                return r;

-       r = ttm_bo_move_ttm(bo, true, false, &tmp);
-       if (unlikely(r))
+       if (ttm->state == tt_bound) {
+               r = ttm->func->unbind(ttm);
+               if (unlikely(r))
+                       return r;
+
+               ttm->state = tt_unbound;
+       }
+
+       r = ttm_tt_bind(ttm, &tmp);
+       if (unlikely(r)) {
                ttm_bo_mem_put(bo, &tmp);
-       else
-               bo->offset = (bo->mem.start << PAGE_SHIFT) +
-                       bo->bdev->man[bo->mem.mem_type].gpu_offset;
+               return r;
+       }

-       return r;
+       ttm_bo_mem_put(bo, bo_mem);
+       bo->mem = tmp;
+       bo->offset = (bo->mem.start << PAGE_SHIFT) +
+               bo->bdev->man[bo->mem.mem_type].gpu_offset;
+
+       return 0;
  }

  int amdgpu_ttm_recover_gart(struct amdgpu_device *adev)
--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to