Module: Mesa
Branch: main
Commit: b4a2cb1e166891ee64a8971a43a42e7e0280a80e
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b4a2cb1e166891ee64a8971a43a42e7e0280a80e

Author: Pierre-Eric Pelloux-Prayer <[email protected]>
Date:   Fri Apr  7 09:24:03 2023 +0200

winsys/amdgpu: use the no-op helper to detect if reset completion

On older kernel the completion of the reset isn't signalled to userspace,
yet we need it to implement the EXT_robustness extension correctly.

In this situation, try to create a new context and submit a no-op job. If
the reset isn't done the kernel will reject the submission (-ECANCELED);
otherwise the submission will go through and we'll know that the reset is
done.

Reviewed-by: André Almeida <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22290>

---

 src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c 
b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
index f9c24287e4e..39817c7b228 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
@@ -469,10 +469,17 @@ amdgpu_ctx_query_reset_status(struct radeon_winsys_ctx 
*rwctx, bool full_reset_o
              *    completed. If a reset status is repeatedly returned, the 
context may
              *    be in the process of resetting.
              *
+             * Starting with drm_minor >= 54 amdgpu reports if the reset is 
complete,
+             * so don't do anything special. On older kernels, submit a no-op 
cs. If it
+             * succeeds then assume the reset is complete.
              */
             if (!(flags & AMDGPU_CTX_QUERY2_FLAGS_RESET_IN_PROGRESS))
                *reset_completed = true;
+
+            if (ctx->ws->info.drm_minor < 54 && ctx->ws->info.has_graphics)
+               *reset_completed = amdgpu_submit_gfx_nop(ctx->ws->dev) == 0;
          }
+
          if (needs_reset)
                *needs_reset = flags & AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST;
          if (flags & AMDGPU_CTX_QUERY2_FLAGS_GUILTY)

Reply via email to