From patchwork Tue Oct 29 10:40:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 11217671 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 568E91709 for ; Tue, 29 Oct 2019 10:40:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 343A0214D9 for ; Tue, 29 Oct 2019 10:40:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BtX3Y2bI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728147AbfJ2Kk5 (ORCPT ); Tue, 29 Oct 2019 06:40:57 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:37987 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727387AbfJ2Kk4 (ORCPT ); Tue, 29 Oct 2019 06:40:56 -0400 Received: by mail-wm1-f67.google.com with SMTP id 22so1830277wms.3 for ; Tue, 29 Oct 2019 03:40:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=jIrSwkySu99IZFShnoHMSIHDhs88OfSpxWdYrboWutY=; b=BtX3Y2bIICvPkckdzlsjd+uP9spMfVI2GiBjvE5xcnYFfqHZqV75n3SFsD3mTeUMZx tBqL/6LB35aez2rquIBgLFHFiF4Fx1sB/7wk62XuHlQeRPws8AQVqFnBLgFwhoKnVCUj T9CB6kc7VisfS16gCmMD1scdrT7n/J6MldlSQeLFQst+8E+Dak/WzrYcdYR5RtJ5cjKY ngnEAdPeKzPk+pKSquzKkU0hMZ3NlEz3//1gPO+b5RqhGAkIejSZlbDeBVsucd31jOaj GI58UxgMahyAWIx+20awa2oOqJGwyOQHIOHl8JvFV+aPYkTTX2Qvz7lG8Z7ibItpLPU4 Suaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jIrSwkySu99IZFShnoHMSIHDhs88OfSpxWdYrboWutY=; b=iB938ZEWP5AoDns4/G5Hucm2xwyYo9kO2aCRjojRMmTUAxC/jPfTBE2wtcC72ssk1T CKiMT4Z7o6R50+8+D6Z74GTzKD2Y1jvHrVbsF/bikVB70BHCf6hJWZVxsViMgGxtARIS G8ekJuemvIbwVXDfJP3Wvh/sT7swJU6eSVaTeinMM1PW026ZmYyvqbWAumNQgF0dFvwh XCdCDQvEISa0fvrHn5czhvt/om7Ds6cyUGXmZPYLNZejvvQlnOIWJEJxnwyNfnrotK/+ DhDD5qvWVUPlgqfPvGgbkQOexrwCiJgI3PG2PvzZX5SYQE+vtRfmJ1Wm5OvH+lTFLCqE abYg== X-Gm-Message-State: APjAAAXa7NfFVcnQkUbuUmx8WCbviBaE2ukkGXmQXHQ4HZy6MJ9PUHwh 3drm+iYNYjdSA1XHUT/RjeG2Op6u X-Google-Smtp-Source: APXvYqyqMO+qdPSkT30UFlfsb1zNCp0MH2Q3Lb3eFI/S2EA4a60/VXHXUuIFLdM1mRmiOcbSfvB7pA== X-Received: by 2002:a7b:c444:: with SMTP id l4mr3330229wmi.21.1572345653806; Tue, 29 Oct 2019 03:40:53 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:c5d9:7998:9ca6:452]) by smtp.gmail.com with ESMTPSA id v10sm2910210wmg.48.2019.10.29.03.40.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2019 03:40:53 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org, sumit.semwal@linaro.org, linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org, intel-gfx@lists.freedesktop.org Subject: [PATCH 2/5] drm/ttm: remove the backing store if no placement is given Date: Tue, 29 Oct 2019 11:40:46 +0100 Message-Id: <20191029104049.9011-3-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191029104049.9011-1-christian.koenig@amd.com> References: <20191029104049.9011-1-christian.koenig@amd.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Pipeline removal of the BOs backing store when no placement is given during validation. Signed-off-by: Christian König --- 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 d52fc16266ce..2d1488271d63 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -1219,6 +1219,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. */