From patchwork Fri Mar 16 13:20:47 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: 10287073 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 36E7A602C2 for ; Fri, 16 Mar 2018 13:21:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A54328E9B for ; Fri, 16 Mar 2018 13:21:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1DEF928E9D; Fri, 16 Mar 2018 13:21:11 +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 A3BE728E9B for ; Fri, 16 Mar 2018 13:21:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B49286EB4F; Fri, 16 Mar 2018 13:21:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 312646EB41; Fri, 16 Mar 2018 13:20:56 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id q83so2998159wme.5; Fri, 16 Mar 2018 06:20:56 -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=oymBlXKvZ9SxcEN/cgWUBszuBnE9sWuIkqbBvXAbeVdnnIYp4dkLH2ElMhmGmxGa24 cs24Cn/d7pL6bcqYojqqPp6rNnqjzpn4CtBW1giF9mVz0B2690ySJBr+DnaJr9iGFrsv FMBHED/ur9+b4q7K8EU0ept3YT2eSx6yOoLfT88ebqeBDXLWIcjY41zcLonOnlkhEL7w HvMbwjVh87VKPd3kbC93UJS+6YByaR992O8ErNx3O5M4ev0zHrXw+WUYVJSa1zhSZixI UGXHhoOr8uQ+CgAqypE27HCcEQLRcj1F02DF5/5r6/d4QT0dfhJi3U6NGnYSWkJY6xw1 1Pbw== 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=Rk2/ODut+Rxe2y1tZi1bj6yER6X7/v3uifvppZYkjIS2JrBmHpiw13MI6vCGz7xT8s bXt7rcU8WBQpI5rvCPLdKKj/MTht1puPN6rRNsyH5tsVlbnnSXy3fZ7xe4zbUJ9lNY/P ehz/vw19RgD6yMp06S0Lq0NYjFLNaA7ylAgiz/yMti+i/j6FNF5fNnHCE253M7N2IQ25 TvlQLRlLA7wluNHG0kB9x+kong/WsjRV3bqP2uVE+X4z7G2md8hlAjjlsrdoDu1ai3RZ vOArCCB8rZ/LeQ+GipxwaRAWSHzVC7Ddn9Ebs6B5xo/25CN9Rk8yUFBA8UX+jdU2YkKS E9DQ== X-Gm-Message-State: AElRT7FH9lSYVn+glg9TXFXfuzuWQ6iTTp0waK6YJlp7qRcT0Ge13UKH kHrXiQno06JGPBK7hIYlwaY= X-Google-Smtp-Source: AG47ELtGcKjCwWN+FPLtZTzNh+LOQej2FSLjYHSbIToPWA7BdCPnhMvbZemze/jpbXsZMs0FS9JZ/Q== X-Received: by 10.28.69.133 with SMTP id l5mr1694209wmi.100.1521206454837; Fri, 16 Mar 2018 06:20:54 -0700 (PDT) Received: from baker.fritz.box ([2a02:908:1251:8fc0:20a1:f59:5f9f:5472]) by smtp.gmail.com with ESMTPSA id r136sm4947675wmf.18.2018.03.16.06.20.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Mar 2018 06:20:54 -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 Subject: [PATCH 3/5] drm/ttm: remove the backing store if no placement is given Date: Fri, 16 Mar 2018 14:20:47 +0100 Message-Id: <20180316132049.1748-4-christian.koenig@amd.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180316132049.1748-1-christian.koenig@amd.com> References: <20180316132049.1748-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. */