radv/amdgpu: Add some debug flags.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sun, 5 Mar 2017 19:58:31 +0000 (20:58 +0100)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sun, 5 Mar 2017 23:10:23 +0000 (00:10 +0100)
Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/Makefile.sources
src/amd/vulkan/radv_debug.h [new file with mode: 0644]
src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_private.h
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys_public.h

index 425a00fe6a8dcee10f75230ae58837222456daaa..4896952156eb58723ecb8d2bfea33cbe3dd79363 100644 (file)
@@ -33,6 +33,7 @@ RADV_WS_AMDGPU_FILES := \
 VULKAN_FILES := \
        radv_cmd_buffer.c \
        radv_cs.h \
+       radv_debug.h \
        radv_device.c \
        radv_descriptor_set.c \
        radv_descriptor_set.h \
diff --git a/src/amd/vulkan/radv_debug.h b/src/amd/vulkan/radv_debug.h
new file mode 100644 (file)
index 0000000..4d1398e
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright © 2017 Google.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef RADV_DEBUG_H
+#define RADV_DEBUG_H
+
+enum {
+       RADV_DEBUG_NO_FAST_CLEARS    =   0x1,
+       RADV_DEBUG_NO_DCC            =   0x2,
+       RADV_DEBUG_DUMP_SHADERS      =   0x4,
+       RADV_DEBUG_NO_CACHE          =   0x8,
+       RADV_DEBUG_DUMP_SHADER_STATS =  0x10,
+       RADV_DEBUG_NO_HIZ            =  0x20,
+       RADV_DEBUG_NO_COMPUTE_QUEUE  =  0x40,
+       RADV_DEBUG_UNSAFE_MATH       =  0x80,
+       RADV_DEBUG_ALL_BOS           = 0x100,
+       RADV_DEBUG_NO_IBS            = 0x200,
+};
+
+#endif
index eaf610c286ede7712e2b0e0f28108eafaeca5a0f..760b6b028e643696c358ec4b1c0ecd46c05eb5d1 100644 (file)
@@ -207,7 +207,7 @@ radv_physical_device_init(struct radv_physical_device *device,
        assert(strlen(path) < ARRAY_SIZE(device->path));
        strncpy(device->path, path, ARRAY_SIZE(device->path));
 
-       device->ws = radv_amdgpu_winsys_create(fd);
+       device->ws = radv_amdgpu_winsys_create(fd, instance->debug_flags);
        if (!device->ws) {
                result = VK_ERROR_INCOMPATIBLE_DRIVER;
                goto fail;
@@ -292,6 +292,8 @@ static const struct debug_control radv_debug_options[] = {
        {"nohiz", RADV_DEBUG_NO_HIZ},
        {"nocompute", RADV_DEBUG_NO_COMPUTE_QUEUE},
        {"unsafemath", RADV_DEBUG_UNSAFE_MATH},
+       {"allbos", RADV_DEBUG_ALL_BOS},
+       {"noibs", RADV_DEBUG_NO_IBS},
        {NULL, 0}
 };
 
index bc8e447d7191970992086cfd59fc43467e4228d7..7eb10512012c683556116f5c59ce34902f8142b2 100644 (file)
@@ -53,6 +53,7 @@
 #include "radv_radeon_winsys.h"
 #include "ac_binary.h"
 #include "ac_nir_to_llvm.h"
+#include "radv_debug.h"
 #include "radv_descriptor_set.h"
 
 #include <llvm-c/TargetMachine.h>
@@ -100,18 +101,6 @@ enum radv_mem_type {
        RADV_MEM_TYPE_COUNT
 };
 
-
-enum {
-       RADV_DEBUG_NO_FAST_CLEARS    =   0x1,
-       RADV_DEBUG_NO_DCC            =   0x2,
-       RADV_DEBUG_DUMP_SHADERS      =   0x4,
-       RADV_DEBUG_NO_CACHE          =   0x8,
-       RADV_DEBUG_DUMP_SHADER_STATS =  0x10,
-       RADV_DEBUG_NO_HIZ            =  0x20,
-       RADV_DEBUG_NO_COMPUTE_QUEUE  =  0x40,
-       RADV_DEBUG_UNSAFE_MATH       =  0x80,
-};
-
 #define radv_printflike(a, b) __attribute__((__format__(__printf__, a, b)))
 
 static inline uint32_t
index 35b6bc57a42bec20d4fb2799a08d51048b81661f..c9f52359912bb5d4409939560c30e2e7081dfcd0 100644 (file)
@@ -27,6 +27,7 @@
 #include "radv_amdgpu_winsys.h"
 #include "radv_amdgpu_winsys_public.h"
 #include "radv_amdgpu_surface.h"
+#include "radv_debug.h"
 #include "amdgpu_id.h"
 #include "xf86drm.h"
 #include <stdio.h>
@@ -347,7 +348,7 @@ static void radv_amdgpu_winsys_destroy(struct radeon_winsys *rws)
 }
 
 struct radeon_winsys *
-radv_amdgpu_winsys_create(int fd)
+radv_amdgpu_winsys_create(int fd, uint32_t debug_flags)
 {
        uint32_t drm_major, drm_minor, r;
        amdgpu_device_handle dev;
@@ -367,7 +368,10 @@ radv_amdgpu_winsys_create(int fd)
        if (!do_winsys_init(ws, fd))
                goto winsys_fail;
 
-       ws->debug_all_bos = getenv("RADV_DEBUG_ALL_BOS") ? true : false;
+       ws->debug_all_bos = !!(debug_flags & RADV_DEBUG_ALL_BOS);
+       if (debug_flags & RADV_DEBUG_NO_IBS)
+               ws->use_ib_bos = false;
+
        LIST_INITHEAD(&ws->global_bo_list);
        pthread_mutex_init(&ws->global_bo_list_lock, NULL);
        ws->base.query_info = radv_amdgpu_winsys_query_info;
index 208561db903b3df2da4fd872978472d534b76da5..d5d0ff52c215912a64baacc09e5a28710e5ab5ea 100644 (file)
@@ -29,6 +29,6 @@
 #ifndef RADV_AMDGPU_WINSYS_PUBLIC_H
 #define RADV_AMDGPU_WINSYS_PUBLIC_H
 
-struct radeon_winsys *radv_amdgpu_winsys_create(int fd);
+struct radeon_winsys *radv_amdgpu_winsys_create(int fd, uint32_t debug_flags);
 
 #endif /* RADV_AMDGPU_WINSYS_PUBLIC_H */