vkr: add RELEASE_TRACKED_OBJECTS for tracked vkr_object

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
macos/master
Yiwei Zhang 3 years ago
parent de46f378cb
commit 9da6721165
  1. 4
      src/venus/vkr_command_buffer.c
  2. 11
      src/venus/vkr_common.h
  3. 9
      src/venus/vkr_descriptor_set.c
  4. 12
      src/venus/vkr_device.c

@ -32,9 +32,7 @@ vkr_dispatch_vkDestroyCommandPool(struct vn_dispatch_context *dispatch,
DESTROY_OBJECT(pool, command_pool, COMMAND_POOL, vkDestroyCommandPool, commandPool); DESTROY_OBJECT(pool, command_pool, COMMAND_POOL, vkDestroyCommandPool, commandPool);
struct vkr_command_buffer *cmd, *tmp; RELEASE_TRACKED_OBJECTS(&pool->command_buffers);
LIST_FOR_EACH_ENTRY_SAFE (cmd, tmp, &pool->command_buffers, base.track_head)
util_hash_table_remove_u64(ctx->object_table, cmd->base.id);
util_hash_table_remove_u64(ctx->object_table, pool->base.id); util_hash_table_remove_u64(ctx->object_table, pool->base.id);
} }

@ -134,6 +134,13 @@
object_array_fini(&arr); \ object_array_fini(&arr); \
} while (0) } while (0)
#define RELEASE_TRACKED_OBJECTS(track_list) \
do { \
struct vkr_object *obj, *tmp; \
LIST_FOR_EACH_ENTRY_SAFE (obj, tmp, track_list, track_head) \
util_hash_table_remove_u64(ctx->object_table, obj->id); \
} while (0)
#define FREE_OBJECT_ARRAY(obj, vkr_type, vk_type, vk_cmd, arg_obj, arg_count, arg_pool) \ #define FREE_OBJECT_ARRAY(obj, vkr_type, vk_type, vk_cmd, arg_obj, arg_count, arg_pool) \
do { \ do { \
struct list_head free_list; \ struct list_head free_list; \
@ -155,9 +162,7 @@
vn_replace_##vk_cmd##_args_handle(args); \ vn_replace_##vk_cmd##_args_handle(args); \
vk_cmd(args->device, args->arg_pool, args->arg_count, args->arg_obj); \ vk_cmd(args->device, args->arg_pool, args->arg_count, args->arg_obj); \
\ \
struct vkr_##vkr_type *obj, *tmp; \ RELEASE_TRACKED_OBJECTS(&free_list); \
LIST_FOR_EACH_ENTRY_SAFE (obj, tmp, &free_list, base.track_head) \
util_hash_table_remove_u64(ctx->object_table, obj->base.id); \
} while (0) } while (0)
#define CREATE_PIPELINE_ARRAY(vk_cmd) \ #define CREATE_PIPELINE_ARRAY(vk_cmd) \

@ -71,9 +71,7 @@ vkr_dispatch_vkDestroyDescriptorPool(struct vn_dispatch_context *dispatch,
DESTROY_OBJECT(pool, descriptor_pool, DESCRIPTOR_POOL, vkDestroyDescriptorPool, DESTROY_OBJECT(pool, descriptor_pool, DESCRIPTOR_POOL, vkDestroyDescriptorPool,
descriptorPool); descriptorPool);
struct vkr_descriptor_set *set, *tmp; RELEASE_TRACKED_OBJECTS(&pool->descriptor_sets);
LIST_FOR_EACH_ENTRY_SAFE (set, tmp, &pool->descriptor_sets, base.track_head)
util_hash_table_remove_u64(ctx->object_table, set->base.id);
util_hash_table_remove_u64(ctx->object_table, pool->base.id); util_hash_table_remove_u64(ctx->object_table, pool->base.id);
} }
@ -94,9 +92,8 @@ vkr_dispatch_vkResetDescriptorPool(struct vn_dispatch_context *dispatch,
vn_replace_vkResetDescriptorPool_args_handle(args); vn_replace_vkResetDescriptorPool_args_handle(args);
args->ret = vkResetDescriptorPool(args->device, args->descriptorPool, args->flags); args->ret = vkResetDescriptorPool(args->device, args->descriptorPool, args->flags);
struct vkr_descriptor_set *set, *tmp; RELEASE_TRACKED_OBJECTS(&pool->descriptor_sets);
LIST_FOR_EACH_ENTRY_SAFE (set, tmp, &pool->descriptor_sets, base.track_head)
util_hash_table_remove_u64(ctx->object_table, set->base.id);
list_inithead(&pool->descriptor_sets); list_inithead(&pool->descriptor_sets);
} }

@ -241,11 +241,7 @@ vkr_device_object_destroy(struct vkr_context *ctx,
*/ */
vkDestroyDescriptorPool(device, obj->handle.descriptor_pool, NULL); vkDestroyDescriptorPool(device, obj->handle.descriptor_pool, NULL);
struct vkr_descriptor_set *set, *tmp; RELEASE_TRACKED_OBJECTS(&((struct vkr_descriptor_pool *)obj)->descriptor_sets);
LIST_FOR_EACH_ENTRY_SAFE (
set, tmp, &((struct vkr_descriptor_pool *)obj)->descriptor_sets, base.track_head)
util_hash_table_remove_u64(ctx->object_table, set->base.id);
break; break;
} }
case VK_OBJECT_TYPE_FRAMEBUFFER: case VK_OBJECT_TYPE_FRAMEBUFFER:
@ -257,11 +253,7 @@ vkr_device_object_destroy(struct vkr_context *ctx,
*/ */
vkDestroyCommandPool(device, obj->handle.command_pool, NULL); vkDestroyCommandPool(device, obj->handle.command_pool, NULL);
struct vkr_command_buffer *buf, *tmp; RELEASE_TRACKED_OBJECTS(&((struct vkr_command_pool *)obj)->command_buffers);
LIST_FOR_EACH_ENTRY_SAFE (
buf, tmp, &((struct vkr_command_pool *)obj)->command_buffers, base.track_head)
util_hash_table_remove_u64(ctx->object_table, buf->base.id);
break; break;
} }
case VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION: case VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION:

Loading…
Cancel
Save