From patchwork Thu Jan 11 22:15:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 10158783 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 7538260170 for ; Thu, 11 Jan 2018 22:16:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64EF928619 for ; Thu, 11 Jan 2018 22:16:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 583BF28657; Thu, 11 Jan 2018 22:16:09 +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 E7A9C28619 for ; Thu, 11 Jan 2018 22:16:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BE03E6E4A3; Thu, 11 Jan 2018 22:16:00 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk0-x244.google.com (mail-qk0-x244.google.com [IPv6:2607:f8b0:400d:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id C73B26E4AB; Thu, 11 Jan 2018 22:15:57 +0000 (UTC) Received: by mail-qk0-x244.google.com with SMTP id b76so6400344qkc.1; Thu, 11 Jan 2018 14:15:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AdILtsBYX/kS1sCYY7Nit+DAvn0DC+z/vLizaF7eTHE=; b=CjiUuv4El1L2p8ZLWvxBpg3tdPC7PXd/VJlSJPIOV9qwcAefS10JURO1igfrCV/qIL lsn2E0nDwfea5RiYXkzadgQDLc8Ei9uS8uTddCMV4gVHjzd9rMYvfJ/Hm7qV8OsZ/emP JJoj04D2gDPtEWXqHuiG2GV14kZEIuoPF6W3hVIMiWLznQyo7mjTqRFJRtaghUjV644K rI2ahl2lK1y8tgpUtU8x216MiD+uxkX7/MVgACBIWQExXf8ehF+bRGByAayxiGbwJy7+ bysjMUbrHhTBMy0m5Bj27CHRJhM69p5kXmPiqgto//GhKxFxLnwumKNBujhmtTXMd0UW HOTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AdILtsBYX/kS1sCYY7Nit+DAvn0DC+z/vLizaF7eTHE=; b=PRDHk+YFKhDgU9hdESj+Z1A87Ig4OLA+Wue30mlhKzytxwVen+5vM7kfs4ygPxymz1 I09hmpBrDH9uGHISsKkgDxFGjAKMDNhSQBJv5r0+Fo+hJnZ6zbXeR77Z95djY+E+Bhmi 1lj3lzolVn+/FC/YUudZFmpG/2qm27810EqrieZOPF0Eaq9hx4qTcjgPkkrbSOGnKPMr 9ldKP2hxJjyc/KJ4HEGK/h5QtGGjxt5T/lyzDjAedFfgAA2A1HdkLxLQw3HdqUrM7M/t MY7iOGHQoQ6nnh363S5BDbz1H7Twk3ezI/j4CYGQycW3t+0OsycO/9AbaDdaffI2HOId HsAw== X-Gm-Message-State: AKwxytdI7WiZylsZgZ1qsKTo4RnYItq1Z8XdyKk9TLizhkhI58+wYWsL k+ewKGiuhYb9485I1Oso20EqTw== X-Google-Smtp-Source: ACJfBosZ4VyIhbzwBZkmT1Ii2NBkk2waQnBmixlJUhK9pDDDi1oEAap1A6tswcZzdoMO84YLxuJqGw== X-Received: by 10.55.102.87 with SMTP id a84mr20111615qkc.75.1515708956412; Thu, 11 Jan 2018 14:15:56 -0800 (PST) Received: from localhost (p200300E41F21CF00227DB10B7BBDB590.dip0.t-ipconnect.de. [2003:e4:1f21:cf00:227d:b10b:7bbd:b590]) by smtp.gmail.com with ESMTPSA id w39sm13370373qtw.90.2018.01.11.14.15.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Jan 2018 14:15:55 -0800 (PST) From: Thierry Reding To: Ben Skeggs Subject: [PATCH 3/3] drm/nouveau: Support DMA fence arrays Date: Thu, 11 Jan 2018 23:15:46 +0100 Message-Id: <20180111221546.28547-4-thierry.reding@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180111221546.28547-1-thierry.reding@gmail.com> References: <20180111221546.28547-1-thierry.reding@gmail.com> Cc: linux-tegra@vger.kernel.org, nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Thierry Reding Signed-off-by: Thierry Reding --- drivers/gpu/drm/nouveau/nouveau_fence.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index d61fcfb97b09..53178b1471e3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -331,9 +332,9 @@ nouveau_fence_wait(struct nouveau_fence *fence, bool lazy, bool intr) return 0; } -int -nouveau_fence_sync(struct dma_fence *fence, struct nouveau_channel *chan, - bool intr) +static int +__nouveau_fence_sync(struct dma_fence *fence, struct nouveau_channel *chan, + bool intr) { struct nouveau_fence_chan *fctx = chan->fence; struct nouveau_channel *prev = NULL; @@ -356,6 +357,30 @@ nouveau_fence_sync(struct dma_fence *fence, struct nouveau_channel *chan, return ret; } +int +nouveau_fence_sync(struct dma_fence *fence, struct nouveau_channel *chan, + bool intr) +{ + int ret = 0; + + if (dma_fence_is_array(fence)) { + struct dma_fence_array *array = to_dma_fence_array(fence); + unsigned int i; + + for (i = 0; i < array->num_fences; i++) { + struct dma_fence *f = array->fences[i]; + + ret = __nouveau_fence_sync(f, chan, intr); + if (ret < 0) + break; + } + } else { + ret = __nouveau_fence_sync(fence, chan, intr); + } + + return ret; +} + void nouveau_fence_unref(struct nouveau_fence **pfence) {