From patchwork Thu Oct 4 13:12:50 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: 10626161 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 3932C15A6 for ; Thu, 4 Oct 2018 13:13:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A4912909C for ; Thu, 4 Oct 2018 13:13:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E6BC290B0; Thu, 4 Oct 2018 13:13:39 +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 C6D97290A4 for ; Thu, 4 Oct 2018 13:13:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7BEC56E5F8; Thu, 4 Oct 2018 13:13:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 20D756E5E4; Thu, 4 Oct 2018 13:13:01 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id n1-v6so9870075wrt.10; Thu, 04 Oct 2018 06:13:01 -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=jOzPl/ODHPItnUpA9W+Ne2YhRKKSDbXUf+vuIEIfBGg=; b=LGiz6CUjXs8KdrsoZ/evJePiKdsrxoUKfBUrx4FcMTccH8ssCqMzOfbn1Xdlj5etnp CEzzCfd9BjDHzicIxq3YHSzjJiWdIX/0H2EyIATOF97qPQYvVxzv4wfYk5qkiMHANBzb uHnO1nP09MVIev13k4z834fFCvPFT9WRoBe5xbEJSjryoNhXWb+5jfBl31bp2mnOqa8+ GLoPcyzqFJyeY+BrxMUK47Trpg173GLeUwMAZhltOzU+xZmUr8I/NeEHUcL604wZ73Dx WSQHYl1MQJRqW4resdo003K/rgJBkrfjmhV9OVGzivRDHj0jMnDEfnmT6Plurbo85dtU TWgA== X-Gm-Message-State: ABuFfohVdVJPKP5ZHLV9HFInhCDb8qZr55dq7/Ox35OOIb9fvpFqIlUY VdyABWkOds1p5k1vvUW16B6/3lc5 X-Google-Smtp-Source: ACcGV62zo38dys+XwLKnOk8/q7tPgTSwlLBwECIW0DPvPGSs+vrnbH5bwbOikcJWC3ccECFn+gAXPw== X-Received: by 2002:adf:b109:: with SMTP id l9-v6mr4679457wra.101.1538658779570; Thu, 04 Oct 2018 06:12:59 -0700 (PDT) Received: from baker.fritz.box ([2a02:908:1257:4460:2d2f:ac8e:6b85:b5e9]) by smtp.gmail.com with ESMTPSA id b139-v6sm9755457wmd.36.2018.10.04.06.12.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Oct 2018 06:12:58 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH 8/8] drm/ttm: drop the extra reservation for pipelined BO moves Date: Thu, 4 Oct 2018 15:12:50 +0200 Message-Id: <20181004131250.2373-8-christian.koenig@amd.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20181004131250.2373-1-christian.koenig@amd.com> References: <20181004131250.2373-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 The driver is now responsible to allocate enough shared slots. Signed-off-by: Christian König --- drivers/gpu/drm/ttm/ttm_bo.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 83b4657ffb10..7bdfc1e8236d 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -858,12 +858,11 @@ EXPORT_SYMBOL(ttm_bo_mem_put); /** * Add the last move fence to the BO and reserve a new shared slot. */ -static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo, - struct ttm_mem_type_manager *man, - struct ttm_mem_reg *mem) +static void ttm_bo_add_move_fence(struct ttm_buffer_object *bo, + struct ttm_mem_type_manager *man, + struct ttm_mem_reg *mem) { struct dma_fence *fence; - int ret; spin_lock(&man->move_lock); fence = dma_fence_get(man->move); @@ -871,16 +870,9 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo, if (fence) { reservation_object_add_shared_fence(bo->resv, fence); - - ret = reservation_object_reserve_shared(bo->resv, 1); - if (unlikely(ret)) - return ret; - dma_fence_put(bo->moving); bo->moving = fence; } - - return 0; } /** @@ -908,7 +900,8 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo, return ret; } while (1); mem->mem_type = mem_type; - return ttm_bo_add_move_fence(bo, man, mem); + ttm_bo_add_move_fence(bo, man, mem); + return 0; } static uint32_t ttm_bo_select_caching(struct ttm_mem_type_manager *man, @@ -977,10 +970,6 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, bool has_erestartsys = false; int i, ret; - ret = reservation_object_reserve_shared(bo->resv, 1); - if (unlikely(ret)) - return ret; - mem->mm_node = NULL; for (i = 0; i < placement->num_placement; ++i) { const struct ttm_place *place = &placement->placement[i]; @@ -1016,11 +1005,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, return ret; if (mem->mm_node) { - ret = ttm_bo_add_move_fence(bo, man, mem); - if (unlikely(ret)) { - (*man->func->put_node)(man, mem); - return ret; - } + ttm_bo_add_move_fence(bo, man, mem); break; } }