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/nouveau/nvkm/engine/disp Conv...



details:   https://anonhg.NetBSD.org/src/rev/590649e259f2
branches:  trunk
changeset: 992763:590649e259f2
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 07:43:38 2018 +0000

description:
Convert nouveau dp output train waitqueue.

diffstat:

 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp/nouveau_nvkm_engine_disp_dport.c  |  11 +++-
 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp/nouveau_nvkm_engine_disp_outpdp.c |  25 +++++++++-
 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp/outpdp.h                          |   7 ++-
 3 files changed, 38 insertions(+), 5 deletions(-)

diffs (120 lines):

diff -r 4663d6281963 -r 590649e259f2 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp/nouveau_nvkm_engine_disp_dport.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp/nouveau_nvkm_engine_disp_dport.c  Mon Aug 27 07:43:28 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp/nouveau_nvkm_engine_disp_dport.c  Mon Aug 27 07:43:38 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_nvkm_engine_disp_dport.c,v 1.2 2018/08/27 04:58:31 riastradh Exp $     */
+/*     $NetBSD: nouveau_nvkm_engine_disp_dport.c,v 1.3 2018/08/27 07:43:38 riastradh Exp $     */
 
 /*
  * Copyright 2013 Red Hat Inc.
@@ -24,7 +24,7 @@
  * Authors: Ben Skeggs
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_disp_dport.c,v 1.2 2018/08/27 04:58:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_disp_dport.c,v 1.3 2018/08/27 07:43:38 riastradh Exp $");
 
 #include "dport.h"
 #include "outpdp.h"
@@ -407,7 +407,14 @@
 
        /* signal completion and enable link interrupt handling */
        OUTP_DBG(&outp->base, "training complete");
+#ifdef __NetBSD__
+       spin_lock(&outp->lt.lock);
+       atomic_set(&outp->lt.done, 1);
+       DRM_SPIN_WAKEUP_ONE(&outp->lt.wait, &outp->lt.lock);
+       spin_unlock(&outp->lt.lock);
+#else
        atomic_set(&outp->lt.done, 1);
        wake_up(&outp->lt.wait);
+#endif
        nvkm_notify_get(&outp->irq);
 }
diff -r 4663d6281963 -r 590649e259f2 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp/nouveau_nvkm_engine_disp_outpdp.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp/nouveau_nvkm_engine_disp_outpdp.c Mon Aug 27 07:43:28 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp/nouveau_nvkm_engine_disp_outpdp.c Mon Aug 27 07:43:38 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_nvkm_engine_disp_outpdp.c,v 1.2 2018/08/27 04:58:31 riastradh Exp $    */
+/*     $NetBSD: nouveau_nvkm_engine_disp_outpdp.c,v 1.3 2018/08/27 07:43:38 riastradh Exp $    */
 
 /*
  * Copyright 2014 Red Hat Inc.
@@ -24,7 +24,7 @@
  * Authors: Ben Skeggs
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_disp_outpdp.c,v 1.2 2018/08/27 04:58:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_disp_outpdp.c,v 1.3 2018/08/27 07:43:38 riastradh Exp $");
 
 #include "outpdp.h"
 #include "conn.h"
@@ -100,10 +100,22 @@
        }
 
        if (wait) {
+#ifdef __NetBSD__
+               spin_lock(&outp->lt.lock);
+               DRM_SPIN_TIMED_WAIT_UNTIL(ret, &outp->lt.wait, &outp->lt.lock,
+                   msecs_to_jiffies(2000),
+                   atomic_read(&outp->lt.done));
+               spin_unlock(&outp->lt.lock);
+               if (ret == 0)   /* timeout */
+                       ret = -ETIMEDOUT;
+               else if (ret > 0) /* success */
+                       ret = 0;
+#else
                if (!wait_event_timeout(outp->lt.wait,
                                        atomic_read(&outp->lt.done),
                                        msecs_to_jiffies(2000)))
                        ret = -ETIMEDOUT;
+#endif
        }
 
        return ret;
@@ -201,6 +213,10 @@
        struct nvkm_output_dp *outp = nvkm_output_dp(base);
        nvkm_notify_fini(&outp->hpd);
        nvkm_notify_fini(&outp->irq);
+#ifndef __NetBSD__
+       spin_lock_destroy(&outp->lt.lock);
+       DRM_DESTROY_WAITQUEUE(&outp->lt.wait);
+#endif
        return outp;
 }
 
@@ -245,7 +261,12 @@
 
        /* link training */
        INIT_WORK(&outp->lt.work, nvkm_dp_train);
+#ifdef __NetBSD__
+       DRM_INIT_WAITQUEUE(&outp->lt.wait, "nvoutpdp");
+       spin_lock_init(&outp->lt.lock);
+#else
        init_waitqueue_head(&outp->lt.wait);
+#endif
        atomic_set(&outp->lt.done, 0);
 
        /* link maintenance */
diff -r 4663d6281963 -r 590649e259f2 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp/outpdp.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp/outpdp.h  Mon Aug 27 07:43:28 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp/outpdp.h  Mon Aug 27 07:43:38 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: outpdp.h,v 1.2 2018/08/27 04:58:31 riastradh Exp $     */
+/*     $NetBSD: outpdp.h,v 1.3 2018/08/27 07:43:38 riastradh Exp $     */
 
 #ifndef __NVKM_DISP_OUTP_DP_H__
 #define __NVKM_DISP_OUTP_DP_H__
@@ -33,7 +33,12 @@
 
        struct {
                struct work_struct work;
+#ifdef __NetBSD__
+               drm_waitqueue_t wait;
+               spinlock_t lock;
+#else
                wait_queue_head_t wait;
+#endif
                atomic_t done;
        } lt;
 };



Home | Main Index | Thread Index | Old Index