The flush callback may be called on the same pipe context, and thus
the same stream, from two different threads of execution. However,
etna_cmd_stream_flush{,2}() must not be called on the same stream
from two different threads of execution as that would mess up the
etna_bo refcounting and likely have other ugly side effects.
Fix this by using a reentrant screen lock around the flush callback.
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
enum pipe_flush_flags flags)
{
struct etna_context *ctx = etna_context(pctx);
+ struct etna_screen *screen = ctx->screen;
int out_fence_fd = -1;
+ mtx_lock(&screen->lock);
+
list_for_each_entry(struct etna_hw_query, hq, &ctx->active_hw_queries, node)
etna_hw_query_suspend(hq, ctx);
if (fence)
*fence = etna_fence_create(pctx, out_fence_fd);
+
+ mtx_unlock(&screen->lock);
}
static void