diff --git a/src/venus/vkr_context.c b/src/venus/vkr_context.c index e4c695a..1e301d5 100644 --- a/src/venus/vkr_context.c +++ b/src/venus/vkr_context.c @@ -544,7 +544,7 @@ vkr_context_destroy(struct virgl_context *base) if (ctx->instance) { vkr_log("destroying context %d (%s) with a valid instance", ctx->base.ctx_id, - ctx->debug_name); + vkr_context_get_name(ctx)); vkr_instance_destroy(ctx, ctx->instance); } diff --git a/src/venus/vkr_context.h b/src/venus/vkr_context.h index 46fac6d..13f50c0 100644 --- a/src/venus/vkr_context.h +++ b/src/venus/vkr_context.h @@ -94,6 +94,16 @@ vkr_context_remove_objects(struct vkr_context *ctx, struct list_head *objects) /* objects should be reinitialized if to be reused */ } +static inline const char * +vkr_context_get_name(const struct vkr_context *ctx) +{ + /* ctx->instance_name is the application name while ctx->debug_name is + * usually the guest process name or the hypervisor name. This never + * returns NULL because ctx->debug_name is never NULL. + */ + return ctx->instance_name ? ctx->instance_name : ctx->debug_name; +} + void vkr_context_add_instance(struct vkr_context *ctx, struct vkr_instance *instance,