radv/amdgpu: Add some debug flags.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Bas Nieuwenhuizen
2017-03-05 20:58:31 +01:00
parent 682248db45
commit fb7e4e16e7
6 changed files with 52 additions and 16 deletions

View 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 \

View File

@@ -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

View 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}
};

View 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

View 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;

View 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 */