[PATCH 19/45] drm/qxl/ttm: handle move notify inside move callback

Dave Airlie airlied at gmail.com
Thu Sep 24 05:18:19 UTC 2020


From: Dave Airlie <airlied at redhat.com>

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 drivers/gpu/drm/qxl/qxl_ttm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
index 5738be300078..378b6827b7a3 100644
--- a/drivers/gpu/drm/qxl/qxl_ttm.c
+++ b/drivers/gpu/drm/qxl/qxl_ttm.c
@@ -151,6 +151,11 @@ static int qxl_bo_move(struct ttm_buffer_object *bo, bool evict,
 {
 	struct ttm_resource *old_mem = &bo->mem;
 	int ret;
+	struct qxl_bo *qbo = to_qxl_bo(bo);
+	struct qxl_device *qdev = to_qxl(qbo->tbo.base.dev);
+
+	if (bo->mem.mem_type == TTM_PL_PRIV && qbo->surface_id)
+		qxl_surface_evict(qdev, qbo, true);
 
 	ret = ttm_bo_wait_ctx(bo, ctx);
 	if (ret)
@@ -175,8 +180,8 @@ static void qxl_bo_move_notify(struct ttm_buffer_object *bo,
 	qbo = to_qxl_bo(bo);
 	qdev = to_qxl(qbo->tbo.base.dev);
 
-	if (bo->mem.mem_type == TTM_PL_PRIV && qbo->surface_id)
-		qxl_surface_evict(qdev, qbo, new_mem ? true : false);
+	if (!new_mem && bo->mem.mem_type == TTM_PL_PRIV && qbo->surface_id)
+		qxl_surface_evict(qdev, qbo, false);
 }
 
 static struct ttm_bo_driver qxl_bo_driver = {
-- 
2.27.0



More information about the dri-devel mailing list