[Mesa-dev] [PATCH 2/7] winsys/amdgpu: drop all IBs if at least one was rejected within the context
Marek Olšák
maraeo at gmail.com
Fri Jan 20 19:07:07 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
The corruption is inevitable and hangs are possible too.
---
src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
index d63ff36..0bc4ce9 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
@@ -1032,25 +1032,31 @@ void amdgpu_cs_submit_ib(void *job, int thread_index)
}
if (r) {
fprintf(stderr, "amdgpu: buffer list creation failed (%d)\n", r);
cs->request.resources = NULL;
amdgpu_fence_signalled(cs->fence);
cs->error_code = r;
goto cleanup;
}
- r = amdgpu_cs_submit(acs->ctx->ctx, 0, &cs->request, 1);
+ if (acs->ctx->num_rejected_cs)
+ r = -ECANCELED;
+ else
+ r = amdgpu_cs_submit(acs->ctx->ctx, 0, &cs->request, 1);
+
cs->error_code = r;
if (r) {
if (r == -ENOMEM)
fprintf(stderr, "amdgpu: Not enough memory for command submission.\n");
+ else if (r == -ECANCELED)
+ fprintf(stderr, "amdgpu: The CS has been cancelled because the context is lost.\n");
else
fprintf(stderr, "amdgpu: The CS has been rejected, "
"see dmesg for more information (%i).\n", r);
amdgpu_fence_signalled(cs->fence);
acs->ctx->num_rejected_cs++;
ws->num_total_rejected_cs++;
} else {
/* Success. */
--
2.7.4
More information about the mesa-dev
mailing list