From patchwork Sun Mar 25 10:57:57 2018 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: 10306561 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 02BF560385 for ; Sun, 25 Mar 2018 10:58:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E887B2855C for ; Sun, 25 Mar 2018 10:58:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD99729308; Sun, 25 Mar 2018 10:58:12 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham 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 A8ADD2855C for ; Sun, 25 Mar 2018 10:58:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B973B6E40F; Sun, 25 Mar 2018 10:58:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id DB19A6E40A; Sun, 25 Mar 2018 10:58:04 +0000 (UTC) Received: by mail-wr0-x244.google.com with SMTP id m13so2778675wrj.5; Sun, 25 Mar 2018 03:58:04 -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=ChLroVXIS51oWW2S5IY+AaLDtkNykjhheGHTrtX4Og8=; b=Tz77OS2sqGHxbSqHRzmFU5k7oHH2NKTGLwnCURcQ9aneD7+yUzhTSGzqBcGxTQ0hBd 9wveTfPEHB6V4cMAPWv+XSfURkjJS8OzVTYkNFC+ll9rvZSqgxz9MP2QE0HLS4lqhecO 2ho0pWcu4zqggasZEga/1EWEX7loo85/mTDQDZQKEO/H/y5cCxAtKgbNH4Ahe2VQnMcJ Lv5pywmHjkiINtg7WSqv/e7jTEWHI5U+B/AVNHiCKCqLWCLJJ2ZuNDbhq2TZbi8q+TCR kKDdBNVj9I5QqNfzIXr2c84NHK+JTaE19wWBStxuvTpDx4XMOYsoMrZ3AeCEaulVKLdP FYkQ== 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=ChLroVXIS51oWW2S5IY+AaLDtkNykjhheGHTrtX4Og8=; b=pJ0+o1IB884qLj9cyNo1ADQRRYSZ5lYX30Cf8ThX1ROfIlGuEE2efH7bFVsV3xb+Nl TLazsGEpa3TaDxTiUGc4jIkxb91xtIllThbZVbvp0Tec89vSysHvt6QXkpzjqx1/4D94 sxj83QCqWOibGc6HaJgrPEUrbhwuAcHOHsE3Opcp6BraQ/H3UKwadogxucfq5W0Rgo99 X9sbAM14hLjZQxVutbhCFA5LSvjg++33dZKC9Bl+lJcluHxV2DpHYcvfij1Bth9xdKcf y0HgxnnCRSy6VJRC1DUbIclQ7Ri9EJ5hO8Wz041lDPFFQTm6F0sbXN5W+zo4HrMRY3TA WajA== X-Gm-Message-State: AElRT7E+XosLi2FdCpu6abqTWCfZMgxDi2L8HI0qn5uGeFlfICCMtskK 02xUZ/QGz+ZbTqVdAINOzxI= X-Google-Smtp-Source: AG47ELuSiyDLwypFx1kOYVLA6JpsfVJ4YvYUj24gaXC1JDa11bCU5aMkcgs4vlXSmhNxa9CPTGS25Q== X-Received: by 10.223.152.83 with SMTP id v77mr28655389wrb.225.1521975483474; Sun, 25 Mar 2018 03:58:03 -0700 (PDT) Received: from baker.fritz.box ([2a02:908:1257:4460:80f2:8bcd:4355:2edc]) by smtp.gmail.com with ESMTPSA id c187sm1033899wmf.18.2018.03.25.03.58.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Mar 2018 03:58:02 -0700 (PDT) From: "=?UTF-8?q?Christian=20K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, sumit.semwal@linaro.org Subject: [PATCH 3/5] drm/ttm: remove the backing store if no placement is given Date: Sun, 25 Mar 2018 12:57:57 +0200 Message-Id: <20180325105759.2151-3-christian.koenig@amd.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180325105759.2151-1-christian.koenig@amd.com> References: <20180325105759.2151-1-christian.koenig@amd.com> MIME-Version: 1.0 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 the 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 98e06f8bf23b..17e821f01d0a 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -1078,6 +1078,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. */