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: 859386 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="CjiUuv4E"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zHgFB1jlFz9sNr for ; Fri, 12 Jan 2018 09:15:58 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933619AbeAKWP5 (ORCPT ); Thu, 11 Jan 2018 17:15:57 -0500 Received: from mail-qk0-f193.google.com ([209.85.220.193]:45413 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933649AbeAKWP5 (ORCPT ); Thu, 11 Jan 2018 17:15:57 -0500 Received: by mail-qk0-f193.google.com with SMTP id z12so6299880qkf.12 for ; Thu, 11 Jan 2018 14:15:56 -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=P5dY/w5wxJn1K9oTF4sURtUJXpZ/UKcZk52tAZfkrcXEJo4u3k+0lcUGY35HdYxDkt iUHGHHjMJSU2N/tBe28aG7YwSMVqfKWbOJr/5S0qClaEG3Holzj58lbUYiZTJ1MvRHEO 6Pkdjk1DZc2+90A8MYTID7gkmPjSVZnzMsYpgA5yKd7+yyaISViu9j7EVnnsK2dKlNHT Yo8nIt0C8/ax/tjxwnDhb9Acj28/b/3mp5V9UHcwmN0vgf+2d/A0Z6tPLnWVVlj0SqbE EpWWA6fYQ86dtAGWsY+JpxD/ZEv3RcS3UC47b2RHZpr19n+fjuJoQj7xzyk3RBG3FtK3 j9xQ== X-Gm-Message-State: AKwxyteV+aQh+gVL+ERUVnoZLtoAuZk0WkYaPr+t4yjAWyNUFqOfxgNm 97nSnzcUEwvH9saBreCqamw= 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 Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-tegra@vger.kernel.org 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> Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org 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) {