Re: [PATCH 1/3] drm/syncobj: extract two helpers from drm_syncobj_create
Sorry, this codepath is not tested by radeonsi. Marek On Sun, Oct 1, 2017 at 1:20 AM, Zhou, David(ChunMing) wrote: > Could you test and review it? On hand, I have no env. > > Regards, > David Zhou > > 发自坚果 Pro > > Marek Ol?醟 于 2017年9月30日 下午11:56写道: > > The idea sounds good. > > Marek > > On Sat, Sep 30, 2017 at 3:55 AM, Chunming Zhou wrote: >> My mean is like the attached, I revert part of yours. >> >> Regards, >> >> David zhou >> >> >> >> On 2017年09月29日 22:15, Marek Olšák wrote: >>> >>> On Fri, Sep 29, 2017 at 4:13 PM, Marek Olšák wrote: On Fri, Sep 29, 2017 at 4:44 AM, Chunming Zhou wrote: > > > On 2017年09月13日 04:42, Marek Olšák wrote: >> >> From: Marek Olšák >> >> For amdgpu. >> >> drm_syncobj_create is renamed to drm_syncobj_create_as_handle, and new >> helpers drm_syncobj_create and drm_syncobj_get_handle are added. >> >> Signed-off-by: Marek Olšák >> --- >>drivers/gpu/drm/drm_syncobj.c | 49 >> +++ >>include/drm/drm_syncobj.h | 4 >>2 files changed, 49 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/gpu/drm/drm_syncobj.c >> b/drivers/gpu/drm/drm_syncobj.c >> index 0422b8c..0bb1741 100644 >> --- a/drivers/gpu/drm/drm_syncobj.c >> +++ b/drivers/gpu/drm/drm_syncobj.c >> @@ -262,8 +262,14 @@ void drm_syncobj_free(struct kref *kref) >>} >>EXPORT_SYMBOL(drm_syncobj_free); >>-static int drm_syncobj_create(struct drm_file *file_private, >> - u32 *handle, uint32_t flags) > > You can add a new parameter for passing dma fence, then in patch3, you > can > directly use it for AMDGPU_FENCE_TO HANDLE_GET_SYNCOBJ. > > otherwise the set looks good to me. Sorry I just pushed this. >>> >>> Actually, you commented on a deleted line. The function already has >>> dma_fence among the parameters. >>> >>> Marek >> >> ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3] drm/syncobj: extract two helpers from drm_syncobj_create
Could you test and review it? On hand, I have no env. Regards, David Zhou 发自坚果 Pro Marek Ol?醟 于 2017年9月30日 下午11:56写道: The idea sounds good. Marek On Sat, Sep 30, 2017 at 3:55 AM, Chunming Zhou wrote: > My mean is like the attached, I revert part of yours. > > Regards, > > David zhou > > > > On 2017年09月29日 22:15, Marek Olšák wrote: >> >> On Fri, Sep 29, 2017 at 4:13 PM, Marek Olšák wrote: >>> >>> On Fri, Sep 29, 2017 at 4:44 AM, Chunming Zhou wrote: On 2017年09月13日 04:42, Marek Olšák wrote: > > From: Marek Olšák > > For amdgpu. > > drm_syncobj_create is renamed to drm_syncobj_create_as_handle, and new > helpers drm_syncobj_create and drm_syncobj_get_handle are added. > > Signed-off-by: Marek Olšák > --- >drivers/gpu/drm/drm_syncobj.c | 49 > +++ >include/drm/drm_syncobj.h | 4 >2 files changed, 49 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/drm_syncobj.c > b/drivers/gpu/drm/drm_syncobj.c > index 0422b8c..0bb1741 100644 > --- a/drivers/gpu/drm/drm_syncobj.c > +++ b/drivers/gpu/drm/drm_syncobj.c > @@ -262,8 +262,14 @@ void drm_syncobj_free(struct kref *kref) >} >EXPORT_SYMBOL(drm_syncobj_free); >-static int drm_syncobj_create(struct drm_file *file_private, > - u32 *handle, uint32_t flags) You can add a new parameter for passing dma fence, then in patch3, you can directly use it for AMDGPU_FENCE_TO HANDLE_GET_SYNCOBJ. otherwise the set looks good to me. >>> >>> Sorry I just pushed this. >> >> Actually, you commented on a deleted line. The function already has >> dma_fence among the parameters. >> >> Marek > > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3] drm/syncobj: extract two helpers from drm_syncobj_create
The idea sounds good. Marek On Sat, Sep 30, 2017 at 3:55 AM, Chunming Zhou wrote: > My mean is like the attached, I revert part of yours. > > Regards, > > David zhou > > > > On 2017年09月29日 22:15, Marek Olšák wrote: >> >> On Fri, Sep 29, 2017 at 4:13 PM, Marek Olšák wrote: >>> >>> On Fri, Sep 29, 2017 at 4:44 AM, Chunming Zhou wrote: On 2017年09月13日 04:42, Marek Olšák wrote: > > From: Marek Olšák > > For amdgpu. > > drm_syncobj_create is renamed to drm_syncobj_create_as_handle, and new > helpers drm_syncobj_create and drm_syncobj_get_handle are added. > > Signed-off-by: Marek Olšák > --- >drivers/gpu/drm/drm_syncobj.c | 49 > +++ >include/drm/drm_syncobj.h | 4 >2 files changed, 49 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/drm_syncobj.c > b/drivers/gpu/drm/drm_syncobj.c > index 0422b8c..0bb1741 100644 > --- a/drivers/gpu/drm/drm_syncobj.c > +++ b/drivers/gpu/drm/drm_syncobj.c > @@ -262,8 +262,14 @@ void drm_syncobj_free(struct kref *kref) >} >EXPORT_SYMBOL(drm_syncobj_free); >-static int drm_syncobj_create(struct drm_file *file_private, > - u32 *handle, uint32_t flags) You can add a new parameter for passing dma fence, then in patch3, you can directly use it for AMDGPU_FENCE_TO HANDLE_GET_SYNCOBJ. otherwise the set looks good to me. >>> >>> Sorry I just pushed this. >> >> Actually, you commented on a deleted line. The function already has >> dma_fence among the parameters. >> >> Marek > > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3] drm/syncobj: extract two helpers from drm_syncobj_create
My mean is like the attached, I revert part of yours. Regards, David zhou On 2017年09月29日 22:15, Marek Olšák wrote: On Fri, Sep 29, 2017 at 4:13 PM, Marek Olšák wrote: On Fri, Sep 29, 2017 at 4:44 AM, Chunming Zhou wrote: On 2017年09月13日 04:42, Marek Olšák wrote: From: Marek Olšák For amdgpu. drm_syncobj_create is renamed to drm_syncobj_create_as_handle, and new helpers drm_syncobj_create and drm_syncobj_get_handle are added. Signed-off-by: Marek Olšák --- drivers/gpu/drm/drm_syncobj.c | 49 +++ include/drm/drm_syncobj.h | 4 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index 0422b8c..0bb1741 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -262,8 +262,14 @@ void drm_syncobj_free(struct kref *kref) } EXPORT_SYMBOL(drm_syncobj_free); -static int drm_syncobj_create(struct drm_file *file_private, - u32 *handle, uint32_t flags) You can add a new parameter for passing dma fence, then in patch3, you can directly use it for AMDGPU_FENCE_TO HANDLE_GET_SYNCOBJ. otherwise the set looks good to me. Sorry I just pushed this. Actually, you commented on a deleted line. The function already has dma_fence among the parameters. Marek >From a34c466f4a8617c18bf191d83bff3a3382166b00 Mon Sep 17 00:00:00 2001 From: Chunming Zhou Date: Sat, 30 Sep 2017 09:53:53 +0800 Subject: [PATCH] drm: Don't split drm_syncobj_create Change-Id: Icc6e4d8e94236675d6267d211e53698834d29869 Signed-off-by: Chunming Zhou --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 + drivers/gpu/drm/drm_syncobj.c | 42 +- include/drm/drm_syncobj.h | 7 +++--- 3 files changed, 10 insertions(+), 45 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index ab83dfc..882becc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -1351,14 +1351,10 @@ int amdgpu_cs_fence_to_handle_ioctl(struct drm_device *dev, void *data, switch (info->in.what) { case AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ: - r = drm_syncobj_create(&syncobj, 0, fence); + r = drm_syncobj_create(filp, fence, &info->out.handle, 0); dma_fence_put(fence); if (r) return r; - r = drm_syncobj_get_handle(filp, syncobj, &info->out.handle); - drm_syncobj_put(syncobj); - return r; - case AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ_FD: r = drm_syncobj_create(&syncobj, 0, fence); dma_fence_put(fence); diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index 62adc7a..28e1463 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -268,8 +268,9 @@ EXPORT_SYMBOL(drm_syncobj_free); * @flags: DRM_SYNCOBJ_* flags * @fence: if non-NULL, the syncobj will represent this fence */ -int drm_syncobj_create(struct drm_syncobj **out_syncobj, uint32_t flags, - struct dma_fence *fence) +int drm_syncobj_create(struct drm_file *file_private, + struct dma_fence *fence, + u32 *handle, uint32_t flags) { int ret; struct drm_syncobj *syncobj; @@ -293,22 +294,6 @@ int drm_syncobj_create(struct drm_syncobj **out_syncobj, uint32_t flags, if (fence) drm_syncobj_replace_fence(syncobj, fence); - *out_syncobj = syncobj; - return 0; -} -EXPORT_SYMBOL(drm_syncobj_create); - -/** - * drm_syncobj_get_handle - get a handle from a syncobj - */ -int drm_syncobj_get_handle(struct drm_file *file_private, - struct drm_syncobj *syncobj, u32 *handle) -{ - int ret; - - /* take a reference to put in the idr */ - drm_syncobj_get(syncobj); - idr_preload(GFP_KERNEL); spin_lock(&file_private->syncobj_table_lock); ret = idr_alloc(&file_private->syncobj_idr, syncobj, 1, 0, GFP_NOWAIT); @@ -324,22 +309,7 @@ int drm_syncobj_get_handle(struct drm_file *file_private, *handle = ret; return 0; } -EXPORT_SYMBOL(drm_syncobj_get_handle); - -static int drm_syncobj_create_as_handle(struct drm_file *file_private, - u32 *handle, uint32_t flags) -{ - int ret; - struct drm_syncobj *syncobj; - - ret = drm_syncobj_create(&syncobj, flags, NULL); - if (ret) - return ret; - - ret = drm_syncobj_get_handle(file_private, syncobj, handle); - drm_syncobj_put(syncobj); - return ret; -} +EXPORT_SYMBOL(drm_syncobj_create); static int drm_syncobj_destroy(struct drm_file *file_private, u32 handle) @@ -568,8 +538,8 @@ drm_syncobj_create_ioctl(struct drm_device *dev, void *data, if (args->flags & ~DRM_SYNCOBJ_CREATE_SIGNALED) return -EINVAL; - return drm_syncobj_create_as_handle(file_private, - &args->handle, args->flags); + return drm_syncobj_create(file_private, NULL, + &args->handle, args->flags); } int diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h index 43e2f38..4e3025e 100644 --- a/include/drm/drm_syncobj.h +++ b/include/dr
Re: [PATCH 1/3] drm/syncobj: extract two helpers from drm_syncobj_create
On Fri, Sep 29, 2017 at 4:13 PM, Marek Olšák wrote: > On Fri, Sep 29, 2017 at 4:44 AM, Chunming Zhou wrote: >> >> >> On 2017年09月13日 04:42, Marek Olšák wrote: >>> >>> From: Marek Olšák >>> >>> For amdgpu. >>> >>> drm_syncobj_create is renamed to drm_syncobj_create_as_handle, and new >>> helpers drm_syncobj_create and drm_syncobj_get_handle are added. >>> >>> Signed-off-by: Marek Olšák >>> --- >>> drivers/gpu/drm/drm_syncobj.c | 49 >>> +++ >>> include/drm/drm_syncobj.h | 4 >>> 2 files changed, 49 insertions(+), 4 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c >>> index 0422b8c..0bb1741 100644 >>> --- a/drivers/gpu/drm/drm_syncobj.c >>> +++ b/drivers/gpu/drm/drm_syncobj.c >>> @@ -262,8 +262,14 @@ void drm_syncobj_free(struct kref *kref) >>> } >>> EXPORT_SYMBOL(drm_syncobj_free); >>> -static int drm_syncobj_create(struct drm_file *file_private, >>> - u32 *handle, uint32_t flags) >> >> You can add a new parameter for passing dma fence, then in patch3, you can >> directly use it for AMDGPU_FENCE_TO HANDLE_GET_SYNCOBJ. >> >> otherwise the set looks good to me. > > Sorry I just pushed this. Actually, you commented on a deleted line. The function already has dma_fence among the parameters. Marek ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3] drm/syncobj: extract two helpers from drm_syncobj_create
On Fri, Sep 29, 2017 at 4:44 AM, Chunming Zhou wrote: > > > On 2017年09月13日 04:42, Marek Olšák wrote: >> >> From: Marek Olšák >> >> For amdgpu. >> >> drm_syncobj_create is renamed to drm_syncobj_create_as_handle, and new >> helpers drm_syncobj_create and drm_syncobj_get_handle are added. >> >> Signed-off-by: Marek Olšák >> --- >> drivers/gpu/drm/drm_syncobj.c | 49 >> +++ >> include/drm/drm_syncobj.h | 4 >> 2 files changed, 49 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c >> index 0422b8c..0bb1741 100644 >> --- a/drivers/gpu/drm/drm_syncobj.c >> +++ b/drivers/gpu/drm/drm_syncobj.c >> @@ -262,8 +262,14 @@ void drm_syncobj_free(struct kref *kref) >> } >> EXPORT_SYMBOL(drm_syncobj_free); >> -static int drm_syncobj_create(struct drm_file *file_private, >> - u32 *handle, uint32_t flags) > > You can add a new parameter for passing dma fence, then in patch3, you can > directly use it for AMDGPU_FENCE_TO HANDLE_GET_SYNCOBJ. > > otherwise the set looks good to me. Sorry I just pushed this. Marek ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3] drm/syncobj: extract two helpers from drm_syncobj_create
On 2017年09月13日 04:42, Marek Olšák wrote: From: Marek Olšák For amdgpu. drm_syncobj_create is renamed to drm_syncobj_create_as_handle, and new helpers drm_syncobj_create and drm_syncobj_get_handle are added. Signed-off-by: Marek Olšák --- drivers/gpu/drm/drm_syncobj.c | 49 +++ include/drm/drm_syncobj.h | 4 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c index 0422b8c..0bb1741 100644 --- a/drivers/gpu/drm/drm_syncobj.c +++ b/drivers/gpu/drm/drm_syncobj.c @@ -262,8 +262,14 @@ void drm_syncobj_free(struct kref *kref) } EXPORT_SYMBOL(drm_syncobj_free); -static int drm_syncobj_create(struct drm_file *file_private, - u32 *handle, uint32_t flags) You can add a new parameter for passing dma fence, then in patch3, you can directly use it for AMDGPU_FENCE_TO HANDLE_GET_SYNCOBJ. otherwise the set looks good to me. Regards, David Zhou +/** + * drm_syncobj_create - create a new syncobj + * @out_syncobj: returned syncobj + * @flags: DRM_SYNCOBJ_* flags + * @fence: if non-NULL, the syncobj will represent this fence + */ +int drm_syncobj_create(struct drm_syncobj **out_syncobj, uint32_t flags, + struct dma_fence *fence) { int ret; struct drm_syncobj *syncobj; @@ -284,6 +290,25 @@ static int drm_syncobj_create(struct drm_file *file_private, } } + if (fence) + drm_syncobj_replace_fence(syncobj, fence); + + *out_syncobj = syncobj; + return 0; +} +EXPORT_SYMBOL(drm_syncobj_create); + +/** + * drm_syncobj_get_handle - get a handle from a syncobj + */ +int drm_syncobj_get_handle(struct drm_file *file_private, + struct drm_syncobj *syncobj, u32 *handle) +{ + int ret; + + /* take a reference to put in the idr */ + drm_syncobj_get(syncobj); + idr_preload(GFP_KERNEL); spin_lock(&file_private->syncobj_table_lock); ret = idr_alloc(&file_private->syncobj_idr, syncobj, 1, 0, GFP_NOWAIT); @@ -299,6 +324,22 @@ static int drm_syncobj_create(struct drm_file *file_private, *handle = ret; return 0; } +EXPORT_SYMBOL(drm_syncobj_get_handle); + +static int drm_syncobj_create_as_handle(struct drm_file *file_private, + u32 *handle, uint32_t flags) +{ + int ret; + struct drm_syncobj *syncobj; + + ret = drm_syncobj_create(&syncobj, flags, NULL); + if (ret) + return ret; + + ret = drm_syncobj_get_handle(file_private, syncobj, handle); + drm_syncobj_put(syncobj); + return ret; +} static int drm_syncobj_destroy(struct drm_file *file_private, u32 handle) @@ -522,8 +563,8 @@ drm_syncobj_create_ioctl(struct drm_device *dev, void *data, if (args->flags & ~DRM_SYNCOBJ_CREATE_SIGNALED) return -EINVAL; - return drm_syncobj_create(file_private, - &args->handle, args->flags); + return drm_syncobj_create_as_handle(file_private, + &args->handle, args->flags); } int diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h index c00fee5..e7f0035 100644 --- a/include/drm/drm_syncobj.h +++ b/include/drm/drm_syncobj.h @@ -136,5 +136,9 @@ int drm_syncobj_find_fence(struct drm_file *file_private, u32 handle, struct dma_fence **fence); void drm_syncobj_free(struct kref *kref); +int drm_syncobj_create(struct drm_syncobj **out_syncobj, uint32_t flags, + struct dma_fence *fence); +int drm_syncobj_get_handle(struct drm_file *file_private, + struct drm_syncobj *syncobj, u32 *handle); #endif ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3] drm/syncobj: extract two helpers from drm_syncobj_create
On Thu, Sep 14, 2017 at 10:01 AM, Emil Velikov wrote: > On 14 September 2017 at 08:56, Emil Velikov wrote: >> Hi Marek, >> >> On 12 September 2017 at 21:42, Marek Olšák wrote: >> >>> include/drm/drm_syncobj.h | 4 >> Please sync the header as described in >> https://cgit.freedesktop.org/mesa/drm/tree/include/drm/README#n72 >> >> Tl;DR: cd .../linux; make headers_install; cp ... .../drm/include/drm; >> cd .../drm; git commit -sm " $branch $sha1..." >> > Seems like I've replied to the wrong patch - silly me. > This was meant for the libdrm ones - suggestion still applies though. I actually did that, but I'm on amd-staging-drm-next. Marek ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3] drm/syncobj: extract two helpers from drm_syncobj_create
On 14 September 2017 at 08:56, Emil Velikov wrote: > Hi Marek, > > On 12 September 2017 at 21:42, Marek Olšák wrote: > >> include/drm/drm_syncobj.h | 4 > Please sync the header as described in > https://cgit.freedesktop.org/mesa/drm/tree/include/drm/README#n72 > > Tl;DR: cd .../linux; make headers_install; cp ... .../drm/include/drm; > cd .../drm; git commit -sm " $branch $sha1..." > Seems like I've replied to the wrong patch - silly me. This was meant for the libdrm ones - suggestion still applies though. -Emil ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3] drm/syncobj: extract two helpers from drm_syncobj_create
Hi Marek, On 12 September 2017 at 21:42, Marek Olšák wrote: > include/drm/drm_syncobj.h | 4 Please sync the header as described in https://cgit.freedesktop.org/mesa/drm/tree/include/drm/README#n72 Tl;DR: cd .../linux; make headers_install; cp ... .../drm/include/drm; cd .../drm; git commit -sm " $branch $sha1..." Thank you Emil ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel