summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@collabora.com>2022-04-04 18:37:26 -0500
committerMarge Bot <emma+marge@anholt.net>2022-04-13 17:22:14 +0000
commit93fbaae7d546aa707dfd5057635aa37318e5adb7 (patch)
tree4cafc7029ab69a57bc04ceeabd011c203f544eaf
parent1cc917bc683c4980f3d6e98e5dd154d4eedc16a8 (diff)
downloadmesa-93fbaae7d546aa707dfd5057635aa37318e5adb7.tar.gz
v3dv: Add emulated timeline semaphore support
This is trivial thanks to the emulated timelines provided in common code. "Real" timeline semaphores which can be shared across processes will require kernel support. Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15704>
-rw-r--r--src/broadcom/vulkan/v3dv_device.c14
-rw-r--r--src/broadcom/vulkan/v3dv_private.h4
2 files changed, 16 insertions, 2 deletions
diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c
index f4c9cc24a41..02392bf546f 100644
--- a/src/broadcom/vulkan/v3dv_device.c
+++ b/src/broadcom/vulkan/v3dv_device.c
@@ -145,6 +145,7 @@ get_device_extensions(const struct v3dv_physical_device *device,
.KHR_shader_non_semantic_info = true,
.KHR_sampler_mirror_clamp_to_edge = true,
.KHR_storage_buffer_storage_class = true,
+ .KHR_timeline_semaphore = true,
.KHR_uniform_buffer_standard_layout = true,
#ifdef V3DV_USE_WSI_PLATFORM
.KHR_swapchain = true,
@@ -879,8 +880,17 @@ physical_device_init(struct v3dv_physical_device *device,
device->drm_syncobj_type.import_sync_file = NULL;
device->drm_syncobj_type.export_sync_file = NULL;
+ /* Multiwait is required for emulated timeline semaphores and is supported
+ * by the v3d kernel interface.
+ */
+ device->drm_syncobj_type.features |= VK_SYNC_FEATURE_GPU_MULTI_WAIT;
+
+ device->sync_timeline_type =
+ vk_sync_timeline_get_type(&device->drm_syncobj_type);
+
device->sync_types[0] = &device->drm_syncobj_type;
- device->sync_types[1] = NULL;
+ device->sync_types[1] = &device->sync_timeline_type.sync;
+ device->sync_types[2] = NULL;
device->vk.supported_sync_types = device->sync_types;
result = v3dv_wsi_init(device);
@@ -1163,6 +1173,7 @@ v3dv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
.storageBuffer8BitAccess = true,
.storagePushConstant8 = true,
.imagelessFramebuffer = true,
+ .timelineSemaphore = true,
};
VkPhysicalDeviceVulkan11Features vk11 = {
@@ -1548,6 +1559,7 @@ v3dv_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
*/
.independentResolveNone = false,
.independentResolve = false,
+ .maxTimelineSemaphoreValueDifference = UINT64_MAX,
};
memset(vk12.driverName, 0, VK_MAX_DRIVER_NAME_SIZE_KHR);
snprintf(vk12.driverName, VK_MAX_DRIVER_NAME_SIZE_KHR, "V3DV Mesa");
diff --git a/src/broadcom/vulkan/v3dv_private.h b/src/broadcom/vulkan/v3dv_private.h
index 950fd3329c8..c922c8dbcd1 100644
--- a/src/broadcom/vulkan/v3dv_private.h
+++ b/src/broadcom/vulkan/v3dv_private.h
@@ -44,6 +44,7 @@
#include "vk_physical_device.h"
#include "vk_shader_module.h"
#include "vk_sync.h"
+#include "vk_sync_timeline.h"
#include "vk_util.h"
#include "vk_command_buffer.h"
@@ -142,7 +143,8 @@ struct v3dv_physical_device {
uint8_t driver_uuid[VK_UUID_SIZE];
struct vk_sync_type drm_syncobj_type;
- const struct vk_sync_type *sync_types[2];
+ struct vk_sync_timeline_type sync_timeline_type;
+ const struct vk_sync_type *sync_types[3];
struct disk_cache *disk_cache;