Mesa (master): winsys/amdgpu: drop all IBs if at least one was rejected within the context

Marek Olšák mareko at kemper.freedesktop.org
Mon Jan 23 22:48:47 UTC 2017


Module: Mesa
Branch: master
Commit: e248390e93d025472d55b89252216895bc895a74
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e248390e93d025472d55b89252216895bc895a74

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Thu Jan 19 20:44:49 2017 +0100

winsys/amdgpu: drop all IBs if at least one was rejected within the context

The corruption is inevitable and hangs are possible too.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

---

 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
@@ -1039,11 +1039,17 @@ void amdgpu_cs_submit_ib(void *job, int thread_index)
       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);




More information about the mesa-commit mailing list