Mon Dec 24 08:26:04 2018 UTC ()
this works well enough to start and have basic accel only on GTX 750,
so enable those cards.  maybe can enable some pascal cards too.

thanks to fly for fixing nouveau drm2 so it was worth trying :-)


(mrg)
diff -r1.21 -r1.22 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c

cvs diff -r1.21 -r1.22 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/nouveau/nouveau_pci.c 2018/08/28 03:34:07 1.21
+++ src/sys/external/bsd/drm2/nouveau/nouveau_pci.c 2018/12/24 08:26:04 1.22
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: nouveau_pci.c,v 1.21 2018/08/28 03:34:07 riastradh Exp $ */ 1/* $NetBSD: nouveau_pci.c,v 1.22 2018/12/24 08:26:04 mrg Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2015 The NetBSD Foundation, Inc. 4 * Copyright (c) 2015 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Taylor R. Campbell. 8 * by Taylor R. Campbell.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.21 2018/08/28 03:34:07 riastradh Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.22 2018/12/24 08:26:04 mrg Exp $");
34 34
35#include <sys/types.h> 35#include <sys/types.h>
36#include <sys/device.h> 36#include <sys/device.h>
37#include <sys/queue.h> 37#include <sys/queue.h>
38#include <sys/workqueue.h> 38#include <sys/workqueue.h>
39#include <sys/module.h> 39#include <sys/module.h>
40 40
41#include <drm/drmP.h> 41#include <drm/drmP.h>
42 42
43#include <core/device.h> 43#include <core/device.h>
44#include <core/pci.h> 44#include <core/pci.h>
45 45
46#include "nouveau_drm.h" 46#include "nouveau_drm.h"
@@ -88,33 +88,26 @@ nouveau_pci_match(device_t parent, cfdat @@ -88,33 +88,26 @@ nouveau_pci_match(device_t parent, cfdat
88 struct nvkm_device *device; 88 struct nvkm_device *device;
89 int ret; 89 int ret;
90 90
91 if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_NVIDIA && 91 if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_NVIDIA &&
92 PCI_VENDOR(pa->pa_id) != PCI_VENDOR_NVIDIA_SGS) 92 PCI_VENDOR(pa->pa_id) != PCI_VENDOR_NVIDIA_SGS)
93 return 0; 93 return 0;
94 94
95 if (PCI_CLASS(pa->pa_class) != PCI_CLASS_DISPLAY) 95 if (PCI_CLASS(pa->pa_class) != PCI_CLASS_DISPLAY)
96 return 0; 96 return 0;
97 97
98#define IS_BETWEEN(x,y) \ 98#define IS_BETWEEN(x,y) \
99 (PCI_PRODUCT(pa->pa_id) >= (x) && PCI_PRODUCT(pa->pa_id) <= (y)) 99 (PCI_PRODUCT(pa->pa_id) >= (x) && PCI_PRODUCT(pa->pa_id) <= (y))
100 /* 100 /*
101 * NetBSD drm2 needs missing-so-far firmware for Maxwell-based cards: 
102 * 0x1380-0x13bf GM107 
103 */ 
104 if (IS_BETWEEN(0x1380, 0x13bf)) 
105 return 0; 
106 
107 /* 
108 * NetBSD drm2 doesn't support Pascal-based cards: 101 * NetBSD drm2 doesn't support Pascal-based cards:
109 * 0x1580-0x15ff GP100 102 * 0x1580-0x15ff GP100
110 * 0x1b00-0x1b7f GP102 103 * 0x1b00-0x1b7f GP102
111 * 0x1b80-0x1bff GP104 104 * 0x1b80-0x1bff GP104
112 * 0x1c00-0x1c7f GP106 105 * 0x1c00-0x1c7f GP106
113 * 0x1c80-0x1cff GP107 106 * 0x1c80-0x1cff GP107
114 * 0x1d00-0x1d7f GP108 107 * 0x1d00-0x1d7f GP108
115 * 0x1d80-0x1dff GV100 108 * 0x1d80-0x1dff GV100
116 */ 109 */
117  110
118 if (IS_BETWEEN(0x1580, 0x15ff) || 111 if (IS_BETWEEN(0x1580, 0x15ff) ||
119 IS_BETWEEN(0x1b00, 0x1b7f) || 112 IS_BETWEEN(0x1b00, 0x1b7f) ||
120 IS_BETWEEN(0x1b80, 0x1bff) || 113 IS_BETWEEN(0x1b80, 0x1bff) ||