dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Chunming Zhou <zhoucm1@amd.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 08/10] drm/syncobj: use the timeline point in drm_syncobj_find_fence v3
Date: Tue, 4 Dec 2018 12:47:02 +0000	[thread overview]
Message-ID: <2cb94d85-1ab4-6659-7223-0504fec6908a@amd.com> (raw)
In-Reply-To: <20181204115948.15202-8-christian.koenig@amd.com>



在 2018/12/4 19:59, Christian König 写道:
> Implement finding the right timeline point in drm_syncobj_find_fence.
>
> v2: return -EINVAL when the point is not submitted yet.
> v3: fix reference counting bug, add flags handling as well
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>   drivers/gpu/drm/drm_syncobj.c | 43 ++++++++++++++++++++++++++++++++++++++++---
>   1 file changed, 40 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
> index ee44cf2a8a12..fdbec8cedc3d 100644
> --- a/drivers/gpu/drm/drm_syncobj.c
> +++ b/drivers/gpu/drm/drm_syncobj.c
> @@ -231,16 +231,53 @@ int drm_syncobj_find_fence(struct drm_file *file_private,
>   			   struct dma_fence **fence)
>   {
>   	struct drm_syncobj *syncobj = drm_syncobj_find(file_private, handle);
> -	int ret = 0;
> +	struct syncobj_wait_entry wait;
> +	int ret;
>   
>   	if (!syncobj)
>   		return -ENOENT;
>   
>   	*fence = drm_syncobj_fence_get(syncobj);
> -	if (!*fence) {
> +	drm_syncobj_put(syncobj);
> +
> +	if (*fence) {
> +		ret = dma_fence_chain_find_seqno(fence, point);
> +		if (!ret)
> +			return 0;
> +		dma_fence_put(*fence);
> +	} else {
>   		ret = -EINVAL;
>   	}
> -	drm_syncobj_put(syncobj);
> +
> +	if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))
> +		return ret;
> +
> +	memset(&wait, 0, sizeof(wait));
> +	wait.task = current;
> +	wait.point = point;
> +	drm_syncobj_fence_add_wait(syncobj, &wait);
> +
> +	do {
> +		set_current_state(TASK_INTERRUPTIBLE);
> +		if (wait.fence) {
> +			ret = 0;
> +			break;
> +		}
> +
> +		if (signal_pending(current)) {
> +			ret = -ERESTARTSYS;
> +			break;
> +		}
> +
> +		schedule();
> +	} while (1);
> +
> +	__set_current_state(TASK_RUNNING);
> +	*fence = wait.fence;
> +
> +	if (wait.node.next)

This condition isn't need, which is already in 
drm_syncobj_remove_wait(), with that fix, Reviewed-by: Chunming Zhou 
<david1.zhou@amd.com>

> +		drm_syncobj_remove_wait(syncobj, &wait);
> +
>   	return ret;
>   }
>   EXPORT_SYMBOL(drm_syncobj_find_fence);

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

  reply	other threads:[~2018-12-04 12:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-04 11:59 [PATCH 01/10] dma-buf: make fence sequence numbers 64 bit v2 Christian König
     [not found] ` <20181204115948.15202-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-12-04 11:59   ` [PATCH 02/10] dma-buf: add new dma_fence_chain container v3 Christian König
2018-12-04 12:19     ` Chunming Zhou
2018-12-04 11:59   ` [PATCH 03/10] drm: revert "expand replace_fence to support timeline point v2" Christian König
2018-12-04 12:20     ` Chunming Zhou
2018-12-04 11:59   ` [PATCH 04/10] drm/syncobj: remove drm_syncobj_cb and cleanup Christian König
2018-12-04 12:29     ` Chunming Zhou
2018-12-05 10:00     ` Christian König
2018-12-07 14:20       ` Daniel Vetter
2018-12-07 14:23         ` Christian König
2018-12-04 11:59   ` [PATCH 05/10] drm/syncobj: add new drm_syncobj_add_point interface v2 Christian König
2018-12-04 12:31     ` Chunming Zhou
2018-12-04 11:59   ` [PATCH 07/10] drm/syncobj: add timeline payload query ioctl v4 Christian König
2018-12-04 11:59   ` [PATCH 08/10] drm/syncobj: use the timeline point in drm_syncobj_find_fence v3 Christian König
2018-12-04 12:47     ` Chunming Zhou [this message]
2018-12-04 11:59   ` [PATCH 10/10] drm/amdgpu: update version for timeline syncobj support in amdgpu Christian König
2018-12-04 12:12   ` [PATCH 01/10] dma-buf: make fence sequence numbers 64 bit v2 Chunming Zhou
2018-12-04 12:52   ` Chris Wilson
2018-12-04 12:57     ` Chris Wilson
2018-12-04 11:59 ` [PATCH 06/10] drm/syncobj: add support for timeline point wait v7 Christian König
2018-12-04 11:59 ` [PATCH 09/10] drm/amdgpu: add timeline support in amdgpu CS v2 Christian König

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=2cb94d85-1ab4-6659-7223-0504fec6908a@amd.com \
    --to=zhoucm1@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=dri-devel@lists.freedesktop.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