public inbox for amd-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Chunming Zhou <david1.zhou-5C7GfCeVMHo@public.gmane.org>,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 2/3] drm: add support of syncobj timeline point wait
Date: Thu, 6 Sep 2018 09:27:45 +0200	[thread overview]
Message-ID: <4208875e-cf4a-0dbe-802e-0d22aa88d36e@gmail.com> (raw)
In-Reply-To: <20180906062523.16542-2-david1.zhou-5C7GfCeVMHo@public.gmane.org>

Am 06.09.2018 um 08:25 schrieb Chunming Zhou:
> points array is one-to-one match with syncobjs array.
>
> Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
> ---
>   drivers/gpu/drm/drm_syncobj.c | 23 ++++++++++++++++++++---
>   include/uapi/drm/drm.h        |  2 ++
>   2 files changed, 22 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
> index 94b31de23858..4e43c62ab432 100644
> --- a/drivers/gpu/drm/drm_syncobj.c
> +++ b/drivers/gpu/drm/drm_syncobj.c
> @@ -1000,6 +1000,7 @@ static void syncobj_wait_fence_func(struct dma_fence *fence,
>   }
>   
>   static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,
> +						  void __user *user_points,
>   						  uint32_t count,
>   						  uint32_t flags,
>   						  signed long timeout,
> @@ -1007,13 +1008,25 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,
>   {
>   	struct syncobj_wait_entry *entries;
>   	struct dma_fence *fence;
> +	uint64_t *points;
>   	signed long ret;
>   	uint32_t signaled_count, i;
>   
> -	entries = kcalloc(count, sizeof(*entries), GFP_KERNEL);
> -	if (!entries)
> +	points = kmalloc_array(count, sizeof(*points), GFP_KERNEL);
> +	if (points == NULL)
>   		return -ENOMEM;
>   
> +	if (copy_from_user(points, user_points, sizeof(uint64_t) * count)) {
> +		ret = -EFAULT;
> +		goto err_free_points;
> +	}
> +
> +
> +	entries = kcalloc(count, sizeof(*entries), GFP_KERNEL);
> +	if (!entries) {
> +		ret = -ENOMEM;
> +		goto err_free_points;
> +	}
>   	/* Walk the list of sync objects and initialize entries.  We do
>   	 * this up-front so that we can properly return -EINVAL if there is
>   	 * a syncobj with a missing fence and then never have the chance of
> @@ -1022,7 +1035,7 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,
>   	signaled_count = 0;
>   	for (i = 0; i < count; ++i) {
>   		entries[i].task = current;
> -		ret = drm_syncobj_search_fence(syncobjs[i], 0, 0,
> +		ret = drm_syncobj_search_fence(syncobjs[i], points[i], 0,
>   					       &entries[i].fence);
>   		if (!entries[i].fence) {
>   			ret = -EINVAL;
> @@ -1108,6 +1121,9 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,
>   	}
>   	kfree(entries);
>   
> +err_free_points:
> +	kfree(points);
> +
>   	return ret;
>   }
>   
> @@ -1153,6 +1169,7 @@ static int drm_syncobj_array_wait(struct drm_device *dev,
>   	uint32_t first = ~0;
>   
>   	ret = drm_syncobj_array_wait_timeout(syncobjs,
> +					     u64_to_user_ptr(wait->points),
>   					     wait->count_handles,
>   					     wait->flags,
>   					     timeout, &first);
> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
> index cebdb2541eb7..4420c7604690 100644
> --- a/include/uapi/drm/drm.h
> +++ b/include/uapi/drm/drm.h
> @@ -740,6 +740,8 @@ struct drm_syncobj_handle {
>   #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)
>   struct drm_syncobj_wait {
>   	__u64 handles;
> +	/* wait on specific timeline point for every handles*/
> +	__u64 points;

That would break UAPI and isn't allowed like this.

You need to add a new operation to wait for multiple sync objects and 
their sequence number or add a flag or something like this here.

Regards,
Christian.

>   	/* absolute timeout */
>   	__s64 timeout_nsec;
>   	__u32 count_handles;

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2018-09-06  7:27 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-06  6:25 [PATCH 1/3] [RFC]drm: add syncobj timeline support v4 Chunming Zhou
2018-09-06  6:25 ` [PATCH 2/3] drm: add support of syncobj timeline point wait Chunming Zhou
     [not found]   ` <20180906062523.16542-2-david1.zhou-5C7GfCeVMHo@public.gmane.org>
2018-09-06  7:27     ` Christian König [this message]
     [not found] ` <20180906062523.16542-1-david1.zhou-5C7GfCeVMHo@public.gmane.org>
2018-09-06  6:25   ` [PATCH 3/3] drm: add timeline syncobj payload query ioctl Chunming Zhou
2018-09-06  7:25   ` [PATCH 1/3] [RFC]drm: add syncobj timeline support v4 Christian König
     [not found]     ` <4374aa17-c659-0c22-a487-c5e236690108-5C7GfCeVMHo@public.gmane.org>
2018-09-12  7:22       ` Christian König
     [not found]         ` <b69c0d93-5e46-fc25-2545-e2e1de18295e-5C7GfCeVMHo@public.gmane.org>
2018-09-12 10:20           ` zhoucm1
     [not found]             ` <e90fbb9b-f201-9887-c722-fa91c300441b-5C7GfCeVMHo@public.gmane.org>
2018-09-12 11:05               ` Christian König
     [not found]                 ` <7117b33b-c24f-6cb5-5372-143385f7a7b5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-09-13  2:15                   ` zhoucm1
2018-09-13  6:55                     ` Christian König
     [not found]                       ` <6879599a-0270-3eae-f8a2-1efc154159bb-5C7GfCeVMHo@public.gmane.org>
2018-09-13  7:43                         ` Zhou, David(ChunMing)
     [not found]                           ` <BY1PR12MB0502C7E29899EBF4B0379B0BB41A0-PicGAnIBOobrCwm+z9iKNgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-09-13  8:50                             ` Christian König
     [not found]                               ` <ead45230-65dd-ecd8-5153-8312dd2a9480-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-09-13  9:11                                 ` Zhou, David(ChunMing)
     [not found]                                   ` <BY1PR12MB0502DD202E93FFAD340FE931B41A0-PicGAnIBOobrCwm+z9iKNgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-09-13  9:20                                     ` Christian König
     [not found]                                       ` <54f6a4e6-36e1-fb6d-967a-81a105ea271d-5C7GfCeVMHo@public.gmane.org>
2018-09-13  9:35                                         ` Zhou, David(ChunMing)
     [not found]                                           ` <BY1PR12MB05020A2E66D19438D4069CFCB41A0-PicGAnIBOobrCwm+z9iKNgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-09-13 10:22                                             ` Christian König
     [not found]                                               ` <c077c499-dcad-2545-d918-75f13a1d3a14-5C7GfCeVMHo@public.gmane.org>
2018-09-14  3:14                                                 ` zhoucm1
     [not found]                                                   ` <a47d925d-c37f-d60c-db8d-dfb4ea570dca-5C7GfCeVMHo@public.gmane.org>
2018-09-14  3:59                                                     ` zhoucm1
2018-09-14  7:26                                                       ` Christian König
2018-09-14  7:46                                                         ` Zhou, David(ChunMing)
     [not found]                                                           ` <BY1PR12MB050245C96DE62338FB349AE5B4190-PicGAnIBOobrCwm+z9iKNgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-09-14  7:47                                                             ` 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=4208875e-cf4a-0dbe-802e-0d22aa88d36e@gmail.com \
    --to=ckoenig.leichtzumerken-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=david1.zhou-5C7GfCeVMHo@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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