From d001f6d270073d53fac82d75fcb583fa66bd468f Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 24 Sep 2021 15:30:35 -0700 Subject: [PATCH] vkr: add vkr_context_get_object Minor refactor, no real change. Reviewed-by: Ryan Neph Reviewed-by: Yiwei Zhang --- src/venus/vkr_context.c | 4 ++-- src/venus/vkr_context.h | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/venus/vkr_context.c b/src/venus/vkr_context.c index da1fac9..ef5f571 100644 --- a/src/venus/vkr_context.c +++ b/src/venus/vkr_context.c @@ -124,7 +124,7 @@ vkr_context_submit_fence_locked(struct virgl_context *base, struct vkr_queue *queue; VkResult result; - queue = util_hash_table_get_u64(ctx->object_table, queue_id); + queue = vkr_context_get_object(ctx, queue_id); if (!queue) return -EINVAL; struct vkr_device *dev = queue->device; @@ -271,7 +271,7 @@ vkr_context_get_blob_locked(struct virgl_context *base, struct vkr_device_memory *mem; enum virgl_resource_fd_type fd_type = VIRGL_RESOURCE_FD_INVALID; - mem = util_hash_table_get_u64(ctx->object_table, blob_id); + mem = vkr_context_get_object(ctx, blob_id); if (!mem || mem->base.type != VK_OBJECT_TYPE_DEVICE_MEMORY) return EINVAL; diff --git a/src/venus/vkr_context.h b/src/venus/vkr_context.h index cccac54..84a746e 100644 --- a/src/venus/vkr_context.h +++ b/src/venus/vkr_context.h @@ -144,6 +144,12 @@ vkr_context_remove_objects(struct vkr_context *ctx, struct list_head *objects) /* objects should be reinitialized if to be reused */ } +static inline void * +vkr_context_get_object(struct vkr_context *ctx, vkr_object_id obj_id) +{ + return util_hash_table_get_u64(ctx->object_table, obj_id); +} + static inline const char * vkr_context_get_name(const struct vkr_context *ctx) {