dma-buf: add new dma_fence_chain container v7
Subsystems (5)
PATCH 1/9 dma-buf: add new dma_fence_chain container v7
From: Christian König <[email protected]>
Lockless container implementation similar to a dma_fence_array, but with only two elements per node and automatic garbage collection.
v2: properly document dma_fence_chain_for_each, add dma_fence_chain_find_seqno,
drop prev reference during garbage collection if it's not a chain fence.
v3: use head and iterator for dma_fence_chain_for_each
v4: fix reference count in dma_fence_chain_enable_signaling
v5: fix iteration when walking each chain node
v6: add __rcu for member 'prev' of struct chain node
v7: fix rcu warnings from kernel robot
--- drivers/dma-buf/Makefile | 3 +- drivers/dma-buf/dma-fence-chain.c | 241 ++++++++++++++++++++++++++++++ include/linux/dma-fence-chain.h | 81 ++++++++++ 3 files changed, 324 insertions(+), 1 deletion(-) create mode 100644 drivers/dma-buf/dma-fence-chain.c create mode 100644 include/linux/dma-fence-chain.h
drivers/dma-buf/Makefile +2 -1
@@ -1,4 +1,5 @@ -obj-y := dma-buf.o dma-fence.o dma-fence-array.o reservation.o seqno-fence.o +obj-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \ + reservation.o seqno-fence.o obj-$(CONFIG_SYNC_FILE) += sync_file.o obj-$(CONFIG_SW_SYNC) += sw_sync.o sync_debug.o obj-$(CONFIG_UDMABUF) += udmabuf.o
drivers/dma-buf/dma-fence-chain.c new file +241 -0
241 lines not on this page · raw message
include/linux/dma-fence-chain.h new file +81 -0
81 lines not on this page · raw message
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/9 drm/syncobj: add new drm_syncobj_add_point interface v4
From: Christian König <[email protected]>
Use the dma_fence_chain object to create a timeline of fence objects instead of just replacing the existing fence.
v2: rebase and cleanup
v3: fix garbage collection parameters
v4: add unorder point check, print a warn calltrace
--- drivers/gpu/drm/drm_syncobj.c | 39 +++++++++++++++++++++++++++++++++++ include/drm/drm_syncobj.h | 5 +++++ 2 files changed, 44 insertions(+)
drivers/gpu/drm/drm_syncobj.c +39 -0
@@ -122,6 +122,45 @@ static void drm_syncobj_remove_wait(struct drm_syncobj *syncobj,spin_unlock (&syncobj->lock); } +/** +* drm_syncobj_add_point - add new timeline point to the syncobj +* @syncobj: sync object to add timeline point do +* @chain: chain node to use to add the point +* @fence: fence to encapsulate in the chain node +* @point: sequence number to use for the point +* +* Add the chain node as new timeline point to the syncobj. +*/ +void drm_syncobj_add_point (struct drm_syncobj *syncobj, +struct dma_fence_chain *chain, +struct dma_fence *fence, +uint64_t point) +{ +struct syncobj_wait_entry *cur, *tmp; +struct dma_fence *prev; + +dma_fence_get (fence); + +spin_lock (&syncobj->lock); + + prev =drm_syncobj_fence_get (syncobj); +/* You are adding an unorder point to timeline, which could cause payload returned from query_ioctl is 0! */ +WARN_ON_ONCE (prev && prev->seqno >= point); +dma_fence_chain_init (chain, prev, fence, point); +rcu_assign_pointer (syncobj->fence, &chain->base); + +list_for_each_entry_safe (cur, tmp, &syncobj->cb_list, node) { +list_del_init (&cur->node); +syncobj_wait_syncobj_func (syncobj, cur); + } +spin_unlock (&syncobj->lock); + +/* Walk the chain once to trigger garbage collection */ +dma_fence_chain_for_each (fence, prev); +dma_fence_put (prev); +} +EXPORT_SYMBOL (drm_syncobj_add_point); +/** * drm_syncobj_replace_fence - replace fence in a sync object. * @syncobj: Sync object to replace fence in
include/drm/drm_syncobj.h +5 -0
@@ -27,6 +27,7 @@#define __DRM_SYNCOBJ_H__#include <linux/dma-fence.h> +#include <linux/dma-fence-chain.h> struct drm_file ;
@@ -112,6 +113,10 @@ drm_syncobj_fence_get(struct drm_syncobj *syncobj)struct drm_syncobj *drm_syncobj_find (struct drm_file *file_private,u32 handle); +void drm_syncobj_add_point (struct drm_syncobj *syncobj, +struct dma_fence_chain *chain, +struct dma_fence *fence, +uint64_t point);void drm_syncobj_replace_fence (struct drm_syncobj *syncobj,struct dma_fence *fence); int drm_syncobj_find_fence(struct drm_file *file_private,
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 2/9] drm/syncobj: add new drm_syncobj_add_point interface v4
Quoted 38 lines · Chunming Zhou
From: Christian König <[email protected]>
Use the
dma_fence_chainobject to create a timeline of fence objects instead of just replacing the existing fence.v2: rebase and cleanup
v3: fix garbage collection parameters
v4: add unorder point check, print a warn calltraceSigned-off-by Christian König <[email protected]>Cc Lionel Landwerlin <[email protected]>--- drivers/gpu/drm/drm_syncobj.c | 39 +++++++++++++++++++++++++++++++++++ include/drm/drm_syncobj.h | 5 +++++ 2 files changed, 44 insertions(+)drivers/gpu/drm/drm_syncobj.c +14
-0@@ -122,6 +122,45 @@ static void drm_syncobj_remove_wait(struct drm_syncobj *syncobj,spin_unlock (&syncobj->lock); } +/** +* drm_syncobj_add_point - add new timeline point to the syncobj +* @syncobj: sync object to add timeline point do +* @chain: chain node to use to add the point +* @fence: fence to encapsulate in the chain node +* @point: sequence number to use for the point +* +* Add the chain node as new timeline point to the syncobj. +*/ +void drm_syncobj_add_point (struct drm_syncobj *syncobj, +struct dma_fence_chain *chain, +struct dma_fence *fence, +uint64_t point) +{
drivers/gpu/drm/drm_syncobj.c static void drm_syncobj_remove_wait(struct drm_syncobj *syncobj, · line 148
Quoted 10 lines
drivers/gpu/drm/drm_syncobj.c +10
-0+struct syncobj_wait_entry *cur, *tmp; +struct dma_fence *prev; + +dma_fence_get (fence); + +spin_lock (&syncobj->lock); + + prev =drm_syncobj_fence_get (syncobj); +/* You are adding an unorder point to timeline, which could cause payload returned from query_ioctl is 0! */ +WARN_ON_ONCE (prev && prev->seqno >= point);
I think the WARN/BUG macros should only fire when there is an issue with programming from within the kernel.
But this particular warning can be triggered by an application.
Probably best to just remove it?
-Lionel
Quoted 31 lines
drivers/gpu/drm/drm_syncobj.c +15
-0+dma_fence_chain_init (chain, prev, fence, point); +rcu_assign_pointer (syncobj->fence, &chain->base); + +list_for_each_entry_safe (cur, tmp, &syncobj->cb_list, node) { +list_del_init (&cur->node); +syncobj_wait_syncobj_func (syncobj, cur); + } +spin_unlock (&syncobj->lock); + +/* Walk the chain once to trigger garbage collection */ +dma_fence_chain_for_each (fence, prev); +dma_fence_put (prev); +} +EXPORT_SYMBOL (drm_syncobj_add_point); +/** * drm_syncobj_replace_fence - replace fence in a sync object. * @syncobj: Sync object to replace fence in include/drm/drm_syncobj.h +1
-0@@ -27,6 +27,7 @@#define __DRM_SYNCOBJ_H__#include <linux/dma-fence.h> +#include <linux/dma-fence-chain.h> struct drm_file ;
include/drm/drm_syncobj.h drm_syncobj_fence_get(struct drm_syncobj *syncobj) · line 122
Quoted 10 lines
include/drm/drm_syncobj.h +4
-0@@ -112,6 +113,10 @@ drm_syncobj_fence_get(struct drm_syncobj *syncobj)struct drm_syncobj *drm_syncobj_find (struct drm_file *file_private,u32 handle); +void drm_syncobj_add_point (struct drm_syncobj *syncobj, +struct dma_fence_chain *chain, +struct dma_fence *fence, +uint64_t point);void drm_syncobj_replace_fence (struct drm_syncobj *syncobj,struct dma_fence *fence); int drm_syncobj_find_fence(struct drm_file *file_private,
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1e6783f1-8db6-47b5-2083-724257a53f84-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [PATCH 2/9] drm/syncobj: add new drm_syncobj_add_point interface v4
Am 28.03.19 um 14:50 schrieb Lionel Landwerlin:
Quoted 54 lines · Chunming Zhou
Quoted 47 lines
From: Christian König <[email protected]>
Use the
dma_fence_chainobject to create a timeline of fence objects instead of just replacing the existing fence.v2: rebase and cleanup
v3: fix garbage collection parameters
v4: add unorder point check, print a warn calltraceSigned-off-by Christian König <[email protected]>Cc Lionel Landwerlin <[email protected]>---
drivers/gpu/drm/drm_syncobj.c| 39 +++++++++++++++++++++++++++++++++++ include/drm/drm_syncobj.h | 5 +++++2 files changed, 44 insertions(+)drivers/gpu/drm/drm_syncobj.c +0
-0@@ -122,6 +122,45 @@ static void drm_syncobj_remove_wait(structdrm_syncobj *syncobj, spin_unlock(&syncobj->lock); }+/**
+ *drm_syncobj_add_point- add new timeline point to the syncobj
+ * @syncobj: sync object to add timeline point do
+ * @chain: chain node to use to add the point
+ * @fence: fence to encapsulate in the chain node
+ * @point: sequence number to use for the point
+ *
+ * Add the chain node as new timeline point to the syncobj.
+ */drivers/gpu/drm/drm_syncobj.c +14
-0+void drm_syncobj_add_point (struct drm_syncobj *syncobj, + struct dma_fence_chain *chain, + struct dma_fence *fence, + uint64_t point) +{ + struct syncobj_wait_entry *cur, *tmp; + struct dma_fence *prev; + + dma_fence_get(fence); + + spin_lock(&syncobj->lock); + + prev = drm_syncobj_fence_get(syncobj); + /* You are adding an unorder point to timeline, which couldQuoted 2 lines
cause payload returned from
query_ioctlis 0! */
+WARN_ON_ONCE(prev && prev->seqno >= point);I think the WARN/BUG macros should only fire when there is an issue with programming from within the kernel.
Quoted 4 lines
But this particular warning can be triggered by an application.
Probably best to just remove it?
Yeah, that was also my argument against it.
Key point here is that we still want to note somehow that userspace did something wrong and returning an error is not an option.
Maybe just use DRM_ERROR with a static variable to print the message only once.
Christian.
Quoted 34 lines
-Lionel
Quoted 29 lines
+
dma_fence_chain_init(chain, prev, fence, point); +rcu_assign_pointer(syncobj->fence, &chain->base);drivers/gpu/drm/drm_syncobj.c +13
-0+ + list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) { + list_del_init(&cur->node); + syncobj_wait_syncobj_func(syncobj, cur); + } + spin_unlock(&syncobj->lock); + + /* Walk the chain once to trigger garbage collection */ + dma_fence_chain_for_each(fence, prev); + dma_fence_put(prev); +} +EXPORT_SYMBOL (drm_syncobj_add_point); +/**
*drm_syncobj_replace_fence- replace fence in a sync object.
* @syncobj: Sync object to replace fence ininclude/drm/drm_syncobj.h +1
-0@@ -27,6 +27,7 @@ #define __DRM_SYNCOBJ_H__ #include <linux/dma-fence.h> +#include <linux/dma-fence-chain.h> struct drm_file; @@ -112,6 +113,10 @@ drm_syncobj_fence_get(struct drm_syncobj *syncobj) struct drm_syncobj *drm_syncobj_find(struct drm_file *file_private,
Quoted 10 lines
Quoted 8 lines
include/drm/drm_syncobj.h +4
-0u32 handle); +void drm_syncobj_add_point (struct drm_syncobj *syncobj, + struct dma_fence_chain *chain, + struct dma_fence *fence, + uint64_t point);void
drm_syncobj_replace_fence(struct drm_syncobj *syncobj, struct dma_fence *fence);
int drm_syncobj_find_fence(structdrm_file*file_private,
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/9] drm/syncobj: add new drm_syncobj_add_point interface v4
Quoted 62 lines · Christian König
Am 28.03.19 um 14:50 schrieb Lionel Landwerlin:
Quoted 56 lines · Chunming Zhou
Quoted 48 lines
From: Christian König <[email protected]>
Use the
dma_fence_chainobject to create a timeline of fence objects instead of just replacing the existing fence.v2: rebase and cleanup
v3: fix garbage collection parameters
v4: add unorder point check, print a warn calltraceSigned-off-by Christian König <[email protected]>Cc Lionel Landwerlin <[email protected]>---
drivers/gpu/drm/drm_syncobj.c| 39 +++++++++++++++++++++++++++++++++++ include/drm/drm_syncobj.h | 5 +++++2 files changed, 44 insertions(+)drivers/gpu/drm/drm_syncobj.c +0
-0@@ -122,6 +122,45 @@ static void drm_syncobj_remove_wait(structdrm_syncobj *syncobj, spin_unlock(&syncobj->lock); }+/**
+ *drm_syncobj_add_point- add new timeline point to the syncobj
+ * @syncobj: sync object to add timeline point do
+ * @chain: chain node to use to add the point
+ * @fence: fence to encapsulate in the chain node
+ * @point: sequence number to use for the point
+ *
+ * Add the chain node as new timeline point to the syncobj.
+ */drivers/gpu/drm/drm_syncobj.c +14
-0+void drm_syncobj_add_point (struct drm_syncobj *syncobj, + struct dma_fence_chain *chain, + struct dma_fence *fence, + uint64_t point) +{ + struct syncobj_wait_entry *cur, *tmp; + struct dma_fence *prev; + + dma_fence_get(fence); + + spin_lock(&syncobj->lock); + + prev = drm_syncobj_fence_get(syncobj); + /* You are adding an unorder point to timeline, which couldQuoted 2 lines
cause payload returned from
query_ioctlis 0! */
+WARN_ON_ONCE(prev && prev->seqno >= point);I think the WARN/BUG macros should only fire when there is an issue with programming from within the kernel.
Quoted 4 lines
But this particular warning can be triggered by an application.
Probably best to just remove it?
Quoted 7 lines
Yeah, that was also my argument against it.
Key point here is that we still want to note somehow that userspace did something wrong and returning an error is not an option.
Maybe just use
DRM_ERRORwith a static variable to print the message only once.
How about DRM_WARN_ONCE ?
Signature · 6 lines
Earthling Michel Dänzer | https://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/9] drm/syncobj: add new drm_syncobj_add_point interface v4
In reply to Christian KönigQuoted 61 lines · Christian König
Am 28.03.19 um 14:50 schrieb Lionel Landwerlin:
Quoted 55 lines · Chunming Zhou
Quoted 48 lines
From: Christian König <[email protected]>
Use the
dma_fence_chainobject to create a timeline of fence objects instead of just replacing the existing fence.v2: rebase and cleanup
v3: fix garbage collection parameters
v4: add unorder point check, print a warn calltraceSigned-off-by Christian König <[email protected]>Cc Lionel Landwerlin <[email protected]>---
drivers/gpu/drm/drm_syncobj.c| 39
+++++++++++++++++++++++++++++++++++
include/drm/drm_syncobj.h | 5 +++++2 files changed, 44 insertions(+)drivers/gpu/drm/drm_syncobj.c +0
-0@@ -122,6 +122,45 @@ static void drm_syncobj_remove_wait(structdrm_syncobj *syncobj, spin_unlock(&syncobj->lock); }+/**
+ *drm_syncobj_add_point- add new timeline point to the syncobj
+ * @syncobj: sync object to add timeline point do
+ * @chain: chain node to use to add the point
+ * @fence: fence to encapsulate in the chain node
+ * @point: sequence number to use for the point
+ *
+ * Add the chain node as new timeline point to the syncobj.
+ */drivers/gpu/drm/drm_syncobj.c +14
-0+void drm_syncobj_add_point (struct drm_syncobj *syncobj, + struct dma_fence_chain *chain, + struct dma_fence *fence, + uint64_t point) +{ + struct syncobj_wait_entry *cur, *tmp; + struct dma_fence *prev; + + dma_fence_get(fence); + + spin_lock(&syncobj->lock); + + prev = drm_syncobj_fence_get(syncobj); + /* You are adding an unorder point to timeline, which couldQuoted 2 lines
cause payload returned from
query_ioctlis 0! */
+WARN_ON_ONCE(prev && prev->seqno >= point);I think the WARN/BUG macros should only fire when there is an issue with programming from within the kernel.
Quoted 4 lines
But this particular warning can be triggered by an application.
Probably best to just remove it?
Quoted 7 lines
Yeah, that was also my argument against it.
Key point here is that we still want to note somehow that userspace did something wrong and returning an error is not an option.
Maybe just use
DRM_ERRORwith a static variable to print the message only once.Christian.
I don't really see any point in printing an error once. If you run your application twice you end up thinking there was an issue just on the first run but it's actually always wrong.
Unless we're willing to take the syncobj lock for longer periods of time when adding points, I guess we'll have to defer validation to validation layers.
-Lionel
Quoted 37 lines
Quoted 37 lines
-Lionel
Quoted 31 lines
+
dma_fence_chain_init(chain, prev, fence, point); +rcu_assign_pointer(syncobj->fence, &chain->base);drivers/gpu/drm/drm_syncobj.c +13
-0+ + list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) { + list_del_init(&cur->node); + syncobj_wait_syncobj_func(syncobj, cur); + } + spin_unlock(&syncobj->lock); + + /* Walk the chain once to trigger garbage collection */ + dma_fence_chain_for_each(fence, prev); + dma_fence_put(prev); +} +EXPORT_SYMBOL (drm_syncobj_add_point); +/**
*drm_syncobj_replace_fence- replace fence in a sync object.
* @syncobj: Sync object to replace fence ininclude/drm/drm_syncobj.h +2
-0@@ -27,6 +27,7 @@ #define __DRM_SYNCOBJ_H__ #include <linux/dma-fence.h> +#include <linux/dma-fence-chain.h> struct drm_file; @@ -112,6 +113,10 @@ drm_syncobj_fence_get(struct drm_syncobj *syncobj) struct drm_syncobj *drm_syncobj_find(struct drm_file *file_private, u32 handle); +void drm_syncobj_add_point(struct drm_syncobj *syncobj,
Quoted 10 lines
Quoted 8 lines
Quoted 6 lines
+ struct
dma_fence_chain*chain,
+ structdma_fence*fence,
+uint64_tpoint);
voiddrm_syncobj_replace_fence(struct drm_syncobj *syncobj, struct dma_fence *fence);
int drm_syncobj_find_fence(structdrm_file*file_private,
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 5f93be6c-5038-3409-d98d-55d50a62854c-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
RE: [PATCH 2/9] drm/syncobj: add new drm_syncobj_add_point interface v4
Quoted 81 lines
-----Original Message-----
From: Lionel Landwerlin <[email protected]>
Sent: Saturday, March 30, 2019 10:09 PM
To: Koenig, Christian <[email protected]>; Zhou, David(ChunMing) <[email protected]>; [email protected]; amd- [email protected]; [email protected]; Hector, Tobias <[email protected]>
Subject: Re: [PATCH 2/9] drm/syncobj: add newdrm_syncobj_add_pointinterface v4Quoted 68 lines · Christian König
Am 28.03.19 um 14:50 schrieb Lionel Landwerlin:
Quoted 57 lines · Chunming Zhou
Quoted 49 lines
From: Christian König <[email protected]>
Use the
dma_fence_chainobject to create a timeline of fence objects instead of just replacing the existing fence.v2: rebase and cleanup
v3: fix garbage collection parameters
v4: add unorder point check, print a warn calltraceSigned-off-by Christian König <[email protected]>Cc Lionel Landwerlin <[email protected]>---
drivers/gpu/drm/drm_syncobj.c| 39
+++++++++++++++++++++++++++++++++++
include/drm/drm_syncobj.h | 5 +++++2 files changed, 44 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/drm_syncobj.cindex5329e66598c6..19a9ce638119100644drivers/gpu/drm/drm_syncobj.c +0
-0@@ -122,6 +122,45 @@ static void drm_syncobj_remove_wait(structdrm_syncobj *syncobj, spin_unlock(&syncobj->lock); }+/**
+ *drm_syncobj_add_point- add new timeline point to the syncobj
+ * @syncobj: sync object to add timeline point do
+ * @chain: chain node to use to add the point
+ * @fence: fence to encapsulate in the chain node
+ * @point: sequence number to use for the point
+ *
+ * Add the chain node as new timeline point to the syncobj.
+ */drivers/gpu/drm/drm_syncobj.c +14
-0+void drm_syncobj_add_point (struct drm_syncobj *syncobj, + struct dma_fence_chain *chain, + struct dma_fence *fence, + uint64_t point) +{ + struct syncobj_wait_entry *cur, *tmp; + struct dma_fence *prev; + + dma_fence_get(fence); + + spin_lock(&syncobj->lock); + + prev = drm_syncobj_fence_get(syncobj); + /* You are adding an unorder point to timeline, which couldQuoted 2 lines
cause payload returned from
query_ioctlis 0! */
+WARN_ON_ONCE(prev && prev->seqno >= point);I think the WARN/BUG macros should only fire when there is an issue with programming from within the kernel.
Quoted 4 lines
But this particular warning can be triggered by an application.
Probably best to just remove it?
Yeah, that was also my argument against it.
Key point here is that we still want to note somehow that userspace did something wrong and returning an error is not an option.
Quoted 9 lines
Quoted 4 lines
Maybe just use
DRM_ERRORwith a static variable to print the message only once.Christian.
I don't really see any point in printing an error once. If you run your application twice you end up thinking there was an issue just on the first run but it's actually always wrong.
Except this nitpick, is there any other concern to push whole patch set? Is that time to push whole patch set?
-David
Quoted 56 lines
Unless we're willing to take the syncobj lock for longer periods of time when adding points, I guess we'll have to defer validation to validation layers.
-Lionel
Quoted 49 lines
Quoted 47 lines
-Lionel
Quoted 39 lines
+
dma_fence_chain_init(chain, prev, fence, point); +rcu_assign_pointer(syncobj->fence, &chain->base);drivers/gpu/drm/drm_syncobj.c +13
-0+ + list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) { + list_del_init(&cur->node); + syncobj_wait_syncobj_func(syncobj, cur); + } + spin_unlock(&syncobj->lock); + + /* Walk the chain once to trigger garbage collection */ + dma_fence_chain_for_each(fence, prev); + dma_fence_put(prev); +} +EXPORT_SYMBOL (drm_syncobj_add_point); +/**
*drm_syncobj_replace_fence- replace fence in a sync object.
* @syncobj: Sync object to replace fence in diff --gita/include/drm/drm_syncobj.hb/include/drm/drm_syncobj.hindex0311c9fdbd2f..6cf7243a1dc5100644include/drm/drm_syncobj.h +1
-0@@ -27,6 +27,7 @@ #define __DRM_SYNCOBJ_H__ #include <linux/dma-fence.h> +#include <linux/dma-fence-chain.h> struct drm_file;@@ -112,6 +113,10 @@
drm_syncobj_fence_get(struct drm_syncobj *syncobj)
structdrm_syncobj*drm_syncobj_find(structdrm_file*file_private,
u32 handle);
+void drm_syncobj_add_point(structdrm_syncobj*syncobj, + structdma_fence_chain*chain,
+ structdma_fence*fence,
+uint64_tpoint);
voiddrm_syncobj_replace_fence(struct drm_syncobj *syncobj, struct dma_fence *fence);
int drm_syncobj_find_fence(structdrm_file*file_private,
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/9] drm/syncobj: add new drm_syncobj_add_point interface v4
Quoted 81 lines · David(ChunMing)
Quoted 81 lines
-----Original Message-----
From: Lionel Landwerlin <[email protected]>
Sent: Saturday, March 30, 2019 10:09 PM
To: Koenig, Christian <[email protected]>; Zhou, David(ChunMing) <[email protected]>; [email protected]; amd- [email protected]; [email protected]; Hector, Tobias <[email protected]>
Subject: Re: [PATCH 2/9] drm/syncobj: add newdrm_syncobj_add_pointinterface v4Quoted 69 lines · Christian König
Am 28.03.19 um 14:50 schrieb Lionel Landwerlin:
Quoted 56 lines · Chunming Zhou
Quoted 49 lines
From: Christian König <[email protected]>
Use the
dma_fence_chainobject to create a timeline of fence objects instead of just replacing the existing fence.v2: rebase and cleanup
v3: fix garbage collection parameters
v4: add unorder point check, print a warn calltraceSigned-off-by Christian König <[email protected]>Cc Lionel Landwerlin <[email protected]>--- drivers/gpu/drm/drm_syncobj.c | 39 +++++++++++++++++++++++++++++++++++ include/drm/drm_syncobj.h | 5 +++++ 2 files changed, 44 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/drm_syncobj.cindex5329e66598c6..19a9ce638119100644drivers/gpu/drm/drm_syncobj.c +22
-0@@ -122,6 +122,45 @@ static void drm_syncobj_remove_wait(structdrm_syncobj *syncobj, spin_unlock(&syncobj->lock); } +/** +* drm_syncobj_add_point - add new timeline point to the syncobj +* @syncobj: sync object to add timeline point do +* @chain: chain node to use to add the point +* @fence: fence to encapsulate in the chain node +* @point: sequence number to use for the point +* +* Add the chain node as new timeline point to the syncobj. +*/ +void drm_syncobj_add_point(struct drm_syncobj *syncobj, + struct dma_fence_chain *chain, + struct dma_fence *fence, + uint64_t point) +{ + struct syncobj_wait_entry *cur, *tmp; + struct dma_fence *prev; + + dma_fence_get(fence); + + spin_lock(&syncobj->lock); + + prev = drm_syncobj_fence_get(syncobj); + /* You are adding an unorder point to timeline, which couldQuoted 2 lines
cause payload returned from
query_ioctlis 0! */
+WARN_ON_ONCE(prev && prev->seqno >= point);I think the WARN/BUG macros should only fire when there is an issue with programming from within the kernel.
Quoted 4 lines
But this particular warning can be triggered by an application.
Probably best to just remove it?
Yeah, that was also my argument against it.
Key point here is that we still want to note somehow that userspace did something wrong and returning an error is not an option.
Maybe just use
DRM_ERRORwith a static variable to print the message only once.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Christian.
I don't really see any point in printing an error once. If you run your application twice you end up thinking there was an issue just on the first run but it's actually always wrong.
Except this nitpick, is there any other concern to push whole patch set? Is that time to push whole patch set?
-David
Looks good to me.
I have an additional change to make drm_syncobj_find_fence() also return the drm_syncobj : https://github.com/djdeath/linux/commit/0b7732b267b931339d71fe6f493ea6fa4eab453e
This is needed in i915 to avoid looking up the drm_syncobj handle twice.
Our driver allows to wait on the syncobj's dma_fence that we're then going to replace so we need to get bot the fence & syncobj at the same time.
I guess it can go in a follow up series.
-Lionel
Quoted 44 lines
Quoted 44 lines
Unless we're willing to take the syncobj lock for longer periods of time when adding points, I guess we'll have to defer validation to validation layers.
-Lionel
Quoted 37 lines
Quoted 37 lines
-Lionel
Quoted 33 lines
+
dma_fence_chain_init(chain, prev, fence, point); +rcu_assign_pointer(syncobj->fence, &chain->base);drivers/gpu/drm/drm_syncobj.c +13
-0+ + list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) { + list_del_init(&cur->node); + syncobj_wait_syncobj_func(syncobj, cur); + } + spin_unlock(&syncobj->lock); + + /* Walk the chain once to trigger garbage collection */ + dma_fence_chain_for_each(fence, prev); + dma_fence_put(prev); +} +EXPORT_SYMBOL (drm_syncobj_add_point); + /*** drm_syncobj_replace_fence - replace fence in a sync object. * @syncobj: Sync object to replace fence in diff --git
a/include/drm/drm_syncobj.hb/include/drm/drm_syncobj.hindex0311c9fdbd2f..6cf7243a1dc5100644include/drm/drm_syncobj.h +1
-0@@ -27,6 +27,7 @@ #define __DRM_SYNCOBJ_H__ #include <linux/dma-fence.h> +#include <linux/dma-fence-chain.h> struct drm_file; @@ -112,6 +113,10 @@ drm_syncobj_fence_get(struct drm_syncobj *syncobj) struct drm_syncobj *drm_syncobj_find(struct drm_file
*file_private,
u32 handle);
+void drm_syncobj_add_point(structdrm_syncobj*syncobj,
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
+ struct
dma_fence_chain*chain,
+ structdma_fence*fence,
+uint64_tpoint);
voiddrm_syncobj_replace_fence(struct drm_syncobj *syncobj, struct dma_fence *fence);
int drm_syncobj_find_fence(structdrm_file*file_private,
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): f8e0e0af-c917-af05-9aa8-cecbbfcf73f9-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [PATCH 2/9] drm/syncobj: add new drm_syncobj_add_point interface v4
Quoted 87 lines · Lionel Landwerlin
Quoted 86 lines · David(ChunMing)
Quoted 86 lines
-----Original Message-----
From: Lionel Landwerlin <[email protected]>
Sent: Saturday, March 30, 2019 10:09 PM
To: Koenig, Christian <[email protected]>; Zhou, David(ChunMing) <[email protected]>; [email protected]; amd- [email protected]; [email protected]; Hector, Tobias <[email protected]>
Subject: Re: [PATCH 2/9] drm/syncobj: add newdrm_syncobj_add_pointinterface v4Quoted 63 lines · Christian König
Am 28.03.19 um 14:50 schrieb Lionel Landwerlin:
Quoted 56 lines · Chunming Zhou
Quoted 49 lines
From: Christian König <[email protected]>
Use the
dma_fence_chainobject to create a timeline of fence objects instead of just replacing the existing fence.v2: rebase and cleanup
v3: fix garbage collection parameters
v4: add unorder point check, print a warn calltraceSigned-off-by Christian König <[email protected]>Cc Lionel Landwerlin <[email protected]>---
drivers/gpu/drm/drm_syncobj.c| 39
+++++++++++++++++++++++++++++++++++
include/drm/drm_syncobj.h | 5 +++++2 files changed, 44 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/drm_syncobj.cindex5329e66598c6..19a9ce638119100644drivers/gpu/drm/drm_syncobj.c +0
-0@@ -122,6 +122,45 @@ static void drm_syncobj_remove_wait(structdrm_syncobj *syncobj, spin_unlock(&syncobj->lock); }+/**
+ *drm_syncobj_add_point- add new timeline point to the syncobj
+ * @syncobj: sync object to add timeline point do
+ * @chain: chain node to use to add the point
+ * @fence: fence to encapsulate in the chain node
+ * @point: sequence number to use for the point
+ *
+ * Add the chain node as new timeline point to the syncobj.
+ */drivers/gpu/drm/drm_syncobj.c +14
-0+void drm_syncobj_add_point (struct drm_syncobj *syncobj, + struct dma_fence_chain *chain, + struct dma_fence *fence, + uint64_t point) +{ + struct syncobj_wait_entry *cur, *tmp; + struct dma_fence *prev; + + dma_fence_get(fence); + + spin_lock(&syncobj->lock); + + prev = drm_syncobj_fence_get(syncobj); + /* You are adding an unorder point to timeline, which couldQuoted 2 lines
cause payload returned from
query_ioctlis 0! */
+WARN_ON_ONCE(prev && prev->seqno >= point);I think the WARN/BUG macros should only fire when there is an issue with programming from within the kernel.
Quoted 4 lines
But this particular warning can be triggered by an application.
Probably best to just remove it?
Yeah, that was also my argument against it.
Quoted 7 lines
Key point here is that we still want to note somehow that userspace did something wrong and returning an error is not an option.
Maybe just use
DRM_ERRORwith a static variable to print the message only once.Christian.
I don't really see any point in printing an error once. If you run your application twice you end up thinking there was an issue just on the first run but it's actually always wrong.
Quoted 6 lines
Quoted 3 lines
Except this nitpick, is there any other concern to push whole patch set? Is that time to push whole patch set?
-David
Looks good to me.
Does that mean we can add your RB on patch set so that we can submit the patch set to drm-misc-next branch?
Quoted 8 lines
I have an additional change to make
drm_syncobj_find_fence()also return thedrm_syncobj: https://github.com/djdeath/linux/commit/0b7732b267b931339d71fe6f493ea6fa4eab453eThis is needed in i915 to avoid looking up the
drm_syncobjhandle twice.Our driver allows to wait on the syncobj's
dma_fencethat we're then going to replace so we need to get bot the fence & syncobj at the same time.I guess it can go in a follow up series.
Yes, agree.
Thanks for your effort as well,
-David
Quoted 58 lines
-Lionel
Quoted 52 lines
Quoted 52 lines
Unless we're willing to take the syncobj lock for longer periods of time when adding points, I guess we'll have to defer validation to validation layers.
-Lionel
Quoted 45 lines
Quoted 44 lines
-Lionel
Quoted 39 lines
+
dma_fence_chain_init(chain, prev, fence, point); +rcu_assign_pointer(syncobj->fence, &chain->base);drivers/gpu/drm/drm_syncobj.c +13
-0+ + list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) { + list_del_init(&cur->node); + syncobj_wait_syncobj_func(syncobj, cur); + } + spin_unlock(&syncobj->lock); + + /* Walk the chain once to trigger garbage collection */ + dma_fence_chain_for_each(fence, prev); + dma_fence_put(prev); +} +EXPORT_SYMBOL (drm_syncobj_add_point); +/**
*drm_syncobj_replace_fence- replace fence in a sync object.
* @syncobj: Sync object to replace fence in diff --gita/include/drm/drm_syncobj.hb/include/drm/drm_syncobj.hindex0311c9fdbd2f..6cf7243a1dc5100644include/drm/drm_syncobj.h +1
-0@@ -27,6 +27,7 @@ #define __DRM_SYNCOBJ_H__ #include <linux/dma-fence.h> +#include <linux/dma-fence-chain.h> struct drm_file;@@ -112,6 +113,10 @@
drm_syncobj_fence_get(struct drm_syncobj *syncobj)
structdrm_syncobj*drm_syncobj_find(structdrm_file*file_private,
u32 handle);
+void drm_syncobj_add_point(structdrm_syncobj*syncobj, + structdma_fence_chain*chain,
+ structdma_fence*fence,
+uint64_tpoint);
voiddrm_syncobj_replace_fence(struct drm_syncobj *syncobj, struct dma_fence *fence);
int drm_syncobj_find_fence(structdrm_file*file_private,
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 0674a0a5-7311-55c9-3634-2e96b89e2caa-5C7GfCeVMHo@public.gmane.org
Lionel Landwerlin
Reviewed-byRe: [PATCH 2/9] drm/syncobj: add new drm_syncobj_add_point interface v4
Quoted 90 lines · On 01/04/2019 11:50, zhoucm1 wrote:
Quoted 87 lines · Lionel Landwerlin
Quoted 86 lines · David(ChunMing)
Quoted 86 lines
-----Original Message-----
From: Lionel Landwerlin <[email protected]>
Sent: Saturday, March 30, 2019 10:09 PM
To: Koenig, Christian <[email protected]>; Zhou, David(ChunMing) <[email protected]>; [email protected]; amd- [email protected]; [email protected]; Hector, Tobias <[email protected]>
Subject: Re: [PATCH 2/9] drm/syncobj: add newdrm_syncobj_add_pointinterface v4Quoted 63 lines · Christian König
Am 28.03.19 um 14:50 schrieb Lionel Landwerlin:
Quoted 56 lines · Chunming Zhou
Quoted 49 lines
From: Christian König <[email protected]>
Use the
dma_fence_chainobject to create a timeline of fence objects instead of just replacing the existing fence.v2: rebase and cleanup
v3: fix garbage collection parameters
v4: add unorder point check, print a warn calltraceSigned-off-by Christian König <[email protected]>Cc Lionel Landwerlin <[email protected]>---
drivers/gpu/drm/drm_syncobj.c| 39
+++++++++++++++++++++++++++++++++++
include/drm/drm_syncobj.h | 5 +++++2 files changed, 44 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/drm_syncobj.cindex5329e66598c6..19a9ce638119100644drivers/gpu/drm/drm_syncobj.c +0
-0@@ -122,6 +122,45 @@ static void drm_syncobj_remove_wait(structdrm_syncobj *syncobj, spin_unlock(&syncobj->lock); }+/**
+ *drm_syncobj_add_point- add new timeline point to the syncobj
+ * @syncobj: sync object to add timeline point do
+ * @chain: chain node to use to add the point
+ * @fence: fence to encapsulate in the chain node
+ * @point: sequence number to use for the point
+ *
+ * Add the chain node as new timeline point to the syncobj.
+ */drivers/gpu/drm/drm_syncobj.c +14
-0+void drm_syncobj_add_point (struct drm_syncobj *syncobj, + struct dma_fence_chain *chain, + struct dma_fence *fence, + uint64_t point) +{ + struct syncobj_wait_entry *cur, *tmp; + struct dma_fence *prev; + + dma_fence_get(fence); + + spin_lock(&syncobj->lock); + + prev = drm_syncobj_fence_get(syncobj); + /* You are adding an unorder point to timeline, which couldQuoted 2 lines
cause payload returned from
query_ioctlis 0! */
+WARN_ON_ONCE(prev && prev->seqno >= point);I think the WARN/BUG macros should only fire when there is an issue with programming from within the kernel.
Quoted 4 lines
But this particular warning can be triggered by an application.
Probably best to just remove it?
Yeah, that was also my argument against it.
Quoted 7 lines
Key point here is that we still want to note somehow that userspace did something wrong and returning an error is not an option.
Maybe just use
DRM_ERRORwith a static variable to print the message only once.Christian.
I don't really see any point in printing an error once. If you run your application twice you end up thinking there was an issue just on the first run but it's actually always wrong.
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Except this nitpick, is there any other concern to push whole patch set? Is that time to push whole patch set?
-David
Looks good to me.
Does that mean we can add your RB on patch set so that we can submit the patch set to drm-misc-next branch?
Yes :
Not too sure about the process for drm-misc-next. Sounds like Sumit Semwal <[email protected]> is the go to person according to MAINTAINERS.
Quoted 6 lines
Quoted 6 lines
I have an additional change to make
drm_syncobj_find_fence()also return thedrm_syncobj: https://github.com/djdeath/linux/commit/0b7732b267b931339d71fe6f493ea6fa4eab453eThis is needed in i915 to avoid looking up the
drm_syncobjhandle twice.
Quoted 7 lines
Quoted 3 lines
Our driver allows to wait on the syncobj's
dma_fencethat we're then going to replace so we need to get bot the fence & syncobj at the same time.I guess it can go in a follow up series.
Yes, agree.
Thanks for your effort as well,
-David
Thanks to you!
-Lionel
Quoted 50 lines
Quoted 50 lines
-Lionel
Quoted 45 lines
Quoted 45 lines
Unless we're willing to take the syncobj lock for longer periods of time when adding points, I guess we'll have to defer validation to validation layers.
-Lionel
Quoted 38 lines
Quoted 38 lines
-Lionel
Quoted 34 lines
+
dma_fence_chain_init(chain, prev, fence, point); +rcu_assign_pointer(syncobj->fence, &chain->base);drivers/gpu/drm/drm_syncobj.c +13
-0+ + list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) { + list_del_init(&cur->node); + syncobj_wait_syncobj_func(syncobj, cur); + } + spin_unlock(&syncobj->lock); + + /* Walk the chain once to trigger garbage collection */ + dma_fence_chain_for_each(fence, prev); + dma_fence_put(prev); +} +EXPORT_SYMBOL (drm_syncobj_add_point); +/**
*drm_syncobj_replace_fence- replace fence in a sync object.
* @syncobj: Sync object to replace fence in diff --gita/include/drm/drm_syncobj.hb/include/drm/drm_syncobj.hindex0311c9fdbd2f..6cf7243a1dc5100644include/drm/drm_syncobj.h +1
-0@@ -27,6 +27,7 @@ #define __DRM_SYNCOBJ_H__ #include <linux/dma-fence.h> +#include <linux/dma-fence-chain.h> struct drm_file;@@ -112,6 +113,10 @@
drm_syncobj_fence_get(struct drm_syncobj *syncobj)
structdrm_syncobj*drm_syncobj_find(structdrm_file*file_private,
u32 handle);
+void drm_syncobj_add_point(structdrm_syncobj*syncobj, + structdma_fence_chain*chain,
Quoted 10 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
+ struct
dma_fence*fence,
+uint64_tpoint);
voiddrm_syncobj_replace_fence(struct drm_syncobj *syncobj, struct dma_fence *fence);
int drm_syncobj_find_fence(structdrm_file*file_private,
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 5dd6ae07-24d4-db2b-cc3f-80150e1b0ea6-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [PATCH 2/9] drm/syncobj: add new drm_syncobj_add_point interface v4
Am 01.04.19 um 11:05 schrieb Lionel Landwerlin:
Quoted 106 lines · On 01/04/2019 11:50, zhoucm1 wrote:
Quoted 97 lines · Lionel Landwerlin
Quoted 94 lines · David(ChunMing)
Quoted 93 lines
Quoted 83 lines
-----Original Message-----
From: Lionel Landwerlin <[email protected]>
Sent: Saturday, March 30, 2019 10:09 PM
To: Koenig, Christian <[email protected]>; Zhou, David(ChunMing)
<[email protected]>; [email protected]; amd- [email protected]; [email protected]; Hector, Tobias <[email protected]>
Subject: Re: [PATCH 2/9] drm/syncobj: add newdrm_syncobj_add_pointinterface v4Quoted 70 lines · Christian König
Am 28.03.19 um 14:50 schrieb Lionel Landwerlin:
Quoted 57 lines · Chunming Zhou
Quoted 50 lines
From: Christian König <[email protected]>
Use the
dma_fence_chainobject to create a timeline of fence objects
instead of just replacing the existing fence.v2: rebase and cleanup
v3: fix garbage collection parameters
v4: add unorder point check, print a warn calltraceSigned-off-by Christian König <[email protected]>Cc Lionel Landwerlin <[email protected]>---
drivers/gpu/drm/drm_syncobj.c| 39
+++++++++++++++++++++++++++++++++++
include/drm/drm_syncobj.h | 5 +++++2 files changed, 44 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/drm_syncobj.cindex5329e66598c6..19a9ce638119100644drivers/gpu/drm/drm_syncobj.c +0
-0@@ -122,6 +122,45 @@ static void drm_syncobj_remove_wait(structdrm_syncobj *syncobj, spin_unlock(&syncobj->lock); }+/**
+ *drm_syncobj_add_point- add new timeline point to the syncobj
+ * @syncobj: sync object to add timeline point do
+ * @chain: chain node to use to add the point
+ * @fence: fence to encapsulate in the chain node
+ * @point: sequence number to use for the point
+ *
+ * Add the chain node as new timeline point to the syncobj.
+ */drivers/gpu/drm/drm_syncobj.c +14
-0+void drm_syncobj_add_point (struct drm_syncobj *syncobj, + struct dma_fence_chain *chain, + struct dma_fence *fence, + uint64_t point) +{ + struct syncobj_wait_entry *cur, *tmp; + struct dma_fence *prev; + + dma_fence_get(fence); + + spin_lock(&syncobj->lock); + + prev = drm_syncobj_fence_get(syncobj); + /* You are adding an unorder point to timeline, which couldQuoted 2 lines
cause payload returned from
query_ioctlis 0! */
+WARN_ON_ONCE(prev && prev->seqno >= point);I think the WARN/BUG macros should only fire when there is an issue with programming from within the kernel.
Quoted 4 lines
But this particular warning can be triggered by an application.
Probably best to just remove it?
Yeah, that was also my argument against it.
Key point here is that we still want to note somehow that userspace did something wrong and returning an error is not an option.
Maybe just use
DRM_ERRORwith a static variable to print the message only once.Quoted 7 lines
Quoted 1 line
Christian.
I don't really see any point in printing an error once. If you run your
application twice you end up thinking there was an issue just on the first run
but it's actually always wrong.Except this nitpick, is there any other concern to push whole patch set? Is that time to push whole patch set?
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
-David
Looks good to me.
Does that mean we can add your RB on patch set so that we can submit the patch set to drm-misc-next branch?
Quoted 8 lines
Yes :
Reviewed-by Lionel Landwerlin <[email protected]>Not too sure about the process for drm-misc-next. Sounds like Sumit Semwal <[email protected]> is the go to person according to
MAINTAINERS.
Well, I've got commit rights as well.
Going to remove the warning, add your rb and push everything if nobody objects in the next hour or so.
Christian.
Quoted 18 lines
Quoted 18 lines
Quoted 8 lines
I have an additional change to make
drm_syncobj_find_fence()also return thedrm_syncobj:
https://github.com/djdeath/linux/commit/0b7732b267b931339d71fe6f493ea6fa4eab453eQuoted 8 lines
This is needed in i915 to avoid looking up the
drm_syncobjhandle twice.Our driver allows to wait on the syncobj's
dma_fencethat we're then going to replace so we need to get bot the fence & syncobj at the same time.I guess it can go in a follow up series.
Yes, agree.
Quoted 73 lines
Quoted 2 lines
Thanks for your effort as well,
-DavidThanks to you!
-Lionel
Quoted 62 lines
Quoted 60 lines
-Lionel
Quoted 54 lines
Quoted 54 lines
Unless we're willing to take the syncobj lock for longer periods of time when
adding points, I guess we'll have to defer validation to validation layers.-Lionel
Quoted 45 lines
Quoted 44 lines
-Lionel
Quoted 39 lines
+
dma_fence_chain_init(chain, prev, fence, point); +rcu_assign_pointer(syncobj->fence, &chain->base);drivers/gpu/drm/drm_syncobj.c +13
-0+ + list_for_each_entry_safe(cur, tmp, &syncobj->cb_list, node) { + list_del_init(&cur->node); + syncobj_wait_syncobj_func(syncobj, cur); + } + spin_unlock(&syncobj->lock); + + /* Walk the chain once to trigger garbage collection */ + dma_fence_chain_for_each(fence, prev); + dma_fence_put(prev); +} +EXPORT_SYMBOL (drm_syncobj_add_point); +/**
*drm_syncobj_replace_fence- replace fence in a sync object.
* @syncobj: Sync object to replace fence in diff --gita/include/drm/drm_syncobj.hb/include/drm/drm_syncobj.hindex0311c9fdbd2f..6cf7243a1dc5100644include/drm/drm_syncobj.h +1
-0@@ -27,6 +27,7 @@ #define __DRM_SYNCOBJ_H__ #include <linux/dma-fence.h> +#include <linux/dma-fence-chain.h> struct drm_file;@@ -112,6 +113,10 @@
drm_syncobj_fence_get(struct drm_syncobj *syncobj)
structdrm_syncobj*drm_syncobj_find(structdrm_file*file_private,
u32 handle);
+void drm_syncobj_add_point(structdrm_syncobj*syncobj, + structdma_fence_chain*chain,
+ structdma_fence*fence,
+uint64_tpoint);
voiddrm_syncobj_replace_fence(struct drm_syncobj *syncobj, struct dma_fence *fence);
int drm_syncobj_find_fence(structdrm_file*file_private,
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Dave Airlie
maintainerRe: [PATCH 2/9] drm/syncobj: add new drm_syncobj_add_point interface v4
Quoted 4 lines
Well, I've got commit rights as well.
Going to remove the warning, add your rb and push everything if nobody objects in the next hour or so.
So this got committed and is in my -next tree, but where is the userspace and igt tests?
There needs to be a functional mesa userspace and a set of IGTs for this, maybe I've overlooked them if I haven't we can't ship this.
Dave.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Koenig, Christian
maintainerRe: [PATCH 2/9] drm/syncobj: add new drm_syncobj_add_point interface v4
Am 15.04.19 um 20:54 schrieb Dave Airlie:
Quoted 6 lines
Quoted 4 lines
Well, I've got commit rights as well.
Going to remove the warning, add your rb and push everything if nobody objects in the next hour or so.
So this got committed and is in my -next tree, but where is the userspace and igt tests?
I was waiting for this to land in -next before pushing the libdrm changes with amdgpu test cases.
As soon as those are committed Lionel and David wanted to commit the igt tests.
Christian.
Quoted 5 lines
There needs to be a functional mesa userspace and a set of IGTs for this, maybe I've overlooked them if I haven't we can't ship this.
Dave.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 01c86eb6-0e76-86c7-7437-f1d88419b4ae-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/9] drm/syncobj: add new drm_syncobj_add_point interface v4
Quoted 6 lines · Christian
Am 15.04.19 um 20:54 schrieb Dave Airlie:
Quoted 4 lines
Quoted 4 lines
Well, I've got commit rights as well.
Going to remove the warning, add your rb and push everything if nobody objects in the next hour or so.
Quoted 8 lines
Quoted 2 lines
So this got committed and is in my -next tree, but where is the userspace and igt tests?
I was waiting for this to land in -next before pushing the libdrm changes with amdgpu test cases.
As soon as those are committed Lionel and David wanted to commit the igt tests.
Testcases are ofc great, but that's not the userspace we're looking for :-) All still khr embargo? Even if that's all available at under khr nda, and reviewed by relevant folks I'm not sure we're setting a great precedence here - if khr still wants to be able to change the interface spec, casting the kernel uapi into stone is a bit premature. Aside from that this excludes everyone without khr nda, which isn't a nice move really. Note: Picky because this is winsys stuff, so relevant beyond just a single driver - for driver/hw specific stuff it makes sense to allow plenty of leeway to work around various embargos. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 3/9 drm/syncobj: add support for timeline point wait v8
points array is one-to-one match with syncobjs array. v2:
add seperate ioctl for timeline point wait, otherwise break uapi. v3:
userspace can specify two kinds waits::
a. Wait for time point to be completed.
b. and wait for time point to become available
v4:
rebase
v5:
add comment for xxx_WAIT_AVAILABLE
v6: rebase and rework on new container
v7: drop _WAIT_COMPLETED, it is the default anyway
v8: correctly handle garbage collected fences
--- drivers/gpu/drm/drm_internal.h | 2 + drivers/gpu/drm/drm_ioctl.c | 2 + drivers/gpu/drm/drm_syncobj.c | 153 ++++++++++++++++++++++++++------- include/uapi/drm/drm.h | 15 ++++ 4 files changed, 143 insertions(+), 29 deletions(-)
drivers/gpu/drm/drm_internal.h +2 -0
@@ -182,6 +182,8 @@ int drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private);int drm_syncobj_wait_ioctl (struct drm_device *dev,void *data,struct drm_file *file_private); +int drm_syncobj_timeline_wait_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_private);int drm_syncobj_reset_ioctl (struct drm_device *dev,void *data,struct drm_file *file_private); int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data,
drivers/gpu/drm/drm_ioctl.c +2 -0
@@ -688,6 +688,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_UNLOCKED|DRM_RENDER_ALLOW),DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_WAIT , drm_syncobj_wait_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ), +DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT , drm_syncobj_timeline_wait_ioctl, +DRM_UNLOCKED |DRM_RENDER_ALLOW ),DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_RESET , drm_syncobj_reset_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_SIGNAL, drm_syncobj_signal_ioctl,
drivers/gpu/drm/drm_syncobj.c +124 -29
253 lines not on this page · raw message
include/uapi/drm/drm.h +15 -0
@@ -737,6 +737,7 @@ struct drm_syncobj_handle {#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1) +#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2)/* wait for time point to become available */ struct drm_syncobj_wait {__u64 handles;/* absolute timeout */
@@ -747,6 +748,19 @@ struct drm_syncobj_wait {__u32 pad; }; +struct drm_syncobj_timeline_wait { +__u64 handles; +/* wait on specific timeline point for every handles*/ +__u64 points; +/* absolute timeout */ +__s64 timeout_nsec; +__u32 count_handles; +__u32 flags; +__u32 first_signaled;/* only valid when not waiting all */ +__u32 pad; +}; + +struct drm_syncobj_array {__u64 handles;__u32 count_handles;
@@ -909,6 +923,7 @@ extern "C" {#define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease)#define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease) +#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)/** * Device specific ioctls should only be in their respective headers * The device specific ioctl range is from 0x40 to 0x9f.
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/9 drm/syncobj: add timeline payload query ioctl v6
In reply to a message not in the archiveuser mode can query timeline payload.
v2: check return value of copy_to_user
v3: handle querying entry by entry
v4: rebase on new chain container, simplify interface
v5: query last signaled timeline point, not last point.
v6: add unorder point check
--- drivers/gpu/drm/drm_internal.h | 2 ++ drivers/gpu/drm/drm_ioctl.c | 2 ++ drivers/gpu/drm/drm_syncobj.c | 62 ++++++++++++++++++++++++++++++++++ include/uapi/drm/drm.h | 10 ++++++ 4 files changed, 76 insertions(+)
drivers/gpu/drm/drm_internal.h +2 -0
@@ -188,6 +188,8 @@ int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private);int drm_syncobj_signal_ioctl (struct drm_device *dev,void *data,struct drm_file *file_private); +int drm_syncobj_query_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_private);/* drm_framebuffer.c */ void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent,
drivers/gpu/drm/drm_ioctl.c +2 -0
@@ -694,6 +694,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_UNLOCKED|DRM_RENDER_ALLOW),DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_SIGNAL , drm_syncobj_signal_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ), +DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_QUERY , drm_syncobj_query_ioctl, +DRM_UNLOCKED |DRM_RENDER_ALLOW ),DRM_IOCTL_DEF (DRM_IOCTL_CRTC_GET_SEQUENCE , drm_crtc_get_sequence_ioctl,DRM_UNLOCKED ),DRM_IOCTL_DEF (DRM_IOCTL_CRTC_QUEUE_SEQUENCE , drm_crtc_queue_sequence_ioctl,DRM_UNLOCKED ), DRM_IOCTL_DEF(DRM_IOCTL_MODE_CREATE_LEASE, drm_mode_create_lease_ioctl, DRM_MASTER|DRM_UNLOCKED),
drivers/gpu/drm/drm_syncobj.c +62 -0
65 lines not on this page · raw message
include/uapi/drm/drm.h +10 -0
@@ -767,6 +767,14 @@ struct drm_syncobj_array {__u32 pad; }; +struct drm_syncobj_timeline_array { +__u64 handles; +__u64 points; +__u32 count_handles; +__u32 pad; +}; + +/* Query current scanout sequence number */ struct drm_crtc_get_sequence {__u32 crtc_id;/* requested crtc_id */
@@ -924,6 +932,8 @@ extern "C" {#define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease)#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait) +#define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array) +/** * Device specific ioctls should only be in their respective headers * The device specific ioctl range is from 0x40 to 0x9f.
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/9 drm/syncobj: add transition iotcls between binary and timeline v2
In reply to a message not in the archivewe need to import/export timeline point.
v2: unify to one transfer ioctl
--- drivers/gpu/drm/drm_internal.h | 2 + drivers/gpu/drm/drm_ioctl.c | 2 + drivers/gpu/drm/drm_syncobj.c | 74 ++++++++++++++++++++++++++++++++++ include/uapi/drm/drm.h | 10 +++++ 4 files changed, 88 insertions(+)
drivers/gpu/drm/drm_internal.h +2 -0
@@ -180,6 +180,8 @@ int drm_syncobj_handle_to_fd_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private);int drm_syncobj_fd_to_handle_ioctl (struct drm_device *dev,void *data,struct drm_file *file_private); +int drm_syncobj_transfer_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_private);int drm_syncobj_wait_ioctl (struct drm_device *dev,void *data,struct drm_file *file_private); int drm_syncobj_timeline_wait_ioctl(struct drm_device *dev, void *data,
drivers/gpu/drm/drm_ioctl.c +2 -0
@@ -686,6 +686,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_UNLOCKED|DRM_RENDER_ALLOW),DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE , drm_syncobj_fd_to_handle_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ), +DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_TRANSFER , drm_syncobj_transfer_ioctl, +DRM_UNLOCKED |DRM_RENDER_ALLOW ),DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_WAIT , drm_syncobj_wait_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT, drm_syncobj_timeline_wait_ioctl,
drivers/gpu/drm/drm_syncobj.c +74 -0
80 lines not on this page · raw message
include/uapi/drm/drm.h +10 -0
@@ -735,6 +735,15 @@ struct drm_syncobj_handle {__u32 pad; }; +struct drm_syncobj_transfer { +__u32 src_handle; +__u32 dst_handle; +__u64 src_point; +__u64 dst_point; +__u32 flags; +__u32 pad; +}; +#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0)#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1)#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2)/* wait for time point to become available */
@@ -933,6 +942,7 @@ extern "C" {#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)#define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array) +#define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer)/** * Device specific ioctls should only be in their respective headers
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/9 drm/syncobj: add timeline signal ioctl for syncobj v5
In reply to a message not in the archivev2: individually allocate chain array, since chain node is free independently.
v3: all existing points must be already signaled before cpu perform signal operation,
so add check condition for that.
v4: remove v3 change and add checking to prevent out-of-order
v5: unify binary and timeline
--- drivers/gpu/drm/drm_internal.h | 2 + drivers/gpu/drm/drm_ioctl.c | 2 + drivers/gpu/drm/drm_syncobj.c | 73 ++++++++++++++++++++++++++++++++++ include/uapi/drm/drm.h | 1 + 4 files changed, 78 insertions(+)
drivers/gpu/drm/drm_internal.h +2 -0
@@ -190,6 +190,8 @@ int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private);int drm_syncobj_signal_ioctl (struct drm_device *dev,void *data,struct drm_file *file_private); +int drm_syncobj_timeline_signal_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_private);int drm_syncobj_query_ioctl (struct drm_device *dev,void *data,struct drm_file *file_private);
drivers/gpu/drm/drm_ioctl.c +2 -0
@@ -696,6 +696,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_UNLOCKED|DRM_RENDER_ALLOW),DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_SIGNAL , drm_syncobj_signal_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ), +DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL , drm_syncobj_timeline_signal_ioctl, +DRM_UNLOCKED |DRM_RENDER_ALLOW ),DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_QUERY , drm_syncobj_query_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ), DRM_IOCTL_DEF(DRM_IOCTL_CRTC_GET_SEQUENCE, drm_crtc_get_sequence_ioctl, DRM_UNLOCKED),
drivers/gpu/drm/drm_syncobj.c +73 -0
79 lines not on this page · raw message
include/uapi/drm/drm.h +1 -0
@@ -943,6 +943,7 @@ extern "C" {#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)#define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array)#define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer) +#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)/** * Device specific ioctls should only be in their respective headers
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 8/9] drm/syncobj: add timeline signal ioctl for syncobj v5
Quoted 106 lines · Chunming Zhou
v2: individually allocate chain array, since chain node is free independently.
v3: all existing points must be already signaled before cpu perform signal operation,
so add check condition for that.
v4: remove v3 change and add checking to prevent out-of-order
v5: unify binary and timelineSigned-off-by Chunming Zhou <[email protected]>Cc Tobias Hector <[email protected]>Cc Jason Ekstrand <[email protected]>Cc Dave Airlie <[email protected]>Cc Chris Wilson <[email protected]>Cc Lionel Landwerlin <[email protected]>--- drivers/gpu/drm/drm_internal.h | 2 + drivers/gpu/drm/drm_ioctl.c | 2 + drivers/gpu/drm/drm_syncobj.c | 73 ++++++++++++++++++++++++++++++++++ include/uapi/drm/drm.h | 1 + 4 files changed, 78 insertions(+)drivers/gpu/drm/drm_internal.h +2
-0@@ -190,6 +190,8 @@ int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private);int drm_syncobj_signal_ioctl (struct drm_device *dev,void *data,struct drm_file *file_private); +int drm_syncobj_timeline_signal_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_private);int drm_syncobj_query_ioctl (struct drm_device *dev,void *data,struct drm_file *file_private);drivers/gpu/drm/drm_ioctl.c +2
-0@@ -696,6 +696,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_UNLOCKED|DRM_RENDER_ALLOW),DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_SIGNAL , drm_syncobj_signal_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ), +DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL , drm_syncobj_timeline_signal_ioctl, +DRM_UNLOCKED |DRM_RENDER_ALLOW ),DRM_IOCTL_DEF (DRM_IOCTL_SYNCOBJ_QUERY , drm_syncobj_query_ioctl,DRM_UNLOCKED |DRM_RENDER_ALLOW ), DRM_IOCTL_DEF(DRM_IOCTL_CRTC_GET_SEQUENCE, drm_crtc_get_sequence_ioctl, DRM_UNLOCKED),drivers/gpu/drm/drm_syncobj.c +53
-0@@ -1183,6 +1183,79 @@ drm_syncobj_signal_ioctl(struct drm_device *dev, void *data,return ret; } +int +drm_syncobj_timeline_signal_ioctl (struct drm_device *dev,void *data, +struct drm_file *file_private) +{ +struct drm_syncobj_timeline_array *args = data; +struct drm_syncobj **syncobjs; +struct dma_fence_chain **chains; +uint64_t *points; +uint32_t i, j; +int ret; + +if (!drm_core_check_feature (dev,DRIVER_SYNCOBJ )) +return -EOPNOTSUPP ; + +if (args->pad !=0 ) +return -EINVAL ; + +if (args->count_handles ==0 ) +return -EINVAL ; + + ret =drm_syncobj_array_find (file_private, +u64_to_user_ptr (args->handles), + args->count_handles, + &syncobjs); +if (ret <0 ) +return ret; + + points =kmalloc_array (args->count_handles,sizeof (*points), +GFP_KERNEL ); +if (!points) { + ret = -ENOMEM ; + goto out; + } +if (!u64_to_user_ptr (args->points)) { +memset (points,0 , args->count_handles *sizeof (uint64_t )); + }else if (copy_from_user (points,u64_to_user_ptr (args->points), +sizeof (uint64_t ) * args->count_handles)) { + ret = -EFAULT ; + goto err_points; + } + + chains =kmalloc_array (args->count_handles,sizeof (void *),GFP_KERNEL ); +if (!chains) { + ret = -ENOMEM ; + goto err_points; + } +for (i =0 ; i < args->count_handles; i++) { + chains[i] =kzalloc (sizeof (struct dma_fence_chain ),GFP_KERNEL ); +if (!chains[i]) { +for (j =0 ; j < i; j++) +kfree (chains[j]); + ret = -ENOMEM ; + goto err_chains;
drivers/gpu/drm/drm_syncobj.c drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, · line 1248
Quoted 10 lines
drivers/gpu/drm/drm_syncobj.c +10
-0+ } + } + +for (i =0 ; i < args->count_handles; i++) { +struct dma_fence *fence =dma_fence_get_stub (); + +drm_syncobj_add_point (syncobjs[i], chains[i], + fence, points[i]); +dma_fence_put (fence); + }
I think I found an issue where the implementation doesn't match what the spec requires on host signaling.
Consider the following :
Timeline semaphore has a value of 4.
A device submits a commands to signal point 5.
The host signals point 6.
The value of the timeline will remain 4 until the device commands complete, at which point it will change to 6.
But the specification seems to say that the timeline value should be 6 once the host signaling completes.
The only option that I see working would be to add point 6 in the timeline and wait on that point to complete.
Christian, David, what do you think?
Thanks,
-Lionel
Quoted 18 lines
drivers/gpu/drm/drm_syncobj.c +10
-0+err_chains: +kfree (chains); +err_points: +kfree (points); +out: +drm_syncobj_array_free (syncobjs, args->count_handles); + +return ret; +} +int drm_syncobj_query_ioctl (struct drm_device *dev,void *data,struct drm_file *file_private) {include/uapi/drm/drm.h +0
-0
include/uapi/drm/drm.h extern "C" { · line 949
Quoted 7 lines
include/uapi/drm/drm.h +1
-0@@ -943,6 +943,7 @@ extern "C" {#define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)#define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array)#define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer) +#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)/** * Device specific ioctls should only be in their respective headers
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): d24ee0d0-f044-38ca-6b8d-fcb98cb47d1a-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [PATCH 8/9] drm/syncobj: add timeline signal ioctl for syncobj v5
Quoted 148 lines · Lionel Landwerlin
Quoted 117 lines · Chunming Zhou
v2: individually allocate chain array, since chain node is free independently.
v3: all existing points must be already signaled before cpu perform signal operation,
so add check condition for that.
v4: remove v3 change and add checking to prevent out-of-order
v5: unify binary and timelineSigned-off-by Chunming Zhou <[email protected]>Cc Tobias Hector <[email protected]>Cc Jason Ekstrand <[email protected]>Cc Dave Airlie <[email protected]>Cc Chris Wilson <[email protected]>Cc Lionel Landwerlin <[email protected]>---
drivers/gpu/drm/drm_internal.h| 2 + drivers/gpu/drm/drm_ioctl.c | 2 + drivers/gpu/drm/drm_syncobj.c | 73 ++++++++++++++++++++++++++++++++++ include/uapi/drm/drm.h | 1 +4 files changed, 78 insertions(+)drivers/gpu/drm/drm_internal.h +2
-0@@ -190,6 +190,8 @@ int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); +int drm_syncobj_timeline_signal_ioctl (struct drm_device *dev,void *data, + struct drm_file *file_private); int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,struct
drm_file*file_private);
diff --gita/drivers/gpu/drm/drm_ioctl.cb/drivers/gpu/drm/drm_ioctl.cindex92b3b7b2fd81..d337f161909c100644drivers/gpu/drm/drm_ioctl.c +2
-0@@ -696,6 +696,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_SIGNAL, drm_syncobj_signal_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL, drm_syncobj_timeline_signal_ioctl, + DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_QUERY, drm_syncobj_query_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW),DRM_IOCTL_DEF(DRM_IOCTL_CRTC_GET_SEQUENCE,
drm_crtc_get_sequence_ioctl,DRM_UNLOCKED),drivers/gpu/drm/drm_syncobj.c +0
-0@@ -1183,6 +1183,79 @@ drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, return ret; }+int
drivers/gpu/drm/drm_syncobj.c +41
-0+drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_private) +{ + struct drm_syncobj_timeline_array *args = data; + struct drm_syncobj **syncobjs; + struct dma_fence_chain **chains; + uint64_t *points; + uint32_t i, j; + int ret; + + if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) + return -EOPNOTSUPP; + + if (args->pad != 0) + return -EINVAL; + + if (args->count_handles == 0) + return -EINVAL; + + ret = drm_syncobj_array_find(file_private, + u64_to_user_ptr(args->handles), + args->count_handles, + &syncobjs); + if (ret < 0) + return ret; + + points = kmalloc_array(args->count_handles, sizeof(*points), + GFP_KERNEL); + if (!points) { + ret = -ENOMEM; + goto out; + } + if (!u64_to_user_ptr(args->points)) { + memset(points, 0, args->count_handles * sizeof(uint64_t)); + } else if (copy_from_user(points, u64_to_user_ptr(args->points), + sizeof(uint64_t) * args->count_handles)) { + ret = -EFAULT; + goto err_points; + } + + chains = kmalloc_array(args->count_handles, sizeof(void *),
GFP_KERNEL);
+ if (!chains) {
+ ret =-ENOMEM;
+ gotoerr_points;
+ }
+ for (i = 0; i <args->count_handles; i++) {
+ chains[i] =kzalloc(sizeof(struct dma_fence_chain), GFP_KERNEL);
+ if (!chains[i]) {
+ for (j = 0; j < i; j++)
+kfree(chains[j]);
+ ret =-ENOMEM;
+ gotoerr_chains;
+ }
+ }drivers/gpu/drm/drm_syncobj.c drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, · line 1248
Quoted 8 lines
drivers/gpu/drm/drm_syncobj.c +8
-0+ + for (i = 0; i < args->count_handles; i++) { + struct dma_fence *fence = dma_fence_get_stub(); + + drm_syncobj_add_point(syncobjs[i], chains[i], + fence, points[i]); + dma_fence_put(fence); + }I think I found an issue where the implementation doesn't match what the spec requires on host signaling.
Consider the following :
Timeline semaphore has a value of 4.
A device submits a commands to signal point 5.
The host signals point 6.
The value of the timeline will remain 4 until the device commands complete, at which point it will change to 6.
But the specification seems to say that the timeline value should be 6 once the host signaling completes.
Quoted 5 lines
The only option that I see working would be to add point 6 in the timeline and wait on that point to complete.
Christian, David, what do you think?
This is exactly what I said before, see V3 comment in the patch head.
But Jeson said this should be guranteed by user and application.
Btw, if we wait all previous points completion this ioctl could be blocked.
-David
Quoted 28 lines
Thanks,
-Lionel
Quoted 20 lines
drivers/gpu/drm/drm_syncobj.c +10
-0+err_chains: + kfree(chains); +err_points: + kfree(points); +out: + drm_syncobj_array_free(syncobjs, args->count_handles); + + return ret; +} +int
drm_syncobj_query_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private)
{include/uapi/drm/drm.h +0
-0@@ -943,6 +943,7 @@ extern "C" { #define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait)
Quoted 10 lines
Quoted 8 lines
include/uapi/drm/drm.h +1
-0#define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct drm_syncobj_timeline_array) #define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer) +#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct
drm_syncobj_timeline_array)
/**
* Device specific ioctls should only be in their respective headers
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 8/9] drm/syncobj: add timeline signal ioctl for syncobj v5
Quoted 153 lines · Chunming Zhou
Quoted 147 lines · Lionel Landwerlin
Quoted 115 lines · Chunming Zhou
v2: individually allocate chain array, since chain node is free independently.
v3: all existing points must be already signaled before cpu perform signal operation,
so add check condition for that.
v4: remove v3 change and add checking to prevent out-of-order
v5: unify binary and timelineSigned-off-by Chunming Zhou <[email protected]>Cc Tobias Hector <[email protected]>Cc Jason Ekstrand <[email protected]>Cc Dave Airlie <[email protected]>Cc Chris Wilson <[email protected]>Cc Lionel Landwerlin <[email protected]>--- drivers/gpu/drm/drm_internal.h | 2 + drivers/gpu/drm/drm_ioctl.c | 2 + drivers/gpu/drm/drm_syncobj.c | 73 ++++++++++++++++++++++++++++++++++ include/uapi/drm/drm.h | 1 + 4 files changed, 78 insertions(+)drivers/gpu/drm/drm_internal.h +2
-0@@ -190,6 +190,8 @@ int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); +int drm_syncobj_timeline_signal_ioctl (struct drm_device *dev,void *data, + struct drm_file *file_private); int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,struct
drm_file*file_private);
diff --gita/drivers/gpu/drm/drm_ioctl.cb/drivers/gpu/drm/drm_ioctl.c
index92b3b7b2fd81..d337f161909c100644drivers/gpu/drm/drm_ioctl.c +2
-0@@ -696,6 +696,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_SIGNAL, drm_syncobj_signal_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL, drm_syncobj_timeline_signal_ioctl, + DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_QUERY, drm_syncobj_query_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW),DRM_IOCTL_DEF(DRM_IOCTL_CRTC_GET_SEQUENCE,
drm_crtc_get_sequence_ioctl,DRM_UNLOCKED),drivers/gpu/drm/drm_syncobj.c +52
-0@@ -1183,6 +1183,79 @@ drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, return ret; } +int +drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_private) +{ + struct drm_syncobj_timeline_array *args = data; + struct drm_syncobj **syncobjs; + struct dma_fence_chain **chains; + uint64_t *points; + uint32_t i, j; + int ret; + + if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) + return -EOPNOTSUPP; + + if (args->pad != 0) + return -EINVAL; + + if (args->count_handles == 0) + return -EINVAL; + + ret = drm_syncobj_array_find(file_private, + u64_to_user_ptr(args->handles), + args->count_handles, + &syncobjs); + if (ret < 0) + return ret; + + points = kmalloc_array(args->count_handles, sizeof(*points), + GFP_KERNEL); + if (!points) { + ret = -ENOMEM; + goto out; + } + if (!u64_to_user_ptr(args->points)) { + memset(points, 0, args->count_handles * sizeof(uint64_t)); + } else if (copy_from_user(points, u64_to_user_ptr(args->points), + sizeof(uint64_t) * args->count_handles)) { + ret = -EFAULT; + goto err_points; + } + + chains = kmalloc_array(args->count_handles, sizeof(void *),GFP_KERNEL ); + if (!chains) { + ret = -ENOMEM; + goto err_points; + } + for (i = 0; i < args->count_handles; i++) { + chains[i] = kzalloc(sizeof(struct dma_fence_chain),GFP_KERNEL ); + if (!chains[i]) { + for (j = 0; j < i; j++) + kfree(chains[j]); + ret = -ENOMEM; + goto err_chains;drivers/gpu/drm/drm_syncobj.c drm_syncobj_signal_ioctl(struct drm_device · line 1250
Quoted 10 lines
drivers/gpu/drm/drm_syncobj.c +10
-0+ } + } + + for (i = 0; i < args->count_handles; i++) { + struct dma_fence *fence = dma_fence_get_stub(); + + drm_syncobj_add_point(syncobjs[i], chains[i], + fence, points[i]); + dma_fence_put(fence); + }I think I found an issue where the implementation doesn't match what the spec requires on host signaling.
Consider the following :
Timeline semaphore has a value of 4.
A device submits a commands to signal point 5.
The host signals point 6.
The value of the timeline will remain 4 until the device commands complete, at which point it will change to 6.
But the specification seems to say that the timeline value should be 6 once the host signaling completes.
Quoted 5 lines
The only option that I see working would be to add point 6 in the timeline and wait on that point to complete.
Christian, David, what do you think?
Quoted 8 lines
This is exactly what I said before, see V3 comment in the patch head.
But Jeson said this should be guranteed by user and application.
Btw, if we wait all previous points completion this ioctl could be blocked.
-David
I haven't seen anything that explicitly forbids that in the spec.
Trying to get a clarification.
-Lionel
Quoted 30 lines
Quoted 30 lines
Thanks,
-Lionel
Quoted 21 lines
drivers/gpu/drm/drm_syncobj.c +10
-0+err_chains: + kfree(chains); +err_points: + kfree(points); +out: + drm_syncobj_array_free(syncobjs, args->count_handles); + + return ret; +} + int drm_syncobj_query_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private) {include/uapi/drm/drm.h +0
-0@@ -943,6 +943,7 @@ extern "C" { #define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait) #define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, struct
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
include/uapi/drm/drm.h +1
-0drm_syncobj_timeline_array) #define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer) +#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct
drm_syncobj_timeline_array)
/**
* Device specific ioctls should only be in their respective headers
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): b5bfbd8f-24df-ba45-5715-8c2dd4c0e60c-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Re: [PATCH 8/9] drm/syncobj: add timeline signal ioctl for syncobj v5
Quoted 166 lines · Lionel Landwerlin
Quoted 155 lines · Chunming Zhou
Quoted 149 lines · Lionel Landwerlin
Quoted 119 lines · Chunming Zhou
v2: individually allocate chain array, since chain node is free independently.
v3: all existing points must be already signaled before cpu perform signal operation,
so add check condition for that.
v4: remove v3 change and add checking to prevent out-of-order
v5: unify binary and timelineSigned-off-by Chunming Zhou <[email protected]>Cc Tobias Hector <[email protected]>Cc Jason Ekstrand <[email protected]>Cc Dave Airlie <[email protected]>Cc Chris Wilson <[email protected]>Cc Lionel Landwerlin <[email protected]>---
drivers/gpu/drm/drm_internal.h| 2 +
drivers/gpu/drm/drm_ioctl.c | 2 +
drivers/gpu/drm/drm_syncobj.c | 73
++++++++++++++++++++++++++++++++++
include/uapi/drm/drm.h | 1 +4 files changed, 78 insertions(+)drivers/gpu/drm/drm_internal.h +2
-0@@ -190,6 +190,8 @@ int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private); +int drm_syncobj_timeline_signal_ioctl (struct drm_device *dev,void *data, + struct drm_file *file_private); int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,struct
drm_file*file_private);
diff --gita/drivers/gpu/drm/drm_ioctl.cb/drivers/gpu/drm/drm_ioctl.cindex92b3b7b2fd81..d337f161909c100644drivers/gpu/drm/drm_ioctl.c +2
-0@@ -696,6 +696,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_SIGNAL, drm_syncobj_signal_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL, drm_syncobj_timeline_signal_ioctl, + DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_QUERY, drm_syncobj_query_ioctl,DRM_UNLOCKED|DRM_RENDER_ALLOW),
DRM_IOCTL_DEF(DRM_IOCTL_CRTC_GET_SEQUENCE,drm_crtc_get_sequence_ioctl,DRM_UNLOCKED),drivers/gpu/drm/drm_syncobj.c +0
-0@@ -1183,6 +1183,79 @@ drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, return ret; }+int
drivers/gpu/drm/drm_syncobj.c +41
-0+drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_private) +{ + struct drm_syncobj_timeline_array *args = data; + struct drm_syncobj **syncobjs; + struct dma_fence_chain **chains; + uint64_t *points; + uint32_t i, j; + int ret; + + if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ)) + return -EOPNOTSUPP; + + if (args->pad != 0) + return -EINVAL; + + if (args->count_handles == 0) + return -EINVAL; + + ret = drm_syncobj_array_find(file_private, + u64_to_user_ptr(args->handles), + args->count_handles, + &syncobjs); + if (ret < 0) + return ret; + + points = kmalloc_array(args->count_handles, sizeof(*points), + GFP_KERNEL); + if (!points) { + ret = -ENOMEM; + goto out; + } + if (!u64_to_user_ptr(args->points)) { + memset(points, 0, args->count_handles * sizeof(uint64_t)); + } else if (copy_from_user(points, u64_to_user_ptr(args->points), + sizeof(uint64_t) * args->count_handles)) { + ret = -EFAULT; + goto err_points; + } + + chains = kmalloc_array(args->count_handles, sizeof(void *),
GFP_KERNEL);
+ if (!chains) {
+ ret =-ENOMEM;
+ gotoerr_points;
+ }
+ for (i = 0; i <args->count_handles; i++) {
+ chains[i] =kzalloc(sizeof(struct dma_fence_chain), GFP_KERNEL);
+ if (!chains[i]) {
+ for (j = 0; j < i; j++)
+kfree(chains[j]);
+ ret =-ENOMEM;
+ gotoerr_chains;
+ }
+ }drivers/gpu/drm/drm_syncobj.c
Quoted 8 lines
drivers/gpu/drm/drm_syncobj.c +8
-0+ + for (i = 0; i < args->count_handles; i++) { + struct dma_fence *fence = dma_fence_get_stub(); + + drm_syncobj_add_point(syncobjs[i], chains[i], + fence, points[i]); + dma_fence_put(fence); + }I think I found an issue where the implementation doesn't match what the spec requires on host signaling.
Consider the following :
Timeline semaphore has a value of 4.
A device submits a commands to signal point 5.
The host signals point 6.
The value of the timeline will remain 4 until the device commands complete, at which point it will change to 6.
But the specification seems to say that the timeline value should be 6 once the host signaling completes.
Quoted 5 lines
The only option that I see working would be to add point 6 in the timeline and wait on that point to complete.
Christian, David, what do you think?
Quoted 8 lines
This is exactly what I said before, see V3 comment in the patch head.
But Jeson said this should be guranteed by user and application.
Btw, if we wait all previous points completion this ioctl could be blocked.
-David
Quoted 6 lines
I haven't seen anything that explicitly forbids that in the spec.
Trying to get a clarification.
-Lionel
So it looks like this won't be allowed by the vulkan spec.
Sorry, I genuinely thought this was allowed because we can end up in such situation on the device side :(
Not quite sure how useful it would be to have some checks here as most of the error handling can only be done within the add_point() function and requires taking the syncobj lock.
As much as I could like to see more error checking, I guess this isn't doable without more locking.
-Lionel
Quoted 41 lines
Quoted 32 lines
Quoted 32 lines
Thanks,
-Lionel
Quoted 21 lines
drivers/gpu/drm/drm_syncobj.c +10
-0+err_chains: + kfree(chains); +err_points: + kfree(points); +out: + drm_syncobj_array_free(syncobjs, args->count_handles); + + return ret; +} +int
drm_syncobj_query_ioctl(struct drm_device *dev, void *data, struct drm_file *file_private)
{include/uapi/drm/drm.h +0
-0@@ -943,6 +943,7 @@ extern "C" { #define DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT DRM_IOWR(0xCA, struct drm_syncobj_timeline_wait) #define DRM_IOCTL_SYNCOBJ_QUERY DRM_IOWR(0xCB, structQuoted 8 lines
Quoted 8 lines
Quoted 7 lines
include/uapi/drm/drm.h +1
-0drm_syncobj_timeline_array) #define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer) +#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct
drm_syncobj_timeline_array)
/**
* Device specific ioctls should only be in their respective headers
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/9 drm/syncobj: use the timeline point in drm_syncobj_find_fence v4
In reply to Chunming ZhouFrom: Christian König <[email protected]>
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
v4: add timeout for find fence
--- drivers/gpu/drm/drm_syncobj.c | 50 ++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_syncobj.c +47 -3
@@ -213,6 +213,8 @@ static void drm_syncobj_assign_null_handle(struct drm_syncobj *syncobj)dma_fence_put (fence); } +/* 5s default for wait submission */ +#define DRM_SYNCOBJ_WAIT_FOR_SUBMIT_TIMEOUT 5000000000ULL/** * drm_syncobj_find_fence - lookup and reference the fence in a sync object * @file_private: drm file private pointer
@@ -233,16 +235,58 @@ 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; +u64 timeout =nsecs_to_jiffies64 (DRM_SYNCOBJ_WAIT_FOR_SUBMIT_TIMEOUT ); +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 (timeout ==0 ) { + ret = -ETIME ; +break ; + } + +if (signal_pending (current)) { + ret = -ERESTARTSYS ; +break ; + } + + timeout =schedule_timeout (timeout); + }while (1 ); + +__set_current_state (TASK_RUNNING ); + *fence = wait.fence; + +if (wait.node.next) +drm_syncobj_remove_wait (syncobj, &wait); +return ret; }EXPORT_SYMBOL (drm_syncobj_find_fence);
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/9 drm/amdgpu: add timeline support in amdgpu CS v3
In reply to Chunming Zhousyncobj wait/signal operation is appending in command submission.
v2: separate to two kinds in/out_deps functions
v3: fix checking for timeline syncobj
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 10 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 152 +++++++++++++++++++++---- include/uapi/drm/amdgpu_drm.h | 8 ++ 3 files changed, 144 insertions(+), 26 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +8 -2
@@ -433,6 +433,12 @@ struct amdgpu_cs_chunk {void *kdata; }; +struct amdgpu_cs_post_dep { +struct drm_syncobj *syncobj; +struct dma_fence_chain *chain; +u64 point; +}; +struct amdgpu_cs_parser {struct amdgpu_device *adev;struct drm_file *filp;
@@ -462,8 +468,8 @@ struct amdgpu_cs_parser {/* user fence */ struct amdgpu_bo_list_entry uf_entry; -unsigned num_post_dep_syncobjs; -struct drm_syncobj **post_dep_syncobjs; +unsigned num_post_deps; +struct amdgpu_cs_post_dep *post_deps; }; static inline u32 amdgpu_get_ib_value(struct amdgpu_cs_parser *p,
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +128 -24
229 lines not on this page · raw message
include/uapi/drm/amdgpu_drm.h +8 -0
@@ -525,6 +525,8 @@ struct drm_amdgpu_gem_va {#define AMDGPU_CHUNK_ID_SYNCOBJ_OUT 0x05#define AMDGPU_CHUNK_ID_BO_HANDLES 0x06#define AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES 0x07 +#define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT 0x08 +#define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_SIGNAL 0x09struct drm_amdgpu_cs_chunk {__u32 chunk_id;
@@ -605,6 +607,12 @@ struct drm_amdgpu_cs_chunk_sem {__u32 handle; }; +struct drm_amdgpu_cs_chunk_syncobj { +__u32 handle; +__u32 flags; +__u64 point; +}; +#define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ 0#define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ_FD 1#define AMDGPU_FENCE_TO_HANDLE_GET_SYNC_FILE_FD 2
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 9/9 drm/amdgpu: update version for timeline syncobj support in amdgpu
In reply to Chunming Zhou--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
@@ -74,9 +74,10 @@* - 3.28.0 - Add AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES * - 3.29.0 - Add AMDGPU_IB_FLAG_RESET_GDS_MAX_WAVE_ID * - 3.30.0 - Add AMDGPU_SCHED_OP_CONTEXT_PRIORITY_OVERRIDE. +* - 3.31.0 - Add syncobj timeline support to AMDGPU_CS. */ #define KMS_DRIVER_MAJOR 3 -#define KMS_DRIVER_MINOR 30 +#define KMS_DRIVER_MINOR 31#define KMS_DRIVER_PATCHLEVEL 0int amdgpu_vram_limit =0 ;
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel