radeonsi: submit cs to failed context instead of skipping them
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Fri, 9 Apr 2021 16:08:44 +0000 (18:08 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 14 Apr 2021 07:00:00 +0000 (07:00 +0000)
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 <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10179>

src/gallium/drivers/radeonsi/si_gfx_cs.c

index 71972d4..f9aef3c 100644 (file)
@@ -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;