vc4_program_fini(pctx);
+ if (vc4->screen->has_syncobj)
+ drmSyncobjDestroy(vc4->fd, vc4->job_syncobj);
+
ralloc_free(vc4);
}
{
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;
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);
struct vc4_hwperfmon *perfmon;
/** @} */
+
+ /** Handle of syncobj containing the last submitted job fence. */
+ uint32_t job_syncobj;
};
struct vc4_rasterizer_state {
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);
}
submit.flags |= job->flags;
+ if (vc4->screen->has_syncobj)
+ submit.out_sync = vc4->job_syncobj;
+
if (!(vc4_debug & VC4_DEBUG_NORAST)) {
int ret;
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,
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;
}