dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: zhoucm1 <david1.zhou@amd.com>
To: Gustavo Padovan <gustavo@padovan.org>, dri-devel@lists.freedesktop.org
Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Subject: Re: [PATCH] dma-buf/fence-array: get signaled state when signaling is disabled
Date: Thu, 22 Sep 2016 09:59:23 +0800	[thread overview]
Message-ID: <57E33AFB.4040301@amd.com> (raw)
In-Reply-To: <1474457767-26195-1-git-send-email-gustavo@padovan.org>



On 2016年09月21日 19:36, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
> If the fences in the fence_array signal on the fence_array does not have
> signalling enabled num_pending will not be updated accordingly.
>
> So when signaling is disabled check the signal of every fence with
> fence_is_signaled() and then compare with num_pending to learn if the
> fence_array was signalled or not.
>
> If we want to keep the poll_does_not_wait optimization I think we need
> something like this. It keeps the same behaviour if signalling is enabled
> but tries to calculated the state otherwise.
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>

Regards,
David Zhou
> ---
>   drivers/dma-buf/fence-array.c | 19 ++++++++++++++++++-
>   1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma-buf/fence-array.c b/drivers/dma-buf/fence-array.c
> index f1989fc..1eec271 100644
> --- a/drivers/dma-buf/fence-array.c
> +++ b/drivers/dma-buf/fence-array.c
> @@ -75,8 +75,25 @@ static bool fence_array_enable_signaling(struct fence *fence)
>   static bool fence_array_signaled(struct fence *fence)
>   {
>   	struct fence_array *array = to_fence_array(fence);
> +	int i, num_pending;
> +
> +	num_pending = atomic_read(&array->num_pending);
> +
> +	/*
> +	 * Before signaling is enabled, num_pending is static (set during array
> +	 * construction as a count of all fences or set to 1 if signal_on_any
> +	 * flag is passed. To ensure forward progress, i.e. a while
> +	 * (!fence_is_signaled()) ; busy-loop eventually proceeds, we need to
> +	 * check the current status of our fences.
> +	 */
> +	if (!test_bit(FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags)) {
> +		for (i = 0 ; i < array->num_fences; ++i) {
> +			if (fence_is_signaled(array->fences[i]))
> +				num_pending--;
> +		}
> +	}
>   
> -	return atomic_read(&array->num_pending) <= 0;
> +	return num_pending <= 0;
>   }
>   
>   static void fence_array_release(struct fence *fence)

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      parent reply	other threads:[~2016-09-22 14:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21 11:36 [PATCH] dma-buf/fence-array: get signaled state when signaling is disabled Gustavo Padovan
2016-09-21 18:47 ` Christian König
2016-09-22  7:44   ` Gustavo Padovan
2016-09-22  8:05     ` Christian König
2016-09-22 10:40       ` Gustavo Padovan
2016-09-22 11:00         ` Christian König
2016-09-22 11:16           ` Gustavo Padovan
2016-09-22 14:11             ` Christian König
2016-09-22 14:12               ` Christian König
2016-09-23 11:30               ` Gustavo Padovan
2016-09-23 13:47                 ` Christian König
2016-09-25 20:43                   ` Gustavo Padovan
2016-09-26  7:22                     ` Chris Wilson
2016-09-22  1:59 ` zhoucm1 [this message]

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=57E33AFB.4040301@amd.com \
    --to=david1.zhou@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=gustavo@padovan.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;
as well as URLs for NNTP newsgroup(s).