Pipeline removal of the BOs backing store when no placement is given
during validation.

Signed-off-by: Christian König <christian.koe...@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index e634d3a36923..6e9ff94a085d 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1237,6 +1237,18 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
        uint32_t new_flags;
 
        reservation_object_assert_held(bo->resv);
+
+       /*
+        * Remove the backing store if no placement is given.
+        */
+       if (!placement->num_placement && !placement->num_busy_placement) {
+               ret = ttm_bo_pipeline_gutting(bo);
+               if (ret)
+                       return ret;
+
+               return ttm_tt_create(bo, false);
+       }
+
        /*
         * Check whether we need to move buffer.
         */
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to