From patchwork Fri Jun 7 12:50:35 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: 10981625 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 2047C924 for ; Fri, 7 Jun 2019 12:50:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 108C728BE2 for ; Fri, 7 Jun 2019 12:50:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0505A28BF2; Fri, 7 Jun 2019 12:50:49 +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=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 BA87628BEB for ; Fri, 7 Jun 2019 12:50:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CD94D89D58; Fri, 7 Jun 2019 12:50:44 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id 26F7889CD5; Fri, 7 Jun 2019 12:50:43 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id z23so1804421wma.4; Fri, 07 Jun 2019 05:50:43 -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=EQ7yCPhseFFtnKl7TQLta/RCrRbUcr05Dz0MU/kySoDA91i+ZLj1sAk9ku5OPnaBym SVaLlYCLaIc6riaWsEd+dyLVx3/HOrzNFkB7Is/eRp4dSvw+R8VJCv44nGY1MVIi5nZ+ EGNMQj3aTic6S06caeq7xN0PCYTLLZWY8gA/8JZCQbbC9BfvYg8ZnpK17hCfZcHVGYXz 20mxtM3sUJgO2R+acqZDdv7cSKU9c1fbHdesekE1rz2jtqZTyQQdMhjtj/YI6iImtJOP sz3hBaXDyTwhlFxxzJgFccdtfu82t+Mr6jFn08YWyLU0uYgUtalfVwf7yxZ0cRx7Nk38 cOBg== X-Gm-Message-State: APjAAAXPtSs3OLdjZgM0i3L05/C9Xt7VXx7kNqIFspFXmFxXxb+n5tw+ ZrYgZ20l2AU8omOsev6c/luzbbum X-Google-Smtp-Source: APXvYqwIQUNt2CoqghJaQe5aB9Vddu5qXyq1/yzRUX/BI4SDj8/cY5xTUsFi+76aVIYEwn9x4Pnc1A== X-Received: by 2002:a1c:f713:: with SMTP id v19mr3535086wmh.159.1559911841713; Fri, 07 Jun 2019 05:50:41 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:c5a0:21d3:d7e7:98b7]) by smtp.gmail.com with ESMTPSA id 32sm3923249wra.35.2019.06.07.05.50.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Jun 2019 05:50:41 -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, daniel.vetter@ffwll.ch Date: Fri, 7 Jun 2019 14:50:35 +0200 Message-Id: <20190607125039.2240-2-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190607125039.2240-1-christian.koenig@amd.com> References: <20190607125039.2240-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=WiOcX6U1bq8OY92YXylACYLenOGY80ymm/FLwguyTnw5EdIjY0HWGHCoe03mAvIoI3 5E/iwy2rD+MBt/T7N1QSAzzn3uoQFp2C6Zml2LYB44hVNHZWpKL7X8L4e7alORSo4+PY y+yL8vjGYQ3y4ykHK9szpjS5r999oJWqBF/gETpL1bQfa9MFDiF7FQuSa/QpgedrkHWH mFyHKMpqtobN02Pdj7f4kU7UWmDNC1tG3F9Sx9/M1+U/vfNO6lulpy4A2LGkn813/7N7 UIbnVOgEhvOWudAnbGzo73aweJwcnhvzEExDGCZQV8+FOn0LuhlT2r77FER0S4irasA3 OxaA== Subject: [Intel-gfx] [PATCH 2/6] drm/ttm: remove the backing store if no placement is given X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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. */