From 646c5db06ff3b743ca1684302ee63c16944a2a98 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Fri, 9 Apr 2021 18:08:44 +0200 Subject: [PATCH] radeonsi: submit cs to failed context instead of skipping them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Skipping the submission would trigger asserts in debug builds or cause memory corruption. Instead the cs is submitted as ususual but the kernel won't submit it to the hardware (and will return ECANCELED) if the context is really lost (= not soft-recovered). Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2491 Reviewed-by: Marek Olšák Part-of: --- src/gallium/drivers/radeonsi/si_gfx_cs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_gfx_cs.c b/src/gallium/drivers/radeonsi/si_gfx_cs.c index 71972d4d126..f9aef3c0242 100644 --- a/src/gallium/drivers/radeonsi/si_gfx_cs.c +++ b/src/gallium/drivers/radeonsi/si_gfx_cs.c @@ -96,8 +96,13 @@ void si_flush_gfx_cs(struct si_context *ctx, unsigned flags, struct pipe_fence_h !(flags & RADEON_FLUSH_TOGGLE_SECURE_SUBMISSION)) return; - if (ctx->b.get_device_reset_status(&ctx->b) != PIPE_NO_RESET) - return; + /* Calling get_device_reset_status is useful to re-create the + * aux context if needed. + * This cs will be submitted even if a reset is detected; in this + * case it'll treated as a no-op. This ensures that all states + * are properly reset. + */ + ctx->b.get_device_reset_status(&ctx->b); if (sscreen->debug_flags & DBG(CHECK_VM)) flags &= ~PIPE_FLUSH_ASYNC;