summaryrefslogtreecommitdiff
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorStefan Schake <stschake@gmail.com>2018-04-25 00:00:59 +0200
committerEric Anholt <eric@anholt.net>2018-05-17 16:04:28 +0100
commit44036c354d800dda08d3688b042130039f3d592a (patch)
tree371fabae2380e942d4ebf71d6d7d5dcd839d8ce1 /src/gallium/drivers
parent9ed05e2520f77a11f73d21bccfe149b2b800082c (diff)
broadcom/vc4: Store job fence in syncobj
This gives us access to the fence created for the render job. v2: Drop flag (Eric) Signed-off-by: Stefan Schake <stschake@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/vc4/vc4_context.c10
-rw-r--r--src/gallium/drivers/vc4/vc4_context.h5
-rw-r--r--src/gallium/drivers/vc4/vc4_job.c24
3 files changed, 35 insertions, 4 deletions
diff --git a/src/gallium/drivers/vc4/vc4_context.c b/src/gallium/drivers/vc4/vc4_context.c
index c1e041d1ef9..0deb3ef85ee 100644
--- a/src/gallium/drivers/vc4/vc4_context.c
+++ b/src/gallium/drivers/vc4/vc4_context.c
@@ -124,6 +124,9 @@ vc4_context_destroy(struct pipe_context *pctx)
vc4_program_fini(pctx);
+ if (vc4->screen->has_syncobj)
+ drmSyncobjDestroy(vc4->fd, vc4->job_syncobj);
+
ralloc_free(vc4);
}
@@ -132,6 +135,7 @@ vc4_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
{
struct vc4_screen *screen = vc4_screen(pscreen);
struct vc4_context *vc4;
+ int err;
/* Prevent dumping of the shaders built during context setup. */
uint32_t saved_shaderdb_flag = vc4_debug & VC4_DEBUG_SHADERDB;
@@ -157,10 +161,12 @@ vc4_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
vc4_query_init(pctx);
vc4_resource_context_init(pctx);
- vc4_job_init(vc4);
-
vc4->fd = screen->fd;
+ err = vc4_job_init(vc4);
+ if (err)
+ goto fail;
+
slab_create_child(&vc4->transfer_pool, &screen->transfer_pool);
vc4->uploader = u_upload_create_default(&vc4->base);
diff --git a/src/gallium/drivers/vc4/vc4_context.h b/src/gallium/drivers/vc4/vc4_context.h
index 16bebeec40b..d094957bb57 100644
--- a/src/gallium/drivers/vc4/vc4_context.h
+++ b/src/gallium/drivers/vc4/vc4_context.h
@@ -408,6 +408,9 @@ struct vc4_context {
struct vc4_hwperfmon *perfmon;
/** @} */
+
+ /** Handle of syncobj containing the last submitted job fence. */
+ uint32_t job_syncobj;
};
struct vc4_rasterizer_state {
@@ -502,7 +505,7 @@ void vc4_write_uniforms(struct vc4_context *vc4,
struct vc4_texture_stateobj *texstate);
void vc4_flush(struct pipe_context *pctx);
-void vc4_job_init(struct vc4_context *vc4);
+int vc4_job_init(struct vc4_context *vc4);
struct vc4_job *vc4_get_job(struct vc4_context *vc4,
struct pipe_surface *cbuf,
struct pipe_surface *zsbuf);
diff --git a/src/gallium/drivers/vc4/vc4_job.c b/src/gallium/drivers/vc4/vc4_job.c
index 41c274ca1b3..3b0ba8b69cf 100644
--- a/src/gallium/drivers/vc4/vc4_job.c
+++ b/src/gallium/drivers/vc4/vc4_job.c
@@ -477,6 +477,9 @@ vc4_job_submit(struct vc4_context *vc4, struct vc4_job *job)
}
submit.flags |= job->flags;
+ if (vc4->screen->has_syncobj)
+ submit.out_sync = vc4->job_syncobj;
+
if (!(vc4_debug & VC4_DEBUG_NORAST)) {
int ret;
@@ -530,7 +533,7 @@ vc4_job_hash(const void *key)
return _mesa_hash_data(key, sizeof(struct vc4_job_key));
}
-void
+int
vc4_job_init(struct vc4_context *vc4)
{
vc4->jobs = _mesa_hash_table_create(vc4,
@@ -539,5 +542,24 @@ vc4_job_init(struct vc4_context *vc4)
vc4->write_jobs = _mesa_hash_table_create(vc4,
_mesa_hash_pointer,
_mesa_key_pointer_equal);
+
+ if (vc4->screen->has_syncobj) {
+ /* Create the syncobj as signaled since with no job executed
+ * there is nothing to wait on.
+ */
+ int ret = drmSyncobjCreate(vc4->fd,
+ DRM_SYNCOBJ_CREATE_SIGNALED,
+ &vc4->job_syncobj);
+ if (ret) {
+ /* If the screen indicated syncobj support, we should
+ * be able to create a signaled syncobj.
+ * At this point it is too late to pretend the screen
+ * has no syncobj support.
+ */
+ return ret;
+ }
+ }
+
+ return 0;
}