Mesa (master): vc4: Fix return value handling for BO waits.

Eric Anholt anholt at kemper.freedesktop.org
Sat May 30 05:57:30 UTC 2015


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

Author: Eric Anholt <eric at anholt.net>
Date:   Fri May 29 17:21:15 2015 -0700

vc4: Fix return value handling for BO waits.

If the wait ever returned -ETIME, we'd abort because the errno was
stored in errno and not drmIoctl()'s return value.

---

 src/gallium/drivers/vc4/vc4_bufmgr.c |   27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_bufmgr.c b/src/gallium/drivers/vc4/vc4_bufmgr.c
index 6b3a8c3..8f9d9c3 100644
--- a/src/gallium/drivers/vc4/vc4_bufmgr.c
+++ b/src/gallium/drivers/vc4/vc4_bufmgr.c
@@ -343,15 +343,17 @@ vc4_wait_seqno(struct vc4_screen *screen, uint64_t seqno, uint64_t timeout_ns)
                 ret = 0;
         }
 
-        if (ret == -ETIME) {
-                return false;
-        } else if (ret != 0) {
-                fprintf(stderr, "wait failed\n");
-                abort();
-        } else {
+        if (ret == 0) {
                 screen->finished_seqno = wait.seqno;
                 return true;
         }
+
+        if (errno != ETIME) {
+                fprintf(stderr, "wait failed: %d\n", ret);
+                abort();
+        }
+
+        return false;
 }
 
 bool
@@ -370,14 +372,15 @@ vc4_bo_wait(struct vc4_bo *bo, uint64_t timeout_ns)
         else
                 ret = 0;
 
-        if (ret == -ETIME) {
-                return false;
-        } else if (ret != 0) {
-                fprintf(stderr, "wait failed\n");
-                abort();
-        } else {
+        if (ret == 0)
                 return true;
+
+        if (errno != ETIME) {
+                fprintf(stderr, "wait failed: %d\n", ret);
+                abort();
         }
+
+        return false;
 }
 
 void *




More information about the mesa-commit mailing list