From ff18dfe5083be38208feb2b4c241222a38cb6b1d Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Fri, 1 Feb 2019 15:45:48 +0100 Subject: [PATCH] debug: Add option to print the guest program name in the log This is helpful to get the name of the guest program that may trigger a memory leak. One can also pass a custom string as program name by setting the environment variable GALLIUM_PROCESS_NAME in the guest accordingly. Signed-off-by: Gert Wollny Signed-off-by: Dave Airlie --- src/vrend_debug.c | 1 + src/vrend_debug.h | 3 ++- src/vrend_renderer.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/vrend_debug.c b/src/vrend_debug.c index 5930be6..c46fc14 100644 --- a/src/vrend_debug.c +++ b/src/vrend_debug.c @@ -113,6 +113,7 @@ static const struct debug_named_value vrend_debug_options[] = { {"copyres", dbg_copy_resource, "Debug copy resource code path"}, {"feat", dbg_features, "Log features found"}, {"tex", dbg_tex, "Log texture operations"}, + {"caller", dbg_caller, "Log who is creating the context"}, {"all", dbg_all, "Enable all debugging output"}, {"guestallow", dbg_allow_guest_override, "Allow the guest to override the debug flags"}, DEBUG_NAMED_VALUE_END diff --git a/src/vrend_debug.h b/src/vrend_debug.h index 1c560ba..61a40f3 100644 --- a/src/vrend_debug.h +++ b/src/vrend_debug.h @@ -42,7 +42,8 @@ enum virgl_debug_flags { dbg_copy_resource = 1 << 6, dbg_features = 1 << 7, dbg_tex = 1 << 8, - dbg_all = (1 << 9) - 1, + dbg_caller = 1 << 9, + dbg_all = (1 << 10) - 1, dbg_allow_guest_override = 1 << 16, dbg_feature_use = 1 << 17, }; diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index aa22d8a..25e29ac 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -5504,6 +5504,8 @@ struct vrend_context *vrend_create_context(int id, uint32_t nlen, const char *de strncpy(grctx->debug_name, debug_name, 64); } + VREND_DEBUG(dbg_caller, grctx, "create context\n"); + grctx->ctx_id = id; list_inithead(&grctx->sub_ctxs);