Linux Media Controller development
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: daniel@ffwll.ch, linaro-mm-sig@lists.linaro.org,
	dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org
Cc: "Christian König" <christian.koenig@amd.com>
Subject: [PATCH 3/5] dma-buf: return only unsignaled fences in dma_fence_unwrap_for_each v3
Date: Fri,  6 May 2022 16:10:07 +0200	[thread overview]
Message-ID: <20220506141009.18047-3-christian.koenig@amd.com> (raw)
In-Reply-To: <20220506141009.18047-1-christian.koenig@amd.com>

dma_fence_chain containers cleanup signaled fences automatically, so
filter those out from arrays as well.

v2: fix missing walk over the array
v3: massively simplify the patch and actually update the description.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 include/linux/dma-fence-unwrap.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/linux/dma-fence-unwrap.h b/include/linux/dma-fence-unwrap.h
index e7c219da4ed7..a4d342fef8e0 100644
--- a/include/linux/dma-fence-unwrap.h
+++ b/include/linux/dma-fence-unwrap.h
@@ -43,9 +43,13 @@ struct dma_fence *dma_fence_unwrap_next(struct dma_fence_unwrap *cursor);
  * Unwrap dma_fence_chain and dma_fence_array containers and deep dive into all
  * potential fences in them. If @head is just a normal fence only that one is
  * returned.
+ *
+ * Note that signalled fences are opportunistically filtered out, which
+ * means the iteration is potentially over no fence at all.
  */
 #define dma_fence_unwrap_for_each(fence, cursor, head)			\
 	for (fence = dma_fence_unwrap_first(head, cursor); fence;	\
-	     fence = dma_fence_unwrap_next(cursor))
+	     fence = dma_fence_unwrap_next(cursor))			\
+		if (!dma_fence_is_signaled(fence))
 
 #endif
-- 
2.25.1


  parent reply	other threads:[~2022-05-06 14:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06 14:10 [PATCH 1/5] dma-buf: cleanup dma_fence_unwrap selftest v2 Christian König
2022-05-06 14:10 ` [PATCH 2/5] dma-buf: cleanup dma_fence_unwrap implementation Christian König
2022-05-06 14:10 ` Christian König [this message]
2022-05-25 13:13   ` [PATCH 3/5] dma-buf: return only unsignaled fences in dma_fence_unwrap_for_each v3 Daniel Vetter
2022-07-11  9:44   ` Karolina Drobnik
2022-07-11  9:57     ` Christian König
2022-07-11 12:17       ` Karolina Drobnik
2022-07-11 12:25         ` Christian König
2022-07-11 12:41           ` Karolina Drobnik
2022-05-06 14:10 ` [PATCH 4/5] dma-buf: generalize dma_fence unwrap & merging v2 Christian König
2022-05-06 14:10 ` [PATCH 5/5] drm: use dma_fence_unwrap_merge() in drm_syncobj Christian König
2022-05-06 14:11 ` [PATCH 1/5] dma-buf: cleanup dma_fence_unwrap selftest v2 Christian König
2022-05-12 11:34   ` Christian König
2022-05-25 13:16 ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220506141009.18047-3-christian.koenig@amd.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox