diff options
author | Christian König <christian.koenig@amd.com> | 2018-09-19 16:12:25 +0200 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2018-10-25 13:45:07 +0200 |
commit | ca05359f1e64cf8303ee532e50efe4ab7563d4a9 (patch) | |
tree | 853e9e47b788fa72fcc5b0cd099e4199ad6c78a0 /drivers/dma-buf | |
parent | dma-buf: remove shared fence staging in reservation object (diff) | |
download | linux-ca05359f1e64cf8303ee532e50efe4ab7563d4a9.tar.xz linux-ca05359f1e64cf8303ee532e50efe4ab7563d4a9.zip |
dma-buf: allow reserving more than one shared fence slot
Let's support simultaneous submissions to multiple engines.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Link: https://patchwork.kernel.org/patch/10626149/
Diffstat (limited to 'drivers/dma-buf')
-rw-r--r-- | drivers/dma-buf/reservation.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c index 5825fc336a13..5fb4fd461908 100644 --- a/drivers/dma-buf/reservation.c +++ b/drivers/dma-buf/reservation.c @@ -56,9 +56,10 @@ const char reservation_seqcount_string[] = "reservation_seqcount"; EXPORT_SYMBOL(reservation_seqcount_string); /** - * reservation_object_reserve_shared - Reserve space to add a shared - * fence to a reservation_object. + * reservation_object_reserve_shared - Reserve space to add shared fences to + * a reservation_object. * @obj: reservation object + * @num_fences: number of fences we want to add * * Should be called before reservation_object_add_shared_fence(). Must * be called with obj->lock held. @@ -66,7 +67,8 @@ EXPORT_SYMBOL(reservation_seqcount_string); * RETURNS * Zero for success, or -errno */ -int reservation_object_reserve_shared(struct reservation_object *obj) +int reservation_object_reserve_shared(struct reservation_object *obj, + unsigned int num_fences) { struct reservation_object_list *old, *new; unsigned int i, j, k, max; @@ -74,10 +76,11 @@ int reservation_object_reserve_shared(struct reservation_object *obj) old = reservation_object_get_list(obj); if (old && old->shared_max) { - if (old->shared_count < old->shared_max) + if ((old->shared_count + num_fences) <= old->shared_max) return 0; else - max = old->shared_max * 2; + max = max(old->shared_count + num_fences, + old->shared_max * 2); } else { max = 4; } |