Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Port rasops'fied smg(4) framebuffer driver for VS...
details: https://anonhg.NetBSD.org/src/rev/628d4f7bcfa9
branches: trunk
changeset: 373446:628d4f7bcfa9
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat Feb 11 05:59:39 2023 +0000
description:
Port rasops'fied smg(4) framebuffer driver for VS3100 from OpenBSD/vax.
This allows using more fonts other than 8x15 pixels on smg(4).
Tested on my VAXstation 3100/m30.
Note the bitorder of smg(4) VRAM is LSB first (i.e. LSBit is the
most left side pixel) and this requires more complicated changes
to bitmask ops in MI rasops(9) because several LE machines have
VRAMs whose MSBit is connected to the most left side pixel,
but for now I prepared smg(4) specific putchar and cursor ops
based on old luna68k omrasops.
diffstat:
sys/arch/vax/vsa/maskbits.h | 75 ++
sys/arch/vax/vsa/smg.c | 1281 +++++++++++++++++++++++++++---------------
sys/dev/ic/dc503reg.h | 100 +++
3 files changed, 1000 insertions(+), 456 deletions(-)
diffs (truncated from 1644 to 300 lines):
diff -r 93d1fd5f079a -r 628d4f7bcfa9 sys/arch/vax/vsa/maskbits.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/vax/vsa/maskbits.h Sat Feb 11 05:59:39 2023 +0000
@@ -0,0 +1,75 @@
+/* $NetBSD: maskbits.h,v 1.1 2023/02/11 05:59:39 tsutsui Exp $ */
+/* $OpenBSD: maskbits.h,v 1.1 2006/08/05 10:00:30 miod Exp $ */
+
+/*-
+ * Copyright (c) 1994
+ * The Regents of the University of California. 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.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ *
+ * @(#)maskbits.h 8.2 (Berkeley) 3/21/94
+ */
+
+/*
+ * Derived from X11R4
+ */
+
+#define FASTGETBITS(psrc,x,w,dst) \
+ __asm__ ("extzv %1,%2,%3,%0" \
+ : "=g" (dst) \
+ : "g" (x), "g" (w), "m" (*(char *)(psrc)))
+
+#define FASTPUTBITS(src, x, w, pdst) \
+ __asm__ ("insv %3,%1,%2,%0" \
+ : "=m" (*(char *)(pdst)) \
+ : "g" (x), "g" (w), "g" (src))
+
+#define RR_CLEAR 0x00
+#define RR_SET 0x01
+#define RR_COPY 0x02
+
+#define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \
+do { \
+ unsigned int _tmpdst; \
+ switch (rop) { \
+ case RR_CLEAR: \
+ _tmpdst = 0; \
+ break; \
+ case RR_SET: \
+ _tmpdst = ~0; \
+ break; \
+ default: \
+ FASTGETBITS(psrc, srcbit, width, _tmpdst); \
+ break; \
+ } \
+ FASTPUTBITS(_tmpdst, dstbit, width, pdst); \
+} while (0)
+
+#define getunalignedword(psrc, x, dst) \
+do { \
+ int _tmp; \
+ FASTGETBITS(psrc, x, 32, _tmp); \
+ dst = _tmp; \
+} while (0)
diff -r 93d1fd5f079a -r 628d4f7bcfa9 sys/arch/vax/vsa/smg.c
--- a/sys/arch/vax/vsa/smg.c Sat Feb 11 04:16:57 2023 +0000
+++ b/sys/arch/vax/vsa/smg.c Sat Feb 11 05:59:39 2023 +0000
@@ -1,4 +1,57 @@
-/* $NetBSD: smg.c,v 1.63 2023/02/06 13:13:05 tsutsui Exp $ */
+/* $NetBSD: smg.c,v 1.64 2023/02/11 05:59:39 tsutsui Exp $ */
+/* $OpenBSD: smg.c,v 1.28 2014/12/23 21:39:12 miod Exp $ */
+/*
+ * Copyright (c) 2006, Miodrag Vallat
+ *
+ * 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.
+ */
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Tohru Nishimura.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
/*
* Copyright (c) 1998 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -23,178 +76,157 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/*
+ * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
+ * Copyright (c) 1991 University of Utah.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department and Mark Davies of the Department of Computer
+ * Science, Victoria University of Wellington, New Zealand.
+ *
+ * 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.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ *
+ * from: Utah $Hdr: grf_hy.c 1.2 93/08/13$
+ *
+ * @(#)grf_hy.c 8.4 (Berkeley) 1/12/94
+ */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.63 2023/02/06 13:13:05 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.64 2023/02/11 05:59:39 tsutsui Exp $");
-#include "opt_wsfont.h"
#include "dzkbd.h"
#include "wsdisplay.h"
#include <sys/param.h>
+#include <sys/device.h>
#include <sys/systm.h>
-#include <sys/callout.h>
+#include <sys/kmem.h>
#include <sys/conf.h>
-#include <sys/cpu.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/kmem.h>
-#include <sys/time.h>
#include <machine/vsbus.h>
#include <machine/sid.h>
+#include <machine/cpu.h>
#include <machine/ka420.h>
#include <machine/scb.h>
#include <dev/cons.h>
+#include <dev/ic/dc503reg.h>
+
#include <dev/dec/dzreg.h>
#include <dev/dec/dzvar.h>
#include <dev/dec/dzkbdvar.h>
+#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wscons_callbacks.h>
-#include <dev/wsfont/wsfont.h>
+#include <dev/rasops/rasops.h>
/* Screen hardware defs */
-#define SM_COLS 128 /* char width of screen */
-#define SM_ROWS 57 /* rows of char on screen */
-#define SM_CHEIGHT 15 /* lines a char consists of */
-#define SM_NEXTROW (SM_COLS * SM_CHEIGHT)
-#define SM_YWIDTH 864
#define SM_XWIDTH 1024
-
-/* Cursor register definitions */
-#define CUR_CMD 0
-#define CUR_XPOS 4
-#define CUR_YPOS 8
-#define CUR_XMIN_1 12
-#define CUR_XMAX_1 16
-#define CUR_YMIN_1 20
-#define CUR_YMAX_1 24
-#define CUR_XMIN_2 28
-#define CUR_XMAX_2 32
-#define CUR_YMIN_2 36
-#define CUR_YMAX_2 40
-#define CUR_LOAD 44
-
-#define CUR_CMD_TEST 0x8000
-#define CUR_CMD_HSHI 0x4000
-#define CUR_CMD_VBHI 0x2000
-#define CUR_CMD_LODSA 0x1000
-#define CUR_CMD_FORG2 0x0800
-#define CUR_CMD_ENRG2 0x0400
-#define CUR_CMD_FORG1 0x0200
-#define CUR_CMD_ENRG1 0x0100
-#define CUR_CMD_XHWID 0x0080
-#define CUR_CMD_XHCL1 0x0040
-#define CUR_CMD_XHCLP 0x0020
-#define CUR_CMD_XHAIR 0x0010
-#define CUR_CMD_FOPB 0x0008
-#define CUR_CMD_ENPB 0x0004
-#define CUR_CMD_FOPA 0x0002
-#define CUR_CMD_ENPA 0x0001
+#define SM_YWIDTH 864
#define CUR_XBIAS 216 /* Add to cursor position */
-#define CUR_YBIAS 33
+#define CUR_YBIAS 33
+
+static int smg_match(device_t, cfdata_t, void *);
+static void smg_attach(device_t, device_t, void *);
-#define WRITECUR(addr, val) *(volatile uint16_t *)(curaddr + (addr)) = (val)
-static char *curaddr;
-static uint16_t curcmd, curx, cury, hotX, hotY;
-static int bgmask, fgmask;
+struct smg_screen {
+ struct rasops_info ss_ri;
+ uint8_t *ss_addr; /* frame buffer address */
+ struct dc503reg *ss_cursor; /* cursor registers */
+ uint16_t ss_curcmd;
+ struct wsdisplay_curpos ss_curpos, ss_curhot;
+ uint16_t ss_curimg[PCC_CURSOR_SIZE];
+ uint16_t ss_curmask[PCC_CURSOR_SIZE];
+};
-static int smg_match(device_t, cfdata_t, void *);
-static void smg_attach(device_t, device_t, void *);
+/* for console */
+static struct smg_screen smg_consscr;
-CFATTACH_DECL_NEW(smg, 0,
+struct smg_softc {
+ device_t sc_dev;
+ struct smg_screen *sc_scr;
+ int sc_nscreens;
+};
+
+CFATTACH_DECL_NEW(smg, sizeof(struct smg_softc),
Home |
Main Index |
Thread Index |
Old Index