This context needs to be locked before usage, and flushed after.
If it's forgotten, radeonsi may crash (eg #6666).
To avoid this kind of error, introduce 2 helpers.
cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17032>
drmFreeVersion(version);
return rw ? rw->screen : NULL;
}
+
+struct si_context* si_get_aux_context(struct si_screen *sscreen)
+{
+ simple_mtx_lock(&sscreen->aux_context_lock);
+ return (struct si_context*)sscreen->aux_context;
+}
+
+void si_put_aux_context_flush(struct si_screen *sscreen)
+{
+ struct pipe_context *c = &((struct si_context*)sscreen->aux_context)->b;
+ c->flush(c, NULL, 0);
+ simple_mtx_unlock(&sscreen->aux_context_lock);
+}
/* si_pipe.c */
bool si_init_compiler(struct si_screen *sscreen, struct ac_llvm_compiler *compiler);
void si_init_aux_async_compute_ctx(struct si_screen *sscreen);
+struct si_context* si_get_aux_context(struct si_screen *sscreen);
+void si_put_aux_context_flush(struct si_screen *sscreen);
/* si_perfcounters.c */
void si_init_perfcounters(struct si_screen *screen);