winsys/amdgpu: change num_rejected_cs to a bool flag

and don't increment the total sum after the first rejection

Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17968>
This commit is contained in:
Marek Olšák
2022-08-16 11:47:47 -04:00
committed by Marge Bot
parent 471c82d21e
commit e348985cd3
2 changed files with 6 additions and 5 deletions

View File

@@ -408,7 +408,7 @@ amdgpu_ctx_query_reset_status(struct radeon_winsys_ctx *rwctx, bool full_reset_o
if (ctx->ws->num_total_rejected_cs > ctx->initial_num_total_rejected_cs) { if (ctx->ws->num_total_rejected_cs > ctx->initial_num_total_rejected_cs) {
if (needs_reset) if (needs_reset)
*needs_reset = true; *needs_reset = true;
return ctx->num_rejected_cs ? PIPE_GUILTY_CONTEXT_RESET : return ctx->rejected_any_cs ? PIPE_GUILTY_CONTEXT_RESET :
PIPE_INNOCENT_CONTEXT_RESET; PIPE_INNOCENT_CONTEXT_RESET;
} }
if (needs_reset) if (needs_reset)
@@ -1606,7 +1606,7 @@ static void amdgpu_cs_submit_ib(void *job, void *gdata, int thread_index)
assert(num_chunks <= ARRAY_SIZE(chunks)); assert(num_chunks <= ARRAY_SIZE(chunks));
if (unlikely(acs->ctx->num_rejected_cs)) { if (unlikely(acs->ctx->rejected_any_cs)) {
r = -ECANCELED; r = -ECANCELED;
} else if (unlikely(noop)) { } else if (unlikely(noop)) {
r = 0; r = 0;
@@ -1659,8 +1659,9 @@ cleanup:
} }
fprintf(stderr, "amdgpu: The CS has been rejected (%i). Recreate the context.\n", r); fprintf(stderr, "amdgpu: The CS has been rejected (%i). Recreate the context.\n", r);
acs->ctx->num_rejected_cs++; if (!acs->ctx->rejected_any_cs)
ws->num_total_rejected_cs++; ws->num_total_rejected_cs++;
acs->ctx->rejected_any_cs = true;
} }
/* If there was an error, signal the fence, because it won't be signalled /* If there was an error, signal the fence, because it won't be signalled

View File

@@ -45,7 +45,7 @@ struct amdgpu_ctx {
uint64_t *user_fence_cpu_address_base; uint64_t *user_fence_cpu_address_base;
int refcount; int refcount;
unsigned initial_num_total_rejected_cs; unsigned initial_num_total_rejected_cs;
unsigned num_rejected_cs; bool rejected_any_cs;
}; };
struct amdgpu_cs_buffer { struct amdgpu_cs_buffer {