vkr: use vkr_context_{add,remove}_object

Use them for objects that are tracked as non-device objects.  These
include VkInstance, VkPhysicalDevice, VkDevice, VkQueue,
VkDescriptorSet, and VkCommandBuffer.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
macos/master
Chia-I Wu 3 years ago
parent 77f796ea56
commit 99b28673b0
  1. 2
      src/venus/vkr_common.h
  2. 4
      src/venus/vkr_device.c
  3. 4
      src/venus/vkr_instance.c
  4. 6
      src/venus/vkr_physical_device.c
  5. 4
      src/venus/vkr_queue.c

@ -129,7 +129,7 @@
/* pool objects are tracked by the pool other than the device */ \ /* pool objects are tracked by the pool other than the device */ \
list_add(&obj->base.track_head, &pool->vkr_type##s); \ list_add(&obj->base.track_head, &pool->vkr_type##s); \
\ \
util_hash_table_set_u64(ctx->object_table, obj->base.id, obj); \ vkr_context_add_object(ctx, &obj->base); \
} \ } \
\ \
arr.objects_stolen = true; \ arr.objects_stolen = true; \

@ -223,7 +223,7 @@ vkr_dispatch_vkCreateDevice(struct vn_dispatch_context *dispatch,
list_add(&dev->base.track_head, &physical_dev->devices); list_add(&dev->base.track_head, &physical_dev->devices);
util_hash_table_set_u64(ctx->object_table, dev->base.id, dev); vkr_context_add_object(ctx, &dev->base);
} }
static void static void
@ -362,7 +362,7 @@ vkr_device_destroy(struct vkr_context *ctx, struct vkr_device *dev)
list_del(&dev->base.track_head); list_del(&dev->base.track_head);
util_hash_table_remove_u64(ctx->object_table, dev->base.id); vkr_context_remove_object(ctx, &dev->base);
} }
static void static void

@ -241,7 +241,7 @@ vkr_dispatch_vkCreateInstance(struct vn_dispatch_context *dispatch,
} }
} }
util_hash_table_set_u64(ctx->object_table, instance->base.id, instance); vkr_context_add_object(ctx, &instance->base);
ctx->instance = instance; ctx->instance = instance;
} }
@ -267,7 +267,7 @@ vkr_instance_destroy(struct vkr_context *ctx, struct vkr_instance *instance)
free(instance->physical_device_handles); free(instance->physical_device_handles);
free(instance->physical_devices); free(instance->physical_devices);
util_hash_table_remove_u64(ctx->object_table, instance->base.id); vkr_context_remove_object(ctx, &instance->base);
} }
static void static void

@ -22,7 +22,7 @@ vkr_physical_device_destroy(struct vkr_context *ctx,
free(physical_dev->extensions); free(physical_dev->extensions);
util_hash_table_remove_u64(ctx->object_table, physical_dev->base.id); vkr_context_remove_object(ctx, &physical_dev->base);
} }
static VkResult static VkResult
@ -217,7 +217,7 @@ vkr_dispatch_vkEnumeratePhysicalDevices(struct vn_dispatch_context *dispatch,
instance->physical_devices[i] = physical_dev; instance->physical_devices[i] = physical_dev;
util_hash_table_set_u64(ctx->object_table, physical_dev->base.id, physical_dev); vkr_context_add_object(ctx, &physical_dev->base);
} }
/* remove all physical devices on errors */ /* remove all physical devices on errors */
if (i < count) { if (i < count) {
@ -226,7 +226,7 @@ vkr_dispatch_vkEnumeratePhysicalDevices(struct vn_dispatch_context *dispatch,
if (!physical_dev) if (!physical_dev)
break; break;
free(physical_dev->extensions); free(physical_dev->extensions);
util_hash_table_remove_u64(ctx->object_table, physical_dev->base.id); vkr_context_remove_object(ctx, &physical_dev->base);
instance->physical_devices[i] = NULL; instance->physical_devices[i] = NULL;
} }
} }

@ -150,7 +150,7 @@ vkr_queue_destroy(struct vkr_context *ctx, struct vkr_queue *queue)
list_del(&queue->base.track_head); list_del(&queue->base.track_head);
if (queue->base.id) if (queue->base.id)
util_hash_table_remove_u64(ctx->object_table, queue->base.id); vkr_context_remove_object(ctx, &queue->base);
else else
free(queue); free(queue);
} }
@ -273,7 +273,7 @@ vkr_queue_assign_object_id(struct vkr_context *ctx,
queue->base.id = id; queue->base.id = id;
util_hash_table_set_u64(ctx->object_table, queue->base.id, queue); vkr_context_add_object(ctx, &queue->base);
} }
static struct vkr_queue * static struct vkr_queue *

Loading…
Cancel
Save