mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-02-04 12:58:06 +00:00
a/vk: Enable synchronization2 feature
This commit is contained in:
parent
11fc8d5629
commit
d63b9f4518
|
@ -281,6 +281,7 @@ DEVICE_EXTENSIONS_TO_CHECK = [
|
|||
"VK_KHR_maintenance2",
|
||||
"VK_KHR_maintenance3",
|
||||
"VK_KHR_maintenance4",
|
||||
"VK_KHR_synchronization2",
|
||||
"VK_KHR_timeline_semaphore",
|
||||
"VK_EXT_calibrated_timestamps",
|
||||
"VK_EXT_display_control",
|
||||
|
|
|
@ -748,6 +748,7 @@ fill_in_has_device_extensions(struct vk_bundle *vk, struct u_string_list *ext_li
|
|||
vk->has_KHR_maintenance2 = false;
|
||||
vk->has_KHR_maintenance3 = false;
|
||||
vk->has_KHR_maintenance4 = false;
|
||||
vk->has_KHR_synchronization2 = false;
|
||||
vk->has_KHR_timeline_semaphore = false;
|
||||
vk->has_EXT_calibrated_timestamps = false;
|
||||
vk->has_EXT_display_control = false;
|
||||
|
@ -826,6 +827,13 @@ fill_in_has_device_extensions(struct vk_bundle *vk, struct u_string_list *ext_li
|
|||
}
|
||||
#endif // defined(VK_KHR_maintenance4)
|
||||
|
||||
#if defined(VK_KHR_synchronization2)
|
||||
if (strcmp(ext, VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME) == 0) {
|
||||
vk->has_KHR_synchronization2 = true;
|
||||
continue;
|
||||
}
|
||||
#endif // defined(VK_KHR_synchronization2)
|
||||
|
||||
#if defined(VK_KHR_timeline_semaphore)
|
||||
if (strcmp(ext, VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME) == 0) {
|
||||
vk->has_KHR_timeline_semaphore = true;
|
||||
|
@ -1015,6 +1023,13 @@ filter_device_features(struct vk_bundle *vk,
|
|||
};
|
||||
#endif
|
||||
|
||||
#ifdef VK_KHR_synchronization2
|
||||
VkPhysicalDeviceSynchronization2Features synchronization_2_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES,
|
||||
.pNext = NULL,
|
||||
};
|
||||
#endif
|
||||
|
||||
VkPhysicalDeviceFeatures2 physical_device_features = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
|
||||
.pNext = NULL,
|
||||
|
@ -1034,6 +1049,13 @@ filter_device_features(struct vk_bundle *vk,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef VK_KHR_synchronization2
|
||||
if (vk->has_KHR_synchronization2) {
|
||||
append_to_pnext_chain((VkBaseInStructure *)&physical_device_features,
|
||||
(VkBaseInStructure *)&synchronization_2_info);
|
||||
}
|
||||
#endif
|
||||
|
||||
vk->vkGetPhysicalDeviceFeatures2( //
|
||||
physical_device, // physicalDevice
|
||||
&physical_device_features); // pFeatures
|
||||
|
@ -1052,6 +1074,11 @@ filter_device_features(struct vk_bundle *vk,
|
|||
#ifdef VK_KHR_timeline_semaphore
|
||||
CHECK(timeline_semaphore, timeline_semaphore_info.timelineSemaphore);
|
||||
#endif
|
||||
|
||||
#ifdef VK_KHR_synchronization2
|
||||
CHECK(synchronization_2, synchronization_2_info.synchronization2);
|
||||
#endif
|
||||
|
||||
CHECK(shader_image_gather_extended, physical_device_features.features.shaderImageGatherExtended);
|
||||
|
||||
CHECK(shader_storage_image_write_without_format,
|
||||
|
@ -1065,11 +1092,13 @@ filter_device_features(struct vk_bundle *vk,
|
|||
"\n\tnull_descriptor: %i"
|
||||
"\n\tshader_image_gather_extended: %i"
|
||||
"\n\tshader_storage_image_write_without_format: %i"
|
||||
"\n\ttimeline_semaphore: %i", //
|
||||
"\n\ttimeline_semaphore: %i"
|
||||
"\n\tsynchronization_2: %i", //
|
||||
device_features->null_descriptor, //
|
||||
device_features->shader_image_gather_extended, //
|
||||
device_features->shader_storage_image_write_without_format, //
|
||||
device_features->timeline_semaphore);
|
||||
device_features->timeline_semaphore, //
|
||||
device_features->synchronization_2);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1115,6 +1144,7 @@ vk_create_device(struct vk_bundle *vk,
|
|||
struct vk_device_features device_features = {0};
|
||||
filter_device_features(vk, vk->physical_device, optional_device_features, &device_features);
|
||||
vk->features.timeline_semaphore = device_features.timeline_semaphore;
|
||||
vk->features.synchronization_2 = device_features.synchronization_2;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1205,6 +1235,14 @@ vk_create_device(struct vk_bundle *vk,
|
|||
};
|
||||
#endif
|
||||
|
||||
#ifdef VK_KHR_synchronization2
|
||||
VkPhysicalDeviceSynchronization2FeaturesKHR synchronization_2_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES_KHR,
|
||||
.pNext = NULL,
|
||||
.synchronization2 = device_features.synchronization_2,
|
||||
};
|
||||
#endif
|
||||
|
||||
VkPhysicalDeviceFeatures enabled_features = {
|
||||
.shaderImageGatherExtended = device_features.shader_image_gather_extended,
|
||||
.shaderStorageImageWriteWithoutFormat = device_features.shader_storage_image_write_without_format,
|
||||
|
@ -1232,6 +1270,13 @@ vk_create_device(struct vk_bundle *vk,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef VK_KHR_synchronization2
|
||||
if (vk->has_KHR_synchronization2) {
|
||||
append_to_pnext_chain((VkBaseInStructure *)&device_create_info,
|
||||
(VkBaseInStructure *)&synchronization_2_info);
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = vk->vkCreateDevice(vk->physical_device, &device_create_info, NULL, &vk->device);
|
||||
|
||||
u_string_list_destroy(&device_ext_list);
|
||||
|
|
|
@ -134,6 +134,7 @@ struct vk_bundle
|
|||
bool has_KHR_maintenance2;
|
||||
bool has_KHR_maintenance3;
|
||||
bool has_KHR_maintenance4;
|
||||
bool has_KHR_synchronization2;
|
||||
bool has_KHR_timeline_semaphore;
|
||||
bool has_EXT_calibrated_timestamps;
|
||||
bool has_EXT_display_control;
|
||||
|
@ -163,6 +164,9 @@ struct vk_bundle
|
|||
|
||||
//! Per stage limit on storage images.
|
||||
uint32_t max_per_stage_descriptor_storage_images;
|
||||
|
||||
//! Was synchronization2 requested, available, and enabled?
|
||||
bool synchronization_2;
|
||||
} features;
|
||||
|
||||
//! Is the GPU a tegra device.
|
||||
|
@ -989,6 +993,7 @@ struct vk_device_features
|
|||
bool shader_storage_image_write_without_format;
|
||||
bool null_descriptor;
|
||||
bool timeline_semaphore;
|
||||
bool synchronization_2;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
|
@ -559,6 +559,9 @@ static const char *optional_device_extensions[] = {
|
|||
#ifdef VK_EXT_display_control
|
||||
VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME,
|
||||
#endif
|
||||
#ifdef VK_KHR_synchronization2
|
||||
VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME,
|
||||
#endif
|
||||
};
|
||||
|
||||
static bool
|
||||
|
|
|
@ -279,6 +279,7 @@ create_device(struct vk_bundle *vk, const struct comp_vulkan_arguments *vk_args)
|
|||
.shader_storage_image_write_without_format = true,
|
||||
.null_descriptor = only_compute_queue,
|
||||
.timeline_semaphore = vk_args->timeline_semaphore,
|
||||
.synchronization_2 = true,
|
||||
};
|
||||
|
||||
// No other way then to try to see if realtime is available.
|
||||
|
|
Loading…
Reference in a new issue