vkr: vkr_physical_device to track vkr_device with vkr_object::track_head

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 aed086d399
commit bd28750890
  1. 3
      src/vkr_object.h
  2. 12
      src/vkr_renderer.c

@ -9,6 +9,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include "util/u_double_list.h"
#include "venus-protocol/vulkan.h" #include "venus-protocol/vulkan.h"
typedef uint64_t vkr_object_id; typedef uint64_t vkr_object_id;
@ -50,6 +51,8 @@ struct vkr_object {
VkSamplerYcbcrConversion sampler_ycbcr_conversion; VkSamplerYcbcrConversion sampler_ycbcr_conversion;
VkDescriptorUpdateTemplate descriptor_update_template; VkDescriptorUpdateTemplate descriptor_update_template;
} handle; } handle;
struct list_head track_head;
}; };
#endif /* VKR_OBJECT_H */ #endif /* VKR_OBJECT_H */

@ -207,12 +207,14 @@ struct vkr_physical_device {
VkExtensionProperties *extensions; VkExtensionProperties *extensions;
uint32_t extension_count; uint32_t extension_count;
VkPhysicalDeviceMemoryProperties memory_properties;
bool KHR_external_memory_fd; bool KHR_external_memory_fd;
bool EXT_external_memory_dma_buf; bool EXT_external_memory_dma_buf;
bool KHR_external_fence_fd; bool KHR_external_fence_fd;
VkPhysicalDeviceMemoryProperties memory_properties;
struct list_head devices;
}; };
struct vkr_queue_sync { struct vkr_queue_sync {
@ -1284,6 +1286,8 @@ vkr_dispatch_vkEnumeratePhysicalDevices(struct vn_dispatch_context *dispatch,
vkr_physical_device_init_extensions(physical_dev, instance); vkr_physical_device_init_extensions(physical_dev, instance);
vkr_physical_device_init_memory_properties(physical_dev); vkr_physical_device_init_memory_properties(physical_dev);
list_inithead(&physical_dev->devices);
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); util_hash_table_set_u64(ctx->object_table, physical_dev->base.id, physical_dev);
@ -2032,6 +2036,8 @@ vkr_dispatch_vkCreateDevice(struct vn_dispatch_context *dispatch,
mtx_init(&dev->free_sync_mutex, mtx_plain); mtx_init(&dev->free_sync_mutex, mtx_plain);
list_inithead(&dev->free_syncs); list_inithead(&dev->free_syncs);
list_add(&dev->base.track_head, &physical_dev->devices);
util_hash_table_set_u64(ctx->object_table, dev->base.id, dev); util_hash_table_set_u64(ctx->object_table, dev->base.id, dev);
} }
@ -2068,6 +2074,8 @@ vkr_dispatch_vkDestroyDevice(struct vn_dispatch_context *dispatch,
vkDestroyDevice(device, NULL); vkDestroyDevice(device, NULL);
list_del(&dev->base.track_head);
util_hash_table_remove_u64(ctx->object_table, dev->base.id); util_hash_table_remove_u64(ctx->object_table, dev->base.id);
} }

Loading…
Cancel
Save