vkr: add vkr_context_get_object

Minor refactor, no real change.

Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
macos/master
Chia-I Wu 3 years ago
parent 0e2eb9ca83
commit d001f6d270
  1. 4
      src/venus/vkr_context.c
  2. 6
      src/venus/vkr_context.h

@ -124,7 +124,7 @@ vkr_context_submit_fence_locked(struct virgl_context *base,
struct vkr_queue *queue; struct vkr_queue *queue;
VkResult result; VkResult result;
queue = util_hash_table_get_u64(ctx->object_table, queue_id); queue = vkr_context_get_object(ctx, queue_id);
if (!queue) if (!queue)
return -EINVAL; return -EINVAL;
struct vkr_device *dev = queue->device; struct vkr_device *dev = queue->device;
@ -271,7 +271,7 @@ vkr_context_get_blob_locked(struct virgl_context *base,
struct vkr_device_memory *mem; struct vkr_device_memory *mem;
enum virgl_resource_fd_type fd_type = VIRGL_RESOURCE_FD_INVALID; 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) if (!mem || mem->base.type != VK_OBJECT_TYPE_DEVICE_MEMORY)
return EINVAL; return EINVAL;

@ -144,6 +144,12 @@ vkr_context_remove_objects(struct vkr_context *ctx, struct list_head *objects)
/* objects should be reinitialized if to be reused */ /* 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 * static inline const char *
vkr_context_get_name(const struct vkr_context *ctx) vkr_context_get_name(const struct vkr_context *ctx)
{ {

Loading…
Cancel
Save