Source-Changes-HG archive

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

[src/trunk]: src add driver for Permedia 3 based graphics devices



details:   https://anonhg.NetBSD.org/src/rev/ad8e13e9e761
branches:  trunk
changeset: 819161:ad8e13e9e761
user:      macallan <macallan%NetBSD.org@localhost>
date:      Sun Nov 20 16:55:18 2016 +0000

description:
add driver for Permedia 3 based graphics devices
from Naruaki Etomi, via PR 49518

diffstat:

 distrib/sets/lists/man/mi    |     5 +-
 share/man/man4/Makefile      |     4 +-
 share/man/man4/pm3fb.4       |    59 +
 sys/arch/alpha/conf/GENERIC  |     5 +-
 sys/arch/macppc/conf/GENERIC |     5 +-
 sys/dev/pci/pm3fb.c          |  1304 ++++++++++++++++++++++++++++++++++++++++++
 sys/dev/pci/pm3reg.h         |   309 +++++++++
 7 files changed, 1684 insertions(+), 7 deletions(-)

diffs (truncated from 1787 to 300 lines):

diff -r 1b5565d09f5f -r ad8e13e9e761 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Sun Nov 20 16:13:03 2016 +0000
+++ b/distrib/sets/lists/man/mi Sun Nov 20 16:55:18 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1538 2016/10/29 17:12:20 kamil Exp $
+# $NetBSD: mi,v 1.1539 2016/11/20 16:55:18 macallan Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1531,6 +1531,7 @@
 ./usr/share/man/cat4/piixpm.0                  man-sys-catman          .cat
 ./usr/share/man/cat4/pim.0                     man-sys-catman          .cat
 ./usr/share/man/cat4/plip.0                    man-sys-catman          .cat
+./usr/share/man/cat4/pm3fb.0                   man-sys-catman          .cat
 ./usr/share/man/cat4/pmax/asc.0                        man-sys-catman          .cat
 ./usr/share/man/cat4/pmax/autoconf.0           man-sys-catman          .cat
 ./usr/share/man/cat4/pmax/dc.0                 man-obsolete            obsolete
@@ -4578,6 +4579,7 @@
 ./usr/share/man/html4/piixpm.html              man-sys-htmlman         html
 ./usr/share/man/html4/pim.html                 man-sys-htmlman         html
 ./usr/share/man/html4/plip.html                        man-sys-htmlman         html
+./usr/share/man/html4/pm3fb.html               man-sys-htmlman         html
 ./usr/share/man/html4/pmax/asc.html            man-sys-htmlman         html
 ./usr/share/man/html4/pmax/autoconf.html       man-sys-htmlman         html
 ./usr/share/man/html4/pmax/ibus.html           man-sys-htmlman         html
@@ -7497,6 +7499,7 @@
 ./usr/share/man/man4/piixpm.4                  man-sys-man             .man
 ./usr/share/man/man4/pim.4                     man-sys-man             .man
 ./usr/share/man/man4/plip.4                    man-sys-man             .man
+./usr/share/man/man4/pm3fb.4                   man-sys-man             .man
 ./usr/share/man/man4/pmax/asc.4                        man-sys-man             .man
 ./usr/share/man/man4/pmax/autoconf.4           man-sys-man             .man
 ./usr/share/man/man4/pmax/dc.4                 man-obsolete            obsolete
diff -r 1b5565d09f5f -r ad8e13e9e761 share/man/man4/Makefile
--- a/share/man/man4/Makefile   Sun Nov 20 16:13:03 2016 +0000
+++ b/share/man/man4/Makefile   Sun Nov 20 16:55:18 2016 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.630 2016/10/02 22:44:30 jdolecek Exp $
+#      $NetBSD: Makefile,v 1.631 2016/11/20 16:55:18 macallan Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/18/93
 
 MAN=   aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -49,7 +49,7 @@
        oak.4 oosiop.4 opl.4 options.4 optiide.4 osiop.4 otus.4 \
        pad.4 pas.4 pcdisplay.4 pcf8563rtc.4 pciide.4 pckbc.4 pckbd.4 pcn.4 \
        pcppi.4 pcscp.4 pcweasel.4 pdcide.4 pdcsata.4 piixide.4 piixpcib.4 \
-       piixpm.4 pim.4 plip.4 pms.4 pmu.4 pnaphy.4 ppbus.4 ppp.4 pppoe.4 \
+       piixpm.4 pim.4 plip.4 pm3fb.4 pms.4 pmu.4 pnaphy.4 ppbus.4 ppp.4 pppoe.4 \
        pseye.4 ptcd.4 ptm.4 pty.4 puc.4 pud.4 puffs.4 pwdog.4 px.4 pxg.4 \
        qe.4 qec.4 qsphy.4 \
        raid.4 ral.4 ray.4 rcons.4 rdcphy.4 re.4 rgephy.4 rlphy.4 \
diff -r 1b5565d09f5f -r ad8e13e9e761 share/man/man4/pm3fb.4
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man4/pm3fb.4    Sun Nov 20 16:55:18 2016 +0000
@@ -0,0 +1,59 @@
+.\" Copyright (c) 2015 Naruaki Etomi
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd January 1, 2015
+.Dt PM3FB 4
+.Os
+.Sh NAME
+.Nm pm3fb
+.Nd 3Dlabs Permedia 3 / Oxygen VX1 / Proformance 3 framebuffer driver
+.Sh SYNOPSIS
+.Cd "pm3fb* at pci?"
+.Cd "wsdisplay* at pm3fb?"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the 3Dlabs Permedia 3 / Oxygen VX1 / Proformance 3 series of
+graphics cards and provides an interface for machine independent
+.Xr wscons 4
+driver.
+.Pp
+Currently
+.Nm
+does not support Anti-alias font rendering and OpenLDI video interface.
+However, it is capable of changing the resolution and uses DDC2 to
+pick an appropriate video mode.
+.Pp
+A 2D graphics engine is used to accelerate scrolling, rectangle fills
+and Bitmap font rendering.
+.Sh SEE ALSO
+.Xr pci 4 ,
+.Xr wscons 4 ,
+.Xr wsdisplay 4
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Naruaki Etomi .
diff -r 1b5565d09f5f -r ad8e13e9e761 sys/arch/alpha/conf/GENERIC
--- a/sys/arch/alpha/conf/GENERIC       Sun Nov 20 16:13:03 2016 +0000
+++ b/sys/arch/alpha/conf/GENERIC       Sun Nov 20 16:55:18 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.369 2016/10/15 09:57:51 flxd Exp $
+# $NetBSD: GENERIC,v 1.370 2016/11/20 16:55:18 macallan Exp $
 #
 # This machine description file is used to generate the default NetBSD
 # kernel.
@@ -19,7 +19,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-ident          "GENERIC-$Revision: 1.369 $"
+ident          "GENERIC-$Revision: 1.370 $"
 
 maxusers 32
 
@@ -363,6 +363,7 @@
 pcn*   at      pci? dev ? function ?           # AMD PCnet-PCI Ethernet
 pcscp* at      pci? dev ? function ?           # AMD Am53c974 PCscsi-PCI
 pm2fb* at      pci? dev ? function ?           # 3Dlabs Permedia 2 Graphics
+pm3fb* at      pci? dev ? function ?           # 3Dlabs Permedia 3 Graphics
 ppb*   at      pci? dev ? function ?           # PCI-PCI Bridges
 puc*   at      pci? dev ? function ?           # PCI "universal" comm. cards
 radeonfb* at   pci? dev ? function ?           # ATI/AMD Radeon Graphics
diff -r 1b5565d09f5f -r ad8e13e9e761 sys/arch/macppc/conf/GENERIC
--- a/sys/arch/macppc/conf/GENERIC      Sun Nov 20 16:13:03 2016 +0000
+++ b/sys/arch/macppc/conf/GENERIC      Sun Nov 20 16:55:18 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.322 2016/05/28 22:24:51 sevan Exp $
+# $NetBSD: GENERIC,v 1.323 2016/11/20 16:55:18 macallan Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.322 $"
+#ident                 "GENERIC-$Revision: 1.323 $"
 
 maxusers       32
 
@@ -291,6 +291,7 @@
 chipsfb*       at pci? function ?      # C&T 65550
 gffb*          at pci? function ?      # NVIDIA GeForce2 MX
 machfb*                at pci? function ?      # ATI Mach 64, Rage, Rage Pro
+pm3fb*         at pci? function ?      # 3Dlabs Permedia 3 Graphics
 tdvfb*         at pci? function ?      # 3Dfx Voodoo2
 r128fb*                at pci? function ?      # ATI Rage 128
 voodoofb*      at pci? function ?      # 3Dfx Voodoo3 
diff -r 1b5565d09f5f -r ad8e13e9e761 sys/dev/pci/pm3fb.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/pci/pm3fb.c       Sun Nov 20 16:55:18 2016 +0000
@@ -0,0 +1,1304 @@
+/*
+ * Copyright (c) 2015 Naruaki Etomi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * A console driver for Permedia 3 graphics controllers
+ * most of the following was adapted from the xf86-video-glint driver's
+ * pm3_accel.c, pm3_dac.c and pm2fb framebuffer console driver
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+#include <sys/lwp.h>
+#include <sys/kauth.h>
+#include <sys/atomic.h>
+
+#include <dev/videomode/videomode.h>
+
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcidevs.h>
+#include <dev/pci/pciio.h>
+#include <dev/pci/pm3reg.h>
+
+#include <dev/wscons/wsdisplayvar.h>
+#include <dev/wscons/wsconsio.h>
+#include <dev/wsfont/wsfont.h>
+#include <dev/rasops/rasops.h>
+#include <dev/wscons/wsdisplay_vconsvar.h>
+#include <dev/pci/wsdisplay_pci.h>
+
+#include <dev/i2c/i2cvar.h>
+#include <dev/i2c/i2c_bitbang.h>
+#include <dev/i2c/ddcvar.h>
+#include <dev/videomode/videomode.h>
+#include <dev/videomode/edidvar.h>
+#include <dev/videomode/edidreg.h>
+
+struct pm3fb_softc {
+       device_t sc_dev;
+
+       pci_chipset_tag_t sc_pc;
+       pcitag_t sc_pcitag;
+
+       bus_space_tag_t sc_memt;
+       bus_space_tag_t sc_iot;
+
+       bus_space_handle_t sc_regh;
+       bus_addr_t sc_fb, sc_reg;
+       bus_size_t sc_fbsize, sc_regsize;
+
+       int sc_width, sc_height, sc_depth, sc_stride;
+       int sc_locked;
+       struct vcons_screen sc_console_screen;
+       struct wsscreen_descr sc_defaultscreen_descr;
+       const struct wsscreen_descr *sc_screens[1];
+       struct wsscreen_list sc_screenlist;
+       struct vcons_data vd;
+       int sc_mode;
+       u_char sc_cmap_red[256];
+       u_char sc_cmap_green[256];
+       u_char sc_cmap_blue[256];
+       /* i2c stuff */
+       struct i2c_controller sc_i2c;
+       uint8_t sc_edid_data[128];
+       struct edid_info sc_ei;
+       const struct videomode *sc_videomode;
+};
+
+static int     pm3fb_match(device_t, cfdata_t, void *);
+static void    pm3fb_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(pm3fb, sizeof(struct pm3fb_softc),
+    pm3fb_match, pm3fb_attach, NULL, NULL);
+
+extern const u_char rasops_cmap[768];
+
+static int     pm3fb_ioctl(void *, void *, u_long, void *, int, struct lwp *);
+static paddr_t pm3fb_mmap(void *, void *, off_t, int);
+static void    pm3fb_init_screen(void *, struct vcons_screen *, int, long *);
+
+static int     pm3fb_putcmap(struct pm3fb_softc *, struct wsdisplay_cmap *);
+static int     pm3fb_getcmap(struct pm3fb_softc *, struct wsdisplay_cmap *);
+static void    pm3fb_init_palette(struct pm3fb_softc *);
+static int     pm3fb_putpalreg(struct pm3fb_softc *, uint8_t, uint8_t, uint8_t, uint8_t);
+
+static void    pm3fb_init(struct pm3fb_softc *);
+static inline void pm3fb_wait(struct pm3fb_softc *, int);
+static void    pm3fb_flush_engine(struct pm3fb_softc *);
+static void    pm3fb_rectfill(struct pm3fb_softc *, int, int, int, int, uint32_t);
+static void    pm3fb_bitblt(void *, int, int, int, int, int, int, int);
+
+static void    pm3fb_cursor(void *, int, int, int);
+static void    pm3fb_putchar(void *, int, int, u_int, long);
+static void    pm3fb_copycols(void *, int, int, int, int);
+static void    pm3fb_erasecols(void *, int, int, int, long);
+static void    pm3fb_copyrows(void *, int, int, int);
+static void    pm3fb_eraserows(void *, int, int, long);
+
+struct wsdisplay_accessops pm3fb_accessops = {
+       pm3fb_ioctl,
+       pm3fb_mmap,
+       NULL,    /* alloc_screen */
+       NULL,    /* free_screen */
+       NULL,    /* show_screen */
+       NULL,    /* load_font */



Home | Main Index | Thread Index | Old Index