CVS commit: src/sys/arch/usermode/dev

2011-12-21 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Dec 21 10:02:45 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: ttycons.c

Log Message:
Increase printing buffer of ttycons from 80 to 1024 significantly increasing
console output on large dumps.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/usermode/dev/ttycons.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/usermode/dev/ttycons.c
diff -u src/sys/arch/usermode/dev/ttycons.c:1.13 src/sys/arch/usermode/dev/ttycons.c:1.14
--- src/sys/arch/usermode/dev/ttycons.c:1.13	Tue Dec 20 21:35:16 2011
+++ src/sys/arch/usermode/dev/ttycons.c	Wed Dec 21 10:02:45 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ttycons.c,v 1.13 2011/12/20 21:35:16 jmcneill Exp $ */
+/* $NetBSD: ttycons.c,v 1.14 2011/12/21 10:02:45 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ttycons.c,v 1.13 2011/12/20 21:35:16 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: ttycons.c,v 1.14 2011/12/21 10:02:45 reinoud Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -301,7 +301,7 @@ ttycons_ioctl(dev_t dev, u_long cmd, voi
 static void
 ttycons_start(struct tty *t)
 {
-	u_char buf[80+1];
+	u_char buf[1024+1];
 	u_char *p = buf;
 	int s, len, brem;
 



CVS commit: src/sys/arch/usermode/dev

2011-12-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Dec 21 11:53:07 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: ttycons.c

Log Message:
move the (now 1024 byte) printing buffer off the stack


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/usermode/dev/ttycons.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/usermode/dev/ttycons.c
diff -u src/sys/arch/usermode/dev/ttycons.c:1.14 src/sys/arch/usermode/dev/ttycons.c:1.15
--- src/sys/arch/usermode/dev/ttycons.c:1.14	Wed Dec 21 10:02:45 2011
+++ src/sys/arch/usermode/dev/ttycons.c	Wed Dec 21 11:53:07 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ttycons.c,v 1.14 2011/12/21 10:02:45 reinoud Exp $ */
+/* $NetBSD: ttycons.c,v 1.15 2011/12/21 11:53:07 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ttycons.c,v 1.14 2011/12/21 10:02:45 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: ttycons.c,v 1.15 2011/12/21 11:53:07 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -53,6 +53,7 @@ struct ttycons_softc {
 	struct tty	*sc_tty;
 	void		*sc_rd_sih;
 	void		*sc_ctrlc_sih;
+	u_char		sc_buf[1024];
 };
 
 dev_type_cngetc(ttycons_cngetc);
@@ -129,6 +130,7 @@ ttycons_attach(device_t parent, device_t
 	tty_attach(sc-sc_tty);
 	sc-sc_tty-t_oproc = ttycons_start;
 	sc-sc_tty-t_param = ttycons_param;
+	sc-sc_tty-t_sc = sc;
 
 	maj = cdevsw_lookup_major(ttycons_cdevsw);
 	cn_tab-cn_dev = makedev(maj, device_unit(self));
@@ -301,8 +303,8 @@ ttycons_ioctl(dev_t dev, u_long cmd, voi
 static void
 ttycons_start(struct tty *t)
 {
-	u_char buf[1024+1];
-	u_char *p = buf;
+	struct ttycons_softc *sc = t-t_sc;
+	u_char *p = sc-sc_buf;
 	int s, len, brem;
 
 	s = spltty();
@@ -313,7 +315,7 @@ ttycons_start(struct tty *t)
 	t-t_state |= TS_BUSY;
 	splx(s);
 
-	brem = q_to_b(t-t_outq, buf, sizeof(buf) - 1);
+	brem = q_to_b(t-t_outq, sc-sc_buf, sizeof(sc-sc_buf));
 
 	while (brem  0) {
 		len = thunk_write(1, p, brem);



CVS commit: src/etc

2011-12-21 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Dec 21 14:33:13 UTC 2011

Modified Files:
src/etc/etc.amd64: boot.cfg
src/etc/etc.i386: boot.cfg

Log Message:
bootmenu doesn't parse prompt as part of a command list, it must
stand alone.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/etc/etc.amd64/boot.cfg
cvs rdiff -u -r1.3 -r1.4 src/etc/etc.i386/boot.cfg

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/etc.amd64/boot.cfg
diff -u src/etc/etc.amd64/boot.cfg:1.3 src/etc/etc.amd64/boot.cfg:1.4
--- src/etc/etc.amd64/boot.cfg:1.3	Fri Dec  9 06:50:36 2011
+++ src/etc/etc.amd64/boot.cfg	Wed Dec 21 14:33:13 2011
@@ -2,7 +2,7 @@ menu=Boot normally:rndseed /var/db/entro
 menu=Boot single user:rndseed /var/db/entropy-file;boot netbsd -s
 menu=Disable ACPI:rndseed /var/db/entropy-file;boot netbsd -2
 menu=Disable ACPI and SMP:rndseed /var/db/entropy-file;boot netbsd -12
-menu=Drop to boot prompt:rndseed /var/db/entropy-file;prompt
+menu=Drop to boot prompt:prompt
 default=1
 timeout=5
 clear=1

Index: src/etc/etc.i386/boot.cfg
diff -u src/etc/etc.i386/boot.cfg:1.3 src/etc/etc.i386/boot.cfg:1.4
--- src/etc/etc.i386/boot.cfg:1.3	Fri Dec  9 06:50:36 2011
+++ src/etc/etc.i386/boot.cfg	Wed Dec 21 14:33:13 2011
@@ -2,7 +2,7 @@ menu=Boot normally:rndseed /var/db/entro
 menu=Boot single user:rndseed /var/db/entropy-file;boot netbsd -s
 menu=Disable ACPI:rndseed /var/db/entropy-file;boot netbsd -2
 menu=Disable ACPI and SMP:rndseed /var/db/entropy-file;boot netbsd -12
-menu=Drop to boot prompt:rndseed /var/db/entropy-file;prompt
+menu=Drop to boot prompt:prompt
 default=1
 timeout=5
 clear=1



CVS commit: src/sys/kern

2011-12-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 21 15:26:57 UTC 2011

Modified Files:
src/sys/kern: uipc_syscalls.c

Log Message:
simplify expression


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/kern/uipc_syscalls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/uipc_syscalls.c
diff -u src/sys/kern/uipc_syscalls.c:1.149 src/sys/kern/uipc_syscalls.c:1.150
--- src/sys/kern/uipc_syscalls.c:1.149	Tue Dec 20 18:56:28 2011
+++ src/sys/kern/uipc_syscalls.c	Wed Dec 21 10:26:57 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_syscalls.c,v 1.149 2011/12/20 23:56:28 christos Exp $	*/
+/*	$NetBSD: uipc_syscalls.c,v 1.150 2011/12/21 15:26:57 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uipc_syscalls.c,v 1.149 2011/12/20 23:56:28 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: uipc_syscalls.c,v 1.150 2011/12/21 15:26:57 christos Exp $);
 
 #include opt_pipe.h
 
@@ -367,7 +367,8 @@ do_sys_connect(struct lwp *l, int fd, st
 	error = soconnect(so, nam, l);
 	if (error)
 		goto bad;
-	if ((so-so_state  SS_NBIO)  (so-so_state  SS_ISCONNECTING) != 0) {
+	if ((so-so_state  (SS_NBIO|SS_ISCONNECTING)) ==
+	(SS_NBIO|SS_ISCONNECTING)) {
 		error = EINPROGRESS;
 		goto out;
 	}



CVS commit: src/sys/miscfs/fifofs

2011-12-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 21 15:27:50 UTC 2011

Modified Files:
src/sys/miscfs/fifofs: fifo_vnops.c

Log Message:
only set CANTRCVMORE if no error.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/miscfs/fifofs/fifo_vnops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/miscfs/fifofs/fifo_vnops.c
diff -u src/sys/miscfs/fifofs/fifo_vnops.c:1.71 src/sys/miscfs/fifofs/fifo_vnops.c:1.72
--- src/sys/miscfs/fifofs/fifo_vnops.c:1.71	Tue Dec 20 18:56:29 2011
+++ src/sys/miscfs/fifofs/fifo_vnops.c	Wed Dec 21 10:27:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fifo_vnops.c,v 1.71 2011/12/20 23:56:29 christos Exp $	*/
+/*	$NetBSD: fifo_vnops.c,v 1.72 2011/12/21 15:27:50 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fifo_vnops.c,v 1.71 2011/12/20 23:56:29 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: fifo_vnops.c,v 1.72 2011/12/21 15:27:50 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -261,7 +261,7 @@ fifo_read(void *v)
 	/*
 	 * Clear EOF indication after first such return.
 	 */
-	if (error != EINTR  uio-uio_resid == startresid)
+	if (error == 0  uio-uio_resid == startresid)
 		rso-so_state = ~SS_CANTRCVMORE;
 	if (ap-a_ioflag  IO_NDELAY) {
 		if (error == EWOULDBLOCK 



CVS commit: src/external/bsd/libpcap

2011-12-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 21 19:00:28 UTC 2011

Modified Files:
src/external/bsd/libpcap/dist: gencode.c
src/external/bsd/libpcap/dist/pcap: bpf.h pcap.h
src/external/bsd/libpcap/lib: Makefile

Log Message:
Don't use libpcap's bpf file, but use our own:
1. include net/dlt.h where needed since we have the information in a separate
   file.
2. #error in pcap/bpf.h to make sure it is not being used.
3. If we don't include pcap/bpf.h include net/bpf.h instead.
4. Install symlinks instead of copies of files.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libpcap/dist/gencode.c
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libpcap/dist/pcap/bpf.h
cvs rdiff -u -r1.1.1.2 -r1.2 src/external/bsd/libpcap/dist/pcap/pcap.h
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/libpcap/lib/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libpcap/dist/gencode.c
diff -u src/external/bsd/libpcap/dist/gencode.c:1.3 src/external/bsd/libpcap/dist/gencode.c:1.4
--- src/external/bsd/libpcap/dist/gencode.c:1.3	Fri Sep 16 12:09:25 2011
+++ src/external/bsd/libpcap/dist/gencode.c	Wed Dec 21 14:00:27 2011
@@ -54,6 +54,7 @@ static const char rcsid[] _U_ =
 
 #ifdef __NetBSD__
 #include sys/param.h
+#include net/dlt.h
 #endif
 
 #include netinet/in.h

Index: src/external/bsd/libpcap/dist/pcap/bpf.h
diff -u src/external/bsd/libpcap/dist/pcap/bpf.h:1.2 src/external/bsd/libpcap/dist/pcap/bpf.h:1.3
--- src/external/bsd/libpcap/dist/pcap/bpf.h:1.2	Sat Dec  4 20:45:46 2010
+++ src/external/bsd/libpcap/dist/pcap/bpf.h	Wed Dec 21 14:00:28 2011
@@ -39,7 +39,7 @@
  *
  * @(#) Header: /tcpdump/master/libpcap/pcap/bpf.h,v 1.32 2008-12-23 20:13:29 guy Exp (LBL)
  */
-
+#error This is not used in NetBSD, we use net/bpf.h
 /*
  * This is libpcap's cut-down version of bpf.h; it includes only
  * the stuff needed for the code generator and the userland BPF

Index: src/external/bsd/libpcap/dist/pcap/pcap.h
diff -u src/external/bsd/libpcap/dist/pcap/pcap.h:1.1.1.2 src/external/bsd/libpcap/dist/pcap/pcap.h:1.2
--- src/external/bsd/libpcap/dist/pcap/pcap.h:1.1.1.2	Sat Dec  4 20:27:29 2010
+++ src/external/bsd/libpcap/dist/pcap/pcap.h	Wed Dec 21 14:00:28 2011
@@ -49,6 +49,8 @@
 
 #ifndef PCAP_DONT_INCLUDE_PCAP_BPF_H
 #include pcap/bpf.h
+#else
+#include net/bpf.h
 #endif
 
 #include stdio.h

Index: src/external/bsd/libpcap/lib/Makefile
diff -u src/external/bsd/libpcap/lib/Makefile:1.7 src/external/bsd/libpcap/lib/Makefile:1.8
--- src/external/bsd/libpcap/lib/Makefile:1.7	Thu Oct 13 13:23:28 2011
+++ src/external/bsd/libpcap/lib/Makefile	Wed Dec 21 14:00:28 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.7 2011/10/13 17:23:28 plunky Exp $	
+# $NetBSD: Makefile,v 1.8 2011/12/21 19:00:28 christos Exp $	
 
 .include bsd.own.mk
 
@@ -7,6 +7,8 @@ USE_FORT?= yes	# network protocol librar
 CWARNFLAGS.clang+=	-Wno-format-extra-args \
 			-Wno-unneeded-internal-declaration
 
+CPPFLAGS+= -DPCAP_DONT_INCLUDE_PCAP_BPF_H
+
 .SUFFIXES: .3 .3pcap
 
 __sed: .USE
@@ -86,8 +88,11 @@ SRCS=	scanner.l savefile.c pcap.c pcap-b
 .PATH:	${NETBSDSRCDIR}/sys/net
 SRCS+=	bpf_filter.c
 
-INCS=		pcap-namedb.h pcap.h pcap/pcap.h pcap/namedb.h pcap/bpf.h
+INCS=		pcap/pcap.h pcap/namedb.h
 INCSDIR=	/usr/include
+INCSYMLINKS+=   ../net/bpf.h ${INCSDIR}/pcap/bpf.h
+INCSYMLINKS+=	pcap/pcap.h ${INCSDIR}/pcap.h
+INCSYMLINKS+=	pcap/namedb.h ${INCSDIR}/pcap-namedb.h
 
 scanner.d scanner.o: tokdefs.h
 



CVS commit: src/sys/net

2011-12-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 21 19:04:19 UTC 2011

Modified Files:
src/sys/net: dlt.h

Log Message:
PR/45730: David Holland: Avoid having 2 copies of bpf.h in /usr/include.
This adds the missing entries from libpcap to make libpcap compile with
our bpf.h.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/net/dlt.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/dlt.h
diff -u src/sys/net/dlt.h:1.11 src/sys/net/dlt.h:1.12
--- src/sys/net/dlt.h:1.11	Mon Feb 27 09:22:26 2006
+++ src/sys/net/dlt.h	Wed Dec 21 14:04:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: dlt.h,v 1.11 2006/02/27 14:22:26 drochner Exp $	*/
+/*	$NetBSD: dlt.h,v 1.12 2011/12/21 19:04:18 christos Exp $	*/
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -144,6 +144,372 @@
 #define DLT_LINUX_LAPD		177	/* Raw LAPD for vISDN */
 
 /*
+ * Juniper-private data link type, as per request from
+ * Hannes Gredler han...@juniper.net. 
+ * The DLT_ are used for prepending meta-information
+ * like interface index, interface name
+ * before standard Ethernet, PPP, Frelay  C-HDLC Frames
+ */
+#define DLT_JUNIPER_ETHER   178
+#define DLT_JUNIPER_PPP 179
+#define DLT_JUNIPER_FRELAY  180
+#define DLT_JUNIPER_CHDLC   181
+
+/*
+ * Multi Link Frame Relay (FRF.16)
+ */
+#define DLT_MFR 182
+
+/*
+ * Juniper-private data link type, as per request from
+ * Hannes Gredler han...@juniper.net. 
+ * The DLT_ is used for internal communication with a
+ * voice Adapter Card (PIC)
+ */
+#define DLT_JUNIPER_VP  183
+
+/*
+ * Arinc 429 frames.
+ * DLT_ requested by Gianluca Varenni gianluca.vare...@cacetech.com.
+ * Every frame contains a 32bit A429 label.
+ * More documentation on Arinc 429 can be found at
+ * http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf
+ */
+#define DLT_A429184
+
+/*
+ * Arinc 653 Interpartition Communication messages.
+ * DLT_ requested by Gianluca Varenni gianluca.vare...@cacetech.com.
+ * Please refer to the A653-1 standard for more information.
+ */
+#define DLT_A653_ICM185
+
+/*
+ * USB packets, beginning with a USB setup header; requested by
+ * Paolo Abeni paolo.ab...@email.it.
+ */
+#define DLT_USB			186
+
+/*
+ * Bluetooth HCI UART transport layer (part H:4); requested by
+ * Paolo Abeni.
+ */
+#define DLT_BLUETOOTH_HCI_H4	187
+
+/*
+ * IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz
+ * cruz_peta...@bah.com.
+ */
+#define DLT_IEEE802_16_MAC_CPS	188
+
+/*
+ * USB packets, beginning with a Linux USB header; requested by
+ * Paolo Abeni paolo.ab...@email.it.
+ */
+#define DLT_USB_LINUX		189
+
+/*
+ * Controller Area Network (CAN) v. 2.0B packets.
+ * DLT_ requested by Gianluca Varenni gianluca.vare...@cacetech.com.
+ * Used to dump CAN packets coming from a CAN Vector board.
+ * More documentation on the CAN v2.0B frames can be found at
+ * http://www.can-cia.org/downloads/?269
+ */
+#define DLT_CAN20B  190
+
+/*
+ * IEEE 802.15.4, with address fields padded, as is done by Linux
+ * drivers; requested by Juergen Schimmer.
+ */
+#define DLT_IEEE802_15_4_LINUX	191
+
+/*
+ * Per Packet Information encapsulated packets.
+ * DLT_ requested by Gianluca Varenni gianluca.vare...@cacetech.com.
+ */
+#define DLT_PPI			192
+
+/*
+ * Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header;
+ * requested by Charles Clancy.
+ */
+#define DLT_IEEE802_16_MAC_CPS_RADIO	193
+
+/*
+ * Juniper-private data link type, as per request from
+ * Hannes Gredler han...@juniper.net. 
+ * The DLT_ is used for internal communication with a
+ * integrated service module (ISM).
+ */
+#define DLT_JUNIPER_ISM 194
+
+/*
+ * IEEE 802.15.4, exactly as it appears in the spec (no padding, no
+ * nothing); requested by Mikko Saarnivala mikko.saarniv...@sensinode.com.
+ */
+#define DLT_IEEE802_15_4	195
+
+/*
+ * Various link-layer types, with a pseudo-header, for SITA
+ * (http://www.sita.aero/); requested by Fulko Hew (fulko@gmail.com).
+ */
+#define DLT_SITA		196
+
+/*
+ * Various link-layer types, with a pseudo-header, for Endace DAG cards;
+ * encapsulates Endace ERF records.  Requested by Stephen Donnelly
+ * step...@endace.com.
+ */
+#define DLT_ERF			197
+
+/*
+ * Special header prepended to Ethernet packets when capturing from a
+ * u10 Networks board.  Requested by Phil Mulholland
+ * p...@u10networks.com.
+ */
+#define DLT_RAIF1		198
+
+/*
+ * IPMB packet for IPMI, beginning with the I2C slave address, followed
+ * by the netFn and LUN, etc..  Requested by Chanthy Toeung
+ * chanthy.toe...@ca.kontron.com.
+ */
+#define DLT_IPMB		199
+
+/*
+ * Juniper-private data link type, as per request from
+ * Hannes Gredler han...@juniper.net. 
+ * The DLT_ is used for capturing data on a secure tunnel interface.
+ */
+#define DLT_JUNIPER_ST  200
+
+/*
+ * Bluetooth HCI UART 

CVS commit: src/sys/sys

2011-12-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 21 19:27:47 UTC 2011

Modified Files:
src/sys/sys: socketvar.h

Log Message:
don't change the layout of the struct, it is used by fstat. (from yamt)


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/sys/socketvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/sys/socketvar.h
diff -u src/sys/sys/socketvar.h:1.127 src/sys/sys/socketvar.h:1.128
--- src/sys/sys/socketvar.h:1.127	Tue Dec 20 18:56:29 2011
+++ src/sys/sys/socketvar.h	Wed Dec 21 14:27:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: socketvar.h,v 1.127 2011/12/20 23:56:29 christos Exp $	*/
+/*	$NetBSD: socketvar.h,v 1.128 2011/12/21 19:27:47 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -128,6 +128,7 @@ struct socket {
 	short		so_options;	/* from socket call, see socket.h */
 	u_short		so_linger;	/* time to linger while closing */
 	short		so_state;	/* internal state flags SS_*, below */
+	int		so_unused;	/* used to be so_nbio */
 	void		*so_pcb;	/* protocol control block */
 	const struct protosw *so_proto;	/* protocol handle */
 /*



CVS commit: src/sys/dev

2011-12-21 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Dec 22 02:00:19 UTC 2011

Modified Files:
src/sys/dev: kttcp.c

Log Message:
Fix up changes commited in kttcp.c 1.29.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/kttcp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/kttcp.c
diff -u src/sys/dev/kttcp.c:1.29 src/sys/dev/kttcp.c:1.30
--- src/sys/dev/kttcp.c:1.29	Tue Dec 20 23:56:28 2011
+++ src/sys/dev/kttcp.c	Thu Dec 22 02:00:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kttcp.c,v 1.29 2011/12/20 23:56:28 christos Exp $	*/
+/*	$NetBSD: kttcp.c,v 1.30 2011/12/22 02:00:19 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kttcp.c,v 1.29 2011/12/20 23:56:28 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: kttcp.c,v 1.30 2011/12/22 02:00:19 jakllsch Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -427,7 +427,8 @@ kttcp_soreceive(struct socket *so, unsig
 		}
 		if (resid == 0)
 			goto release;
-		if ((so-so_so_state  SS_NBIO) || (flags  MSG_DONTWAIT|MSG_NBIO)) {
+		if ((so-so_state  SS_NBIO) ||
+		(flags  (MSG_DONTWAIT|MSG_NBIO))) {
 			error = EWOULDBLOCK;
 			goto release;
 		}



CVS commit: src/sys/dev/usb

2011-12-21 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Dec 22 02:13:08 UTC 2011

Modified Files:
src/sys/dev/usb: uslsa.c

Log Message:
Transfer some static from my winter coat to more structures/functions
in this file.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/usb/uslsa.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/uslsa.c
diff -u src/sys/dev/usb/uslsa.c:1.13 src/sys/dev/usb/uslsa.c:1.14
--- src/sys/dev/usb/uslsa.c:1.13	Tue Dec  6 19:05:43 2011
+++ src/sys/dev/usb/uslsa.c	Thu Dec 22 02:13:08 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: uslsa.c,v 1.13 2011/12/06 19:05:43 jakllsch Exp $ */
+/* $NetBSD: uslsa.c,v 1.14 2011/12/22 02:13:08 jakllsch Exp $ */
 
 /* from ugensa.c */
 
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uslsa.c,v 1.13 2011/12/06 19:05:43 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: uslsa.c,v 1.14 2011/12/22 02:13:08 jakllsch Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -170,7 +170,7 @@ static void uslsa_close(void *, int);
 static int uslsa_request_set(struct uslsa_softc *, uint8_t, uint16_t);
 static void uslsa_set_flow(struct uslsa_softc *, tcflag_t, tcflag_t);
 
-struct ucom_methods uslsa_methods = {
+static const struct ucom_methods uslsa_methods = {
 	uslsa_get_status,
 	uslsa_set,
 	uslsa_param,
@@ -206,16 +206,16 @@ static const struct usb_devno uslsa_devs
 };
 #define uslsa_lookup(v, p) usb_lookup(uslsa_devs, v, p)
 
-int uslsa_match(device_t, cfdata_t, void *);
-void uslsa_attach(device_t, device_t, void *);
-void uslsa_childdet(device_t, device_t);
-int uslsa_detach(device_t, int);
-int uslsa_activate(device_t, enum devact);
-extern struct cfdriver uslsa_cd;
+static int uslsa_match(device_t, cfdata_t, void *);
+static void uslsa_attach(device_t, device_t, void *);
+static void uslsa_childdet(device_t, device_t);
+static int uslsa_detach(device_t, int);
+static int uslsa_activate(device_t, enum devact);
+
 CFATTACH_DECL2_NEW(uslsa, sizeof(struct uslsa_softc), uslsa_match,
 uslsa_attach, uslsa_detach, uslsa_activate, NULL, uslsa_childdet);
 
-int 
+static int 
 uslsa_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct usb_attach_arg *uaa = aux;
@@ -224,7 +224,7 @@ uslsa_match(device_t parent, cfdata_t ma
 	UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
 }
 
-void 
+static void 
 uslsa_attach(device_t parent, device_t self, void *aux)
 {
 	struct uslsa_softc *sc = device_private(self);
@@ -325,7 +325,7 @@ bad:
 	return;
 }
 
-int
+static int
 uslsa_activate(device_t self, enum devact act)
 {
 	struct uslsa_softc *sc = device_private(self);
@@ -339,7 +339,7 @@ uslsa_activate(device_t self, enum devac
 	}
 }
 
-void
+static void
 uslsa_childdet(device_t self, device_t child)
 {
 	struct uslsa_softc *sc = device_private(self);
@@ -348,7 +348,7 @@ uslsa_childdet(device_t self, device_t c
 	sc-sc_subdev = NULL;
 }
 
-int 
+static int 
 uslsa_detach(device_t self, int flags)
 {
 	struct uslsa_softc *sc = device_private(self);
@@ -534,7 +534,7 @@ uslsa_open(void *vsc, int portno)
 	return 0;
 }
 
-void
+static void
 uslsa_close(void *vsc, int portno)
 {
 	struct uslsa_softc *sc;



CVS commit: src/sys/dev/rasops

2011-12-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Dec 22 04:52:45 UTC 2011

Modified Files:
src/sys/dev/rasops: rasops.c rasops.h rasops32.c

Log Message:
support anti-aliased fonts ( as in, pre-rendered alpha maps ), for now only
in rasops32 although adding support in 15, 16 and 24 would be trivial.
Enabled only if the driver explicitly requests it by setting the
RI_ENABLE_ALPHA flag.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/rasops/rasops.h
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/rasops/rasops32.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.66 src/sys/dev/rasops/rasops.c:1.67
--- src/sys/dev/rasops/rasops.c:1.66	Wed Jul 21 12:12:58 2010
+++ src/sys/dev/rasops/rasops.c	Thu Dec 22 04:52:45 2011
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.66 2010/07/21 12:12:58 tsutsui Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.67 2011/12/22 04:52:45 macallan Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rasops.c,v 1.66 2010/07/21 12:12:58 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: rasops.c,v 1.67 2011/12/22 04:52:45 macallan Exp $);
 
 #include opt_rasops.h
 #include rasops_glue.h
@@ -162,6 +162,7 @@ struct rotatedfont {
 void	rasops_make_box_chars_8(struct rasops_info *);
 void	rasops_make_box_chars_16(struct rasops_info *);
 void	rasops_make_box_chars_32(struct rasops_info *);
+void	rasops_make_box_chars_alpha(struct rasops_info *);
 
 extern int cold;
 
@@ -176,13 +177,20 @@ rasops_init(struct rasops_info *ri, int 
 #ifdef _KERNEL
 	/* Select a font if the caller doesn't care */
 	if (ri-ri_font == NULL) {
-		int cookie;
+		int cookie = -1;
 
 		wsfont_init();
 
-		/* Want 8 pixel wide, don't care about aesthetics */
-		cookie = wsfont_find(NULL, 8, 0, 0, WSDISPLAY_FONTORDER_L2R,
-		WSDISPLAY_FONTORDER_L2R);
+		if (ri-ri_flg  RI_ENABLE_ALPHA) {
+			/* try finding an AA font first */
+			cookie = wsfont_find_aa(NULL, 0, 0, 0, WSDISPLAY_FONTORDER_L2R,
+			WSDISPLAY_FONTORDER_L2R);
+		}
+		if (cookie == -1) {
+			/* Want 8 pixel wide, don't care about aesthetics */
+			cookie = wsfont_find(NULL, 8, 0, 0, WSDISPLAY_FONTORDER_L2R,
+			WSDISPLAY_FONTORDER_L2R);
+		}
 		if (cookie = 0)
 			cookie = wsfont_find(NULL, 0, 0, 0,
 			WSDISPLAY_FONTORDER_L2R, WSDISPLAY_FONTORDER_L2R);
@@ -263,17 +271,20 @@ rasops_reconfig(struct rasops_info *ri, 
 	if (((ri-ri_flg  RI_NO_AUTO) == 0)  
 	  ((ri-ri_optfont.data = kmem_zalloc(len, KM_SLEEP)) != NULL)) {
 
-	
-		switch (ri-ri_optfont.stride) {
-		case 1:
-			rasops_make_box_chars_8(ri);
-			break;
-		case 2:
-			rasops_make_box_chars_16(ri);
-			break;
-		case 4:
-			rasops_make_box_chars_32(ri);
-			break;
+		if (ri-ri_optfont.stride  ri-ri_optfont.fontwidth) {
+			switch (ri-ri_optfont.stride) {
+			case 1:
+rasops_make_box_chars_8(ri);
+break;
+			case 2:
+rasops_make_box_chars_16(ri);
+break;
+			case 4:
+rasops_make_box_chars_32(ri);
+break;
+			}
+		} else {
+			rasops_make_box_chars_alpha(ri);
 		}
 	} else
 		memset(ri-ri_optfont, 0, sizeof(ri-ri_optfont));
@@ -1622,3 +1633,54 @@ rasops_make_box_chars_32(struct rasops_i
 		}
 	}
 }
+
+void
+rasops_make_box_chars_alpha(struct rasops_info *ri)
+{
+	uint8_t *data = (uint8_t *)ri-ri_optfont.data;
+	uint8_t *ddata;
+	int c, i, hmid, vmid, wi, he;
+
+	wi = ri-ri_font-fontwidth;
+	he = ri-ri_font-fontheight;
+	
+	vmid = (he + 1)  1;
+	hmid = (wi + 1)  1;
+
+	/* 0x00 would be empty anyway so don't bother */
+	for (c = 1; c  16; c++) {
+		data += ri-ri_fontscale;
+		if (c  1) {
+			/* upper segment */
+			ddata = data + hmid;
+			for (i = 0; i = vmid; i++) {
+*ddata = 0xff;
+ddata += wi;
+			}
+		}
+		if (c  4) {
+			/* lower segment */
+			ddata = data + wi * vmid + hmid;
+			for (i = vmid; i  he; i++) {
+*ddata = 0xff;
+ddata += wi;
+			}
+		}
+		if (c  2) {
+			/* right segment */
+			ddata = data + wi * vmid + hmid;
+			for (i = hmid; i  wi; i++) {
+*ddata = 0xff;
+ddata++;
+			}
+		}
+		if (c  8) {
+			/* left segment */
+			ddata = data + wi * vmid;
+			for (i = 0; i = hmid; i++) {
+*ddata = 0xff;
+ddata++;
+			}
+		}
+	}
+}

Index: src/sys/dev/rasops/rasops.h
diff -u src/sys/dev/rasops/rasops.h:1.26 src/sys/dev/rasops/rasops.h:1.27
--- src/sys/dev/rasops/rasops.h:1.26	Thu May  6 04:30:18 2010
+++ src/sys/dev/rasops/rasops.h	Thu Dec 22 04:52:45 2011
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops.h,v 1.26 2010/05/06 04:30:18 macallan Exp $ */
+/* 	$NetBSD: rasops.h,v 1.27 2011/12/22 04:52:45 macallan Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -55,6 +55,12 @@
  * box drawing characters
  */
 #define	RI_NO_AUTO	0x800	/* do not generate box drawing characters */
+/*
+ * Set this if your driver's 

CVS commit: src/sys/dev/wsfb

2011-12-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Dec 22 04:53:43 UTC 2011

Modified Files:
src/sys/dev/wsfb: genfb.c

Log Message:
support anti-aliased fonts in 32bit colour


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/wsfb/genfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/wsfb/genfb.c
diff -u src/sys/dev/wsfb/genfb.c:1.42 src/sys/dev/wsfb/genfb.c:1.43
--- src/sys/dev/wsfb/genfb.c:1.42	Wed Jul 13 22:47:29 2011
+++ src/sys/dev/wsfb/genfb.c	Thu Dec 22 04:53:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfb.c,v 1.42 2011/07/13 22:47:29 macallan Exp $ */
+/*	$NetBSD: genfb.c,v 1.43 2011/12/22 04:53:43 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.42 2011/07/13 22:47:29 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: genfb.c,v 1.43 2011/12/22 04:53:43 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -505,6 +505,9 @@ genfb_init_screen(void *cookie, struct v
 		ri-ri_flg |= RI_CLEAR;
 	}
 
+	if (ri-ri_depth == 32)
+		ri-ri_flg |= RI_ENABLE_ALPHA;
+
 	rasops_init(ri, sc-sc_height / 8, sc-sc_width / 8);
 	ri-ri_caps = WSSCREEN_WSCOLORS;
 



CVS commit: src/sys/dev/wsfont

2011-12-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Dec 22 05:01:15 UTC 2011

Modified Files:
src/sys/dev/wsfont: files.wsfont wsfont.c wsfont.h
Added Files:
src/sys/dev/wsfont: DejaVu_Sans_Mono_12x22.h Droid_Sans_Mono_12x22.h
FreeMono_12x22.h

Log Message:
add some pre-rendered anti-aliased fonts from pkgsrc:
- DejaVu Sans Mono from fonts/dejavu-ttf
- Droid Sans Mono from fonts/droid-ttf
- Free Mono from fonts/freefonts-ttf


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/wsfont/DejaVu_Sans_Mono_12x22.h \
src/sys/dev/wsfont/Droid_Sans_Mono_12x22.h \
src/sys/dev/wsfont/FreeMono_12x22.h
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/wsfont/files.wsfont
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/wsfont/wsfont.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/wsfont/wsfont.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffs are larger than 1MB and have been omitted


CVS commit: src/sys/dev/pci/voyager

2011-12-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Dec 22 05:05:24 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: files.voyager voyagerfb.c

Log Message:
support running in 32bit colour with anti-aliased fonts
enable with options VOYAGERFB_ANTIALIAS


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/voyager/files.voyager
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/files.voyager
diff -u src/sys/dev/pci/voyager/files.voyager:1.3 src/sys/dev/pci/voyager/files.voyager:1.4
--- src/sys/dev/pci/voyager/files.voyager:1.3	Tue Dec 13 14:46:07 2011
+++ src/sys/dev/pci/voyager/files.voyager	Thu Dec 22 05:05:24 2011
@@ -3,10 +3,10 @@
 define voyagerbus {}
 
 # the graphics part
-device	voyagerfb: wsemuldisplaydev, rasops8, rasops16, vcons, videomode, iic, i2c_bitbang
+device	voyagerfb: wsemuldisplaydev, rasops8, rasops16, rasops32, vcons, videomode, iic, i2c_bitbang
 attach	voyagerfb at voyagerbus
 file	dev/pci/voyager/voyagerfb.c		voyagerfb needs-flag
-defflag	opt_voyagerfb.h	VOYAGERFB_DEBUG
+defflag	opt_voyagerfb.h	VOYAGERFB_DEBUG VOYAGERFB_ANTIALIAS
 
 # a clock timer
 defflag opt_pwmclock.h PWMCLOCK_DEBUG

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.9 src/sys/dev/pci/voyager/voyagerfb.c:1.10
--- src/sys/dev/pci/voyager/voyagerfb.c:1.9	Tue Nov  8 07:05:06 2011
+++ src/sys/dev/pci/voyager/voyagerfb.c	Thu Dec 22 05:05:24 2011
@@ -1,7 +1,7 @@
-/*	$NetBSD: voyagerfb.c,v 1.9 2011/11/08 07:05:06 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.10 2011/12/22 05:05:24 macallan Exp $	*/
 
 /*
- * Copyright (c) 2009 Michael Lorenz
+ * Copyright (c) 2009, 2011 Michael Lorenz
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.9 2011/11/08 07:05:06 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.10 2011/12/22 05:05:24 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -59,6 +59,8 @@ __KERNEL_RCSID(0, $NetBSD: voyagerfb.c,
 #include dev/i2c/i2cvar.h
 #include dev/pci/voyagervar.h
 
+#include opt_voyagerfb.h
+
 #ifdef VOYAGERFB_DEBUG
 #define DPRINTF aprint_error
 #else
@@ -276,8 +278,13 @@ voyagerfb_attach(device_t parent, device
 	sc-sc_gpio_cookie = device_private(parent);
 	voyagerfb_setup_backlight(sc);
 
-	/* init engine here */
+#ifdef VOYAGERFB_ANTIALIAS
+	sc-sc_depth = 32;
+#else
 	sc-sc_depth = 8;
+#endif
+
+	/* init engine here */
 	voyagerfb_init(sc);
 
 	ri = sc-sc_console_screen.scr_ri;
@@ -538,6 +545,9 @@ voyagerfb_init_screen(void *cookie, stru
 	if (existing) {
 		ri-ri_flg |= RI_CLEAR;
 	}
+#ifdef VOYAGERFB_ANTIALIAS
+	ri-ri_flg |= RI_ENABLE_ALPHA;
+#endif
 
 	rasops_init(ri, sc-sc_height / 8, sc-sc_width / 8);
 	ri-ri_caps = WSSCREEN_WSCOLORS;
@@ -715,7 +725,7 @@ voyagerfb_init(struct voyagerfb_softc *s
 #else
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_ADDR,
 	sc-sc_cursor_addr);
-#endif
+#endif	
 }
 
 static void
@@ -856,9 +866,12 @@ voyagerfb_putchar(void *cookie, int row,
 		y = ri-ri_yorigin + row * he;
 		if (c == 0x20) {
 			voyagerfb_rectfill(sc, x, y, wi, he, bg);
-		} else {
-			uc = c - font-firstchar;
-			data = (uint8_t *)font-data + uc * ri-ri_fontscale;
+			return;
+		}
+		uc = c - font-firstchar;
+		data = (uint8_t *)font-data + uc * ri-ri_fontscale;
+		if (font-stride  font-fontwidth) {
+			/* this is a mono font */
 			cmd = ROP_COPY |
 			  SM502_CTRL_USE_ROP2 |
 			  SM502_CTRL_CMD_HOSTWRT |
@@ -889,6 +902,48 @@ voyagerfb_putchar(void *cookie, int row,
 break;
 			
 			}	
+		} else {
+			/*
+			 * alpha font
+			 * we can't accelerate the actual alpha blending but
+			 * we can at least use a host blit to go through the
+			 * pipeline instead of having to sync the engine
+			 */
+			int i, r, g, b, alpha;
+			int rf, gf, bf, rb, gb, bb;
+			uint32_t pixel;
+
+			cmd = ROP_COPY |
+			  SM502_CTRL_USE_ROP2 |
+			  SM502_CTRL_CMD_HOSTWRT |
+			  SM502_CTRL_QUICKSTART_E;
+			voyagerfb_ready(sc);
+			bus_space_write_4(sc-sc_memt, sc-sc_regh,
+			SM502_CONTROL, cmd);
+			bus_space_write_4(sc-sc_memt, sc-sc_regh,
+			SM502_SRC, 0);
+			bus_space_write_4(sc-sc_memt, sc-sc_regh,
+			SM502_DST, (x  16) | y);
+			bus_space_write_4(sc-sc_memt, sc-sc_regh,
+			SM502_DIMENSION, (wi  16) | he);
+			rf = (fg  16)  0xff;
+			rb = (bg  16)  0xff;
+			gf = (fg  8)  0xff;
+			gb = (bg  8)  0xff;
+			bf =  fg  0xff;
+			bb =  bg  0xff;
+			for (i = 0; i  wi * he; i++) {
+alpha = *data;
+data++;
+r = alpha * rf + (255 - alpha) * rb;
+g = alpha * gf + (255 - alpha) * gb;
+b = alpha * bf + (255 - alpha) * bb;
+pixel = (r  0xff00)  8 |
+(g  0xff00) |
+(b  0xff00)  8;
+

CVS commit: src/sys/arch/sparc64/dev

2011-12-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Dec 22 05:08:05 UTC 2011

Modified Files:
src/sys/arch/sparc64/dev: ffb.c ffb_mainbus.c ffbreg.h ffbvar.h

Log Message:
support anti-aliased fonts and let the hardware do the alpha blending


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/sparc64/dev/ffb.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc64/dev/ffb_mainbus.c \
src/sys/arch/sparc64/dev/ffbvar.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc64/dev/ffbreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sparc64/dev/ffb.c
diff -u src/sys/arch/sparc64/dev/ffb.c:1.48 src/sys/arch/sparc64/dev/ffb.c:1.49
--- src/sys/arch/sparc64/dev/ffb.c:1.48	Mon Oct 31 08:28:46 2011
+++ src/sys/arch/sparc64/dev/ffb.c	Thu Dec 22 05:08:05 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffb.c,v 1.48 2011/10/31 08:28:46 jdc Exp $	*/
+/*	$NetBSD: ffb.c,v 1.49 2011/12/22 05:08:05 macallan Exp $	*/
 /*	$OpenBSD: creator.c,v 1.20 2002/07/30 19:48:15 jason Exp $	*/
 
 /*
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ffb.c,v 1.48 2011/10/31 08:28:46 jdc Exp $);
+__KERNEL_RCSID(0, $NetBSD: ffb.c,v 1.49 2011/12/22 05:08:05 macallan Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -633,13 +633,13 @@ ffb_ras_init(struct ffb_softc *sc)
 	DPRINTF((ffb_ras_init: standard resolution.\n));
 		fbc = FFB_FBC_XE_OFF;
 	}
-	ffb_ras_fifo_wait(sc, 8);
+	ffb_ras_fifo_wait(sc, 11);
 	DPRINTF((WID: %08x\n, FBC_READ(sc, FFB_FBC_WID)));
 	FBC_WRITE(sc, FFB_FBC_WID, 0x0);
 	FBC_WRITE(sc, FFB_FBC_PPC,
 	FBC_PPC_VCE_DIS | FBC_PPC_TBE_OPAQUE | FBC_PPC_ACE_DIS | 
 	FBC_PPC_APE_DIS | FBC_PPC_DCE_DIS | FBC_PPC_CS_CONST | 
-	FBC_PPC_XS_WID);
+	FBC_PPC_ABE_DIS | FBC_PPC_XS_WID);
 	
 	fbc |= FFB_FBC_WB_A | FFB_FBC_RB_A | FFB_FBC_SB_BOTH |
 	   FFB_FBC_RGBE_MASK;
@@ -651,6 +651,11 @@ ffb_ras_init(struct ffb_softc *sc)
 	FBC_WRITE(sc, FFB_FBC_FONTINC, 0x1);
 	sc-sc_fg_cache = 0;
 	FBC_WRITE(sc, FFB_FBC_FG, sc-sc_fg_cache);
+	FBC_WRITE(sc, FFB_FBC_BLENDC, FFB_BLENDC_FORCE_ONE |
+  FFB_BLENDC_DF_ONE_M_A |
+  FFB_BLENDC_SF_A);
+	FBC_WRITE(sc, FFB_FBC_BLENDC1, 0);
+	FBC_WRITE(sc, FFB_FBC_BLENDC2, 0);
 	ffb_ras_wait(sc);
 }
 
@@ -722,7 +727,11 @@ ffb_ras_erasecols(void *cookie, int row,
 void
 ffb_ras_fill(struct ffb_softc *sc)
 {
-	ffb_ras_fifo_wait(sc, 2);
+	ffb_ras_fifo_wait(sc, 3);
+	FBC_WRITE(sc, FFB_FBC_PPC,
+	FBC_PPC_VCE_DIS | FBC_PPC_TBE_OPAQUE | FBC_PPC_ACE_DIS | 
+	FBC_PPC_APE_DIS | FBC_PPC_DCE_DIS | FBC_PPC_CS_CONST | 
+	FBC_PPC_ABE_DIS | FBC_PPC_XS_WID);
 	FBC_WRITE(sc, FFB_FBC_ROP, FBC_ROP_NEW);
 	FBC_WRITE(sc, FFB_FBC_DRAWOP, FBC_DRAWOP_RECTANGLE);
 	SYNC;
@@ -755,7 +764,11 @@ ffb_ras_copyrows(void *cookie, int src, 
 	src *= ri-ri_font-fontheight;
 	dst *= ri-ri_font-fontheight;
 
-	ffb_ras_fifo_wait(sc, 8);
+	ffb_ras_fifo_wait(sc, 9);
+	FBC_WRITE(sc, FFB_FBC_PPC,
+	FBC_PPC_VCE_DIS | FBC_PPC_TBE_OPAQUE | FBC_PPC_ACE_DIS | 
+	FBC_PPC_APE_DIS | FBC_PPC_DCE_DIS | FBC_PPC_CS_CONST | 
+	FBC_PPC_ABE_DIS | FBC_PPC_XS_WID);
 	FBC_WRITE(sc, FFB_FBC_ROP, FBC_ROP_OLD | (FBC_ROP_OLD  8));
 	FBC_WRITE(sc, FFB_FBC_DRAWOP, FBC_DRAWOP_VSCROLL);
 	FBC_WRITE(sc, FFB_FBC_BY, ri-ri_yorigin + src);
@@ -1017,34 +1030,42 @@ ffb_putchar(void *cookie, int row, int c
 	struct vcons_screen *scr = ri-ri_hw;
 	struct wsdisplay_font *font = PICK_FONT(ri, c);
 	struct ffb_softc *sc = scr-scr_cookie;
+	void *data;
+	uint32_t fg, bg;
+	int uc, i;
+	int x, y, wi, he;
 	
-	if (sc-sc_mode == WSDISPLAYIO_MODE_EMUL) {
-		void *data;
-		uint32_t fg, bg;
-		int uc, i;
-		int x, y, wi, he;
-
-		wi = font-fontwidth;
-		he = font-fontheight;
-
-		if (!CHAR_IN_FONT(c, font))
-			return;
-		bg = ri-ri_devcmap[(attr  16)  0xf];
-		fg = ri-ri_devcmap[(attr  24)  0xf];
-		x = ri-ri_xorigin + col * wi;
-		y = ri-ri_yorigin + row * he;
+	if (sc-sc_mode != WSDISPLAYIO_MODE_EMUL)
+		return;
+
+	wi = font-fontwidth;
+	he = font-fontheight;
+
+	if (!CHAR_IN_FONT(c, font))
+		return;
+
+	bg = ri-ri_devcmap[(attr  16)  0xf];
+	fg = ri-ri_devcmap[(attr  24)  0xf];
+	x = ri-ri_xorigin + col * wi;
+	y = ri-ri_yorigin + row * he;
 
-		uc = c - font-firstchar;
-		data = (uint8_t *)font-data + uc * ri-ri_fontscale;
+	uc = c - font-firstchar;
+	data = (uint8_t *)font-data + uc * ri-ri_fontscale;
 
+	if (font-stride  wi) {
+		/* mono bitmap font */
 		ffb_ras_setbg(sc, bg);
 		ffb_ras_setfg(sc, fg);
-		ffb_ras_fifo_wait(sc, 3);
+		ffb_ras_fifo_wait(sc, 4);
 		FBC_WRITE(sc, FFB_FBC_ROP, FBC_ROP_NEW);
 		FBC_WRITE(sc, FFB_FBC_FONTXY, (y  16) | x);
 		FBC_WRITE(sc, FFB_FBC_FONTW, wi);
+		FBC_WRITE(sc, FFB_FBC_PPC,
+		FBC_PPC_VCE_DIS | FBC_PPC_TBE_OPAQUE | FBC_PPC_ACE_DIS | 
+		FBC_PPC_APE_DIS | FBC_PPC_DCE_DIS | FBC_PPC_CS_CONST | 
+		FBC_PPC_ABE_DIS | FBC_PPC_XS_WID);
 
-		switch (ri-ri_font-stride) {
+		switch (font-stride) {
 			case 1: {
 uint8_t 

CVS commit: src/sys/dev/pci/voyager

2011-12-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Dec 22 07:32:34 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
don't switch to 8 bit for WSDISPLAYIO_MODE_EMUL if VOYAGERFB_ANTIALIAS
is defined


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.10 src/sys/dev/pci/voyager/voyagerfb.c:1.11
--- src/sys/dev/pci/voyager/voyagerfb.c:1.10	Thu Dec 22 05:05:24 2011
+++ src/sys/dev/pci/voyager/voyagerfb.c	Thu Dec 22 07:32:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.10 2011/12/22 05:05:24 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.11 2011/12/22 07:32:33 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.10 2011/12/22 05:05:24 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.11 2011/12/22 07:32:33 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -387,7 +387,11 @@ voyagerfb_ioctl(void *v, void *vs, u_lon
 		if (new_mode != sc-sc_mode) {
 			sc-sc_mode = new_mode;
 			if(new_mode == WSDISPLAYIO_MODE_EMUL) {
+#ifdef VOYAGERFB_ANTIALIAS
+sc-sc_depth = 32;
+#else
 sc-sc_depth = 8;
+#endif
 voyagerfb_init(sc);
 voyagerfb_restore_palette(sc);
 vcons_redraw_screen(ms);



CVS commit: src/sys/dev/pci/voyager

2011-12-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Dec 22 07:42:43 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
don't probe colour depth on attach - we're going to change it anyway


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.11 src/sys/dev/pci/voyager/voyagerfb.c:1.12
--- src/sys/dev/pci/voyager/voyagerfb.c:1.11	Thu Dec 22 07:32:33 2011
+++ src/sys/dev/pci/voyager/voyagerfb.c	Thu Dec 22 07:42:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.11 2011/12/22 07:32:33 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.12 2011/12/22 07:42:43 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.11 2011/12/22 07:32:33 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.12 2011/12/22 07:42:43 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -202,7 +202,6 @@ voyagerfb_attach(device_t parent, device
 	struct wsemuldisplaydev_attach_args aa;
 	prop_dictionary_t	dict;
 	unsigned long		defattr;
-	uint32_t		reg;
 	bool			is_console;
 	int i, j;
 
@@ -227,29 +226,23 @@ voyagerfb_attach(device_t parent, device
 	sc-sc_dataport = bus_space_vaddr(sc-sc_memt, sc-sc_regh);
 	sc-sc_dataport += SM502_DATAPORT;
 
-	reg = bus_space_read_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_DISP_CTRL);
-	switch (reg  SM502_PDC_DEPTH_MASK) {
-		case SM502_PDC_8BIT:
-			sc-sc_depth = 8;
-			break;
-		case SM502_PDC_16BIT:
-			sc-sc_depth = 16;
-			break;
-		case SM502_PDC_32BIT:
-			sc-sc_depth = 24;
-			break;
-		default:
-			panic(%s: unsupported depth, device_xname(self));
-	}
-	sc-sc_stride = (bus_space_read_4(sc-sc_memt, sc-sc_regh, 	
-		SM502_PANEL_FB_OFFSET)  SM502_FBA_WIN_STRIDE_MASK)  16;
 	sc-sc_width = (bus_space_read_4(sc-sc_memt, sc-sc_regh, 	
 		SM502_PANEL_FB_WIDTH)  SM502_FBW_WIN_WIDTH_MASK)  16;
 	sc-sc_height = (bus_space_read_4(sc-sc_memt, sc-sc_regh, 	
 		SM502_PANEL_FB_HEIGHT)  SM502_FBH_WIN_HEIGHT_MASK)  16;
 
+#ifdef VOYAGERFB_ANTIALIAS
+	sc-sc_depth = 32;
+#else
+	sc-sc_depth = 8;
+#endif
+
+	/* init engine here */
+	voyagerfb_init(sc);
+
 	printf(%s: %d x %d, %d bit, stride %d\n, device_xname(self), 
 		sc-sc_width, sc-sc_height, sc-sc_depth, sc-sc_stride);
+
 	/*
 	 * XXX yeah, casting the fb address to uint32_t is formally wrong
 	 * but as far as I know there are no SM502 with 64bit BARs
@@ -278,15 +271,6 @@ voyagerfb_attach(device_t parent, device
 	sc-sc_gpio_cookie = device_private(parent);
 	voyagerfb_setup_backlight(sc);
 
-#ifdef VOYAGERFB_ANTIALIAS
-	sc-sc_depth = 32;
-#else
-	sc-sc_depth = 8;
-#endif
-
-	/* init engine here */
-	voyagerfb_init(sc);
-
 	ri = sc-sc_console_screen.scr_ri;
 
 	if (is_console) {