Mesa (master): turnip: signal fence and semaphore in AcquireNextImage2KHR
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Sep 30 00:46:35 UTC 2020
Module: Mesa
Branch: master
Commit: 728061b96891290c02297f3097d790221f624a8d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=728061b96891290c02297f3097d790221f624a8d
Author: Jonathan Marek <jonathan at marek.ca>
Date: Tue Sep 15 19:46:24 2020 -0400
turnip: signal fence and semaphore in AcquireNextImage2KHR
As a result of doing semaphores correctly, this is needed for things to
work correctly.
Signed-off-by: Jonathan Marek <jonathan at marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6719>
---
src/freedreno/vulkan/tu_drm.c | 19 +++++++++++++++++++
src/freedreno/vulkan/tu_kgsl.c | 7 +++++++
src/freedreno/vulkan/tu_private.h | 3 +++
src/freedreno/vulkan/tu_wsi.c | 6 +++++-
4 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/src/freedreno/vulkan/tu_drm.c b/src/freedreno/vulkan/tu_drm.c
index c79d93aecb5..28b887a6a2b 100644
--- a/src/freedreno/vulkan/tu_drm.c
+++ b/src/freedreno/vulkan/tu_drm.c
@@ -875,3 +875,22 @@ tu_GetFenceStatus(VkDevice _device, VkFence _fence)
result = VK_NOT_READY;
return result;
}
+
+int
+tu_signal_fences(struct tu_device *device, struct tu_syncobj *fence1, struct tu_syncobj *fence2)
+{
+ uint32_t handles[2], count = 0;
+ if (fence1)
+ handles[count++] = fence1->temporary ?: fence1->permanent;
+
+ if (fence2)
+ handles[count++] = fence2->temporary ?: fence2->permanent;
+
+ if (!count)
+ return 0;
+
+ return ioctl(device->fd, DRM_IOCTL_SYNCOBJ_SIGNAL, &(struct drm_syncobj_array) {
+ .handles = (uintptr_t) handles,
+ .count_handles = count
+ });
+}
diff --git a/src/freedreno/vulkan/tu_kgsl.c b/src/freedreno/vulkan/tu_kgsl.c
index 155d7f77651..cabdb287053 100644
--- a/src/freedreno/vulkan/tu_kgsl.c
+++ b/src/freedreno/vulkan/tu_kgsl.c
@@ -402,3 +402,10 @@ tu_GetFenceStatus(VkDevice _device, VkFence _fence)
tu_finishme("GetFenceStatus");
return VK_SUCCESS;
}
+
+int
+tu_signal_fences(struct tu_device *device, struct tu_syncobj *fence1, struct tu_syncobj *fence2)
+{
+ tu_finishme("tu_signal_fences");
+ return 0;
+}
diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h
index 2e14f3f9e82..1fcb09ce07f 100644
--- a/src/freedreno/vulkan/tu_private.h
+++ b/src/freedreno/vulkan/tu_private.h
@@ -1512,6 +1512,9 @@ tu_drm_submitqueue_new(const struct tu_device *dev,
void
tu_drm_submitqueue_close(const struct tu_device *dev, uint32_t queue_id);
+int
+tu_signal_fences(struct tu_device *device, struct tu_syncobj *fence1, struct tu_syncobj *fence2);
+
#define TU_DEFINE_HANDLE_CASTS(__tu_type, __VkType) \
\
static inline struct __tu_type *__tu_type##_from_handle(__VkType _handle) \
diff --git a/src/freedreno/vulkan/tu_wsi.c b/src/freedreno/vulkan/tu_wsi.c
index d7c4bda9bbb..7a1f7dd5d37 100644
--- a/src/freedreno/vulkan/tu_wsi.c
+++ b/src/freedreno/vulkan/tu_wsi.c
@@ -228,12 +228,16 @@ tu_AcquireNextImage2KHR(VkDevice _device,
uint32_t *pImageIndex)
{
TU_FROM_HANDLE(tu_device, device, _device);
+ TU_FROM_HANDLE(tu_syncobj, fence, pAcquireInfo->fence);
+ TU_FROM_HANDLE(tu_syncobj, semaphore, pAcquireInfo->semaphore);
+
struct tu_physical_device *pdevice = device->physical_device;
VkResult result = wsi_common_acquire_next_image2(
&pdevice->wsi_device, _device, pAcquireInfo, pImageIndex);
- /* TODO signal fence and semaphore */
+ /* signal fence/semaphore - image is available immediately */
+ tu_signal_fences(device, fence, semaphore);
return result;
}
More information about the mesa-commit
mailing list