|
|
@ -462,7 +462,6 @@ struct wlr_vk_device *vulkan_device_create(struct wlr_vk_instance *ini,
|
|
|
|
const char *extensions[32] = {0};
|
|
|
|
const char *extensions[32] = {0};
|
|
|
|
size_t extensions_len = 0;
|
|
|
|
size_t extensions_len = 0;
|
|
|
|
extensions[extensions_len++] = VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME;
|
|
|
|
extensions[extensions_len++] = VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME;
|
|
|
|
extensions[extensions_len++] = VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME;
|
|
|
|
|
|
|
|
extensions[extensions_len++] = VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME; // or vulkan 1.2
|
|
|
|
extensions[extensions_len++] = VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME; // or vulkan 1.2
|
|
|
|
extensions[extensions_len++] = VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME;
|
|
|
|
extensions[extensions_len++] = VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME;
|
|
|
|
extensions[extensions_len++] = VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME;
|
|
|
|
extensions[extensions_len++] = VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME;
|
|
|
@ -497,19 +496,25 @@ struct wlr_vk_device *vulkan_device_create(struct wlr_vk_instance *ini,
|
|
|
|
assert(graphics_found);
|
|
|
|
assert(graphics_found);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const VkPhysicalDeviceExternalSemaphoreInfo ext_semaphore_info = {
|
|
|
|
bool exportable_semaphore = false, importable_semaphore = false;
|
|
|
|
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO,
|
|
|
|
bool has_external_semaphore_fd =
|
|
|
|
.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT,
|
|
|
|
check_extension(avail_ext_props, avail_extc, VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME);
|
|
|
|
};
|
|
|
|
if (has_external_semaphore_fd) {
|
|
|
|
VkExternalSemaphoreProperties ext_semaphore_props = {
|
|
|
|
const VkPhysicalDeviceExternalSemaphoreInfo ext_semaphore_info = {
|
|
|
|
.sType = VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES,
|
|
|
|
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO,
|
|
|
|
};
|
|
|
|
.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT,
|
|
|
|
vkGetPhysicalDeviceExternalSemaphoreProperties(phdev,
|
|
|
|
};
|
|
|
|
&ext_semaphore_info, &ext_semaphore_props);
|
|
|
|
VkExternalSemaphoreProperties ext_semaphore_props = {
|
|
|
|
bool exportable_semaphore = ext_semaphore_props.externalSemaphoreFeatures &
|
|
|
|
.sType = VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES,
|
|
|
|
VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT;
|
|
|
|
};
|
|
|
|
bool importable_semaphore = ext_semaphore_props.externalSemaphoreFeatures &
|
|
|
|
vkGetPhysicalDeviceExternalSemaphoreProperties(phdev,
|
|
|
|
VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT;
|
|
|
|
&ext_semaphore_info, &ext_semaphore_props);
|
|
|
|
|
|
|
|
exportable_semaphore = ext_semaphore_props.externalSemaphoreFeatures &
|
|
|
|
|
|
|
|
VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT;
|
|
|
|
|
|
|
|
importable_semaphore = ext_semaphore_props.externalSemaphoreFeatures &
|
|
|
|
|
|
|
|
VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT;
|
|
|
|
|
|
|
|
extensions[extensions_len++] = VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (!exportable_semaphore) {
|
|
|
|
if (!exportable_semaphore) {
|
|
|
|
wlr_log(WLR_DEBUG, "VkSemaphore is not exportable to a sync_file");
|
|
|
|
wlr_log(WLR_DEBUG, "VkSemaphore is not exportable to a sync_file");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -617,10 +622,13 @@ struct wlr_vk_device *vulkan_device_create(struct wlr_vk_instance *ini,
|
|
|
|
load_device_proc(dev, "vkWaitSemaphoresKHR", &dev->api.vkWaitSemaphoresKHR);
|
|
|
|
load_device_proc(dev, "vkWaitSemaphoresKHR", &dev->api.vkWaitSemaphoresKHR);
|
|
|
|
load_device_proc(dev, "vkGetSemaphoreCounterValueKHR",
|
|
|
|
load_device_proc(dev, "vkGetSemaphoreCounterValueKHR",
|
|
|
|
&dev->api.vkGetSemaphoreCounterValueKHR);
|
|
|
|
&dev->api.vkGetSemaphoreCounterValueKHR);
|
|
|
|
load_device_proc(dev, "vkGetSemaphoreFdKHR", &dev->api.vkGetSemaphoreFdKHR);
|
|
|
|
|
|
|
|
load_device_proc(dev, "vkImportSemaphoreFdKHR", &dev->api.vkImportSemaphoreFdKHR);
|
|
|
|
|
|
|
|
load_device_proc(dev, "vkQueueSubmit2KHR", &dev->api.vkQueueSubmit2KHR);
|
|
|
|
load_device_proc(dev, "vkQueueSubmit2KHR", &dev->api.vkQueueSubmit2KHR);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (has_external_semaphore_fd) {
|
|
|
|
|
|
|
|
load_device_proc(dev, "vkGetSemaphoreFdKHR", &dev->api.vkGetSemaphoreFdKHR);
|
|
|
|
|
|
|
|
load_device_proc(dev, "vkImportSemaphoreFdKHR", &dev->api.vkImportSemaphoreFdKHR);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
size_t max_fmts;
|
|
|
|
size_t max_fmts;
|
|
|
|
const struct wlr_vk_format *fmts = vulkan_get_format_list(&max_fmts);
|
|
|
|
const struct wlr_vk_format *fmts = vulkan_get_format_list(&max_fmts);
|
|
|
|
dev->format_props = calloc(max_fmts, sizeof(*dev->format_props));
|
|
|
|
dev->format_props = calloc(max_fmts, sizeof(*dev->format_props));
|
|
|
|