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 nouveau_drm.c:



details:   https://anonhg.NetBSD.org/src/rev/9d1551140940
branches:  trunk
changeset: 340954:9d1551140940
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue Oct 13 01:43:47 2015 +0000

description:
nouveau_drm.c:
- hook up an empty uvm_pagerops like radeon does.
- hook up nouveau_ttm_mmap_object().
nouveau_engine_fifo_nve0.c:
- if (cold), don't try to wait, but hard-spin until the timeout period.

with these in place, i am able to get working text-console with nouveau!


ok riastradh.

diffstat:

 sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nve0.c |  35 ++++++---
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c                               |  15 +++-
 2 files changed, 34 insertions(+), 16 deletions(-)

diffs (107 lines):

diff -r 72b1ef6b8fda -r 9d1551140940 sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nve0.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nve0.c        Tue Oct 13 00:42:59 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_nve0.c        Tue Oct 13 01:43:47 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_engine_fifo_nve0.c,v 1.4 2015/02/28 05:38:49 riastradh Exp $   */
+/*     $NetBSD: nouveau_engine_fifo_nve0.c,v 1.5 2015/10/13 01:43:47 mrg Exp $ */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_fifo_nve0.c,v 1.4 2015/02/28 05:38:49 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_fifo_nve0.c,v 1.5 2015/10/13 01:43:47 mrg Exp $");
 
 #include <core/client.h>
 #include <core/handle.h>
@@ -136,18 +136,27 @@
        nv_wr32(priv, 0x002274, (engine << 20) | (p >> 3));
 
 #ifdef __NetBSD__
-    {
-       int ret;
+       if (cold) {
+               uint count = 2000;
+               while (count-- > 0) {
+                       if (!(nv_rd32(priv, 0x002284 + (engine * 0x08)) & 0x00100000))
+                               break;
+                       delay(1000);
+               }
+               if (count == 0)
+                       nv_error(priv, "runlist %d update timeout\n", engine);
+       } else {
+               int ret;
 
-       spin_lock(&engn->lock);
-       DRM_SPIN_TIMED_WAIT_NOINTR_UNTIL(ret, &engn->wait, &engn->lock,
-           msecs_to_jiffies(2000),
-           !(nv_rd32(priv, 0x002284 +
-                   (engine * 0x08)) & 0x00100000));
-       if (ret == 0)
-               nv_error(priv, "runlist %d update timeout\n", engine);
-       spin_unlock(&engn->lock);
-    }
+               spin_lock(&engn->lock);
+               DRM_SPIN_TIMED_WAIT_NOINTR_UNTIL(ret, &engn->wait, &engn->lock,
+                   msecs_to_jiffies(2000),
+                   !(nv_rd32(priv, 0x002284 +
+                           (engine * 0x08)) & 0x00100000));
+               if (ret == 0)
+                       nv_error(priv, "runlist %d update timeout\n", engine);
+               spin_unlock(&engn->lock);
+       }
 #else
        if (wait_event_timeout(engn->wait, !(nv_rd32(priv, 0x002284 +
                               (engine * 0x08)) & 0x00100000),
diff -r 72b1ef6b8fda -r 9d1551140940 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c      Tue Oct 13 00:42:59 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c      Tue Oct 13 01:43:47 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_drm.c,v 1.5 2015/03/06 15:39:28 riastradh Exp $        */
+/*     $NetBSD: nouveau_drm.c,v 1.6 2015/10/13 01:43:47 mrg Exp $      */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.5 2015/03/06 15:39:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.6 2015/10/13 01:43:47 mrg Exp $");
 
 #include <linux/console.h>
 #include <linux/module.h>
@@ -62,6 +62,7 @@
 #include "nouveau_fbcon.h"
 #include "nouveau_fence.h"
 #include "nouveau_debugfs.h"
+#include "nouveau_ttm.h"
 
 MODULE_PARM_DESC(config, "option string to pass to driver core");
 char *nouveau_config;
@@ -87,6 +88,10 @@
 static struct drm_driver driver;
 #ifdef __NetBSD__
 struct drm_driver *const nouveau_drm_driver = &driver;
+
+/* XXX Kludge for the non-GEM GEM that nouveau uses.  */
+static const struct uvm_pagerops nouveau_gem_uvm_ops;
+
 #endif
 
 static u64
@@ -880,7 +885,11 @@
 
        .ioctls = nouveau_ioctls,
        .num_ioctls = ARRAY_SIZE(nouveau_ioctls),
-#ifndef __NetBSD__
+#ifdef __NetBSD__
+       .fops = NULL,
+       .mmap_object = &nouveau_ttm_mmap_object,
+       .gem_uvm_ops = &nouveau_gem_uvm_ops,
+#else
        .fops = &nouveau_driver_fops,
 #endif
 



Home | Main Index | Thread Index | Old Index