radeonsi: avoid querying gpu state if possible
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Mon, 12 Apr 2021 06:28:46 +0000 (08:28 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 14 Apr 2021 07:00:00 +0000 (07:00 +0000)
No-op dispatch should only be setup for full reset, not soft-recovery resets.

The same trick cannot be used in si_get_reset_status because EGL expects
us to return GL_***_CONTEXT_RESET even if it has been fixed by a soft
recovery.

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 f9aef3c..24c830a 100644 (file)
@@ -96,13 +96,15 @@ void si_flush_gfx_cs(struct si_context *ctx, unsigned flags, struct pipe_fence_h
        !(flags & RADEON_FLUSH_TOGGLE_SECURE_SUBMISSION))
       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);
+   /* Non-aux contexts must set up no-op API dispatch on GPU resets. This is
+    * similar to si_get_reset_status but here we can ignore soft-recoveries,
+    * while si_get_reset_status can't. */
+   if (!(ctx->context_flags & SI_CONTEXT_FLAG_AUX) &&
+       ctx->device_reset_callback.reset) {
+      enum pipe_reset_status status = ctx->ws->ctx_query_reset_status(ctx->ctx, true, NULL);
+      if (status != PIPE_NO_RESET)
+         ctx->device_reset_callback.reset(ctx->device_reset_callback.data, status);
+   }
 
    if (sscreen->debug_flags & DBG(CHECK_VM))
       flags &= ~PIPE_FLUSH_ASYNC;