Module: Mesa
Branch: master
Commit: 7a51abab425af6c467d70109a95b22937bd3a63d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7a51abab425af6c467d70109a95b22937bd3a63d

Author: Erico Nunes <[email protected]>
Date:   Wed Aug 14 22:39:33 2019 +0200

lima: actually wait for bo in lima_bo_wait

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 <[email protected]>
Reviewed-by: Qiang Yu <[email protected]>

---

 src/gallium/drivers/lima/lima_bo.c     | 3 +++
 src/gallium/drivers/lima/lima_submit.c | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/src/gallium/drivers/lima/lima_bo.c 
b/src/gallium/drivers/lima/lima_bo.c
index 1d6dd720602..bd1f6cf8c8c 100644
--- a/src/gallium/drivers/lima/lima_bo.c
+++ b/src/gallium/drivers/lima/lima_bo.c
@@ -327,6 +327,9 @@ struct lima_bo *lima_bo_import(struct lima_screen *screen,
 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,
diff --git a/src/gallium/drivers/lima/lima_submit.c 
b/src/gallium/drivers/lima/lima_submit.c
index 3b5145f3bc4..92909451db4 100644
--- a/src/gallium/drivers/lima/lima_submit.c
+++ b/src/gallium/drivers/lima/lima_submit.c
@@ -155,6 +155,8 @@ bool lima_submit_start(struct lima_submit *submit, void 
*frame, uint32_t size)
 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);
 }

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to