From f3da589754e201208dc8e0d95fab2323e1c112f9 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 12 Aug 2021 14:18:37 -0700 Subject: [PATCH] vkr: remember application name Remember it as the instance name. Signed-off-by: Chia-I Wu Reviewed-by: Ryan Neph Reviewed-by: Yiwei Zhang --- src/venus/vkr_context.c | 14 +++++++++++++- src/venus/vkr_context.h | 5 ++++- src/venus/vkr_instance.c | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/venus/vkr_context.c b/src/venus/vkr_context.c index 4ffff55..e4c695a 100644 --- a/src/venus/vkr_context.c +++ b/src/venus/vkr_context.c @@ -28,12 +28,19 @@ #include "vkr_transport.h" void -vkr_context_add_instance(struct vkr_context *ctx, struct vkr_instance *instance) +vkr_context_add_instance(struct vkr_context *ctx, + struct vkr_instance *instance, + const char *name) { vkr_context_add_object(ctx, &instance->base); assert(!ctx->instance); ctx->instance = instance; + + if (name && name[0] != '\0') { + assert(!ctx->instance_name); + ctx->instance_name = strdup(name); + } } void @@ -42,6 +49,11 @@ vkr_context_remove_instance(struct vkr_context *ctx, struct vkr_instance *instan assert(ctx->instance && ctx->instance == instance); ctx->instance = NULL; + if (ctx->instance_name) { + free(ctx->instance_name); + ctx->instance_name = NULL; + } + vkr_context_remove_object(ctx, &instance->base); } diff --git a/src/venus/vkr_context.h b/src/venus/vkr_context.h index 3a5c8fb..46fac6d 100644 --- a/src/venus/vkr_context.h +++ b/src/venus/vkr_context.h @@ -62,6 +62,7 @@ struct vkr_context { struct list_head signaled_syncs; struct vkr_instance *instance; + char *instance_name; }; static inline void @@ -94,7 +95,9 @@ vkr_context_remove_objects(struct vkr_context *ctx, struct list_head *objects) } void -vkr_context_add_instance(struct vkr_context *ctx, struct vkr_instance *instance); +vkr_context_add_instance(struct vkr_context *ctx, + struct vkr_instance *instance, + const char *name); void vkr_context_remove_instance(struct vkr_context *ctx, struct vkr_instance *instance); diff --git a/src/venus/vkr_instance.c b/src/venus/vkr_instance.c index 71aaf4a..08148fc 100644 --- a/src/venus/vkr_instance.c +++ b/src/venus/vkr_instance.c @@ -222,7 +222,7 @@ vkr_dispatch_vkCreateInstance(struct vn_dispatch_context *dispatch, } } - vkr_context_add_instance(ctx, instance); + vkr_context_add_instance(ctx, instance, app_info.pApplicationName); } void