mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-24 20:10:40 +02:00
panvk: add PANVK_DEBUG(category) to simplify debug control
In general, the debug flags are served once per proc invocation. So we can make panvk debug flags global and clean up the existing codes in the next change. Meanwhile, this changes improves branch prediction on user builds and logs the enabled debug options when startup is used. Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37752>
This commit is contained in:
parent
77f6753d68
commit
93cd8bf098
2 changed files with 31 additions and 0 deletions
|
|
@ -13,6 +13,7 @@
|
|||
#include "util/driconf.h"
|
||||
#include "util/mesa-sha1.h"
|
||||
#include "util/os_misc.h"
|
||||
#include "util/u_call_once.h"
|
||||
|
||||
#include "vk_alloc.h"
|
||||
#include "vk_log.h"
|
||||
|
|
@ -46,6 +47,30 @@ static const struct debug_control panvk_debug_options[] = {
|
|||
{"force_blackhole", PANVK_DEBUG_FORCE_BLACKHOLE},
|
||||
{NULL, 0}};
|
||||
|
||||
uint64_t panvk_debug;
|
||||
|
||||
static void
|
||||
panvk_debug_init_once(void)
|
||||
{
|
||||
panvk_debug =
|
||||
parse_debug_string(os_get_option("PANVK_DEBUG"), panvk_debug_options);
|
||||
}
|
||||
|
||||
static void
|
||||
panvk_debug_init(void)
|
||||
{
|
||||
static once_flag once = ONCE_FLAG_INIT;
|
||||
call_once(&once, panvk_debug_init_once);
|
||||
|
||||
/* log per VkInstance creation */
|
||||
if (PANVK_DEBUG(STARTUP)) {
|
||||
char debug_string[256];
|
||||
dump_debug_control_string(debug_string, sizeof(debug_string),
|
||||
panvk_debug_options, panvk_debug);
|
||||
mesa_logi("panvk_debug: %s", debug_string);
|
||||
}
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
panvk_EnumerateInstanceVersion(uint32_t *pApiVersion)
|
||||
{
|
||||
|
|
@ -200,6 +225,8 @@ panvk_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
|||
|
||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO);
|
||||
|
||||
panvk_debug_init();
|
||||
|
||||
const struct build_id_note *note =
|
||||
build_id_find_nhdr_for_addr(panvk_CreateInstance);
|
||||
if (!note) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
#include "lib/kmod/pan_kmod.h"
|
||||
|
||||
#define PANVK_DEBUG(category) (unlikely(panvk_debug & PANVK_DEBUG_##category))
|
||||
|
||||
enum panvk_debug_flags {
|
||||
PANVK_DEBUG_STARTUP = 1 << 0,
|
||||
PANVK_DEBUG_NIR = 1 << 1,
|
||||
|
|
@ -29,6 +31,8 @@ enum panvk_debug_flags {
|
|||
PANVK_DEBUG_FORCE_BLACKHOLE = 1 << 12,
|
||||
};
|
||||
|
||||
extern uint64_t panvk_debug;
|
||||
|
||||
#if defined(VK_USE_PLATFORM_WAYLAND_KHR) || \
|
||||
defined(VK_USE_PLATFORM_XCB_KHR) || \
|
||||
defined(VK_USE_PLATFORM_XLIB_KHR) || \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue