aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/panfrost/pan_screen.c
diff options
context:
space:
mode:
authorBoris Brezillon <[email protected]>2019-09-15 10:57:26 +0200
committerBoris Brezillon <[email protected]>2019-10-03 16:55:38 -0400
commit819738e4af1ab0625e17c6fa555e5e23d737c5a0 (patch)
tree4d018641770590cc2251ccfbfe47fbeae05ac83f /src/gallium/drivers/panfrost/pan_screen.c
parent6936b7f31973c89cf1171de2ae65d57ce287f54f (diff)
panfrost: Use the per-batch fences to wait on the last submitted batch
We just replace the per-context out_sync object by a pointer to the the fence of the last last submitted batch. Pipelining of batches will come later. Signed-off-by: Boris Brezillon <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost/pan_screen.c')
-rw-r--r--src/gallium/drivers/panfrost/pan_screen.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c
index dae8b941f1e..e2c31f7f821 100644
--- a/src/gallium/drivers/panfrost/pan_screen.c
+++ b/src/gallium/drivers/panfrost/pan_screen.c
@@ -590,8 +590,12 @@ panfrost_fence_finish(struct pipe_screen *pscreen,
struct panfrost_screen *screen = pan_screen(pscreen);
struct panfrost_fence *f = (struct panfrost_fence *)fence;
int ret;
-
unsigned syncobj;
+
+ /* The fence was already signaled */
+ if (f->fd == -1)
+ return true;
+
ret = drmSyncobjCreate(screen->fd, 0, &syncobj);
if (ret) {
fprintf(stderr, "Failed to create syncobj to wait on: %m\n");
@@ -623,18 +627,28 @@ panfrost_fence_create(struct panfrost_context *ctx)
if (!f)
return NULL;
+ f->fd = -1;
+
+ /* There was no job flushed yet or the batch fence was already
+ * signaled, let's return a dummy fence object that returns true
+ * directly when ->fence_finish() is called.
+ */
+ if (!ctx->last_out_sync || ctx->last_out_sync->signaled)
+ goto out;
+
/* Snapshot the last Panfrost's rendering's out fence. We'd rather have
* another syncobj instead of a sync file, but this is all we get.
* (HandleToFD/FDToHandle just gives you another syncobj ID for the
* same syncobj).
*/
- drmSyncobjExportSyncFile(screen->fd, ctx->out_sync, &f->fd);
+ drmSyncobjExportSyncFile(screen->fd, ctx->last_out_sync->syncobj, &f->fd);
if (f->fd == -1) {
fprintf(stderr, "export failed: %m\n");
free(f);
return NULL;
}
+out:
pipe_reference_init(&f->reference, 1);
return f;