Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/i915 Fix returned timeout in ...



details:   https://anonhg.NetBSD.org/src/rev/5cfac065d8c5
branches:  trunk
changeset: 336350:5cfac065d8c5
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Feb 26 14:10:14 2015 +0000

description:
Fix returned timeout in wait_seqno: remaining time, not time slept.

diffstat:

 sys/external/bsd/drm2/dist/drm/i915/i915_gem.c |  18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r cb8c050d6104 -r 5cfac065d8c5 sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c    Thu Feb 26 14:00:17 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c    Thu Feb 26 14:10:14 2015 +0000
@@ -1441,8 +1441,22 @@
 
        if (!irq_test_in_progress)
                ring->irq_put(ring);
-       if (timeout)
-               timespecsub(&after, &before, timeout);
+       if (timeout) {
+               struct timespec slept;
+
+               /* Compute slept = after - before.  */
+               timespecsub(&after, &before, &slept);
+
+               /*
+                * Return the time remaining, timeout - slept, if we
+                * slept for less time than the timeout; or zero if we
+                * timed out.
+                */
+               if (timespeccmp(&slept, timeout, <))
+                       timespecsub(timeout, &slept, timeout);
+               else
+                       timespecclear(timeout);
+       }
        return MAX(ret, 0);     /* ignore remaining ticks */
 }
 #else



Home | Main Index | Thread Index | Old Index