ctx->ws = amdgpu_winsys(ws);
ctx->refcount = 1;
- ctx->initial_num_total_rejected_cs = ctx->ws->num_total_rejected_cs;
ctx->allow_context_lost = allow_context_lost;
r = amdgpu_cs_ctx_create2(ctx->ws->dev, amdgpu_priority, &ctx->ctx);
return r;
}
+static void
+amdgpu_ctx_set_sw_reset_status(struct radeon_winsys_ctx *rwctx, enum pipe_reset_status status,
+ const char *format, ...)
+{
+ struct amdgpu_ctx *ctx = (struct amdgpu_ctx*)rwctx;
+
+ /* Don't overwrite the last reset status. */
+ if (ctx->sw_status != PIPE_NO_RESET)
+ return;
+
+ ctx->sw_status = status;
+
+ if (!ctx->allow_context_lost) {
+ va_list args;
+
+ va_start(args, format);
+ vfprintf(stderr, format, args);
+ va_end(args);
+
+ /* Non-robust contexts are allowed to terminate the process. The only alternative is
+ * to skip command submission, which would look like a freeze because nothing is drawn,
+ * which looks like a hang without any reset.
+ */
+ abort();
+ }
+}
+
static enum pipe_reset_status
amdgpu_ctx_query_reset_status(struct radeon_winsys_ctx *rwctx, bool full_reset_only,
bool *needs_reset, bool *reset_completed)
if (ctx->ws->info.drm_minor >= 24) {
uint64_t flags;
- if (full_reset_only &&
- ctx->initial_num_total_rejected_cs == ctx->ws->num_total_rejected_cs) {
+ if (full_reset_only && ctx->sw_status == PIPE_NO_RESET) {
/* If the caller is only interested in full reset (= wants to ignore soft
* recoveries), we can use the rejected cs count as a quick first check.
*/
}
}
- /* Return a failure due to a rejected command submission. */
- if (ctx->ws->num_total_rejected_cs > ctx->initial_num_total_rejected_cs) {
+ /* Return a failure due to SW issues. */
+ if (ctx->sw_status != PIPE_NO_RESET) {
if (needs_reset)
*needs_reset = true;
- return ctx->rejected_any_cs ? PIPE_GUILTY_CONTEXT_RESET :
- PIPE_INNOCENT_CONTEXT_RESET;
+ return ctx->sw_status;
}
if (needs_reset)
*needs_reset = false;
assert(num_chunks <= ARRAY_SIZE(chunks));
- if (unlikely(acs->ctx->rejected_any_cs)) {
+ if (unlikely(acs->ctx->sw_status != PIPE_NO_RESET)) {
r = -ECANCELED;
} else if (unlikely(noop)) {
r = 0;
cleanup:
if (unlikely(r)) {
- if (!acs->ctx->allow_context_lost) {
- /* Non-robust contexts are allowed to terminate the process. The only alternative is
- * to skip command submission, which would look like a freeze because nothing is drawn,
- * which is not a useful state to be in under any circumstances.
- */
- fprintf(stderr, "amdgpu: The CS has been rejected (%i), but the context isn't robust.\n", r);
- fprintf(stderr, "amdgpu: The process will be terminated.\n");
- exit(1);
- }
-
- fprintf(stderr, "amdgpu: The CS has been rejected (%i). Recreate the context.\n", r);
- if (!acs->ctx->rejected_any_cs)
- ws->num_total_rejected_cs++;
- acs->ctx->rejected_any_cs = true;
+ amdgpu_ctx_set_sw_reset_status((struct radeon_winsys_ctx*)acs->ctx,
+ PIPE_GUILTY_CONTEXT_RESET,
+ "amdgpu: The CS has been rejected (%i).\n", r);
}
/* If there was an error, signal the fence, because it won't be signalled