PIPE_TIMEOUT_INFINITE is unsigned and gets assigned to signed fields
where it ends up as -1. When this reaches the kernel as a timeout it
gets translated as no timeout, which cause the waiting functions to
return immediately and not actually wait for a completion.
This seems to cause unstable results with lima where even piglit tests
randomly fail.
Handle this by setting the signed max value in case of infinite timeout.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
bool lima_bo_wait(struct lima_bo *bo, uint32_t op, uint64_t timeout_ns)
{
int64_t abs_timeout = os_time_get_absolute_timeout(timeout_ns);
+ if (abs_timeout == OS_TIMEOUT_INFINITE)
+ abs_timeout = INT64_MAX;
+
struct drm_lima_gem_wait req = {
.handle = bo->handle,
.op = op,
bool lima_submit_wait(struct lima_submit *submit, uint64_t timeout_ns)
{
int64_t abs_timeout = os_time_get_absolute_timeout(timeout_ns);
+ if (abs_timeout == OS_TIMEOUT_INFINITE)
+ abs_timeout = INT64_MAX;
return !drmSyncobjWait(submit->screen->fd, &submit->out_sync, 1, abs_timeout, 0, NULL);
}