diff options
author | Eric Anholt <[email protected]> | 2018-04-04 09:59:18 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2018-04-12 11:20:50 -0700 |
commit | b225cdceccb225329298763baa302a9332288b18 (patch) | |
tree | ec5f10c51250de4a64acf94a8bbb4a8d1bca014c /src/gallium/drivers/vc5/vc5_fence.c | |
parent | d9c525ed2240ff450f36a5d83c9c2c66087cd2bb (diff) |
broadcom/vc5: Update the UABI for in/out syncobjs
This is the ABI I'm hoping to stabilize for merging the driver. seqnos
are eliminated, which allows for the GPU scheduler to task-switch between
DRM fds even after submission to the kernel. In/out sync objects are
introduced, to allow the Android fencing extension (not yet implemented,
but should be trivial), and to also allow the driver to tell the kernel to
not start a bin until a previous render is complete.
Diffstat (limited to 'src/gallium/drivers/vc5/vc5_fence.c')
-rw-r--r-- | src/gallium/drivers/vc5/vc5_fence.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/gallium/drivers/vc5/vc5_fence.c b/src/gallium/drivers/vc5/vc5_fence.c index 08de9bca5a1..731dd6db908 100644 --- a/src/gallium/drivers/vc5/vc5_fence.c +++ b/src/gallium/drivers/vc5/vc5_fence.c @@ -36,12 +36,12 @@ #include "util/u_inlines.h" -#include "vc5_screen.h" +#include "vc5_context.h" #include "vc5_bufmgr.h" struct vc5_fence { struct pipe_reference reference; - uint64_t seqno; + uint32_t sync; }; static void @@ -49,11 +49,13 @@ vc5_fence_reference(struct pipe_screen *pscreen, struct pipe_fence_handle **pp, struct pipe_fence_handle *pf) { + struct vc5_screen *screen = vc5_screen(pscreen); struct vc5_fence **p = (struct vc5_fence **)pp; struct vc5_fence *f = (struct vc5_fence *)pf; struct vc5_fence *old = *p; if (pipe_reference(&(*p)->reference, &f->reference)) { + drmSyncobjDestroy(screen->fd, old->sync); free(old); } *p = f; @@ -68,19 +70,28 @@ vc5_fence_finish(struct pipe_screen *pscreen, struct vc5_screen *screen = vc5_screen(pscreen); struct vc5_fence *f = (struct vc5_fence *)pf; - return vc5_wait_seqno(screen, f->seqno, timeout_ns, "fence wait"); + return drmSyncobjWait(screen->fd, &f->sync, 1, timeout_ns, 0, NULL); } struct vc5_fence * -vc5_fence_create(struct vc5_screen *screen, uint64_t seqno) +vc5_fence_create(struct vc5_context *vc5) { struct vc5_fence *f = calloc(1, sizeof(*f)); - if (!f) return NULL; + uint32_t new_sync; + /* Make a new sync object for the context. */ + int ret = drmSyncobjCreate(vc5->fd, DRM_SYNCOBJ_CREATE_SIGNALED, + &new_sync); + if (ret) { + free(f); + return NULL; + } + pipe_reference_init(&f->reference, 1); - f->seqno = seqno; + f->sync = vc5->out_sync; + vc5->out_sync = new_sync; return f; } |