[Mesa-dev] [PATCH] radv/amdgpu: Add some debug flags.
Bas Nieuwenhuizen
bas at basnieuwenhuizen.nl
Sun Mar 5 20:01:52 UTC 2017
Signed-off-by: Bas Nieuwenhuizen <basni at google.com>
---
src/amd/vulkan/Makefile.sources | 1 +
src/amd/vulkan/radv_debug.h | 40 ++++++++++++++++++++++
src/amd/vulkan/radv_device.c | 4 ++-
src/amd/vulkan/radv_private.h | 13 +------
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c | 8 +++--
.../winsys/amdgpu/radv_amdgpu_winsys_public.h | 2 +-
6 files changed, 52 insertions(+), 16 deletions(-)
create mode 100644 src/amd/vulkan/radv_debug.h
diff --git a/src/amd/vulkan/Makefile.sources b/src/amd/vulkan/Makefile.sources
index 425a00fe6a8..4896952156e 100644
--- a/src/amd/vulkan/Makefile.sources
+++ b/src/amd/vulkan/Makefile.sources
@@ -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
index 00000000000..4d1398e191d
--- /dev/null
+++ b/src/amd/vulkan/radv_debug.h
@@ -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
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index eaf610c286e..760b6b028e6 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -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}
};
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 37549c554d0..aea9ed20d6e 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -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
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
index 35b6bc57a42..c9f52359912 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
@@ -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;
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys_public.h b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys_public.h
index 208561db903..d5d0ff52c21 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys_public.h
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys_public.h
@@ -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 */
--
2.11.1
More information about the mesa-dev
mailing list