dma-buf/fence: add fence_array fences v6
authorGustavo Padovan <gustavo.padovan@collabora.co.uk>
Wed, 1 Jun 2016 13:10:03 +0000 (15:10 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 2 Jun 2016 07:26:15 +0000 (09:26 +0200)
commitb3dfbdf261e076a997f812323edfdba84ba80256
tree06bf2fdb5d65c62aee083ae7867e45394def663e
parent76bf0db5543976ef50362db7071da367cb118532
dma-buf/fence: add fence_array fences v6

struct fence_array inherits from struct fence and carries a
collection of fences that needs to be waited together.

It is useful to translate a sync_file to a fence to remove the complexity
of dealing with sync_files on DRM drivers. So even if there are many
fences in the sync_file that needs to waited for a commit to happen,
they all get added to the fence_collection and passed for DRM use as
a standard struct fence.

That means that no changes needed to any driver besides supporting fences.

To avoid fence_array's fence allocates a new timeline if needed (when
combining fences from different timelines).

v2: Comments by Daniel Vetter:
- merge fence_collection_init() and fence_collection_add()
- only add callbacks at ->enable_signalling()
- remove fence_collection_put()
- check for type on to_fence_collection()
- adjust fence_is_later() and fence_later() to WARN_ON() if they
are used with collection fences.

v3: - Initialize fence_cb.node at fence init.

    Comments by Chris Wilson:
- return "unbound" on fence_collection_get_timeline_name()
- don't stop adding callbacks if one fails
- remove redundant !! on fence_collection_enable_signaling()
- remove redundant () on fence_collection_signaled
- use fence_default_wait() instead

v4 (chk): Rework, simplification and cleanup:
- Drop FENCE_NO_CONTEXT handling, always allocate a context.
- Rename to fence_array.
- Return fixed driver name.
- Register only one callback at a time.
- Document that create function takes ownership of array.

v5 (chk): More work and fixes:
- Avoid deadlocks by adding all callbacks at once again.
- Stop trying to remove the callbacks.
- Provide context and sequence number for the array fence.

v6 (chk): Fixes found during testing
- Fix stupid typo in _enable_signaling().

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Acked-by: Sumit Semwal <sumit.semwal@linaro.org>
[danvet: Improve commit message as suggested by Gustavo.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1464786612-5010-3-git-send-email-deathsimple@vodafone.de
drivers/dma-buf/Makefile
drivers/dma-buf/fence-array.c [new file with mode: 0644]
include/linux/fence-array.h [new file with mode: 0644]
This page took 0.031528 seconds and 5 git commands to generate.