From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A1F6EB64D7 for ; Mon, 26 Jun 2023 13:58:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 599E910E207; Mon, 26 Jun 2023 13:58:41 +0000 (UTC) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8530B10E207 for ; Mon, 26 Jun 2023 13:58:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687787919; x=1719323919; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=HWx4jkGlR3YkM7cHJEqrZJMy/4yU2e1NH0t1SCcdASg=; b=MtIPpvFxoUIKsLRnlCRywPz7dlHn/m2jMgfRPEptTKSQ+mIktFfTJo1x oVxCO28xAd3WYDSMhJAdVTtmo0G8XN0AhW/XbTd0FNGRx9s/9mDMudGSt 1o2FWNYb9rWW+Ssofk3MZKAt+v3udduYGr2FyWwMqnn6NSlMsUboK6EsB mq9ShTus4fM38QWUsMctLE4uRwHl1SsjJMs9h9OltH/gFyxQkqCsL/2mk vYc6YeXm0wnClmGGNNjP9XYgki0sRqThw3m84FcdFUfuNtC46b+A2ms6z kW+VMRu+RVStTGBlqh8kZTTO0GHz993Awd9HxuXQ/v+4vWEEKwtGPifae w==; X-IronPort-AV: E=McAfee;i="6600,9927,10753"; a="364723162" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="364723162" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 06:58:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10753"; a="716149381" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="716149381" Received: from ettammin-mobl1.ger.corp.intel.com (HELO thellstr-mobl1.intel.com) ([10.249.254.105]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 06:58:37 -0700 From: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= To: intel-xe@lists.freedesktop.org Date: Mon, 26 Jun 2023 15:58:21 +0200 Message-Id: <20230626135824.21984-1-thomas.hellstrom@linux.intel.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Intel-xe] [CI 1/4] drm/xe/bo: Fix swapin when moving to VRAM X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" When a source system resource had been swapped out, we incorrectly assumed that we were lacking source data for a move and therefore cleared the destination instead of swapping in and copying the swapped-out data. Fix this. Signed-off-by: Thomas Hellström Reviewed-by: Matthew Brost Link: https://patchwork.freedesktop.org/patch/msgid/20230619152222.11733-3-thomas.hellstrom@linux.intel.com --- drivers/gpu/drm/xe/xe_bo.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c index 71a14e1f25be..d2f4575d8548 100644 --- a/drivers/gpu/drm/xe/xe_bo.c +++ b/drivers/gpu/drm/xe/xe_bo.c @@ -568,6 +568,7 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict, struct xe_tile *tile = NULL; struct dma_fence *fence; bool move_lacks_source; + bool tt_has_data; bool needs_clear; int ret = 0; @@ -590,8 +591,10 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict, goto out; } - move_lacks_source = !resource_is_vram(old_mem) && - (!ttm || !ttm_tt_is_populated(ttm)); + tt_has_data = ttm && (ttm_tt_is_populated(ttm) || + (ttm->page_flags & TTM_TT_FLAG_SWAPPED)); + + move_lacks_source = !resource_is_vram(old_mem) && !tt_has_data; needs_clear = (ttm && ttm->page_flags & TTM_TT_FLAG_ZERO_ALLOC) || (!ttm && ttm_bo->type == ttm_bo_type_device); -- 2.40.1