summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2018-03-15 16:48:20 +0100
committerChristian König <christian.koenig@amd.com>2020-02-27 14:58:00 +0100
commitd2588d2ded0f3ac4a955cc92f6e665a2928bf4d6 (patch)
tree70e691a149c6395346cd558a107892b09bf269cb
parentbb42df4662a4476531147c3d9caa1940f7ad36bb (diff)
downloadlinux-d2588d2ded0f3ac4a955cc92f6e665a2928bf4d6.tar.bz2
drm/ttm: remove the backing store if no placement is given
Pipeline removal of the BOs backing store when no placement is given during validation. Signed-off-by: Christian König <christian.koenig@amd.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/353994/?series=73646&rev=1
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 151edfd8de77..6d1e91be9c78 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1196,6 +1196,18 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
uint32_t new_flags;
dma_resv_assert_held(bo->base.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.
*/