| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: gffb.c,v 1.19 2022/03/10 00:14:33 riastradh Exp $ */ | | 1 | /* $NetBSD: gffb.c,v 1.20 2022/03/10 18:13:31 andvar Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2013 Michael Lorenz | | 4 | * Copyright (c) 2013 Michael Lorenz |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -25,27 +25,27 @@ | | | @@ -25,27 +25,27 @@ |
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | | 26 | */ |
27 | | | 27 | |
28 | /* | | 28 | /* |
29 | * A console driver for nvidia geforce graphics controllers | | 29 | * A console driver for nvidia geforce graphics controllers |
30 | * tested on macppc only so far, should work on other hardware as long as | | 30 | * tested on macppc only so far, should work on other hardware as long as |
31 | * something sets up a usable graphics mode and sets the right device properties | | 31 | * something sets up a usable graphics mode and sets the right device properties |
32 | * This driver should work with all NV1x hardware but so far it's been tested | | 32 | * This driver should work with all NV1x hardware but so far it's been tested |
33 | * only on NV11 / GeForce2 MX. Needs testing with more hardware and if | | 33 | * only on NV11 / GeForce2 MX. Needs testing with more hardware and if |
34 | * successful, PCI IDs need to be added to gffb_match() | | 34 | * successful, PCI IDs need to be added to gffb_match() |
35 | */ | | 35 | */ |
36 | | | 36 | |
37 | #include <sys/cdefs.h> | | 37 | #include <sys/cdefs.h> |
38 | __KERNEL_RCSID(0, "$NetBSD: gffb.c,v 1.19 2022/03/10 00:14:33 riastradh Exp $"); | | 38 | __KERNEL_RCSID(0, "$NetBSD: gffb.c,v 1.20 2022/03/10 18:13:31 andvar Exp $"); |
39 | | | 39 | |
40 | #include <sys/param.h> | | 40 | #include <sys/param.h> |
41 | #include <sys/systm.h> | | 41 | #include <sys/systm.h> |
42 | #include <sys/kernel.h> | | 42 | #include <sys/kernel.h> |
43 | #include <sys/device.h> | | 43 | #include <sys/device.h> |
44 | #include <sys/malloc.h> | | 44 | #include <sys/malloc.h> |
45 | #include <sys/lwp.h> | | 45 | #include <sys/lwp.h> |
46 | #include <sys/kauth.h> | | 46 | #include <sys/kauth.h> |
47 | #include <sys/atomic.h> | | 47 | #include <sys/atomic.h> |
48 | | | 48 | |
49 | #include <dev/pci/pcivar.h> | | 49 | #include <dev/pci/pcivar.h> |
50 | #include <dev/pci/pcireg.h> | | 50 | #include <dev/pci/pcireg.h> |
51 | #include <dev/pci/pcidevs.h> | | 51 | #include <dev/pci/pcidevs.h> |
| @@ -1125,27 +1125,27 @@ gffb_putchar(void *cookie, int row, int | | | @@ -1125,27 +1125,27 @@ gffb_putchar(void *cookie, int row, int |
1125 | y = ri->ri_yorigin + row * he; | | 1125 | y = ri->ri_yorigin + row * he; |
1126 | bg = ri->ri_devcmap[(attr >> 16) & 0xf]; | | 1126 | bg = ri->ri_devcmap[(attr >> 16) & 0xf]; |
1127 | | | 1127 | |
1128 | if (c == 0x20) { | | 1128 | if (c == 0x20) { |
1129 | gffb_rectfill(sc, x, y, wi, he, bg); | | 1129 | gffb_rectfill(sc, x, y, wi, he, bg); |
1130 | return; | | 1130 | return; |
1131 | } | | 1131 | } |
1132 | rv = glyphcache_try(&sc->sc_gc, c, x, y, attr); | | 1132 | rv = glyphcache_try(&sc->sc_gc, c, x, y, attr); |
1133 | if (rv == GC_OK) | | 1133 | if (rv == GC_OK) |
1134 | return; | | 1134 | return; |
1135 | | | 1135 | |
1136 | /* | | 1136 | /* |
1137 | * Use gffb_sync to wait for the engine to become idle before | | 1137 | * Use gffb_sync to wait for the engine to become idle before |
1138 | * we start scribbling into VRAM -- we woudn't want to stomp on | | 1138 | * we start scribbling into VRAM -- we wouldn't want to stomp on |
1139 | * a scroll in progress or a prior glyphcache_add that hasn't | | 1139 | * a scroll in progress or a prior glyphcache_add that hasn't |
1140 | * completed yet on the GPU. | | 1140 | * completed yet on the GPU. |
1141 | */ | | 1141 | */ |
1142 | mutex_enter(&sc->sc_lock); | | 1142 | mutex_enter(&sc->sc_lock); |
1143 | gffb_sync(sc); | | 1143 | gffb_sync(sc); |
1144 | sc->sc_putchar(cookie, row, col, c, attr); | | 1144 | sc->sc_putchar(cookie, row, col, c, attr); |
1145 | mutex_exit(&sc->sc_lock); | | 1145 | mutex_exit(&sc->sc_lock); |
1146 | | | 1146 | |
1147 | /* | | 1147 | /* |
1148 | * If glyphcache_try asked us to, cache the newly written | | 1148 | * If glyphcache_try asked us to, cache the newly written |
1149 | * character. This will issue a gffb_bitblt which will wait | | 1149 | * character. This will issue a gffb_bitblt which will wait |
1150 | * for our CPU writes to the framebuffer in VRAM to complete | | 1150 | * for our CPU writes to the framebuffer in VRAM to complete |
1151 | * before triggering GPU reads from the framebuffer in VRAM. | | 1151 | * before triggering GPU reads from the framebuffer in VRAM. |