[Mesa-dev] [PATCH 2/2] winsys/amdgpu: fix infinite loop w/ RADEON_NOOP=1 caused by unsubmitted fences

Marek Olšák maraeo at gmail.com
Tue Oct 11 15:00:06 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
index c0e810c..2b86827 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
@@ -30,20 +30,22 @@
  *      Marek Olšák <maraeo at gmail.com>
  */
 
 #include "amdgpu_cs.h"
 #include "os/os_time.h"
 #include <stdio.h>
 #include <amdgpu_drm.h>
 
 #include "amd/common/sid.h"
 
+DEBUG_GET_ONCE_BOOL_OPTION(noop, "RADEON_NOOP", false)
+
 /* FENCES */
 
 static struct pipe_fence_handle *
 amdgpu_fence_create(struct amdgpu_ctx *ctx, unsigned ip_type,
                     unsigned ip_instance, unsigned ring)
 {
    struct amdgpu_fence *fence = CALLOC_STRUCT(amdgpu_fence);
 
    fence->reference.count = 1;
    fence->ctx = ctx;
@@ -136,20 +138,23 @@ static bool amdgpu_fence_wait_rel_timeout(struct radeon_winsys *rws,
 {
    return amdgpu_fence_wait(fence, timeout, false);
 }
 
 static struct pipe_fence_handle *
 amdgpu_cs_get_next_fence(struct radeon_winsys_cs *rcs)
 {
    struct amdgpu_cs *cs = amdgpu_cs(rcs);
    struct pipe_fence_handle *fence = NULL;
 
+   if (debug_get_option_noop())
+      return NULL;
+
    if (cs->next_fence) {
       amdgpu_fence_reference(&fence, cs->next_fence);
       return fence;
    }
 
    fence = amdgpu_fence_create(cs->ctx,
                                cs->csc->request.ip_type,
                                cs->csc->request.ip_instance,
                                cs->csc->request.ring);
    if (!fence)
@@ -1062,22 +1067,20 @@ cleanup:
 void amdgpu_cs_sync_flush(struct radeon_winsys_cs *rcs)
 {
    struct amdgpu_cs *cs = amdgpu_cs(rcs);
    struct amdgpu_winsys *ws = cs->ctx->ws;
 
    /* Wait for any pending ioctl of this CS to complete. */
    if (util_queue_is_initialized(&ws->cs_queue))
       util_queue_job_wait(&cs->flush_completed);
 }
 
-DEBUG_GET_ONCE_BOOL_OPTION(noop, "RADEON_NOOP", false)
-
 static int amdgpu_cs_flush(struct radeon_winsys_cs *rcs,
                            unsigned flags,
                            struct pipe_fence_handle **fence)
 {
    struct amdgpu_cs *cs = amdgpu_cs(rcs);
    struct amdgpu_winsys *ws = cs->ctx->ws;
    int error_code = 0;
 
    rcs->current.max_dw += amdgpu_cs_epilog_dws(cs->ring_type);
 
-- 
2.7.4



More information about the mesa-dev mailing list