All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>,
	daniel.vetter@ffwll.ch, dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org,
	sumit.semwal@linaro.org
Subject: Re: [PATCH 1/9] dma-buf: fix dma_fence_array_signaled
Date: Tue, 27 Aug 2019 12:44:27 +0100	[thread overview]
Message-ID: <156690626744.15406.4672497135424922383@skylake-alporthouse-com> (raw)
In-Reply-To: <20190826145731.1725-2-christian.koenig@amd.com>

Quoting Christian König (2019-08-26 15:57:23)
> The function is supposed to give a hint even if signaling is not enabled.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>  drivers/dma-buf/dma-fence-array.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c
> index d3fbd950be94..52068ee5eb35 100644
> --- a/drivers/dma-buf/dma-fence-array.c
> +++ b/drivers/dma-buf/dma-fence-array.c
> @@ -103,8 +103,18 @@ static bool dma_fence_array_enable_signaling(struct dma_fence *fence)
>  static bool dma_fence_array_signaled(struct dma_fence *fence)
>  {
>         struct dma_fence_array *array = to_dma_fence_array(fence);
> +       int i, num_pending;
>  
> -       return atomic_read(&array->num_pending) <= 0;
> +       num_pending = atomic_read(&array->num_pending);
> +       if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags))
> +               return num_pending <= 0;
> +
> +       for (i = 0; i < array->num_fences; ++i)
> +               if (dma_fence_is_signaled(array->fences[i]) &&
> +                   --num_pending == 0)
> +                       return true;

num_fences may be 0 (it's not rejected in construction and works
currently as a simple always-signaled stub).

	if (!test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags)) {
		for (i = 0; i < array->num_fences; ++i)
			if (dma_fence_is_signaled(array->fences[i]) &&
			    --num_pending == 0)
				break;
	}

	return num_pending <= 0;

WARNING: multiple messages have this Message-ID (diff)
From: Chris Wilson <chris@chris-wilson.co.uk>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>,
	daniel.vetter@ffwll.ch, dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org,
	sumit.semwal@linaro.org
Subject: Re: [PATCH 1/9] dma-buf: fix dma_fence_array_signaled
Date: Tue, 27 Aug 2019 12:44:27 +0100	[thread overview]
Message-ID: <156690626744.15406.4672497135424922383@skylake-alporthouse-com> (raw)
In-Reply-To: <20190826145731.1725-2-christian.koenig@amd.com>

Quoting Christian König (2019-08-26 15:57:23)
> The function is supposed to give a hint even if signaling is not enabled.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>  drivers/dma-buf/dma-fence-array.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c
> index d3fbd950be94..52068ee5eb35 100644
> --- a/drivers/dma-buf/dma-fence-array.c
> +++ b/drivers/dma-buf/dma-fence-array.c
> @@ -103,8 +103,18 @@ static bool dma_fence_array_enable_signaling(struct dma_fence *fence)
>  static bool dma_fence_array_signaled(struct dma_fence *fence)
>  {
>         struct dma_fence_array *array = to_dma_fence_array(fence);
> +       int i, num_pending;
>  
> -       return atomic_read(&array->num_pending) <= 0;
> +       num_pending = atomic_read(&array->num_pending);
> +       if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags))
> +               return num_pending <= 0;
> +
> +       for (i = 0; i < array->num_fences; ++i)
> +               if (dma_fence_is_signaled(array->fences[i]) &&
> +                   --num_pending == 0)
> +                       return true;

num_fences may be 0 (it's not rejected in construction and works
currently as a simple always-signaled stub).

	if (!test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags)) {
		for (i = 0; i < array->num_fences; ++i)
			if (dma_fence_is_signaled(array->fences[i]) &&
			    --num_pending == 0)
				break;
	}

	return num_pending <= 0;
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-08-27 11:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26 14:57 Use dma_fence_array for implementing shared dma_resv fences Christian König
2019-08-26 14:57 ` Christian König
2019-08-26 14:57 ` [PATCH 1/9] dma-buf: fix dma_fence_array_signaled Christian König
2019-08-26 14:57   ` Christian König
2019-08-27 11:44   ` Chris Wilson [this message]
2019-08-27 11:44     ` Chris Wilson
2019-08-26 14:57 ` [PATCH 2/9] dma-buf: make to_dma_fence_array NULL safe Christian König
2019-08-26 14:57   ` Christian König
2019-08-30 16:07   ` Ruhl, Michael J
2019-08-30 16:07     ` Ruhl, Michael J
2019-08-26 14:57 ` [PATCH 3/9] dma-buf: add dma_fence_array_alloc/free Christian König
2019-08-26 14:57   ` Christian König
2019-08-26 14:57 ` [PATCH 4/9] dma-buf: add dma_fence_array_recycle v2 Christian König
2019-08-26 14:57   ` Christian König
2019-08-26 14:57 ` [PATCH 5/9] dma-buf: add dma_fence_array_for_each Christian König
2019-08-26 14:57   ` Christian König
2019-08-26 14:57 ` [PATCH 6/9] dma-buf/resv: add dma_resv_prune_fences v2 Christian König
2019-08-26 14:57   ` Christian König
2019-08-26 14:57 ` [PATCH 7/9] dma-buf/resv: add new fences container implementation Christian König
2019-08-26 14:57   ` Christian König
2019-08-26 14:57 ` [PATCH 8/9] dma-buf/resv: use new dma_fence_array based implementation Christian König
2019-08-26 14:57   ` Christian König
2019-08-26 14:57 ` [PATCH 9/9] dma-buf/resv: drop the sequence count Christian König
2019-08-26 14:57   ` Christian König
2019-08-27 16:37 ` Use dma_fence_array for implementing shared dma_resv fences Daniel Vetter
2019-08-27 16:37   ` 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=156690626744.15406.4672497135424922383@skylake-alporthouse-com \
    --to=chris@chris-wilson.co.uk \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-media@vger.kernel.org \
    --cc=sumit.semwal@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.