winsys/amdgpu: don't use debug_get_option_noop in a hot path
authorMarek Olšák <marek.olsak@amd.com>
Tue, 24 Nov 2020 03:57:25 +0000 (22:57 -0500)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 1 Dec 2020 20:33:03 +0000 (15:33 -0500)
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7721>

src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h

index f344346..25be8a1 100644 (file)
@@ -33,8 +33,6 @@
 
 #include "amd/common/sid.h"
 
-DEBUG_GET_ONCE_BOOL_OPTION(noop, "RADEON_NOOP", false)
-
 /* FENCES */
 
 static struct pipe_fence_handle *
@@ -259,7 +257,7 @@ amdgpu_cs_get_next_fence(struct radeon_cmdbuf *rcs)
    struct amdgpu_cs *cs = amdgpu_cs(rcs);
    struct pipe_fence_handle *fence = NULL;
 
-   if (debug_get_option_noop())
+   if (cs->noop)
       return NULL;
 
    if (cs->next_fence) {
@@ -969,6 +967,7 @@ amdgpu_cs_create(struct radeon_winsys_ctx *rwctx,
    cs->flush_data = flush_ctx;
    cs->ring_type = ring_type;
    cs->stop_exec_on_failure = stop_exec_on_failure;
+   cs->noop = ctx->ws->noop_cs;
 
    struct amdgpu_cs_fence_info fence_info;
    fence_info.handle = cs->ctx->user_fence_bo;
@@ -1797,7 +1796,7 @@ static int amdgpu_cs_flush(struct radeon_cmdbuf *rcs,
    /* If the CS is not empty or overflowed.... */
    if (likely(radeon_emitted(&cs->main.base, 0) &&
        cs->main.base.current.cdw <= cs->main.base.current.max_dw &&
-       !debug_get_option_noop() &&
+       !cs->noop &&
        !(flags & RADEON_FLUSH_NOOP))) {
       struct amdgpu_cs_context *cur = cs->csc;
 
index 99d954c..d3dbe60 100644 (file)
@@ -149,6 +149,7 @@ struct amdgpu_cs {
    void (*flush_cs)(void *ctx, unsigned flags, struct pipe_fence_handle **fence);
    void *flush_data;
    bool stop_exec_on_failure;
+   bool noop;
 
    struct util_queue_fence flush_completed;
    struct pipe_fence_handle *next_fence;
index 75a6605..ebc1cbe 100644 (file)
@@ -110,6 +110,7 @@ static bool do_winsys_init(struct amdgpu_winsys *ws,
 
    ws->check_vm = strstr(debug_get_option("R600_DEBUG", ""), "check_vm") != NULL ||
                   strstr(debug_get_option("AMD_DEBUG", ""), "check_vm") != NULL;
+   ws->noop_cs = debug_get_bool_option("RADEON_NOOP", false);
 #if DEBUG
    ws->debug_all_bos = debug_get_option_all_bos();
 #endif
index 525e039..4c7407c 100644 (file)
@@ -82,6 +82,7 @@ struct amdgpu_winsys {
    struct ac_addrlib *addrlib;
 
    bool check_vm;
+   bool noop_cs;
    bool reserve_vmid;
    bool zero_all_vram_allocs;
 #if DEBUG