From patchwork Tue Mar 6 14:43:45 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: 10261959 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 3B6296016D for ; Tue, 6 Mar 2018 14:44:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D6C52900C for ; Tue, 6 Mar 2018 14:44:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 21F8C2900E; Tue, 6 Mar 2018 14:44:01 +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 7DECA2901D for ; Tue, 6 Mar 2018 14:44:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DB4506E101; Tue, 6 Mar 2018 14:43:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id AE6996E074; Tue, 6 Mar 2018 14:43:52 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id w128so23397856wmw.0; Tue, 06 Mar 2018 06:43:52 -0800 (PST) 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=+i7RtoGEE/3A28Y2f9QV6Ys0LYkPgZvKUMfkPmezSCI=; b=lZEAu32OpwdKqXgZkzAD/WKRkO7iMQeGrAq+iQLocBWcRQ+rVCtJj5jCDbg6m0dsb7 7kMvweVFmekGt5rZtVDH3TezebMNOx4FSydquWE9BJXH5gvjtI8N65hm1qiwJpOKAn+s G+HxRqHUMccl19636WETAMKQpMzn46XHP7RHa6J0zl0h/icY5v36oWXMZZws/Zy0zQSN dAfmhITTB2/1jyGgaF1g6zyiDPYyj07PXxo91Dp2f5h9hF5G9cJEbJf0N2FGQI6dyQre w26GGAAi5madzf5Svt1CmXdOwSNJSb2VLv1JOCPWumDZ//JfJsbS7JMKOxaWlPgPLLME WH1w== 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=+i7RtoGEE/3A28Y2f9QV6Ys0LYkPgZvKUMfkPmezSCI=; b=Anld1tb+THE393z3dWtj5n+lvnTPVj94NoRINXaLoejRKofzJTsgprNUu9H8Ze+WtW JVcllxJWAIShhB9OcsU5j+G8x+MCh6zB7gk5ooi1phtrHUefLcn/6PBm7CQ4YqN25sar 2ygIwCU2f+Kauk40hsZakLHtkhqno8C+dEv/wK8CehEluSALR0lL6JBd/zQIeYpBU8Zz fIci8+tNBxn3XATTFTlhbDw3Nu4iS0L/tUhAd5NuMIe3m3FtLyuthpI5A3qhxG1Rz2J/ 7Mlqx0/xlA505XEdrvF90P+h5pi33GUKRlgwY2ri0Ig5TSqDU4rJ9EOShUEPdGcdPPk+ nvAA== X-Gm-Message-State: AElRT7G7/QIu9iZjsK4XVtI/kPs40siOfh6yzsbqknKER7O7QWZMYylQ bSeiBwPQlmoyoxH8+1JJUl4aVQ== X-Google-Smtp-Source: AG47ELvEC8sltjBbZ4lejJZa8ysDXU2fOX72hxPODjfhkHWdijjNz5/xRDmWCSRmZj9hFV1hyeeR/g== X-Received: by 10.28.18.146 with SMTP id 140mr12562811wms.50.1520347431195; Tue, 06 Mar 2018 06:43:51 -0800 (PST) Received: from baker.fritz.box ([2a02:908:1251:8fc0:44ab:16c7:7c4f:90f9]) by smtp.gmail.com with ESMTPSA id s21sm13419206wra.45.2018.03.06.06.43.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Mar 2018 06:43:50 -0800 (PST) From: "=?UTF-8?q?Christian=20K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH 4/6] drm/amdgpu: drop the backing store when DMA-buf imports are evicted Date: Tue, 6 Mar 2018 15:43:45 +0100 Message-Id: <20180306144347.1702-4-christian.koenig@amd.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180306144347.1702-1-christian.koenig@amd.com> References: <20180306144347.1702-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 Instead of moving this to the SYSTEM domain just drop the backing store and let the resulting allocation be freed. Signed-off-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 44ae2c60c9d4..eebc9f77b611 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -203,6 +203,12 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo, .flags = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM }; + if (bo->type == ttm_bo_type_sg) { + placement->num_placement = 0; + placement->num_busy_placement = 0; + return; + } + if (!amdgpu_ttm_bo_is_amdgpu_bo(bo)) { placement->placement = &placements; placement->busy_placement = &placements;