turnip: Fix busy-waiting on syncobjs with OS_TIMEOUT_INFINITE.

I noticed that glmark2's glFinish()es in its offscreen rendering tests
under zink were spinning.  When we passed -1 as the timeout for
drmSyncobjWait(), the kernel would immediately return ETIME.

Fixes: 0a82a26a18 ("turnip: Porting to common implementation for timeline semaphore")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18739>
This commit is contained in:
Emma Anholt 2022-09-21 16:42:34 -07:00 committed by Marge Bot
parent e2c0eac5bf
commit 5e39b52e6a

View file

@ -647,11 +647,14 @@ tu_timeline_sync_reset(struct vk_device *vk_device,
static VkResult
drm_syncobj_wait(struct tu_device *device,
uint32_t *handles, uint32_t count_handles,
int64_t timeout_nsec, bool wait_all)
uint64_t timeout_nsec, bool wait_all)
{
uint32_t syncobj_wait_flags = DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT;
if (wait_all) syncobj_wait_flags |= DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL;
/* syncobj absolute timeouts are signed. clamp OS_TIMEOUT_INFINITE down. */
timeout_nsec = MIN2(timeout_nsec, (uint64_t)INT64_MAX);
int err = drmSyncobjWait(device->fd, handles,
count_handles, timeout_nsec,
syncobj_wait_flags,