[PATCH 1/3] drm/ttm: clear ttm_tt when bo->resource is NULL

Matthew Auld matthew.auld at intel.com
Wed Jan 25 12:37:32 UTC 2023


When initially creating a ttm bo the resource is now always NULL, and
the driver is then expected to handle the dummy move. However, if this
is created as a system resource the first ttm_tt we create will always
have the clear value to false. Previously the initial ttm_tt was created
in ttm_bo_validate() with clear always set to true.

Fixes: 00984ad39599 ("drm/ttm: stop allocating dummy resources during BO creation")
Signed-off-by: Matthew Auld <matthew.auld at intel.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 33471e363ff4..882c2fa346f3 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -120,8 +120,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
 	bool old_use_tt, new_use_tt;
 	int ret;
 
-	old_use_tt = bo->resource &&
-		ttm_manager_type(bdev, bo->resource->mem_type)->use_tt;
+	old_use_tt = !bo->resource || ttm_manager_type(bdev, bo->resource->mem_type)->use_tt;
 	new_use_tt = ttm_manager_type(bdev, mem->mem_type)->use_tt;
 
 	ttm_bo_unmap_virtual(bo);
-- 
2.39.1



More information about the Intel-gfx-trybot mailing list