pvr: Add support for VK_KHR_timeline_semaphore

pvrsrvkm will run with VK_DEVICE_TIMELINE_MODE_EMULATED and
powervr will run with VK_DEVICE_TIMELINE_MODE_ASSISTED.

Signed-off-by: Jarred Davies <jarred.davies@imgtec.com>

Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21577>
This commit is contained in:
Jarred Davies 2023-01-31 08:06:25 +00:00 committed by Marge Bot
parent 80f864cd23
commit 5be2e44095
3 changed files with 34 additions and 4 deletions

View file

@ -133,6 +133,7 @@ static void pvr_physical_device_get_supported_extensions(
*extensions = (struct vk_device_extension_table){
.KHR_external_memory = true,
.KHR_external_memory_fd = true,
.KHR_timeline_semaphore = true,
#if defined(PVR_USE_WSI_PLATFORM)
.KHR_swapchain = true,
#endif
@ -667,7 +668,18 @@ void pvr_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
};
vk_foreach_struct (ext, pFeatures->pNext) {
pvr_debug_ignored_stype(ext->sType);
switch (ext->sType) {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES: {
VkPhysicalDeviceTimelineSemaphoreFeatures *pFeature =
(VkPhysicalDeviceTimelineSemaphoreFeatures *)ext;
pFeature->timelineSemaphore = VK_TRUE;
break;
}
default: {
pvr_debug_ignored_stype(ext->sType);
break;
}
}
}
}
@ -1043,7 +1055,18 @@ void pvr_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
VK_UUID_SIZE);
vk_foreach_struct (ext, pProperties->pNext) {
pvr_debug_ignored_stype(ext->sType);
switch (ext->sType) {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES: {
VkPhysicalDeviceTimelineSemaphoreProperties *pProperties =
(VkPhysicalDeviceTimelineSemaphoreProperties *)ext;
pProperties->maxTimelineSemaphoreValueDifference = UINT64_MAX;
break;
}
default: {
pvr_debug_ignored_stype(ext->sType);
break;
}
}
}
}

View file

@ -41,6 +41,7 @@
#include "util/macros.h"
#include "util/vma.h"
#include "vk_sync.h"
#include "vk_sync_timeline.h"
struct pvr_device_info;
struct pvr_device_runtime_info;
@ -480,8 +481,9 @@ struct pvr_winsys {
uint64_t page_size;
uint32_t log2_page_size;
const struct vk_sync_type *sync_types[2];
const struct vk_sync_type *sync_types[3];
struct vk_sync_type syncobj_type;
struct vk_sync_timeline_type timeline_syncobj_type;
const struct pvr_winsys_ops *ops;
};

View file

@ -48,6 +48,7 @@
#include "util/os_misc.h"
#include "vk_log.h"
#include "vk_sync.h"
#include "vk_sync_timeline.h"
/* Amount of space used to hold sync prim values (in bytes). */
#define PVR_SRV_SYNC_PRIM_VALUE_SIZE 4U
@ -677,7 +678,11 @@ struct pvr_winsys *pvr_srv_winsys_create(int master_fd,
srv_ws->base.syncobj_type = pvr_srv_sync_type;
srv_ws->base.sync_types[0] = &srv_ws->base.syncobj_type;
srv_ws->base.sync_types[1] = NULL;
srv_ws->base.timeline_syncobj_type =
vk_sync_timeline_get_type(srv_ws->base.sync_types[0]);
srv_ws->base.sync_types[1] = &srv_ws->base.timeline_syncobj_type.sync;
srv_ws->base.sync_types[2] = NULL;
result = pvr_srv_memctx_init(srv_ws);
if (result != VK_SUCCESS)