Source-Changes-HG archive

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

[src/riastradh-drm2]: src/sys/external/bsd/drm2 Implement and use non-interru...



details:   https://anonhg.NetBSD.org/src/rev/435bcf7162f9
branches:  riastradh-drm2
changeset: 788647:435bcf7162f9
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Mar 05 22:18:10 2014 +0000

description:
Implement and use non-interruptible DRM_WAIT_* gizmos.

diffstat:

 sys/external/bsd/drm2/dist/drm/i915/i915_gem.c      |  18 ++++---
 sys/external/bsd/drm2/dist/drm/i915/intel_display.c |  22 ++++------
 sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h |  44 ++++++++++++++++----
 3 files changed, 54 insertions(+), 30 deletions(-)

diffs (174 lines):

diff -r ebb29b31a575 -r 435bcf7162f9 sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c    Wed Mar 05 22:17:59 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c    Wed Mar 05 22:18:10 2014 +0000
@@ -1195,14 +1195,16 @@
 #ifdef __NetBSD__
                unsigned long flags;
                spin_lock_irqsave(&dev_priv->irq_lock, flags);
-               /*
-                * XXX This wait is always interruptible; we should
-                * heed the flag `interruptible'.
-                */
-               DRM_SPIN_TIMED_WAIT_UNTIL(end, &ring->irq_queue,
-                   &dev_priv->irq_lock,
-                   timeout_jiffies,
-                   EXIT_COND);
+               if (interruptible)
+                       DRM_SPIN_TIMED_WAIT_UNTIL(end, &ring->irq_queue,
+                           &dev_priv->irq_lock,
+                           timeout_jiffies,
+                           EXIT_COND);
+               else
+                       DRM_SPIN_TIMED_WAIT_NOINTR_UNTIL(end, &ring->irq_queue,
+                           &dev_priv->irq_lock,
+                           timeout_jiffies,
+                           EXIT_COND);
                spin_unlock_irqrestore(&dev_priv->irq_lock, flags);
 #else
                if (interruptible)
diff -r ebb29b31a575 -r 435bcf7162f9 sys/external/bsd/drm2/dist/drm/i915/intel_display.c
--- a/sys/external/bsd/drm2/dist/drm/i915/intel_display.c       Wed Mar 05 22:17:59 2014 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/intel_display.c       Wed Mar 05 22:18:10 2014 +0000
@@ -2248,14 +2248,12 @@
        bool was_interruptible = dev_priv->mm.interruptible;
        int ret;
 
-#ifdef __NetBSD__              /* XXX DRM_WAIT_UNINTERRUPTIBLE_UNTIL */
+#ifdef __NetBSD__
        mutex_lock(&dev_priv->pending_flip_lock);
-       do {
-               DRM_WAIT_UNTIL(ret, &dev_priv->pending_flip_queue,
-                   &dev_priv->pending_flip_lock,
-                   (atomic_read(&dev_priv->mm.wedged) ||
-                       atomic_read(&obj->pending_flip) == 0));
-       } while (ret);
+       DRM_WAIT_NOINTR_UNTIL(ret, &dev_priv->pending_flip_queue,
+           &dev_priv->pending_flip_lock,
+           (atomic_read(&dev_priv->mm.wedged) ||
+               atomic_read(&obj->pending_flip) == 0));
        mutex_unlock(&dev_priv->pending_flip_lock);
 #else
        wait_event(dev_priv->pending_flip_queue,
@@ -2970,13 +2968,11 @@
        if (crtc->fb == NULL)
                return;
 
-#ifdef __NetBSD__              /* XXX DRM_WAIT_UNINTERRUPTIBLE_UNTIL */
+#ifdef __NetBSD__
        mutex_lock(&dev_priv->pending_flip_lock);
-       do {
-               DRM_WAIT_UNTIL(error, &dev_priv->pending_flip_queue,
-                   &dev_priv->pending_flip_lock,
-                   !intel_crtc_has_pending_flip(crtc));
-       } while (error);
+       DRM_WAIT_NOINTR_UNTIL(error, &dev_priv->pending_flip_queue,
+           &dev_priv->pending_flip_lock,
+           !intel_crtc_has_pending_flip(crtc));
        mutex_unlock(&dev_priv->pending_flip_lock);
 #else
        wait_event(dev_priv->pending_flip_queue,
diff -r ebb29b31a575 -r 435bcf7162f9 sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h
--- a/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h       Wed Mar 05 22:17:59 2014 +0000
+++ b/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h       Wed Mar 05 22:18:10 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_wait_netbsd.h,v 1.1.2.8 2013/09/08 16:35:20 riastradh Exp $        */
+/*     $NetBSD: drm_wait_netbsd.h,v 1.1.2.9 2014/03/05 22:18:10 riastradh Exp $        */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -99,7 +99,7 @@
        cv_broadcast(q);
 }
 
-#define        DRM_WAIT_UNTIL(RET, Q, INTERLOCK, CONDITION)    do              \
+#define        _DRM_WAIT_UNTIL(RET, WAIT, Q, INTERLOCK, CONDITION) do          \
 {                                                                      \
        KASSERT(mutex_is_locked((INTERLOCK)));                          \
        for (;;) {                                                      \
@@ -108,13 +108,21 @@
                        break;                                          \
                }                                                       \
                /* XXX errno NetBSD->Linux */                           \
-               (RET) = -cv_wait_sig((Q), &(INTERLOCK)->mtx_lock);      \
+               (RET) = -WAIT((Q), &(INTERLOCK)->mtx_lock);             \
                if (RET)                                                \
                        break;                                          \
        }                                                               \
 } while (0)
 
-#define        DRM_TIMED_WAIT_UNTIL(RET, Q, INTERLOCK, TICKS, CONDITION) do    \
+#define        cv_wait_nointr(Q, I)    (cv_wait((Q), (I)), 0)
+
+#define        DRM_WAIT_NOINTR_UNTIL(RET, Q, I, C)                             \
+       _DRM_WAIT_UNTIL(RET, cv_wait_nointr, Q, I, C)
+
+#define        DRM_WAIT_UNTIL(RET, Q, I, C)                            \
+       _DRM_WAIT_UNTIL(RET, cv_wait_sig, Q, I, C)
+
+#define        _DRM_TIMED_WAIT_UNTIL(RET, WAIT, Q, INTERLOCK, TICKS, CONDITION) do \
 {                                                                      \
        extern int hardclock_ticks;                                     \
        const int _dtwu_start = hardclock_ticks;                        \
@@ -126,7 +134,7 @@
                        break;                                          \
                }                                                       \
                /* XXX errno NetBSD->Linux */                           \
-               (RET) = -cv_timedwait_sig((Q), &(INTERLOCK)->mtx_lock,  \
+               (RET) = -WAIT((Q), &(INTERLOCK)->mtx_lock,              \
                    _dtwu_ticks);                                       \
                if (RET)                                                \
                        break;                                          \
@@ -141,18 +149,30 @@
        }                                                               \
 } while (0)
 
-#define        DRM_SPIN_WAIT_UNTIL(RET, Q, INTERLOCK, CONDITION)       do      \
+#define        DRM_TIMED_WAIT_NOINTR_UNTIL(RET, Q, I, T, C)                    \
+       _DRM_TIMED_WAIT_UNTIL(RET, cv_timedwait, Q, I, T, C)
+
+#define        DRM_TIMED_WAIT_UNTIL(RET, Q, I, T, C)                   \
+       _DRM_TIMED_WAIT_UNTIL(RET, cv_timedwait_sig, Q, I, T, C)
+
+#define        _DRM_SPIN_WAIT_UNTIL(RET, WAIT, Q, INTERLOCK, CONDITION) do     \
 {                                                                      \
        KASSERT(spin_is_locked((INTERLOCK)));                           \
        while (!(CONDITION)) {                                          \
                /* XXX errno NetBSD->Linux */                           \
-               (RET) = -cv_wait_sig((Q), &(INTERLOCK)->sl_lock);       \
+               (RET) = -WAIT((Q), &(INTERLOCK)->sl_lock);              \
                if (RET)                                                \
                        break;                                          \
        }                                                               \
 } while (0)
 
-#define        DRM_SPIN_TIMED_WAIT_UNTIL(RET, Q, INTERLOCK, TICKS, CONDITION)  \
+#define        DRM_SPIN_WAIT_NOINTR_UNTIL(RET, Q, I, C)                        \
+       _DRM_SPIN_WAIT_UNTIL(RET, cv_wait_nointr, Q, I, C)
+
+#define        DRM_SPIN_WAIT_UNTIL(RET, Q, I, C)                               \
+       _DRM_SPIN_WAIT_UNTIL(RET, cv_wait_sig, Q, I, C)
+
+#define        _DRM_SPIN_TIMED_WAIT_UNTIL(RET, WAIT, Q, INTERLOCK, TICKS, CONDITION) \
        do                                                              \
 {                                                                      \
        extern int hardclock_ticks;                                     \
@@ -165,7 +185,7 @@
                        break;                                          \
                }                                                       \
                /* XXX errno NetBSD->Linux */                           \
-               (RET) = -cv_timedwait_sig((Q), &(INTERLOCK)->sl_lock,   \
+               (RET) = -WAIT((Q), &(INTERLOCK)->sl_lock,               \
                    _dstwu_ticks);                                      \
                if (RET)                                                \
                        break;                                          \
@@ -180,4 +200,10 @@
        }                                                               \
 } while (0)
 
+#define        DRM_SPIN_TIMED_WAIT_NOINTR_UNTIL(RET, Q, I, T, C)               \
+       _DRM_SPIN_TIMED_WAIT_UNTIL(RET, cv_timedwait, Q, I, T, C)
+
+#define        DRM_SPIN_TIMED_WAIT_UNTIL(RET, Q, I, T, C)                      \
+       _DRM_SPIN_TIMED_WAIT_UNTIL(RET, cv_timedwait_sig, Q, I, T, C)
+
 #endif  /* _DRM_DRM_WAIT_NETBSD_H_ */



Home | Main Index | Thread Index | Old Index