From patchwork Wed Jun 26 12:23:06 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: 11017601 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 20FAA1398 for ; Wed, 26 Jun 2019 12:23:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FDC9287A3 for ; Wed, 26 Jun 2019 12:23:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 044992877B; Wed, 26 Jun 2019 12:23:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CCD60287A8 for ; Wed, 26 Jun 2019 12:23:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D0D5A6E3CB; Wed, 26 Jun 2019 12:23:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id AF6156E3A6; Wed, 26 Jun 2019 12:23:14 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id n9so2535172wru.0; Wed, 26 Jun 2019 05:23:14 -0700 (PDT) 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=2IpMzv21zi/i5aOswxazxdECS2gQzcyfmft+Y6vYyCk=; b=r2I7+LNp/Kp2znpPLS7RjFdR9MU0+ZQMhprA4OAiOdrXCzcVbTSsMFaHOjY12tW72m c40KtWmR5xdiuMelZxu06Q07kajvprCVnRXue2elpYoBcvSA/+HUj12rOBk2t5gshNs0 MBO1T5e1GP/S63Q5TtLuxkb9/KI25eSnAge40gMV5QbWKSnASmUCdOLJVWuiym/bHtUn fm4hRXCzxfDjW+iD09pHImWX/7+rs1ZWo/3dsidit32n5xpY3mrxjH2W5e0qex285uEI pma/4sXaKFin39zTHOnFLigOkcgDXcpIOah30A79XLpREsrfFbJBPFA3hHF9fetp0wB+ 79AA== X-Gm-Message-State: APjAAAXhjDJ2KIS0C27cu7RMlIkxUco7CA9SX2TJNNOGM23g1yxPCxUy udSwQRdAT5ravHVAU16+Cx2+cqX3 X-Google-Smtp-Source: APXvYqzWQsLFR2WLa/lBUcsxAZf+h27PBpZpIpC6JaNPftzBRj/oPy3U5PxSUNNpsK83ENBbeaH0fg== X-Received: by 2002:adf:ec8e:: with SMTP id z14mr3410726wrn.125.1561551793092; Wed, 26 Jun 2019 05:23:13 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:902c:2dc9:c30e:db03]) by smtp.gmail.com with ESMTPSA id k125sm2262018wmf.41.2019.06.26.05.23.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jun 2019 05:23:12 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [PATCH 2/6] drm/ttm: remove the backing store if no placement is given Date: Wed, 26 Jun 2019 14:23:06 +0200 Message-Id: <20190626122310.1498-2-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190626122310.1498-1-christian.koenig@amd.com> References: <20190626122310.1498-1-christian.koenig@amd.com> MIME-Version: 1.0 X-Mailman-Original-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=2IpMzv21zi/i5aOswxazxdECS2gQzcyfmft+Y6vYyCk=; b=p4SWdSvRWuCvN86eCS5IOAZxMRTQhsmtGUVCz6G5+xTtHkBf8g3kfGSZyNuVsXz4zO dnlQ2MNCB8D7JUZa5Ikm5e6uuxMVrMXOFQhgWpHRY+ITWHn02Iw2GXGgpt/5lD9kv0z7 HseGM2Iw/cqmI7EFQYKPkEMM8VEl1k1opZuZ3XHDBiy/w3MjonsQk9i1fgrGumP6zlK3 3nd9S99iQSYxw0737NHcCRpxaSspZa1K/lxPk+C28Yu++XDv0Gw5Mszt/gS3a/2SVTqe Sw2wbDjTr9SogtmicTvoSsr2zaeAQdDxsduT7O6+Rlvt/7qiGKdzW09QXUVeIy8/mPhO DBvw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 c7de667d482a..682a1a035b35 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -1240,6 +1240,18 @@ int ttm_bo_validate(struct ttm_buffer_object *bo, uint32_t new_flags; reservation_object_assert_held(bo->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. */