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>
(cherry picked from commit 5e39b52e6a)
This commit is contained in:
Emma Anholt
2022-09-21 16:42:34 -07:00
committed by Dylan Baker
parent dba8e3f3f5
commit c08e78aba9
2 changed files with 5 additions and 2 deletions

View File

@@ -1633,7 +1633,7 @@
"description": "turnip: Fix busy-waiting on syncobjs with OS_TIMEOUT_INFINITE.",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "0a82a26a1854a63d8248e85c0e3b137d44ce7542"
},

View File

@@ -487,11 +487,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,