winsys/amdgpu: treat cs overflow as context lost
The existing code relies on assert to identify when a cs overlow occurs. On builds without asserts, a cs overflow won't be detected and it will likely lead to a hang. Reporting a preemptively a PIPE_UNKNOWN_CONTEXT_RESET error seems ok as the context is lost anyway. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33288>
This commit is contained in:
committed by
Marge Bot
parent
b3f2435994
commit
2b8c3a12c6
@@ -1065,7 +1065,8 @@ static bool amdgpu_cs_check_space(struct radeon_cmdbuf *rcs, unsigned dw)
|
||||
struct amdgpu_cs *cs = amdgpu_cs(rcs);
|
||||
struct amdgpu_ib *main_ib = &cs->main_ib;
|
||||
|
||||
assert(rcs->current.cdw <= rcs->current.max_dw);
|
||||
if (rcs->current.cdw > rcs->current.max_dw)
|
||||
return false;
|
||||
|
||||
unsigned projected_size_dw = rcs->prev_dw + rcs->current.cdw + dw;
|
||||
|
||||
@@ -2112,7 +2113,11 @@ static int amdgpu_cs_flush(struct radeon_cmdbuf *rcs,
|
||||
}
|
||||
|
||||
if (rcs->current.cdw > rcs->current.max_dw) {
|
||||
fprintf(stderr, "amdgpu: command stream overflowed\n");
|
||||
amdgpu_ctx_set_sw_reset_status(
|
||||
(struct radeon_winsys_ctx*)cs->ctx, PIPE_UNKNOWN_CONTEXT_RESET,
|
||||
"amdgpu: command stream overflowed (current: %d, max: %d)\n",
|
||||
rcs->current.cdw, rcs->current.max_dw);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* If the CS is not empty or overflowed.... */
|
||||
|
||||
Reference in New Issue
Block a user