dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
To: "Koenig, Christian" <Christian.Koenig@amd.com>,
	"Zhou, David(ChunMing)" <David1.Zhou@amd.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm/syncobj: extend syncobj query ability v3
Date: Tue, 30 Jul 2019 16:25:50 +0300	[thread overview]
Message-ID: <de312471-e776-5ab0-1491-586f9c23f951@intel.com> (raw)
In-Reply-To: <cfd2ad24-9210-0ba6-bc36-7cc44ac92112@amd.com>

On 30/07/2019 16:17, Koenig, Christian wrote:
> Am 30.07.19 um 15:02 schrieb Chunming Zhou:
>> user space needs a flexiable query ability.
>> So that umd can get last signaled or submitted point.
>> v2:
>> add sanitizer checking.
>> v3:
>> rebase
>>
>> Change-Id: I6512b430524ebabe715e602a2bf5abb0a7e780ea
>> Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
>> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
>> Cc: Christian König <Christian.Koenig@amd.com>
>> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Reviewed-by: Christian König <cristian.koenig@amd.com>
>
> Lionel is the Intel code using this already public? Or David any chance
> that we can get a public amdvlk release using this?
>
> Christian.


The Khronos specification for timeline semaphore isn't public yet 
unfortunately, which is blocking the release of code associated with the 
whole timeline stuff.

We also have no use for this feature currently in the Anv driver.


-Lionel


>
>> ---
>>    drivers/gpu/drm/drm_syncobj.c | 37 +++++++++++++++++++++--------------
>>    include/uapi/drm/drm.h        |  3 ++-
>>    2 files changed, 24 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
>> index cecff2e447b1..d4432f1513ac 100644
>> --- a/drivers/gpu/drm/drm_syncobj.c
>> +++ b/drivers/gpu/drm/drm_syncobj.c
>> @@ -1197,7 +1197,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data,
>>    	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
>>    		return -EOPNOTSUPP;
>>    
>> -	if (args->pad != 0)
>> +	if (args->flags != 0)
>>    		return -EINVAL;
>>    
>>    	if (args->count_handles == 0)
>> @@ -1268,7 +1268,7 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
>>    	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE))
>>    		return -EOPNOTSUPP;
>>    
>> -	if (args->pad != 0)
>> +	if (args->flags & ~DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED)
>>    		return -EINVAL;
>>    
>>    	if (args->count_handles == 0)
>> @@ -1289,25 +1289,32 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
>>    		fence = drm_syncobj_fence_get(syncobjs[i]);
>>    		chain = to_dma_fence_chain(fence);
>>    		if (chain) {
>> -			struct dma_fence *iter, *last_signaled = NULL;
>> -
>> -			dma_fence_chain_for_each(iter, fence) {
>> -				if (iter->context != fence->context) {
>> -					dma_fence_put(iter);
>> -					/* It is most likely that timeline has
>> -					 * unorder points. */
>> -					break;
>> +			struct dma_fence *iter, *last_signaled =
>> +				dma_fence_get(fence);
>> +
>> +			if (args->flags &
>> +			    DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED) {
>> +				point = fence->seqno;
>> +			} else {
>> +				dma_fence_chain_for_each(iter, fence) {
>> +					if (iter->context != fence->context) {
>> +						dma_fence_put(iter);
>> +						/* It is most likely that timeline has
>> +						* unorder points. */
>> +						break;
>> +					}
>> +					dma_fence_put(last_signaled);
>> +					last_signaled = dma_fence_get(iter);
>>    				}
>> -				dma_fence_put(last_signaled);
>> -				last_signaled = dma_fence_get(iter);
>> +				point = dma_fence_is_signaled(last_signaled) ?
>> +					last_signaled->seqno :
>> +					to_dma_fence_chain(last_signaled)->prev_seqno;
>>    			}
>> -			point = dma_fence_is_signaled(last_signaled) ?
>> -				last_signaled->seqno :
>> -				to_dma_fence_chain(last_signaled)->prev_seqno;
>>    			dma_fence_put(last_signaled);
>>    		} else {
>>    			point = 0;
>>    		}
>> +		dma_fence_put(fence);
>>    		ret = copy_to_user(&points[i], &point, sizeof(uint64_t));
>>    		ret = ret ? -EFAULT : 0;
>>    		if (ret)
>> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
>> index 661d73f9a919..fd987ce24d9f 100644
>> --- a/include/uapi/drm/drm.h
>> +++ b/include/uapi/drm/drm.h
>> @@ -777,11 +777,12 @@ struct drm_syncobj_array {
>>    	__u32 pad;
>>    };
>>    
>> +#define DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED (1 << 0) /* last available point on timeline syncobj */
>>    struct drm_syncobj_timeline_array {
>>    	__u64 handles;
>>    	__u64 points;
>>    	__u32 count_handles;
>> -	__u32 pad;
>> +	__u32 flags;
>>    };
>>    
>>    


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

      parent reply	other threads:[~2019-07-30 13:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-30 13:02 [PATCH] drm/syncobj: extend syncobj query ability v3 Chunming Zhou
2019-07-30 13:17 ` Koenig, Christian
2019-07-30 13:22   ` Chunming Zhou
2019-10-23 20:21     ` Sean Paul
2019-10-24 11:48       ` Daniel Vetter
2019-10-24 11:48         ` Daniel Vetter
2019-10-24 13:19       ` Chunming Zhou
2019-07-30 13:25   ` Lionel Landwerlin [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=de312471-e776-5ab0-1491-586f9c23f951@intel.com \
    --to=lionel.g.landwerlin@intel.com \
    --cc=Christian.Koenig@amd.com \
    --cc=David1.Zhou@amd.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