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@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6719>
This commit is contained in:
Jonathan Marek 2020-09-15 19:46:24 -04:00 committed by Marge Bot
parent e192f8f30a
commit 728061b968
4 changed files with 34 additions and 1 deletions

View file

@ -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
});
}

View file

@ -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;
}

View file

@ -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) \

View file

@ -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;
}