summaryrefslogtreecommitdiff
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>2021-04-09 18:04:56 +0200
committerMarge Bot <eric+marge@anholt.net>2021-04-14 07:00:00 +0000
commitbc71f689f1f5224d90f01cb8276b68e56107cb43 (patch)
tree574140303264a0b34214293350b370c06b6b2aa3 /src/gallium/winsys
parent3a56f06998223ab8f9fc351cd1051d54f3ae6022 (diff)
amdgpu,radeon: add needs_reset param to ctx_query_reset_status
The kernel can do different types of recovery (soft recovery, GPU reset). Since they both increase gpu_reset_counter, this will cause all contexts to report AMDGPU_CTX_QUERY2_FLAGS_RESET, which is a bit misleading: if a single context was soft-recovered, the others are fine and we don't need special processing. This commit uses the AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST to distinguish between the 2 kind of reset and later commits will use this information. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10179>
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/amdgpu/drm/amdgpu_cs.c13
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_cs.c10
2 files changed, 20 insertions, 3 deletions
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
index 008894043a3..6b9614f3f41 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
@@ -334,11 +334,14 @@ static void amdgpu_ctx_destroy(struct radeon_winsys_ctx *rwctx)
}
static enum pipe_reset_status
-amdgpu_ctx_query_reset_status(struct radeon_winsys_ctx *rwctx)
+amdgpu_ctx_query_reset_status(struct radeon_winsys_ctx *rwctx, bool *needs_reset)
{
struct amdgpu_ctx *ctx = (struct amdgpu_ctx*)rwctx;
int r;
+ if (needs_reset)
+ *needs_reset = false;
+
/* Return a failure due to a GPU hang. */
if (ctx->ws->info.drm_minor >= 24) {
uint64_t flags;
@@ -350,6 +353,8 @@ amdgpu_ctx_query_reset_status(struct radeon_winsys_ctx *rwctx)
}
if (flags & AMDGPU_CTX_QUERY2_FLAGS_RESET) {
+ if (needs_reset)
+ *needs_reset = flags & AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST;
if (flags & AMDGPU_CTX_QUERY2_FLAGS_GUILTY)
return PIPE_GUILTY_CONTEXT_RESET;
else
@@ -364,6 +369,8 @@ amdgpu_ctx_query_reset_status(struct radeon_winsys_ctx *rwctx)
return PIPE_NO_RESET;
}
+ if (needs_reset)
+ *needs_reset = true;
switch (result) {
case AMDGPU_CTX_GUILTY_RESET:
return PIPE_GUILTY_CONTEXT_RESET;
@@ -376,9 +383,13 @@ amdgpu_ctx_query_reset_status(struct radeon_winsys_ctx *rwctx)
/* Return a failure due to a rejected command submission. */
if (ctx->ws->num_total_rejected_cs > ctx->initial_num_total_rejected_cs) {
+ if (needs_reset)
+ *needs_reset = true;
return ctx->num_rejected_cs ? PIPE_GUILTY_CONTEXT_RESET :
PIPE_INNOCENT_CONTEXT_RESET;
}
+ if (needs_reset)
+ *needs_reset = false;
return PIPE_NO_RESET;
}
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
index 37b9af2712c..3a3f28dda8a 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
@@ -87,14 +87,20 @@ static void radeon_drm_ctx_destroy(struct radeon_winsys_ctx *ctx)
}
static enum pipe_reset_status
-radeon_drm_ctx_query_reset_status(struct radeon_winsys_ctx *rctx)
+radeon_drm_ctx_query_reset_status(struct radeon_winsys_ctx *rctx, bool *needs_reset)
{
struct radeon_ctx *ctx = (struct radeon_ctx*)rctx;
unsigned latest = radeon_drm_get_gpu_reset_counter(ctx->ws);
- if (ctx->gpu_reset_counter == latest)
+ if (ctx->gpu_reset_counter == latest) {
+ if (needs_reset)
+ *needs_reset = false;
return PIPE_NO_RESET;
+ }
+
+ if (needs_reset)
+ *needs_reset = true;
ctx->gpu_reset_counter = latest;
return PIPE_UNKNOWN_CONTEXT_RESET;