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

2024-08-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug  6 07:34:23 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
magic number reduction, NFC


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.9 src/sys/arch/hppa/dev/hyperfb.c:1.10
--- src/sys/arch/hppa/dev/hyperfb.c:1.9	Mon Aug  5 09:45:05 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Tue Aug  6 07:34:23 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.9 2024/08/05 09:45:05 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.10 2024/08/06 07:34:23 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.9 2024/08/05 09:45:05 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.10 2024/08/06 07:34:23 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -220,10 +220,12 @@ hyperfb_setup_fb(struct hyperfb_softc *s
 	 */
 	hyperfb_wait(sc);
 	if ((sc->sc_mode != WSDISPLAYIO_MODE_EMUL) && sc->sc_24bit) {
-		hyperfb_write4(sc, NGLE_REG_10, 0xBBA0A000);	/* 24bit */
+		hyperfb_write4(sc, NGLE_REG_10, 
+		BA(FractDcd, Otc24, Ots08, AddrLong, 0, BINapp0F8, 0));
 		hyperfb_write4(sc, NGLE_REG_13, 0x);
 	} else {
-		hyperfb_write4(sc, NGLE_REG_10, 0x13602000);	/* 8bit */
+		hyperfb_write4(sc, NGLE_REG_10, 
+		BA(IndexedDcd, Otc04, Ots08, AddrByte, 0, BINovly, 0));
 		hyperfb_write4(sc, NGLE_REG_13, 0xff);
 	}
 	hyperfb_write4(sc, NGLE_REG_14, 0x83000300);
@@ -237,7 +239,8 @@ hyperfb_setup_fb24(struct hyperfb_softc 
 {
 
 	hyperfb_wait(sc);
-	hyperfb_write4(sc, NGLE_REG_10, 0xBBA0A000);	/* 24bit */
+	hyperfb_write4(sc, NGLE_REG_10, 
+	BA(FractDcd, Otc24, Ots08, AddrLong, 0, BINapp0F8, 0));
 	hyperfb_write4(sc, NGLE_REG_13, 0x);
 	hyperfb_write4(sc, NGLE_REG_14, 0x83000300);
 	//IBOvals(RopSrc,0,BitmapExtent08,0,DataDynamic,MaskDynamic,0,0)
@@ -852,7 +855,8 @@ hyperfb_setup(struct hyperfb_softc *sc)
 	if (sc->sc_24bit) {
 		/* overlay transparency */
 		hyperfb_wait_fifo(sc, 7);
-		hyperfb_write4(sc, NGLE_REG_11, 0x13a02000);
+		hyperfb_write4(sc, NGLE_REG_11, 
+		BA(IndexedDcd, Otc04, Ots08, AddrLong, 0, BINovly, 0));
 		hyperfb_write4(sc, NGLE_REG_14, 0x03000300);
 		hyperfb_write4(sc, NGLE_REG_3, 0x17f0);
 		hyperfb_write4(sc, NGLE_REG_13, 0x);
@@ -992,7 +996,8 @@ hyperfb_rectfill(struct hyperfb_softc *s
 		 */
 		if (sc->sc_hwmode != HW_SFILL) {
 			hyperfb_wait(sc);
-			hyperfb_write4(sc, NGLE_REG_10, 0x13a02000);
+			hyperfb_write4(sc, NGLE_REG_10, 
+		 	 BA(IndexedDcd, Otc04, Ots08, AddrLong, 0, BINovly, 0));
 			sc->sc_hwmode = HW_SFILL;
 		}
 		bg &= 0xff;
@@ -1051,7 +1056,8 @@ hyperfb_bitblt(void *cookie, int xs, int
 
 	if (sc->sc_hwmode != HW_BLIT) {
 		hyperfb_wait(sc);
-		hyperfb_write4(sc, NGLE_REG_10, 0x13a02000);
+		hyperfb_write4(sc, NGLE_REG_10, 
+		BA(IndexedDcd, Otc04, Ots08, AddrLong, 0, BINovly, 0));
 		hyperfb_write4(sc, NGLE_REG_13, 0xff);
 		sc->sc_hwmode = HW_BLIT;
 	}



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

2024-08-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug  6 07:34:23 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
magic number reduction, NFC


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hppa/dev/hyperfb.c

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



CVS commit: src/sys/dev/ic

2024-08-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug  6 07:26:56 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
moar bits & pieces


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/stireg.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/dev/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.11 src/sys/dev/ic/stireg.h:1.12
--- src/sys/dev/ic/stireg.h:1.11	Mon Aug  5 09:43:37 2024
+++ src/sys/dev/ic/stireg.h	Tue Aug  6 07:26:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.11 2024/08/05 09:43:37 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.12 2024/08/06 07:26:56 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -644,23 +644,28 @@ STI_DEP(util);
 
 #define BA(F,C,S,A,J,B,I)		\
 	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
-	/* FSSSAAAJ */
+	/* FCCC CSSS AAAJ      */
 
 #define IBOvals(R,M,X,S,D,L,B,F)	\
 	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
-	/* LSSD??BF */
+	/* LSSD       ??BF */
 
 #define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
+#define	FractDcd	1	/* Pixel data is Fractional 8-8-8 */
 #define	Otc04	2	/* Pixels in each longword transfer (4) */
 #define	Otc32	5	/* Pixels in each longword transfer (32) */
+#define	Otc24	7	/* NGLE uses this for 24bit blits */
 #define	Ots08	3	/* Each pixel is size (8)d transfer (1) */
 #define	OtsIndirect	6	/* Each bit goes through FG/BG color(8) */
+#define	AddrByte	3	/* byte access? Used by NGLE for direct fb */
 #define	AddrLong	5	/* FB address is Long aligned (pixel) */
-#define	BINovly	0x2	/* 8 bit overlay */
 #define	BINapp0I	0x0	/* Application Buffer 0, Indexed */
 #define	BINapp1I	0x1	/* Application Buffer 1, Indexed */
+#define	BINovly	0x2	/* 8 bit overlay */
+#define	BINcursor	0x7	/* cursor bitmap on EG */
 #define	BINapp0F8	0xa	/* Application Buffer 0, Fractional 8-8-8 */
 #define	BINattr	0xd	/* Attribute Bitmap */
+#define	BINcmap	0xf	/* colour map(s) */
 #define	RopClr 	0x0
 #define	RopSrc 	0x3
 #define	RopInv 	0xc



CVS commit: src/sys/dev/ic

2024-08-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug  6 07:26:56 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
moar bits & pieces


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

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



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

2024-08-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug  5 09:45:05 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
do cursor position updated the way NGLE does - poke reg 28 and wait_fifo
instead of waiting for the whole thing to go idle


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.8 src/sys/arch/hppa/dev/hyperfb.c:1.9
--- src/sys/arch/hppa/dev/hyperfb.c:1.8	Thu Aug  1 00:20:22 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Mon Aug  5 09:45:05 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.8 2024/08/01 00:20:22 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.9 2024/08/05 09:45:05 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.8 2024/08/01 00:20:22 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.9 2024/08/05 09:45:05 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -1268,7 +1268,8 @@ hyperfb_move_cursor(struct hyperfb_softc
 	if (y < 0) y = 0x1000 - y;
 	pos = (x << 16) | y;
 	if (sc->sc_enabled) pos |= HCRX_ENABLE_CURSOR;
-	hyperfb_wait(sc);
+	hyperfb_wait_fifo(sc, 2);
+	hyperfb_write4(sc, NGLE_REG_28, 0);
 	hyperfb_write4(sc, NGLE_REG_29, pos);
 }
 



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

2024-08-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug  5 09:45:05 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
do cursor position updated the way NGLE does - poke reg 28 and wait_fifo
instead of waiting for the whole thing to go idle


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/hppa/dev/hyperfb.c

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



CVS commit: src/sys/dev/ic

2024-08-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug  5 09:43:38 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
describe more register functions


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/stireg.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/dev/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.10 src/sys/dev/ic/stireg.h:1.11
--- src/sys/dev/ic/stireg.h:1.10	Wed Jul 31 09:54:13 2024
+++ src/sys/dev/ic/stireg.h	Mon Aug  5 09:43:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.10 2024/07/31 09:54:13 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.11 2024/08/05 09:43:37 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -672,11 +672,11 @@ STI_DEP(util);
 #define	MaskOtc	0	/* Mask contains Object Count valid bits */
 
 #define	NGLE_REG_1		0x000118	/* Artist LUT blt ctrl */
-#define	NGLE_REG_28		0x000420
-#define	NGLE_REG_2		0x000480	/* LUT blt src? */
-#define	NGLE_REG_3		0x0004a0	/* palette index */
-#define	NGLE_REG_22		0x0005a0
-#define	NGLE_REG_23		0x0005c0
+#define	NGLE_REG_28		0x000420	/* HCRX video bus access */
+#define	NGLE_REG_2		0x000480	/* BINC src */
+#define	NGLE_REG_3		0x0004a0	/* BINC dst */
+#define	NGLE_REG_22		0x0005a0	/* BINC dst mask */
+#define	NGLE_REG_23		0x0005c0	/* BINC data */
 #define	NGLE_REG_4		0x000600	/* palette data */
 #define	NGLE_REG_5		0x0006a0	/* cursor data */
 #define	NGLE_REG_6		0x000800	/* rectfill XY */
@@ -691,19 +691,20 @@ STI_DEP(util);
 #define	NGLE_REG_11		0x018004	/* dest bitmap access */
 #define	NGLE_REG_12		0x01800c	/* control plane register */
 #define	NGLE_REG_35		0x018010	/* fg color */
-#define	NGLE_REG_36		0x018014
+#define	NGLE_REG_36		0x018014	/* bg colour? */
 #define	NGLE_REG_13		0x018018	/* image planemask */
 #define	NGLE_REG_14		0x01801c	/* raster op */
-#define	NGLE_REG_15		0x20
+#define	NGLE_REG_15		0x20	/* 'busy dodger' idle */
+	#define DODGER_IDLE	0x1000	/* or 0x1, likely tpyo */
 #define	NGLE_REG_15b0		0x20	/* busy register */
 #define	NGLE_REG_16		0x24
-#define	NGLE_REG_16b1		0x25
-#define	NGLE_REG_16b3		0x27
+#define	NGLE_REG_16b1		0x25	/* setup copyarea */
+#define	NGLE_REG_16b3		0x27	/* ROM table index on CRX */
 #define	NGLE_REG_34		0x28	/* # of fifo slots */
 #define	NGLE_REG_17		0x200100	/* cursor coordinates */
 #define	NGLE_REG_18		0x200104	/* cursor enable */
 #define	NGLE_REG_26		0x200118	/* EG LUT blt ctrl */
-#define	NGLE_REG_19		0x200200
+#define	NGLE_REG_19		0x200200	/* artist sprite size */
 #define	NGLE_REG_20		0x200208	/* cursor geometry */
 #define	NGLE_REG_21		0x200218	/* Artist misc video */
 #define	NGLE_REG_27		0x200308	/* Artist misc ctrl */
@@ -722,11 +723,11 @@ STI_DEP(util);
 	#define LBC_TYPE_OVERLAY	0xc000
 	#define LBC_LENGTH_SHIFT	0
 #define	NGLE_REG_41		0x210024
-#define	NGLE_REG_42		0x210028
-#define	NGLE_REG_43		0x21002c
-#define	NGLE_REG_44		0x210030
-#define	NGLE_REG_45		0x210034
-#define	NGLE_REG_32		0x21003c
+#define	NGLE_REG_42		0x210028	/* these seem to control */
+#define	NGLE_REG_43		0x21002c	/* how the 24bit planes */
+#define	NGLE_REG_44		0x210030	/* are displayed on HCRX - */
+#define	NGLE_REG_45		0x210034	/* no info on bits */
+#define	NGLE_REG_32		0x21003c	/* HCRX plane enable */ 
 #define	NGLE_REG_33		0x210040	/* HCRX misc video */
 	#define HCRX_VIDEO_ENABLE	0x0A00
 #define	NGLE_REG_39		0x210120	/* HCRX 'hyperbowl' mode 2 */



CVS commit: src/sys/dev/ic

2024-08-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Aug  5 09:43:38 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
describe more register functions


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/stireg.h

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



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

2024-07-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Aug  1 00:20:22 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c hyperfb.c

Log Message:
fix tpyo and properly limit what we can mmap()


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hppa/dev/gftfb.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.16 src/sys/arch/hppa/dev/gftfb.c:1.17
--- src/sys/arch/hppa/dev/gftfb.c:1.16	Wed Jul 17 08:30:28 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Thu Aug  1 00:20:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.16 2024/07/17 08:30:28 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.17 2024/08/01 00:20:22 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -868,7 +868,7 @@ gftfb_mmap(void *v, void *vs, off_t offs
 	if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)
 		return -1;
 
-	if (offset >= 0 || offset < sc->sc_scr.fblen) {
+	if (offset >= 0 && offset < sc->sc_scr.fblen) {
 		/* framebuffer */
 		pa = bus_space_mmap(rom->memt, sc->sc_scr.fbaddr, offset,
 		prot, BUS_SPACE_MAP_LINEAR);

Index: src/sys/arch/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.7 src/sys/arch/hppa/dev/hyperfb.c:1.8
--- src/sys/arch/hppa/dev/hyperfb.c:1.7	Wed Jul 31 16:38:00 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Thu Aug  1 00:20:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.7 2024/07/31 16:38:00 riastradh Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.8 2024/08/01 00:20:22 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.7 2024/07/31 16:38:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.8 2024/08/01 00:20:22 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -659,7 +659,8 @@ hyperfb_mmap(void *v, void *vs, off_t of
 	if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)
 		return -1;
 
-	if (offset >= 0 || offset < 2048 * 1024) {
+	/* GSC framebuffer space is 16MB */
+	if (offset >= 0 && offset < 0x100) {
 		/* framebuffer */
 		pa = bus_space_mmap(sc->sc_iot, sc->sc_base + HCRX_FBOFFSET,
 		offset, prot,



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

2024-07-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Aug  1 00:20:22 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c hyperfb.c

Log Message:
fix tpyo and properly limit what we can mmap()


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hppa/dev/gftfb.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hppa/dev/hyperfb.c

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



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

2024-07-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 31 09:56:04 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
use the blitter to draw small rectangles as well by abusing set/clear ops
and the plane mask


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.5 src/sys/arch/hppa/dev/hyperfb.c:1.6
--- src/sys/arch/hppa/dev/hyperfb.c:1.5	Wed Jul 24 08:34:03 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Wed Jul 31 09:56:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.5 2024/07/24 08:34:03 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.6 2024/07/31 09:56:04 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.5 2024/07/24 08:34:03 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.6 2024/07/31 09:56:04 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -98,9 +98,10 @@ struct	hyperfb_softc {
 	u_char sc_cmap_blue[256];
 	kmutex_t sc_hwlock;
 	uint32_t sc_hwmode;
-#define HW_FB	0
-#define HW_FILL	1
-#define HW_BLIT	2
+#define HW_FB		0
+#define HW_FILL		1
+#define HW_BLIT		2
+#define HW_SFILL	3
 	/* cursor stuff */
 	int sc_cursor_x, sc_cursor_y;
 	int sc_hot_x, sc_hot_y, sc_enabled;
@@ -210,12 +211,18 @@ static inline void
 hyperfb_setup_fb(struct hyperfb_softc *sc)
 {
 
+	/*
+	 * turns out the plane mask is applied to everything, including
+	 * direct framebuffer writes, so make sure we always set it
+	 */
 	hyperfb_wait(sc);
 	if ((sc->sc_mode != WSDISPLAYIO_MODE_EMUL) && sc->sc_24bit) {
 		hyperfb_write4(sc, NGLE_REG_10, 0xBBA0A000);	/* 24bit */
 		hyperfb_write4(sc, NGLE_REG_13, 0x);
-	} else
+	} else {
 		hyperfb_write4(sc, NGLE_REG_10, 0x13602000);	/* 8bit */
+		hyperfb_write4(sc, NGLE_REG_13, 0xff);
+	}
 	hyperfb_write4(sc, NGLE_REG_14, 0x83000300);
 	hyperfb_wait(sc);
 	hyperfb_write1(sc, NGLE_REG_16b1, 1);
@@ -479,7 +486,6 @@ hyperfb_attach(device_t parent, device_t
 	config_found(sc->sc_dev, , wsemuldisplaydevprint, CFARGS_NONE);
 
 	hyperfb_setup_fb(sc);
-
 }
 
 static void
@@ -957,6 +963,7 @@ hyperfb_rectfill(struct hyperfb_softc *s
 	 * less than 32 pixels wide
 	 */
 	if (wi < 32) {
+#if 0
 		int i;
 		uint8_t *ptr = (uint8_t *)sc->sc_fb + (y << 11) + x;
 
@@ -967,6 +974,37 @@ hyperfb_rectfill(struct hyperfb_softc *s
 			memset(ptr, bg, wi);
 			ptr += 2048;
 		}
+#else
+		/*
+		 * instead of memset() we abuse the blitter - set / clear the
+		 * planes we want, select colour by planemask, do two passes
+		 * where necessary ( as in, anything not black or white )
+		 */ 
+		if (sc->sc_hwmode != HW_SFILL) {
+			hyperfb_wait(sc);
+			hyperfb_write4(sc, NGLE_REG_10, 0x13a02000);
+			sc->sc_hwmode = HW_SFILL;
+		}
+		bg &= 0xff;
+		hyperfb_wait_fifo(sc, 2);
+		hyperfb_write4(sc, NGLE_REG_24, (x << 16) | y);
+		if (bg != 0) {
+			hyperfb_wait_fifo(sc, 4);
+			hyperfb_write4(sc, NGLE_REG_14, 
+			IBOvals(RopSet, 0, BitmapExtent08, 1, DataDynamic, MaskOtc, 0, 0));
+			hyperfb_write4(sc, NGLE_REG_13, bg);
+			hyperfb_write4(sc, NGLE_REG_7, (wi << 16) | he);
+			hyperfb_write4(sc, NGLE_REG_25, (x << 16) | y);
+		}
+		if (bg != 0xff) {
+			hyperfb_wait_fifo(sc, 4);
+			hyperfb_write4(sc, NGLE_REG_14, 
+			IBOvals(RopClr, 0, BitmapExtent08, 1, DataDynamic, MaskOtc, 0, 0));
+			hyperfb_write4(sc, NGLE_REG_13, bg ^ 0xff);
+			hyperfb_write4(sc, NGLE_REG_7, (wi << 16) | he);
+			hyperfb_write4(sc, NGLE_REG_25, (x << 16) | y);
+		}
+#endif
 		return;
 	}
 	if (sc->sc_hwmode != HW_FILL) {



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

2024-07-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 31 09:56:04 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
use the blitter to draw small rectangles as well by abusing set/clear ops
and the plane mask


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hppa/dev/hyperfb.c

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



CVS commit: src/sys/dev/ic

2024-07-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 31 09:54:13 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
moar ROPs


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/stireg.h

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



CVS commit: src/sys/dev/ic

2024-07-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 31 09:54:13 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
moar ROPs


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/stireg.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/dev/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.9 src/sys/dev/ic/stireg.h:1.10
--- src/sys/dev/ic/stireg.h:1.9	Wed Jul 17 08:28:22 2024
+++ src/sys/dev/ic/stireg.h	Wed Jul 31 09:54:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.9 2024/07/17 08:28:22 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.10 2024/07/31 09:54:13 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -648,7 +648,7 @@ STI_DEP(util);
 
 #define IBOvals(R,M,X,S,D,L,B,F)	\
 	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
-	/* LSSDBBBF */
+	/* LSSD??BF */
 
 #define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
 #define	Otc04	2	/* Pixels in each longword transfer (4) */
@@ -661,8 +661,10 @@ STI_DEP(util);
 #define	BINapp1I	0x1	/* Application Buffer 1, Indexed */
 #define	BINapp0F8	0xa	/* Application Buffer 0, Fractional 8-8-8 */
 #define	BINattr	0xd	/* Attribute Bitmap */
+#define	RopClr 	0x0
 #define	RopSrc 	0x3
 #define	RopInv 	0xc
+#define	RopSet 	0xf
 #define	BitmapExtent08  3	/* Each write hits ( 8) bits in depth */
 #define	BitmapExtent32  5	/* Each write hits (32) bits in depth */
 #define	DataDynamic	0	/* Data register reloaded by direct access */



CVS commit: src/libexec/ld.elf_so/arch/hppa

2024-07-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 29 05:32:39 UTC 2024

Modified Files:
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c

Log Message:
skip R_PARISC_NONE reloc entries instead of segfaulting on them
now windowmaker runs on my C360


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c

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

Modified files:

Index: src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
diff -u src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.51 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.52
--- src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.51	Mon Jul 22 23:10:46 2024
+++ src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c	Mon Jul 29 05:32:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hppa_reloc.c,v 1.51 2024/07/22 23:10:46 riastradh Exp $	*/
+/*	$NetBSD: hppa_reloc.c,v 1.52 2024/07/29 05:32:39 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: hppa_reloc.c,v 1.51 2024/07/22 23:10:46 riastradh Exp $");
+__RCSID("$NetBSD: hppa_reloc.c,v 1.52 2024/07/29 05:32:39 macallan Exp $");
 #endif /* not lint */
 
 #include 
@@ -625,6 +625,9 @@ _rtld_relocate_plt_lazy(Obj_Entry *obj)
 		Elf_Addr *where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
 		Elf_Addr func_pc, func_sl;
 
+		/* skip R_PARISC_NONE entries */
+		if (ELF_R_TYPE(rela->r_info) == R_TYPE(NONE)) continue;
+			
 		assert(ELF_R_TYPE(rela->r_info) == R_TYPE(IPLT));
 
 		/*



CVS commit: src/libexec/ld.elf_so/arch/hppa

2024-07-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 29 05:32:39 UTC 2024

Modified Files:
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c

Log Message:
skip R_PARISC_NONE reloc entries instead of segfaulting on them
now windowmaker runs on my C360


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c

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



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

2024-07-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 24 08:34:03 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
hand X a 24bit framebuffer if the hardware supports it


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hppa/dev/hyperfb.c

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



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

2024-07-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 24 08:34:03 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
hand X a 24bit framebuffer if the hardware supports it


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.4 src/sys/arch/hppa/dev/hyperfb.c:1.5
--- src/sys/arch/hppa/dev/hyperfb.c:1.4	Wed Jul 17 08:30:28 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Wed Jul 24 08:34:03 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.4 2024/07/17 08:30:28 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.5 2024/07/24 08:34:03 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.4 2024/07/17 08:30:28 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.5 2024/07/24 08:34:03 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -113,7 +113,8 @@ extern struct cfdriver hyperfb_cd;
 CFATTACH_DECL_NEW(hyperfb, sizeof(struct hyperfb_softc), hyperfb_match,
 hyperfb_attach, NULL, NULL);
 
-void 		hyperfb_setup_fb(struct hyperfb_softc *);
+static inline void  hyperfb_setup_fb(struct hyperfb_softc *);
+static inline void  hyperfb_setup_fb24(struct hyperfb_softc *);
 static void 	hyperfb_init_screen(void *, struct vcons_screen *,
 			int, long *);
 static int	hyperfb_ioctl(void *, void *, u_long, void *, int,
@@ -205,13 +206,31 @@ hyperfb_wait_fifo(struct hyperfb_softc *
 	} while (reg < slots);
 }
 
-void
+static inline void
 hyperfb_setup_fb(struct hyperfb_softc *sc)
 {
 
 	hyperfb_wait(sc);
-	hyperfb_write4(sc, NGLE_REG_10, 0x13602000);	/* 8bit */
+	if ((sc->sc_mode != WSDISPLAYIO_MODE_EMUL) && sc->sc_24bit) {
+		hyperfb_write4(sc, NGLE_REG_10, 0xBBA0A000);	/* 24bit */
+		hyperfb_write4(sc, NGLE_REG_13, 0x);
+	} else
+		hyperfb_write4(sc, NGLE_REG_10, 0x13602000);	/* 8bit */
+	hyperfb_write4(sc, NGLE_REG_14, 0x83000300);
+	hyperfb_wait(sc);
+	hyperfb_write1(sc, NGLE_REG_16b1, 1);
+	sc->sc_hwmode = HW_FB;
+}
+
+static inline void
+hyperfb_setup_fb24(struct hyperfb_softc *sc)
+{
+
+	hyperfb_wait(sc);
+	hyperfb_write4(sc, NGLE_REG_10, 0xBBA0A000);	/* 24bit */
+	hyperfb_write4(sc, NGLE_REG_13, 0x);
 	hyperfb_write4(sc, NGLE_REG_14, 0x83000300);
+	//IBOvals(RopSrc,0,BitmapExtent08,0,DataDynamic,MaskDynamic,0,0)
 	hyperfb_wait(sc);
 	hyperfb_write1(sc, NGLE_REG_16b1, 1);
 	sc->sc_hwmode = HW_FB;
@@ -367,6 +386,9 @@ hyperfb_attach(device_t parent, device_t
 		eaio_l2(PCXL2_ACCEL_IO_ADDR2MASK(ca->ca_hpa));
 #endif /* HP7300LC_CPU */
 
+	sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
+	sc->sc_locked = 0;
+
 	hyperfb_setup(sc);
 	hyperfb_setup_fb(sc);
 
@@ -382,8 +404,6 @@ hyperfb_attach(device_t parent, device_t
 
 	sc->sc_screens[0] = >sc_defaultscreen_descr;
 	sc->sc_screenlist = (struct wsscreen_list){1, sc->sc_screens};
-	sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
-	sc->sc_locked = 0;
 
 	vcons_init(>vd, sc, >sc_defaultscreen_descr,
 	_accessops);
@@ -458,6 +478,8 @@ hyperfb_attach(device_t parent, device_t
 
 	config_found(sc->sc_dev, , wsemuldisplaydevprint, CFARGS_NONE);
 
+	hyperfb_setup_fb(sc);
+
 }
 
 static void
@@ -513,7 +535,7 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 			return ENODEV;
 		wdf = (void *)data;
 		wdf->height = ms->scr_ri.ri_height;
-		wdf->width = ms->scr_ri.ri_width;
+		wdf->width = sc->sc_24bit ? ms->scr_ri.ri_width << 2 : ms->scr_ri.ri_width;
 		wdf->depth = ms->scr_ri.ri_depth;
 		wdf->cmsize = 256;
 		return 0;
@@ -526,7 +548,7 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 		return hyperfb_putcmap(sc,
 		(struct wsdisplay_cmap *)data);
 	case WSDISPLAYIO_LINEBYTES:
-		*(u_int *)data = 2048;
+		*(u_int *)data = sc->sc_24bit ? 8192 : 2048;
 		return 0;
 
 	case WSDISPLAYIO_SMODE: {
@@ -544,6 +566,11 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 (ms->scr_defattr >> 16) & 0xff]);
 vcons_redraw_screen(ms);
 hyperfb_set_video(sc, 1);
+			} else {
+hyperfb_setup(sc);
+hyperfb_rectfill(sc, 0, 0, sc->sc_width,
+sc->sc_height, 0xff);
+hyperfb_setup_fb24(sc);
 			}
 		}
 		}
@@ -556,6 +583,19 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 
 			ret = wsdisplayio_get_fbinfo(>scr_ri, fbi);
 			fbi->fbi_fbsize = sc->sc_height * 2048;
+			if (sc->sc_24bit) {
+fbi->fbi_stride = 8192;
+fbi->fbi_bitsperpixel = 32;
+fbi->fbi_pixeltype = WSFB_RGB;
+fbi->fbi_subtype.fbi_rgbmasks.red_offset = 16;
+fbi->fbi_subtype.fbi_rgbmasks.red_size = 8;
+fbi->fbi_subtype.fbi_rgbmasks.green_offset = 8;
+fbi->fbi_subtype.fbi_rgbmasks.green_size = 8;
+		

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

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 08:30:28 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c hyperfb.c

Log Message:
remove a bunch of #defines that have been moved to stireg.h


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hppa/dev/gftfb.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.15 src/sys/arch/hppa/dev/gftfb.c:1.16
--- src/sys/arch/hppa/dev/gftfb.c:1.15	Fri Jul 12 08:45:05 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Wed Jul 17 08:30:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.15 2024/07/12 08:45:05 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.16 2024/07/17 08:30:28 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -159,31 +159,6 @@ struct wsdisplay_accessops gftfb_accesso
 	NULL	/* scroll */
 };
 
-#define BA(F,C,S,A,J,B,I)		\
-	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
-
-#define IBOvals(R,M,X,S,D,L,B,F)	\
-	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
-
-#define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
-#define	Otc04	2	/* Pixels in each longword transfer (4) */
-#define	Otc32	5	/* Pixels in each longword transfer (32) */
-#define	Ots08	3	/* Each pixel is size (8)d transfer (1) */
-#define	OtsIndirect	6	/* Each bit goes through FG/BG color(8) */
-#define	AddrLong	5	/* FB address is Long aligned (pixel) */
-#define	BINovly	0x2	/* 8 bit overlay */
-#define	BINapp0I	0x0	/* Application Buffer 0, Indexed */
-#define	BINapp1I	0x1	/* Application Buffer 1, Indexed */
-#define	BINapp0F8	0xa	/* Application Buffer 0, Fractional 8-8-8 */
-#define	BINattr	0xd	/* Attribute Bitmap */
-#define	RopSrc 	0x3
-#define	RopInv 	0xc
-#define	BitmapExtent08  3	/* Each write hits ( 8) bits in depth */
-#define	BitmapExtent32  5	/* Each write hits (32) bits in depth */
-#define	DataDynamic	0	/* Data register reloaded by direct access */
-#define	MaskDynamic	1	/* Mask register reloaded by direct access */
-#define	MaskOtc	0	/* Mask contains Object Count valid bits */
-
 static inline void gftfb_wait_fifo(struct gftfb_softc *, uint32_t);
 
 int

Index: src/sys/arch/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.3 src/sys/arch/hppa/dev/hyperfb.c:1.4
--- src/sys/arch/hppa/dev/hyperfb.c:1.3	Wed Jul 17 07:11:01 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Wed Jul 17 08:30:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.3 2024/07/17 07:11:01 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.4 2024/07/17 08:30:28 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -28,10 +28,11 @@
  
 /*
  * a native driver for HCRX / hyperdrive cards
+ * tested on a HCRX24Z in a C360 only so far
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.3 2024/07/17 07:11:01 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.4 2024/07/17 08:30:28 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -73,11 +74,6 @@ __KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 
 
 #define HCRX_CONFIG_24BIT	0x100
 
-#define HYPERBOWL_MODE_FOR_8_OVER_88_LUT0_NO_TRANSPARENCIES	4
-#define HYPERBOWL_MODE01_8_24_LUT0_TRANSPARENT_LUT1_OPAQUE	8
-#define HYPERBOWL_MODE01_8_24_LUT0_OPAQUE_LUT1_OPAQUE		10
-#define HYPERBOWL_MODE2_8_24	15
-
 int hyperfb_match(device_t, cfdata_t, void *);
 void hyperfb_attach(device_t, device_t, void *);
 
@@ -105,7 +101,6 @@ struct	hyperfb_softc {
 #define HW_FB	0
 #define HW_FILL	1
 #define HW_BLIT	2
-	uint32_t sc_rect_colour, sc_rect_height;
 	/* cursor stuff */
 	int sc_cursor_x, sc_cursor_y;
 	int sc_hot_x, sc_hot_y, sc_enabled;
@@ -148,33 +143,6 @@ static void	hyperfb_eraserows(void *, in
 static void	hyperfb_move_cursor(struct hyperfb_softc *, int, int);
 static int	hyperfb_do_cursor(struct hyperfb_softc *, struct wsdisplay_cursor *);
 
-#define BA(F,C,S,A,J,B,I)		\
-	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
-	/* FSSSAAAJ */
-
-#define IBOvals(R,M,X,S,D,L,B,F)	\
-	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
-	/* LSSDBBBF */
-
-#define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
-#define	Otc04	2	/* Pixels in each longword transfer (4) */
-#define	Otc32	5	/* Pixels in each longword transfer (32) */
-#define	Ots08	3	/* Each pixel is size (8)d transfer (1) */
-#define	OtsIndirect	6	/* Each bit goes through FG/BG color(8) */
-#define	AddrLong	5	/* FB

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

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 08:30:28 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c hyperfb.c

Log Message:
remove a bunch of #defines that have been moved to stireg.h


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hppa/dev/gftfb.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/dev/hyperfb.c

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



CVS commit: src/sys/dev/ic

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 08:28:22 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
moar bits
these should probably go into their own header since they don't actually
have anything to do with STI


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/stireg.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/dev/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.8 src/sys/dev/ic/stireg.h:1.9
--- src/sys/dev/ic/stireg.h:1.8	Wed Jul 17 07:06:21 2024
+++ src/sys/dev/ic/stireg.h	Wed Jul 17 08:28:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.8 2024/07/17 07:06:21 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.9 2024/07/17 08:28:22 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -641,6 +641,34 @@ STI_DEP(util);
  * NGLE register layout.
  * Based upon xc/programs/Xserver/hw/hp/ngle/dregs.h
  */
+
+#define BA(F,C,S,A,J,B,I)		\
+	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
+	/* FSSSAAAJ */
+
+#define IBOvals(R,M,X,S,D,L,B,F)	\
+	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
+	/* LSSDBBBF */
+
+#define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
+#define	Otc04	2	/* Pixels in each longword transfer (4) */
+#define	Otc32	5	/* Pixels in each longword transfer (32) */
+#define	Ots08	3	/* Each pixel is size (8)d transfer (1) */
+#define	OtsIndirect	6	/* Each bit goes through FG/BG color(8) */
+#define	AddrLong	5	/* FB address is Long aligned (pixel) */
+#define	BINovly	0x2	/* 8 bit overlay */
+#define	BINapp0I	0x0	/* Application Buffer 0, Indexed */
+#define	BINapp1I	0x1	/* Application Buffer 1, Indexed */
+#define	BINapp0F8	0xa	/* Application Buffer 0, Fractional 8-8-8 */
+#define	BINattr	0xd	/* Attribute Bitmap */
+#define	RopSrc 	0x3
+#define	RopInv 	0xc
+#define	BitmapExtent08  3	/* Each write hits ( 8) bits in depth */
+#define	BitmapExtent32  5	/* Each write hits (32) bits in depth */
+#define	DataDynamic	0	/* Data register reloaded by direct access */
+#define	MaskDynamic	1	/* Mask register reloaded by direct access */
+#define	MaskOtc	0	/* Mask contains Object Count valid bits */
+
 #define	NGLE_REG_1		0x000118	/* Artist LUT blt ctrl */
 #define	NGLE_REG_28		0x000420
 #define	NGLE_REG_2		0x000480	/* LUT blt src? */



CVS commit: src/sys/dev/ic

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 08:28:22 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
moar bits
these should probably go into their own header since they don't actually
have anything to do with STI


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/stireg.h

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



CVS commit: src/sys/arch/hppa/conf

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 08:19:56 UTC 2024

Modified Files:
src/sys/arch/hppa/conf: GENERIC

Log Message:
add hyperfb at uturn
This is a native driver for HCRX cards, with full wscons support
( as in, virtual consoles, fonts, colours, X with hw cursor )
needs testing on anything that isn't a GSC HCRS24Z


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/hppa/conf/GENERIC

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



CVS commit: src/sys/arch/hppa/conf

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 08:19:56 UTC 2024

Modified Files:
src/sys/arch/hppa/conf: GENERIC

Log Message:
add hyperfb at uturn
This is a native driver for HCRX cards, with full wscons support
( as in, virtual consoles, fonts, colours, X with hw cursor )
needs testing on anything that isn't a GSC HCRS24Z


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/hppa/conf/GENERIC

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/hppa/conf/GENERIC
diff -u src/sys/arch/hppa/conf/GENERIC:1.44 src/sys/arch/hppa/conf/GENERIC:1.45
--- src/sys/arch/hppa/conf/GENERIC:1.44	Thu Mar 14 13:18:35 2024
+++ src/sys/arch/hppa/conf/GENERIC	Wed Jul 17 08:19:56 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.44 2024/03/14 13:18:35 macallan Exp $
+# $NetBSD: GENERIC,v 1.45 2024/07/17 08:19:56 macallan Exp $
 #
 # GENERIC machine description file
 #
@@ -23,7 +23,7 @@ include 	"arch/hppa/conf/std.hppa"
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
 
-#ident 		"GENERIC-$Revision: 1.44 $"
+#ident 		"GENERIC-$Revision: 1.45 $"
 
 maxusers	32		# estimated number of users
 
@@ -283,7 +283,10 @@ sti*	at mainbus0		# [H]CRX-{8,24,48}[Z] 
 sti*	at phantomas?		# [H]CRX-{8,24,48}[Z] and Visualize graphics
 sti*	at uturn?
 sti*	at pci?			# EG-PCI, FX*
-gftfb* 	at pci?			# PCI Visualize EG
+
+# graphics with native drivers
+hyperfb* 	at uturn?	# hyperdrive / HCRX
+gftfb* 		at pci?		# PCI Visualize EG
 
 # Human Interface Loop
 hil*		at gsc? irq 1	# Human Interface Loop, kbd and mouse



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

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 07:11:01 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
add cursor sprite support


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.2 src/sys/arch/hppa/dev/hyperfb.c:1.3
--- src/sys/arch/hppa/dev/hyperfb.c:1.2	Mon Jul 15 10:26:09 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Wed Jul 17 07:11:01 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.2 2024/07/15 10:26:09 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.3 2024/07/17 07:11:01 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.2 2024/07/15 10:26:09 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.3 2024/07/17 07:11:01 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -145,10 +145,8 @@ static void	hyperfb_erasecols(void *, in
 static void	hyperfb_copyrows(void *, int, int, int);
 static void	hyperfb_eraserows(void *, int, int, long);
 
-#if 0
 static void	hyperfb_move_cursor(struct hyperfb_softc *, int, int);
 static int	hyperfb_do_cursor(struct hyperfb_softc *, struct wsdisplay_cursor *);
-#endif
 
 #define BA(F,C,S,A,J,B,I)		\
 	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
@@ -593,7 +591,6 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 			return ret;
 		}
 
-#if 0
 	case WSDISPLAYIO_GCURPOS:
 		{
 			struct wsdisplay_curpos *cp = (void *)data;
@@ -626,7 +623,6 @@ hyperfb_ioctl(void *v, void *vs, u_long 
 
 			return hyperfb_do_cursor(sc, cursor);
 		}
-#endif
 
 	case WSDISPLAYIO_SVIDEO:
 		hyperfb_set_video(sc, *(int *)data);
@@ -860,18 +856,14 @@ hyperfb_setup(struct hyperfb_softc *sc)
 	hyperfb_write4(sc, NGLE_REG_13, 0x);
 	hyperfb_wait(sc);
 	hyperfb_write4(sc, NGLE_REG_3, 0);
-	hyperfb_write4(sc, NGLE_REG_4, 0);
-	hyperfb_write4(sc, NGLE_REG_4, 0);
 	hyperfb_write4(sc, NGLE_REG_4, 0x00ff);	/* BG */
 	hyperfb_write4(sc, NGLE_REG_4, 0x00ff);	/* FG */
 	hyperfb_wait(sc);
 	hyperfb_write4(sc, NGLE_REG_2, 0);
-	hyperfb_write4(sc, NGLE_REG_1, 0x80008004);
+	hyperfb_write4(sc, NGLE_REG_38, LBC_ENABLE | LBC_TYPE_CURSOR | 4);
 	hyperfb_setup_fb(sc);	
 
-	//hyperfb_write4(sc, NGLE_REG_29, 0x80200020);
-
-	//hyperfb_move_cursor(sc, 100, 100);
+	hyperfb_move_cursor(sc, 100, 100);
 
 }
 
@@ -889,9 +881,9 @@ hyperfb_set_video(struct hyperfb_softc *
 	reg = hyperfb_read4(sc, NGLE_REG_33);
 	
 	if (on) {
-		hyperfb_write4(sc, NGLE_REG_33, reg | 0x0a00);
+		hyperfb_write4(sc, NGLE_REG_33, reg | HCRX_VIDEO_ENABLE);
 	} else {
-		hyperfb_write4(sc, NGLE_REG_33, reg & ~0x0a00);
+		hyperfb_write4(sc, NGLE_REG_33, reg & ~HCRX_VIDEO_ENABLE);
 	}
 }
 
@@ -1151,3 +1143,158 @@ hyperfb_eraserows(void *cookie, int row,
 			ri->ri_flg &= ~RI_CURSOR;
 	}
 }
+
+static void
+hyperfb_move_cursor(struct hyperfb_softc *sc, int x, int y)
+{
+	uint32_t pos;
+
+	sc->sc_cursor_x = x;
+	x -= sc->sc_hot_x;
+	sc->sc_cursor_y = y;
+	y -= sc->sc_hot_y;
+
+	if (x < 0) x = 0x1000 - x;
+	if (y < 0) y = 0x1000 - y;
+	pos = (x << 16) | y;
+	if (sc->sc_enabled) pos |= HCRX_ENABLE_CURSOR;
+	hyperfb_wait(sc);
+	hyperfb_write4(sc, NGLE_REG_29, pos);
+}
+
+static int
+hyperfb_do_cursor(struct hyperfb_softc *sc, struct wsdisplay_cursor *cur)
+{
+
+	if (cur->which & WSDISPLAY_CURSOR_DOCUR) {
+
+		sc->sc_enabled = cur->enable;
+		cur->which |= WSDISPLAY_CURSOR_DOPOS;
+	}
+	if (cur->which & WSDISPLAY_CURSOR_DOHOT) {
+
+		sc->sc_hot_x = cur->hot.x;
+		sc->sc_hot_y = cur->hot.y;
+		cur->which |= WSDISPLAY_CURSOR_DOPOS;
+	}
+	if (cur->which & WSDISPLAY_CURSOR_DOPOS) {
+
+		hyperfb_move_cursor(sc, cur->pos.x, cur->pos.y);
+	}
+	if (cur->which & WSDISPLAY_CURSOR_DOCMAP) {
+		uint32_t rgb;
+		uint8_t r[2], g[2], b[2];
+
+		copyin(cur->cmap.blue, b, 2);
+		copyin(cur->cmap.green, g, 2);
+		copyin(cur->cmap.red, r, 2);
+		mutex_enter(>sc_hwlock);
+		hyperfb_wait(sc);
+		hyperfb_write4(sc, NGLE_REG_10, 0xBBE0F000);
+		hyperfb_write4(sc, NGLE_REG_14, 0x03000300);
+		hyperfb_write4(sc, NGLE_REG_13, 0x);
+		hyperfb_wait(sc);
+		hyperfb_write4(sc, NGLE_REG_3, 0);
+		rgb = (r[0] << 16) | (g[0] << 8) | b[0];
+		hyperfb_write4(sc, NGLE_REG_4, rgb);	/* BG */
+		rgb = (r[1] << 16) | (g[1] << 8) | b[1];
+		hyperfb_write4(sc, NGLE_REG_4, rgb);	/* FG */
+		hyperfb_write4(sc, NGLE_REG_2, 0);
+		hyperfb_write4(sc, NGLE_REG_38, LBC_ENABLE | LBC_TYPE_CURSOR | 4);
+
+		hyperfb_setup_fb(sc);	
+		mutex_exit(>sc_hwlock);
+
+	}
+	if (cur->which & WSDISPLAY_CURSOR_DOSHAPE) {
+		

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

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 07:11:01 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
add cursor sprite support


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/hppa/dev/hyperfb.c

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



CVS commit: src/sys/dev/ic

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 07:06:22 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
document a few more registers & bits


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/stireg.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/dev/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.7 src/sys/dev/ic/stireg.h:1.8
--- src/sys/dev/ic/stireg.h:1.7	Mon Jul 15 10:30:42 2024
+++ src/sys/dev/ic/stireg.h	Wed Jul 17 07:06:21 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.7 2024/07/15 10:30:42 macallan Exp $	*/
+/*	$NetBSD: stireg.h,v 1.8 2024/07/17 07:06:21 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -641,9 +641,9 @@ STI_DEP(util);
  * NGLE register layout.
  * Based upon xc/programs/Xserver/hw/hp/ngle/dregs.h
  */
-#define	NGLE_REG_1		0x000118
+#define	NGLE_REG_1		0x000118	/* Artist LUT blt ctrl */
 #define	NGLE_REG_28		0x000420
-#define	NGLE_REG_2		0x000480
+#define	NGLE_REG_2		0x000480	/* LUT blt src? */
 #define	NGLE_REG_3		0x0004a0	/* palette index */
 #define	NGLE_REG_22		0x0005a0
 #define	NGLE_REG_23		0x0005c0
@@ -672,15 +672,25 @@ STI_DEP(util);
 #define	NGLE_REG_34		0x28	/* # of fifo slots */
 #define	NGLE_REG_17		0x200100	/* cursor coordinates */
 #define	NGLE_REG_18		0x200104	/* cursor enable */
-#define	NGLE_REG_26		0x200118
+#define	NGLE_REG_26		0x200118	/* EG LUT blt ctrl */
 #define	NGLE_REG_19		0x200200
 #define	NGLE_REG_20		0x200208	/* cursor geometry */
 #define	NGLE_REG_21		0x200218	/* Artist misc video */
 #define	NGLE_REG_27		0x200308	/* Artist misc ctrl */
 #define	NGLE_REG_29		0x21	/* HCRX cursor coord & enable */
+	#define HCRX_ENABLE_CURSOR	0x8000
 #define	NGLE_REG_30		0x210004	/* HCRX cursor address */
 #define	NGLE_REG_31		0x210008	/* HCRX cursor data */
-#define	NGLE_REG_38		0x210020	/* colormap data */
+#define	NGLE_REG_38		0x210020	/* HCRX LUT blt ctrl */
+	/* EWOO  TTLL  */
+	#define LBC_ENABLE	0x8000
+	#define LBC_WAIT_BLANK	0x4000
+	#define LBS_OFFSET_SHIFT	16
+	#define LBC_TYPE_MASK		0xc000
+	#define LBC_TYPE_CMAP		0
+	#define LBC_TYPE_CURSOR		0x8000
+	#define LBC_TYPE_OVERLAY	0xc000
+	#define LBC_LENGTH_SHIFT	0
 #define	NGLE_REG_41		0x210024
 #define	NGLE_REG_42		0x210028
 #define	NGLE_REG_43		0x21002c
@@ -688,8 +698,13 @@ STI_DEP(util);
 #define	NGLE_REG_45		0x210034
 #define	NGLE_REG_32		0x21003c
 #define	NGLE_REG_33		0x210040	/* HCRX misc video */
-#define	NGLE_REG_39		0x210120
-#define	NGLE_REG_40		0x210130
+	#define HCRX_VIDEO_ENABLE	0x0A00
+#define	NGLE_REG_39		0x210120	/* HCRX 'hyperbowl' mode 2 */
+	#define HYPERBOWL_MODE2_8_24	15
+#define	NGLE_REG_40		0x210130	/* HCRX 'hyperbowl' */
+	#define HYPERBOWL_MODE_FOR_8_OVER_88_LUT0_NO_TRANSPARENCIES	4
+	#define HYPERBOWL_MODE01_8_24_LUT0_TRANSPARENT_LUT1_OPAQUE	8
+	#define HYPERBOWL_MODE01_8_24_LUT0_OPAQUE_LUT1_OPAQUE		10
 
 #define	NGLE_BUFF0_CMAP0	0x1e02
 #define	NGLE_BUFF1_CMAP0	0x02001e02



CVS commit: src/sys/dev/ic

2024-07-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 17 07:06:22 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
document a few more registers & bits


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/stireg.h

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



CVS commit: src/sys/dev/ic

2024-07-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 15 10:30:42 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
annotate (some) registers if we know what they do
fix a tpyo while there


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/stireg.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/dev/ic/stireg.h
diff -u src/sys/dev/ic/stireg.h:1.6 src/sys/dev/ic/stireg.h:1.7
--- src/sys/dev/ic/stireg.h:1.6	Wed Sep  9 11:56:53 2015
+++ src/sys/dev/ic/stireg.h	Mon Jul 15 10:30:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: stireg.h,v 1.6 2015/09/09 11:56:53 skrll Exp $	*/
+/*	$NetBSD: stireg.h,v 1.7 2024/07/15 10:30:42 macallan Exp $	*/
 
 /*	$OpenBSD: stireg.h,v 1.14 2015/04/05 23:25:57 miod Exp $	*/
 
@@ -649,16 +649,16 @@ STI_DEP(util);
 #define	NGLE_REG_23		0x0005c0
 #define	NGLE_REG_4		0x000600	/* palette data */
 #define	NGLE_REG_5		0x0006a0	/* cursor data */
-#define	NGLE_REG_6		0x000800
-#define	NGLE_REG_7		0x000804
-#define	NGLE_REG_24		0x000808
-#define	NGLE_REG_8		0x000820
-#define	NGLE_REG_73		0x000944
-#define	NGLE_REG_9		0x000a04
-#define	NGLE_REG_25		0x000b00
+#define	NGLE_REG_6		0x000800	/* rectfill XY */
+#define	NGLE_REG_7		0x000804	/* bitblt size WH */
+#define	NGLE_REG_24		0x000808	/* bitblt src XY */
+#define	NGLE_REG_8		0x000820	/* transfer data */
+#define	NGLE_REG_37		0x000944	/* HCRX fast rect fill, size */
+#define	NGLE_REG_9		0x000a04	/* rect fill size, start */
+#define	NGLE_REG_25		0x000b00	/* bitblt dst XY, start */
 #define	NGLE_REG_RAMDAC		0x001000
-#define	NGLE_REG_10		0x018000
-#define	NGLE_REG_11		0x018004	/* dest coords */
+#define	NGLE_REG_10		0x018000	/* buffer ctl */
+#define	NGLE_REG_11		0x018004	/* dest bitmap access */
 #define	NGLE_REG_12		0x01800c	/* control plane register */
 #define	NGLE_REG_35		0x018010	/* fg color */
 #define	NGLE_REG_36		0x018014



CVS commit: src/sys/dev/ic

2024-07-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 15 10:30:42 UTC 2024

Modified Files:
src/sys/dev/ic: stireg.h

Log Message:
annotate (some) registers if we know what they do
fix a tpyo while there


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/stireg.h

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



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

2024-07-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 15 10:26:09 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
we have a blitter - use it


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/hppa/dev/hyperfb.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/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.1 src/sys/arch/hppa/dev/hyperfb.c:1.2
--- src/sys/arch/hppa/dev/hyperfb.c:1.1	Fri Jul 12 08:43:08 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Mon Jul 15 10:26:09 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.1 2024/07/12 08:43:08 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.2 2024/07/15 10:26:09 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.1 2024/07/12 08:43:08 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.2 2024/07/15 10:26:09 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -133,6 +133,52 @@ static int 	hyperfb_putpalreg(struct hyp
 void 	hyperfb_setup(struct hyperfb_softc *);
 static void	hyperfb_set_video(struct hyperfb_softc *, int);
 
+static void	hyperfb_rectfill(struct hyperfb_softc *, int, int, int, int,
+			uint32_t);
+static void	hyperfb_bitblt(void *, int, int, int, int, int,
+			int, int);
+
+static void	hyperfb_cursor(void *, int, int, int);
+static void	hyperfb_putchar(void *, int, int, u_int, long);
+static void	hyperfb_copycols(void *, int, int, int, int);
+static void	hyperfb_erasecols(void *, int, int, int, long);
+static void	hyperfb_copyrows(void *, int, int, int);
+static void	hyperfb_eraserows(void *, int, int, long);
+
+#if 0
+static void	hyperfb_move_cursor(struct hyperfb_softc *, int, int);
+static int	hyperfb_do_cursor(struct hyperfb_softc *, struct wsdisplay_cursor *);
+#endif
+
+#define BA(F,C,S,A,J,B,I)		\
+	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
+	/* FSSSAAAJ */
+
+#define IBOvals(R,M,X,S,D,L,B,F)	\
+	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
+	/* LSSDBBBF */
+
+#define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
+#define	Otc04	2	/* Pixels in each longword transfer (4) */
+#define	Otc32	5	/* Pixels in each longword transfer (32) */
+#define	Ots08	3	/* Each pixel is size (8)d transfer (1) */
+#define	OtsIndirect	6	/* Each bit goes through FG/BG color(8) */
+#define	AddrLong	5	/* FB address is Long aligned (pixel) */
+#define	BINovly	0x2	/* 8 bit overlay */
+#define	BINapp0I	0x0	/* Application Buffer 0, Indexed */
+#define	BINapp1I	0x1	/* Application Buffer 1, Indexed */
+#define	BINapp0F8	0xa	/* Application Buffer 0, Fractional 8-8-8 */
+#define	BINattr	0xd	/* Attribute Bitmap */
+#define	RopSrc 	0x3
+#define	RopInv 	0xc
+#define	BitmapExtent08  3	/* Each write hits ( 8) bits in depth */
+#define	BitmapExtent32  5	/* Each write hits (32) bits in depth */
+#define	DataDynamic	0	/* Data register reloaded by direct access */
+#define	MaskDynamic	1	/* Mask register reloaded by direct access */
+#define	MaskOtc	0	/* Mask contains Object Count valid bits */
+
+static inline void hyperfb_wait_fifo(struct hyperfb_softc *, uint32_t);
+
 #define	ngle_bt458_write(sc, r, v) \
 	hyperfb_write4(sc, NGLE_REG_RAMDAC + ((r) << 2), (v) << 24)
 
@@ -183,6 +229,16 @@ hyperfb_wait(struct hyperfb_softc *sc)
 	} while (stat != 0);
 }
 
+static inline void
+hyperfb_wait_fifo(struct hyperfb_softc *sc, uint32_t slots)
+{
+	uint32_t reg;
+
+	do {
+		reg = hyperfb_read4(sc, NGLE_REG_34);
+	} while (reg < slots);
+}
+
 void
 hyperfb_setup_fb(struct hyperfb_softc *sc)
 {
@@ -395,10 +451,10 @@ hyperfb_attach(device_t parent, device_t
 #endif
 		wsdisplay_cnattach(>sc_defaultscreen_descr, ri, 0, 0,
 		defattr);
-#if 0
+
 		hyperfb_rectfill(sc, 0, 0, sc->sc_width, sc->sc_height,
 		ri->ri_devcmap[(defattr >> 16) & 0xff]);
-#endif
+
 		vcons_replay_msgbuf(>sc_console_screen);
 	} else {
 		/*
@@ -456,21 +512,20 @@ hyperfb_init_screen(void *cookie, struct
 	rasops_init(ri, 0, 0);
 	ri->ri_caps = WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE |
 		  WSSCREEN_RESIZE;
-	scr->scr_flags |= VCONS_LOADFONT | VCONS_DONT_READ;
+	scr->scr_flags |= VCONS_LOADFONT;
 
 	rasops_reconfig(ri, sc->sc_height / ri->ri_font->fontheight,
 		sc->sc_width / ri->ri_font->fontwidth);
 
 	ri->ri_hw = scr;
-#if 0
+
 	sc->sc_putchar = ri->ri_ops.putchar;
-	ri->ri_ops.copyrows = gftfb_copyrows;
-	ri->ri_ops.copycols = gftfb_copycols;
-	ri->ri_ops.eraserows = gftfb_eraserows;
-	r

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

2024-07-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Jul 15 10:26:09 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
we have a blitter - use it


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/hppa/dev/hyperfb.c

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



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

2024-07-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul 12 08:45:05 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
STIDEBUG -> GFTFB_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hppa/dev/gftfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.14 src/sys/arch/hppa/dev/gftfb.c:1.15
--- src/sys/arch/hppa/dev/gftfb.c:1.14	Thu Apr 18 04:52:43 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Fri Jul 12 08:45:05 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.14 2024/04/18 04:52:43 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.15 2024/07/12 08:45:05 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -47,15 +47,12 @@
 #include 
 #include 
 
-#ifdef STIDEBUG
-#define	DPRINTF(s)	do {	\
-	if (stidebug)		\
-		printf s;	\
-} while(0)
+#include "opt_gftfb.h"
 
-extern int stidebug;
+#ifdef GFTFB_DEBUG
+#define	DPRINTF(s) printf(s)
 #else
-#define	DPRINTF(s)	/* */
+#define	DPRINTF(s) /* */
 #endif
 
 int	gftfb_match(device_t, cfdata_t, void *);
@@ -425,7 +422,7 @@ gftfb_check_rom(struct gftfb_softc *spc,
 		offs + 0x0c);
 		subsize <<= 9;
 
-#ifdef STIDEBUG
+#ifdef GFTFB_DEBUG
 		gftfb_disable_rom_internal(spc);
 		DPRINTF(("ROM offset %08x size %08x type %08x",
 		(u_int)offs, (u_int)subsize, tmp));
@@ -473,7 +470,7 @@ gftfb_check_rom(struct gftfb_softc *spc,
 			break;
 #endif
 		default:
-#ifdef STIDEBUG
+#ifdef GFTFB_DEBUG
 			DPRINTF((" (wrong architecture)"));
 #endif
 			break;



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

2024-07-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul 12 08:45:05 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
STIDEBUG -> GFTFB_DEBUG


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

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



CVS commit: src/sys/arch/hppa

2024-07-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul 12 08:43:08 UTC 2024

Modified Files:
src/sys/arch/hppa/conf: files.hppa
Added Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
first shot at a native driver for HCRX cards
this will give you a fully working wsdisplay in 8bit colour living in the
overlay planes, X/wsfb will also work.
No acceleration or cursor sprite support yet.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/hppa/conf/files.hppa
cvs rdiff -u -r0 -r1.1 src/sys/arch/hppa/dev/hyperfb.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/hppa/conf/files.hppa
diff -u src/sys/arch/hppa/conf/files.hppa:1.25 src/sys/arch/hppa/conf/files.hppa:1.26
--- src/sys/arch/hppa/conf/files.hppa:1.25	Tue Feb 13 13:40:13 2024
+++ src/sys/arch/hppa/conf/files.hppa	Fri Jul 12 08:43:08 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.hppa,v 1.25 2024/02/13 13:40:13 macallan Exp $
+#	$NetBSD: files.hppa,v 1.26 2024/07/12 08:43:08 macallan Exp $
 #
 #	$OpenBSD: files.hppa,v 1.31 2001/06/26 02:41:25 mickey Exp $
 #
@@ -275,6 +275,13 @@ file	arch/hppa/gsc/com_harmony.c	com_har
 device	gftfb: wsemuldisplaydev, rasops8, vcons, glyphcache, sti_pci, sti
 attach	gftfb at pci
 file	arch/hppa/dev/gftfb.c		gftfb
+defflag opt_gftfb.h GFTFB_DEBUG
+
+# hyperdrive, aka HCRX
+device	hyperfb: wsemuldisplaydev, rasops8, vcons, glyphcache, sti
+attach	hyperfb at gedoens
+file	arch/hppa/dev/hyperfb.c		hyperfb
+defflag opt_hyperfb.h HYPERFB_DEBUG
 
 # Memory Disk
 file dev/md_root.c			memory_disk_hooks

Added files:

Index: src/sys/arch/hppa/dev/hyperfb.c
diff -u /dev/null src/sys/arch/hppa/dev/hyperfb.c:1.1
--- /dev/null	Fri Jul 12 08:43:09 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Fri Jul 12 08:43:08 2024
@@ -0,0 +1,843 @@
+/*	$NetBSD: hyperfb.c,v 1.1 2024/07/12 08:43:08 macallan Exp $	*/
+
+/*
+ * Copyright (c) 2024 Michael Lorenz
+ * 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 OR HIS RELATIVES 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 MIND, 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 native driver for HCRX / hyperdrive cards
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.1 2024/07/12 08:43:08 macallan Exp $");
+
+#include "opt_cputype.h"
+#include "opt_hyperfb.h"
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#ifdef HYPERFB_DEBUG
+#define	DPRINTF printf
+#else
+#define DPRINTF if (0) printf
+#endif
+
+#define	STI_ROMSIZE	(sizeof(struct sti_dd) * 4)
+
+#define HCRX_FBOFFSET	0x0100
+#define HCRX_FBLEN	0x0100
+#define HCRX_REGOFFSET	0x0010
+#define HCRX_REGLEN	0x0028
+
+#define HCRX_CONFIG_24BIT	0x100
+
+#define HYPERBOWL_MODE_FOR_8_OVER_88_LUT0_NO_TRANSPARENCIES	4
+#define HYPERBOWL_MODE01_8_24_LUT0_TRANSPARENT_LUT1_OPAQUE	8
+#define HYPERBOWL_MODE01_8_24_LUT0_OPAQUE_LUT1_OPAQUE		10
+#define HYPERBOWL_MODE2_8_24	15
+
+int hyperfb_match(device_t, cfdata_t, void *);
+void hyperfb_attach(device_t, device_t, void *);
+
+struct	hyperfb_softc {
+	device_t		sc_dev;
+	bus_space_tag_t		sc_iot;
+	bus_addr_t		sc_base;
+	bus_space_handle_t	sc_hfb, sc_hreg;
+	void 			*sc_fb;
+
+	int sc_width, sc_height;
+	int sc_locked, sc_is_console, sc_24bit;
+	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;
+	void (*sc_putchar)(void *, int, int, u_int, long);
+	u_char sc_cmap_red[256];
+	u_char sc_cmap_green[256];
+	u_char sc_cmap_blue[256];
+	kmutex_t sc_hwlock;
+	uint32

CVS commit: src/sys/arch/hppa

2024-07-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul 12 08:43:08 UTC 2024

Modified Files:
src/sys/arch/hppa/conf: files.hppa
Added Files:
src/sys/arch/hppa/dev: hyperfb.c

Log Message:
first shot at a native driver for HCRX cards
this will give you a fully working wsdisplay in 8bit colour living in the
overlay planes, X/wsfb will also work.
No acceleration or cursor sprite support yet.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/hppa/conf/files.hppa
cvs rdiff -u -r0 -r1.1 src/sys/arch/hppa/dev/hyperfb.c

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



CVS commit: src/sys/dev/ic

2024-07-03 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul  3 13:08:36 UTC 2024

Modified Files:
src/sys/dev/ic: sti.c

Log Message:
fix HXRC colour map handling
With this we can run X in 8bit with correct colours.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ic/sti.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/ic/sti.c
diff -u src/sys/dev/ic/sti.c:1.36 src/sys/dev/ic/sti.c:1.37
--- src/sys/dev/ic/sti.c:1.36	Tue Jun 25 11:52:11 2024
+++ src/sys/dev/ic/sti.c	Wed Jul  3 13:08:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti.c,v 1.36 2024/06/25 11:52:11 macallan Exp $	*/
+/*	$NetBSD: sti.c,v 1.37 2024/07/03 13:08:36 macallan Exp $	*/
 
 /*	$OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.36 2024/06/25 11:52:11 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.37 2024/07/03 13:08:36 macallan Exp $");
 
 #include "wsdisplay.h"
 
@@ -133,6 +133,7 @@ void	ngle_artist_setupfb(struct sti_scre
 void	ngle_elk_setupfb(struct sti_screen *);
 void	ngle_timber_setupfb(struct sti_screen *);
 int	ngle_putcmap(struct sti_screen *, u_int, u_int);
+int	ngle_hcrx_putcmap(struct sti_screen *, u_int, u_int);
 #endif
 
 #define	STI_ENABLE_ROM(sc) \
@@ -685,7 +686,7 @@ sti_screen_setup(struct sti_screen *scr,
 
 	case STI_DD_HCRX:
 		scr->setupfb = ngle_elk_setupfb;
-		scr->putcmap = ngle_putcmap;
+		scr->putcmap = ngle_hcrx_putcmap;
 
 		if (scr->scr_bpp > 8) {
 			scr->reg12_value = NGLE_BUFF1_CMAP3;
@@ -694,7 +695,7 @@ sti_screen_setup(struct sti_screen *scr,
 			scr->reg12_value = NGLE_BUFF1_CMAP0;
 			scr->reg10_value = 0x13602000;
 		}
-		scr->cmap_finish_register = NGLE_REG_1;
+		scr->cmap_finish_register = NGLE_REG_38;
 		break;
 
 	case STI_DD_GRX:
@@ -1649,6 +1650,7 @@ ngle_putcmap(struct sti_screen *scr, u_i
 		r++, g++, b++;
 	}
 
+
 	bus_space_write_stream_4(memt, memh, NGLE_REG_2, 0x400);
 	bus_space_write_stream_4(memt, memh, scr->cmap_finish_register,
 	cmap_finish);
@@ -1658,6 +1660,49 @@ ngle_putcmap(struct sti_screen *scr, u_i
 	return 0;
 }
 
+int
+ngle_hcrx_putcmap(struct sti_screen *scr, u_int idx, u_int count)
+{
+	struct sti_rom *rom = scr->scr_rom;
+	bus_space_tag_t memt = rom->memt;
+	bus_space_handle_t memh = rom->regh[2];
+	uint8_t *r, *g, *b;
+	uint32_t cmap_finish;
+
+	if (scr->scr_bpp > 8)
+		cmap_finish = 0x8100;
+	else
+		cmap_finish = 0x82000100;
+
+	r = scr->scr_rcmap + idx;
+	g = scr->scr_gcmap + idx;
+	b = scr->scr_bcmap + idx;
+
+	ngle_setup_hw(memt, memh);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_10, 0xbbe0f000);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_14, 0x03000300);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_13, 0x);
+
+	while (count-- != 0) {
+		ngle_setup_hw(memt, memh);
+		bus_space_write_stream_4(memt, memh, NGLE_REG_3,
+		0x400 | (idx << 2));
+		bus_space_write_stream_4(memt, memh, NGLE_REG_4,
+		(*r << 16) | (*g << 8) | *b);
+
+		idx++;
+		r++, g++, b++;
+	}
+
+
+	bus_space_write_stream_4(memt, memh, NGLE_REG_2, 0x400);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_38, cmap_finish);
+	ngle_setup_fb(memt, memh, scr->reg10_value);
+
+
+	return 0;
+}
+
 void
 ngle_setup_hw(bus_space_tag_t memt, bus_space_handle_t memh)
 {



CVS commit: src/sys/dev/ic

2024-07-03 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul  3 13:08:36 UTC 2024

Modified Files:
src/sys/dev/ic: sti.c

Log Message:
fix HXRC colour map handling
With this we can run X in 8bit with correct colours.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ic/sti.c

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



CVS commit: src/sys/dev/ic

2024-06-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jun 25 11:52:12 UTC 2024

Modified Files:
src/sys/dev/ic: sti.c

Log Message:
first step to HCRX support
this gets us an 8bit framebuffer with wrong colours, as opposed to X just
erroring out


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/sti.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/ic/sti.c
diff -u src/sys/dev/ic/sti.c:1.35 src/sys/dev/ic/sti.c:1.36
--- src/sys/dev/ic/sti.c:1.35	Tue Feb 13 13:17:51 2024
+++ src/sys/dev/ic/sti.c	Tue Jun 25 11:52:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti.c,v 1.35 2024/02/13 13:17:51 macallan Exp $	*/
+/*	$NetBSD: sti.c,v 1.36 2024/06/25 11:52:11 macallan Exp $	*/
 
 /*	$OpenBSD: sti.c,v 1.61 2009/09/05 14:09:35 miod Exp $	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.35 2024/02/13 13:17:51 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.36 2024/06/25 11:52:11 macallan Exp $");
 
 #include "wsdisplay.h"
 
@@ -683,12 +683,25 @@ sti_screen_setup(struct sti_screen *scr,
 		}
 		break;
 
+	case STI_DD_HCRX:
+		scr->setupfb = ngle_elk_setupfb;
+		scr->putcmap = ngle_putcmap;
+
+		if (scr->scr_bpp > 8) {
+			scr->reg12_value = NGLE_BUFF1_CMAP3;
+			scr->reg10_value = 0xBBA0A000;
+		} else {
+			scr->reg12_value = NGLE_BUFF1_CMAP0;
+			scr->reg10_value = 0x13602000;
+		}
+		scr->cmap_finish_register = NGLE_REG_1;
+		break;
+
 	case STI_DD_GRX:
 	case STI_DD_CRX24:
 	case STI_DD_EVRX:
 	case STI_DD_3X2V:
 	case STI_DD_DUAL_CRX:
-	case STI_DD_HCRX:
 	case STI_DD_LEGO:
 	case STI_DD_SUMMIT:
 	case STI_DD_PINNACLE:



CVS commit: src/sys/dev/ic

2024-06-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jun 25 11:52:12 UTC 2024

Modified Files:
src/sys/dev/ic: sti.c

Log Message:
first step to HCRX support
this gets us an 8bit framebuffer with wrong colours, as opposed to X just
erroring out


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/sti.c

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



CVS commit: xsrc/external/mit/xorg-server/dist/hw/xfree86/modes

2024-06-10 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Mon Jun 10 22:51:01 UTC 2024

Modified Files:
xsrc/external/mit/xorg-server/dist/hw/xfree86/modes: xf86Modes.c

Log Message:
make sure we fill in the name field in generated / converted modes
fixes PR 58321, tested by tsutsui@


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.8 -r1.2 \
xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c

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

Modified files:

Index: xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c
diff -u xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c:1.1.1.8 xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c:1.2
--- xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c:1.1.1.8	Fri Jul 15 02:12:51 2022
+++ xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c	Mon Jun 10 22:51:01 2024
@@ -818,6 +818,7 @@ xf86CVTMode(int HDisplay, int VDisplay, 
 Mode->VTotal = libxcvt_mode_info->vtotal;
 Mode->VRefresh   = libxcvt_mode_info->vrefresh;
 Mode->Flags  = libxcvt_mode_info->mode_flags;
+xf86SetModeDefaultName(Mode);
 
 free(libxcvt_mode_info);
 



CVS commit: xsrc/external/mit/xorg-server/dist/hw/xfree86/modes

2024-06-10 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Mon Jun 10 22:51:01 UTC 2024

Modified Files:
xsrc/external/mit/xorg-server/dist/hw/xfree86/modes: xf86Modes.c

Log Message:
make sure we fill in the name field in generated / converted modes
fixes PR 58321, tested by tsutsui@


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.8 -r1.2 \
xsrc/external/mit/xorg-server/dist/hw/xfree86/modes/xf86Modes.c

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



CVS commit: src/sys/arch/powerpc/oea

2024-05-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue May 28 11:06:07 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea: ofwoea_machdep.c

Log Message:
- initialize bootpath
- if we don't get anything useful from args, check /chosen
now my G5 finds its boot device even when netbooting a kernel directly


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/powerpc/oea/ofwoea_machdep.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/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.63 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.64
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.63	Sat Sep 23 21:26:16 2023
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Tue May 28 11:06:07 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.63 2023/09/23 21:26:16 andvar Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.64 2024/05/28 11:06:07 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.63 2023/09/23 21:26:16 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.64 2024/05/28 11:06:07 macallan Exp $");
 
 #include "ksyms.h"
 #include "wsdisplay.h"
@@ -113,7 +113,7 @@ struct OF_translation ofw_translations[O
 struct pmap ofw_pmap;
 struct bat ofw_battable[BAT_VA2IDX(0x)+1];
 
-char bootpath[256];
+char bootpath[256] = "";
 char model_name[64];
 #if NKSYMS || defined(DDB) || defined(MODULAR)
 void *startsym, *endsym;
@@ -165,7 +165,10 @@ ofwoea_initppc(u_int startkernel, u_int 
 			while (*args)
 BOOT_FLAG(*args++, boothowto);
 		}
-	} else {
+	}
+
+	/* if bootpath is still empty, get it from /chosen */
+	if (bootpath[0] == 0) {
 		int chs = OF_finddevice("/chosen");
 		int len;
 



CVS commit: src/sys/arch/powerpc/oea

2024-05-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue May 28 11:06:07 UTC 2024

Modified Files:
src/sys/arch/powerpc/oea: ofwoea_machdep.c

Log Message:
- initialize bootpath
- if we don't get anything useful from args, check /chosen
now my G5 finds its boot device even when netbooting a kernel directly


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/powerpc/oea/ofwoea_machdep.c

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



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2024-05-13 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Mon May 13 10:13:11 UTC 2024

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_accel.c
cg14_driver.c

Log Message:
support 16bit colour
This requires kernel support, which was committed yesterday.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
cvs rdiff -u -r1.21 -r1.22 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.32 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.33
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c:1.32	Wed May 11 21:13:13 2022
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c	Mon May 13 10:13:10 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: cg14_accel.c,v 1.32 2022/05/11 21:13:13 macallan Exp $ */
+/* $NetBSD: cg14_accel.c,v 1.33 2024/05/13 10:13:10 macallan Exp $ */
 /*
  * Copyright (c) 2013 Michael Lorenz
  * All rights reserved.
@@ -68,6 +68,7 @@ int src_formats[] = {PICT_a8r8g8b8, PICT
 int tex_formats[] = {PICT_a8r8g8b8, PICT_a8b8g8r8, PICT_a8};
 
 static void CG14Copy32(PixmapPtr, int, int, int, int, int, int);
+static void CG14Copy16(PixmapPtr, int, int, int, int, int, int);
 static void CG14Copy8(PixmapPtr, int, int, int, int, int, int);
 
 static inline void
@@ -121,6 +122,9 @@ CG14PrepareCopy(PixmapPtr pSrcPixmap, Pi
 		case 8:
 			p->pExa->Copy = CG14Copy8;
 			break;
+		case 16:
+			p->pExa->Copy = CG14Copy16;
+			break;
 		case 32:
 			p->pExa->Copy = CG14Copy32;
 			break;
@@ -610,6 +614,13 @@ CG14Copy8_short_norop(Cg14Ptr p, int src
 }
 
 static void
+CG14Copy16(PixmapPtr pDstPixmap,
+ int srcX, int srcY, int dstX, int dstY, int w, int h)
+{
+	CG14Copy8(pDstPixmap, srcX << 1, srcY, dstX << 1, dstY, w << 1, h);
+}
+
+static void
 CG14Copy8(PixmapPtr pDstPixmap,
  int srcX, int srcY, int dstX, int dstY, int w, int h)
 {
@@ -896,10 +907,12 @@ CG14PrepareSolid(PixmapPtr pPixmap, int 
 			fg = 0x;
 			break;
 	}
-	/* repeat the colour in every sub byte if we're in 8 bit */
+	/* repeat the colour in every sub byte if we're in 8 or 16 bit */
 	if (pPixmap->drawable.bitsPerPixel == 8) {
 		fg |= fg << 8;
 		fg |= fg << 16;
+	} else if (pPixmap->drawable.bitsPerPixel == 16) {
+		fg |= fg << 16;
 	}
 	write_sx_reg(p, SX_QUEUED(8), fg);
 	write_sx_reg(p, SX_QUEUED(9), fg);
@@ -974,6 +987,90 @@ CG14Solid32(Cg14Ptr p, uint32_t start, u
 }
 
 static void
+CG14Solid16(Cg14Ptr p, uint32_t start, uint32_t pitch, int w, int h)
+{
+	int line, num, pre, cnt;
+	uint32_t ptr;
+
+	ENTER;
+	pre = start & 2;
+	if (pre != 0) pre = 1;
+
+	if (p->last_rop == 0xcc) {
+		/* simple fill */
+		for (line = 0; line < h; line++) {
+			ptr = start;
+			cnt = w;
+			if (pre) {
+sxm(SX_STW, ptr, 8, 0);
+ptr += 2;
+cnt -= 1;
+if (cnt == 0) goto next;
+			}
+			/* now do the aligned pixels in 32bit chunks */
+			if (ptr & 3) xf86Msg(X_ERROR, "%s %x\n", __func__, ptr);
+			while(cnt > 1) {
+num = min(32, cnt >> 1);
+sxm(SX_STS, ptr, 8, num - 1);
+ptr += num << 2;
+cnt -= num << 1;
+			}
+			if (cnt > 1) xf86Msg(X_ERROR, "%s cnt %d\n", __func__, cnt);
+			if (cnt > 0) {
+sxm(SX_STW, ptr, 8, 0);
+			}
+next:
+			start += pitch;
+		}
+	} else if (p->last_rop == 0xaa) {
+		/* nothing to do here */
+		return;
+	} else {
+		/* alright, let's do actual ROP stuff */
+
+		/* first repeat the fill colour into 16 registers */
+		sxi(SX_SELECT_S, 8, 8, 10, 15);
+
+		for (line = 0; line < h; line++) {
+			ptr = start;
+			cnt = w;
+			pre = min(pre, cnt);
+			if (pre) {
+sxm(SX_LDW, ptr, 26, 0);
+sxi(SX_ROP, 10, 26, 42, 0);
+sxm(SX_STW, ptr, 42, 0);
+ptr += 2;
+cnt -= 1;
+if (cnt == 0) goto next2;
+			}
+			/* now do the aligned pixels in 32bit chunks */
+			if (ptr & 3) xf86Msg(X_ERROR, "%s %x\n", __func__, ptr);
+			while(cnt > 1) {
+num = min(32, cnt >> 1);
+sxm(SX_LD, ptr, 26, num - 1);
+if (num <= 16) {
+	sxi(SX_ROP, 10, 26, 58, num - 1);
+} else {
+	sxi(SX_ROP, 10, 26, 58, 15);
+	sxi(SX_ROP, 10, 42, 74, num - 17);
+}
+sxm(SX_ST, ptr, 58, num - 1);
+ptr += num << 2;
+cnt -= num << 1;
+			}
+			if (cnt > 1) xf86Msg(X_ERROR, "%s cnt %d\n", __func__, cnt);
+			if (cnt > 0) {
+sxm(SX_LDW, ptr, 26, 0);
+sxi(SX_ROP, 10, 26, 42, 0);
+sxm(SX_STW, ptr, 42, 0);
+			}
+next2:
+			start += pitch;
+		}
+	}
+}
+
+static void
 CG14Solid8(Cg14Ptr p, uint32_t start, uint32_t pitch, int w, int h)
 {
 	int line, num, pre, cnt;
@@ -1078

CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2024-05-13 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Mon May 13 10:13:11 UTC 2024

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_accel.c
cg14_driver.c

Log Message:
support 16bit colour
This requires kernel support, which was committed yesterday.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_accel.c
cvs rdiff -u -r1.21 -r1.22 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c

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



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

2024-05-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun May 12 13:43:27 UTC 2024

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
add simple 16bit load and store ops


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sparc/dev/sxreg.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/sparc/dev/sxreg.h
diff -u src/sys/arch/sparc/dev/sxreg.h:1.21 src/sys/arch/sparc/dev/sxreg.h:1.22
--- src/sys/arch/sparc/dev/sxreg.h:1.21	Fri Dec 10 20:36:03 2021
+++ src/sys/arch/sparc/dev/sxreg.h	Sun May 12 13:43:27 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxreg.h,v 1.21 2021/12/10 20:36:03 andvar Exp $	*/
+/*	$NetBSD: sxreg.h,v 1.22 2024/05/12 13:43:27 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -195,6 +195,8 @@
 SX_LONG | (dreg << 7) | (o))
 #define SX_LDB(dreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_LOAD | \
 SX_UBYTE_0 | (dreg << 7) | (o))
+#define SX_LDW(dreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_LOAD | \
+SX_USHORT_0 | (dreg << 7) | (o))
 #define SX_LDP(dreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_LOAD | \
 SX_PACKED | (dreg << 7) | (o))
 #define SX_LDUQ0(dreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_LOAD | \
@@ -223,6 +225,8 @@
 SX_UBYTE_0 | (sreg << 7) | (o))
 #define SX_STBC(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE_CLAMP | \
 SX_UBYTE_0 | (sreg << 7) | (o))
+#define SX_STW(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE | \
+SX_USHORT_0 | (sreg << 7) | (o))
 #define SX_STP(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE | \
 SX_PACKED | (sreg << 7) | (o))
 #define SX_STPS(sreg, cnt, o) (0x8000 | ((cnt) << 23) | SX_STORE_SELECT | \



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

2024-05-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun May 12 13:43:27 UTC 2024

Modified Files:
src/sys/arch/sparc/dev: sxreg.h

Log Message:
add simple 16bit load and store ops


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/sparc/dev/sxreg.h

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



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

2024-05-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun May 12 11:48:05 UTC 2024

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
support 16bit / RGB565 colour


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.97 src/sys/arch/sparc/dev/cgfourteen.c:1.98
--- src/sys/arch/sparc/dev/cgfourteen.c:1.97	Wed Apr 24 11:49:58 2024
+++ src/sys/arch/sparc/dev/cgfourteen.c	Sun May 12 11:48:05 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.97 2024/04/24 11:49:58 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.98 2024/05/12 11:48:05 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -385,6 +385,7 @@ cgfourteenattach(device_t parent, device
 
 	/* Attach to /dev/fb */
 	fb_attach(>sc_fb, isconsole);
+
 }
 
 /*
@@ -493,6 +494,7 @@ cgfourteenioctl(dev_t dev, u_long cmd, v
 			return EINVAL;
 
 		cg14_set_depth(sc, depth);
+		cg14_init_cmap(sc);
 		}
 		break;
 	default:
@@ -608,7 +610,8 @@ cgfourteenpoll(dev_t dev, int events, st
 static void
 cg14_init(struct cgfourteen_softc *sc)
 {
-	cg14_set_depth(sc, 32);
+	cg14_set_depth(sc, 32);	
+	cg14_init_cmap(sc);
 }
 
 static void
@@ -616,6 +619,7 @@ static void
 cg14_reset(struct cgfourteen_softc *sc)
 {
 	cg14_set_depth(sc, 8);
+	cg14_init_cmap(sc);
 }
 
 /* Enable/disable video display; power down monitor if DPMS-capable */
@@ -736,7 +740,9 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 		WSSCREEN_RESIZE,
 		NULL
 	};
+
 	cg14_set_depth(sc, 8);
+
 	sc->sc_screens[0] = >sc_defaultscreen_descr;
 	sc->sc_screenlist = (struct wsscreen_list){1, sc->sc_screens};
 	sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
@@ -753,45 +759,50 @@ cg14_setup_wsdisplay(struct cgfourteen_s
 	sc->sc_gc.gc_rectfill = cg14_rectfill_a;
 	sc->sc_gc.gc_rop = 0xc;
 
-		vcons_init_screen(>sc_vd, >sc_console_screen, 1,
-		);
+	vcons_init_screen(>sc_vd, >sc_console_screen, 1,
+	);
+
+	/* clear the screen with the default background colour */
+	if (sc->sc_sx != NULL) {
+		cg14_rectfill(sc, 0, 0, ri->ri_width, ri->ri_height,
+			ri->ri_devcmap[(defattr >> 16) & 0xf]);
+	} else {
+		memset(sc->sc_fb.fb_pixels,
+		   ri->ri_devcmap[(defattr >> 16) & 0xf],
+		   ri->ri_stride * ri->ri_height);
+	}
+	sc->sc_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC;
+
+	sc->sc_defaultscreen_descr.textops = >ri_ops;
+	sc->sc_defaultscreen_descr.capabilities = ri->ri_caps;
+	sc->sc_defaultscreen_descr.nrows = ri->ri_rows;
+	sc->sc_defaultscreen_descr.ncols = ri->ri_cols;
+	glyphcache_init_align(>sc_gc, sc->sc_fb.fb_type.fb_height + 5,
+		(sc->sc_vramsize / sc->sc_fb.fb_type.fb_width) - 
+		 sc->sc_fb.fb_type.fb_height - 5,
+		sc->sc_fb.fb_type.fb_width,
+		ri->ri_font->fontwidth,
+		ri->ri_font->fontheight,
+		defattr, 4);
 
-		/* clear the screen with the default background colour */
-		if (sc->sc_sx != NULL) {
-			cg14_rectfill(sc, 0, 0, ri->ri_width, ri->ri_height,
-ri->ri_devcmap[(defattr >> 16) & 0xf]);
-		} else {
-			memset(sc->sc_fb.fb_pixels,
-			   ri->ri_devcmap[(defattr >> 16) & 0xf],
-			   ri->ri_stride * ri->ri_height);
-		}
-		sc->sc_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC;
-
-		sc->sc_defaultscreen_descr.textops = >ri_ops;
-		sc->sc_defaultscreen_descr.capabilities = ri->ri_caps;
-		sc->sc_defaultscreen_descr.nrows = ri->ri_rows;
-		sc->sc_defaultscreen_descr.ncols = ri->ri_cols;
-		glyphcache_init_align(>sc_gc, sc->sc_fb.fb_type.fb_height + 5,
-			(sc->sc_vramsize / sc->sc_fb.fb_type.fb_width) - 
-			 sc->sc_fb.fb_type.fb_height - 5,
-			sc->sc_fb.fb_type.fb_width,
-			ri->ri_font->fontwidth,
-			ri->ri_font->fontheight,
-			defattr, 4);
 	if (is_cons) {
 		wsdisplay_cnattach(>sc_defaultscreen_descr, ri, 0, 0,
 		defattr);
 		vcons_replay_msgbuf(>sc_console_screen);
 	}
 
-	cg14_init_cmap(sc);
-
 	aa.console = is_cons;
 	aa.scrdata = >sc_screenlist;
 	aa.accessops = _accessops;
 	aa.accesscookie = >sc_vd;
 
 	config_found(sc->sc_dev, , wsemuldisplaydevprint, CFARGS_NONE);
+
+	/*
+	 * do this here since any output through firmware calls will mess
+	 * with XLUT settings
+	 */
+	cg14_init_cmap(sc);
 }
 
 static void
@@ -799,18 +810,74 @@ cg14_init_cmap(struct cgfourteen_softc *
 {
 	struct rasops_info *ri = >sc_console_screen.scr_ri;
 	int i, j = 0;
+	uint32_t r, g, b, c;
 	uint8_t cmap[768];
 
-	rasops_get_cmap(ri, cmap, sizeof(cmap));
-
-	for (i = 0; i < 256; i++) {
-
-		sc->sc_cmap.cm_map[i][3] = cmap[j];
-		sc->sc_cmap.cm_map[i][2] = cmap[j + 1];
-		sc->sc_cmap.cm_map[i][1] = cmap[j + 2];
-		j += 3;
+	if (sc->sc_depth == 16) {
+		/* construct an R5G6B5 palette in CLUT1/2 */
+		for (i = 0; i < 0x100; i++) {
+			/* upper byte first */
+			r = (i & 0xf8);	/* red component */
+			r |= r >> 5;		/* fill lower bits so 0xf8 */
+			c = 0x4000 | r;	/* becomes 0xff */
+			g = i 

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

2024-05-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun May 12 11:48:05 UTC 2024

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
support 16bit / RGB565 colour


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/sparc/dev/cgfourteen.c

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



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

2024-05-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun May 12 07:22:13 UTC 2024

Modified Files:
src/sys/arch/sparc/dev: cgfourteenreg.h

Log Message:
moar registers
in particular, document XLUT bits


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sparc/dev/cgfourteenreg.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/sparc/dev/cgfourteenreg.h
diff -u src/sys/arch/sparc/dev/cgfourteenreg.h:1.7 src/sys/arch/sparc/dev/cgfourteenreg.h:1.8
--- src/sys/arch/sparc/dev/cgfourteenreg.h:1.7	Sat Jun 12 21:25:56 2010
+++ src/sys/arch/sparc/dev/cgfourteenreg.h	Sun May 12 07:22:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteenreg.h,v 1.7 2010/06/12 21:25:56 macallan Exp $ */
+/*	$NetBSD: cgfourteenreg.h,v 1.8 2024/05/12 07:22:13 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -91,6 +91,39 @@ struct cg14ctl {
 #define CG14_RSR_REVMASK	0xf0 		/*  mask to get revision */
 #define CG14_RSR_IMPLMASK	0x0f		/*  mask to get impl. code */
 	volatile uint8_t	ctl_ccr;	/* clock control register */
+#define CCR_SCL		0x01
+#define CCR_SDA		0x02
+#define CCR_SDA_DIR	0x04
+#define CCR_ASXSEL	0x08	/* the ICS1562 has 4 data/address lines and a */
+#define CCR_DATA	0xf0	/* toggle input - I suspect this is it */
+	volatile uint32_t	ctl_tmr;	/* test mode readback */
+	volatile uint8_t	ctl_mod;	/* monitor data register */
+	/* reads 0x4 on mine, other bits in the lower half can be written with
+	   no obvious effect ( I suspect monitor ID ), upper half is hard zero 
+	 */
+	volatile uint8_t	ctl_acr;	/* aux control register */	
+#define ACR_BYTE_PIXEL	0x01	/* if unset pixels are 32bit */
+/* other bits are hard zero */	
+uint8_t 	m_pad0[6];  /* Reserved */
+uint16_t	m_hct;  /* Horizontal Counter   */
+uint16_t	m_vct;  /* Vertical Counter */
+uint16_t	m_hbs;  /* Horizontal Blank Start   */
+uint16_t	m_hbc;  /* Horizontal Blank Clear   */
+uint16_t	m_hss;  /* Horizontal Sync Set  */
+uint16_t	m_hsc;  /* Horizontal Sync Set  */
+uint16_t	m_csc;  /* Composite sync clear */
+uint16_t	m_vbs;  /* Vertical blank start */
+uint16_t	m_vbc;  /* Vertical Blank Clear */
+uint16_t	m_vss;  /* Verical Sync Set */
+uint16_t	m_vsc;  /* Verical Sync Clear   */
+uint16_t	m_xcs;  /* XXX Gone in VSIMM 2 */
+uint16_t	m_xcc;  /* XXX Gone in VSIMM 2 */
+uint16_t	m_fsa;  /* Fault status address */
+uint16_t	m_adr;  /* Address register (autoincrements) */
+uint8_t		m_pad2[0xce];   /* Reserved */
+
+/* PCG registers */
+uint8_t		m_pcg[0x100];   /* Pixel Clock generator regs   */
 	/* XXX etc. */
 };
 
@@ -134,6 +167,35 @@ struct cg14xlut {
 	volatile uint8_t	xlut_lutincd[CG14_CLUT_SIZE];
 };
 
+/* 
+ * The XLUT and ctl_ppr bits are the same - in 8bit ppr is used, in 16bit and
+ * 24bit XLUT
+ * here we select two colours, either RGB or a component passed through a
+ * CLUT, and blend them together. The alpha value is taken from the right 
+ * source's CLUT's upper byte, with 0x80 being 1.0 and 0x00 being 0.0
+*/
+
+#define CG14_LEFT_PASSTHROUGH	0x00
+#define CG14_LEFT_CLUT1		0x40
+#define CG14_LEFT_CLUT2		0x80
+#define CG14_LEFT_CLUT3		0xc0
+
+#define CG14_RIGHT_PASSTHROUGH	0x00
+#define CG14_RIGHT_CLUT1	0x10
+#define CG14_RIGHT_CLUT2	0x20
+#define CG14_RIGHT_CLUT3	0x30
+
+/* 0 is passthrough again */
+#define CG14_LEFT_B   0x04
+#define CG14_LEFT_G   0x08
+#define CG14_LEFT_R   0x0c
+
+/* except here 0 selects the X channel */
+#define CG14_RIGHT_X  0x00
+#define CG14_RIGHT_B  0x01
+#define CG14_RIGHT_G  0x02
+#define CG14_RIGHT_R  0x03
+
 /* Color Look-Up Table (CLUT) */
 struct cg14clut {
 	volatile uint32_t	clut_lut[CG14_CLUT_SIZE];	/* the LUT */



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

2024-05-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun May 12 07:22:13 UTC 2024

Modified Files:
src/sys/arch/sparc/dev: cgfourteenreg.h

Log Message:
moar registers
in particular, document XLUT bits


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sparc/dev/cgfourteenreg.h

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



CVS commit: src/distrib/sets/lists/base32

2024-05-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon May  6 06:06:41 UTC 2024

Modified Files:
src/distrib/sets/lists/base32: md.sparc64

Log Message:
sprinkle rump, gcc=12 etc.
Now sparc64 with HAVE_GCC=12 and MKRUMP=no builds again


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/base32/md.sparc64

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

Modified files:

Index: src/distrib/sets/lists/base32/md.sparc64
diff -u src/distrib/sets/lists/base32/md.sparc64:1.3 src/distrib/sets/lists/base32/md.sparc64:1.4
--- src/distrib/sets/lists/base32/md.sparc64:1.3	Tue Apr 16 19:15:36 2024
+++ src/distrib/sets/lists/base32/md.sparc64	Mon May  6 06:06:40 2024
@@ -1,4 +1,4 @@
-# $NetBSD: md.sparc64,v 1.3 2024/04/16 19:15:36 christos Exp $
+# $NetBSD: md.sparc64,v 1.4 2024/05/06 06:06:40 macallan Exp $
 ./lib/sparc	base-compat-shlib	compat
 ./lib/sparc/npf	base-compat-shlib	compat,npf
 ./lib/sparc/npf/ext_log.so			base-compat-shlib	compat,npf
@@ -88,8 +88,10 @@
 ./usr/lib/sparc/libarchive.so.5			base-compat-shlib	compat
 ./usr/lib/sparc/libarchive.so.5.0		base-compat-shlib	compat
 ./usr/lib/sparc/libasan.so			base-compat-shlib	compat,gcc,cxx
-./usr/lib/sparc/libasan.so.5			base-compat-shlib	compat,gcc,cxx
-./usr/lib/sparc/libasan.so.5.0			base-compat-shlib	compat,gcc,cxx
+./usr/lib/sparc/libasan.so.5			base-compat-shlib	compat,gcc=10,cxx
+./usr/lib/sparc/libasan.so.5.0			base-compat-shlib	compat,gcc=10,cxx
+./usr/lib/sparc/libasan.so.6			base-compat-shlib	compat,gcc=12,cxx
+./usr/lib/sparc/libasan.so.6.0			base-compat-shlib	compat,gcc=12,cxx
 ./usr/lib/sparc/libasn1.so			base-compat-shlib	compat,kerberos
 ./usr/lib/sparc/libasn1.so.10			base-compat-shlib	compat,kerberos
 ./usr/lib/sparc/libasn1.so.10.0			base-compat-shlib	compat,kerberos
@@ -199,7 +201,8 @@
 ./usr/lib/sparc/libgnumalloc.so.1.0		base-compat-shlib	compat
 ./usr/lib/sparc/libgomp.so			base-compat-shlib	compat,gcc
 ./usr/lib/sparc/libgomp.so.2			base-compat-shlib	compat,gcc
-./usr/lib/sparc/libgomp.so.2.1			base-compat-shlib	compat,gcc
+./usr/lib/sparc/libgomp.so.2.1			base-compat-shlib	compat,gcc=10
+./usr/lib/sparc/libgomp.so.2.2			base-compat-shlib	compat,gcc=12
 ./usr/lib/sparc/libgssapi.so			base-compat-shlib	compat,kerberos
 ./usr/lib/sparc/libgssapi.so.12			base-compat-shlib	compat,kerberos
 ./usr/lib/sparc/libgssapi.so.12.0		base-compat-shlib	compat,kerberos
@@ -270,8 +273,10 @@
 ./usr/lib/sparc/libldap_r.so.6			base-compat-shlib	compat,ldap
 ./usr/lib/sparc/libldap_r.so.6.0		base-compat-shlib	compat,ldap
 ./usr/lib/sparc/liblsan.so			base-compat-shlib	compat,cxx,gcc
-./usr/lib/sparc/liblsan.so.2			base-compat-shlib	compat,cxx,gcc
-./usr/lib/sparc/liblsan.so.2.0			base-compat-shlib	compat,cxx,gcc
+./usr/lib/sparc/liblsan.so.2			base-compat-shlib	compat,cxx,gcc=10
+./usr/lib/sparc/liblsan.so.2.0			base-compat-shlib	compat,cxx,gcc=10
+./usr/lib/sparc/liblsan.so.3			base-compat-shlib	compat,cxx,gcc=12
+./usr/lib/sparc/liblsan.so.3.0			base-compat-shlib	compat,cxx,gcc=12
 ./usr/lib/sparc/liblua.so			base-compat-shlib	compat
 ./usr/lib/sparc/liblua.so.6			base-compat-shlib	compat
 ./usr/lib/sparc/liblua.so.6.1			base-compat-shlib	compat
@@ -314,9 +319,9 @@
 ./usr/lib/sparc/libossaudio.so			base-compat-shlib	compat
 ./usr/lib/sparc/libossaudio.so.1		base-compat-shlib	compat
 ./usr/lib/sparc/libossaudio.so.1.1		base-compat-shlib	compat
-./usr/lib/sparc/libp2k.so			base-compat-shlib	compat
-./usr/lib/sparc/libp2k.so.2			base-compat-shlib	compat
-./usr/lib/sparc/libp2k.so.2.0			base-compat-shlib	compat
+./usr/lib/sparc/libp2k.so			base-compat-shlib	compat,rump
+./usr/lib/sparc/libp2k.so.2			base-compat-shlib	compat,rump
+./usr/lib/sparc/libp2k.so.2.0			base-compat-shlib	compat,rump
 ./usr/lib/sparc/libpam.so			base-compat-shlib	compat
 ./usr/lib/sparc/libpam.so.4			base-compat-shlib	compat
 ./usr/lib/sparc/libpam.so.4.1			base-compat-shlib	compat
@@ -418,7 +423,8 @@
 ./usr/lib/sparc/libssl.so.15.0			base-compat-shlib	compat
 ./usr/lib/sparc/libstdc++.so			base-compat-shlib	compat,gcc,cxx,libstdcxx
 ./usr/lib/sparc/libstdc++.so.9			base-compat-shlib	compat,gcc,cxx,libstdcxx
-./usr/lib/sparc/libstdc++.so.9.0		base-compat-shlib	compat,gcc,cxx,libstdcxx
+./usr/lib/sparc/libstdc++.so.9.0		base-compat-shlib	compat,gcc=10,cxx,libstdcxx
+./usr/lib/sparc/libstdc++.so.9.1		base-compat-shlib	compat,gcc=12,cxx,libstdcxx
 ./usr/lib/sparc/libtermcap.so			base-compat-shlib	compat
 ./usr/lib/sparc/libtermcap.so.0			base-compat-shlib	compat
 ./usr/lib/sparc/libtermcap.so.0.6		base-compat-shlib	compat
@@ -432,11 +438,13 @@
 ./usr/lib/sparc/libtre.so.0			base-compat-shlib	compat
 ./usr/lib/sparc/libtre.so.0.8			base-compat-shlib	compat
 ./usr/lib/sparc/libubsan.so			base-compat-shlib	compat,gcc,cxx
-./usr/lib/sparc/libubsan.so.4			base-compat-shlib	compat,gcc,cxx
-./usr/lib/sparc/libubsan.so.4.0			base-compat-shlib	compat,gcc,cxx

CVS commit: src/distrib/sets/lists/base32

2024-05-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon May  6 06:06:41 UTC 2024

Modified Files:
src/distrib/sets/lists/base32: md.sparc64

Log Message:
sprinkle rump, gcc=12 etc.
Now sparc64 with HAVE_GCC=12 and MKRUMP=no builds again


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/base32/md.sparc64

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



CVS commit: src/distrib/sets/lists/base32

2024-04-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Apr 30 01:18:40 UTC 2024

Modified Files:
src/distrib/sets/lists/base32: md.amd64

Log Message:
sprinkle gcc=12 and rump attributes


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/distrib/sets/lists/base32/md.amd64

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

Modified files:

Index: src/distrib/sets/lists/base32/md.amd64
diff -u src/distrib/sets/lists/base32/md.amd64:1.5 src/distrib/sets/lists/base32/md.amd64:1.6
--- src/distrib/sets/lists/base32/md.amd64:1.5	Tue Apr 16 19:15:36 2024
+++ src/distrib/sets/lists/base32/md.amd64	Tue Apr 30 01:18:40 2024
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.5 2024/04/16 19:15:36 christos Exp $
+# $NetBSD: md.amd64,v 1.6 2024/04/30 01:18:40 macallan Exp $
 ./lib/i386	base-compat-shlib	compat
 ./lib/i386/npf	base-compat-shlib	compat,npf
 ./lib/i386/npf/ext_log.so			base-compat-shlib	compat,npf
@@ -88,8 +88,10 @@
 ./usr/lib/i386/libarchive.so.5			base-compat-shlib	compat
 ./usr/lib/i386/libarchive.so.5.0		base-compat-shlib	compat
 ./usr/lib/i386/libasan.so			base-compat-shlib	compat,gcc,cxx
-./usr/lib/i386/libasan.so.5			base-compat-shlib	compat,gcc,cxx
-./usr/lib/i386/libasan.so.5.0			base-compat-shlib	compat,gcc,cxx
+./usr/lib/i386/libasan.so.5			base-compat-shlib	compat,gcc=10,cxx
+./usr/lib/i386/libasan.so.5.0			base-compat-shlib	compat,gcc=10,cxx
+./usr/lib/i386/libasan.so.6			base-compat-shlib	compat,gcc=12,cxx
+./usr/lib/i386/libasan.so.6.0			base-compat-shlib	compat,gcc=12,cxx
 ./usr/lib/i386/libasn1.so			base-compat-shlib	compat,kerberos
 ./usr/lib/i386/libasn1.so.10			base-compat-shlib	compat,kerberos
 ./usr/lib/i386/libasn1.so.10.0			base-compat-shlib	compat,kerberos
@@ -205,7 +207,8 @@
 ./usr/lib/i386/libgnumalloc.so.1.0		base-compat-shlib	compat
 ./usr/lib/i386/libgomp.so			base-compat-shlib	compat,gcc
 ./usr/lib/i386/libgomp.so.2			base-compat-shlib	compat,gcc
-./usr/lib/i386/libgomp.so.2.1			base-compat-shlib	compat,gcc
+./usr/lib/i386/libgomp.so.2.1			base-compat-shlib	compat,gcc=10
+./usr/lib/i386/libgomp.so.2.2			base-compat-shlib	compat,gcc=12
 ./usr/lib/i386/libgssapi.so			base-compat-shlib	compat,kerberos
 ./usr/lib/i386/libgssapi.so.12			base-compat-shlib	compat,kerberos
 ./usr/lib/i386/libgssapi.so.12.0		base-compat-shlib	compat,kerberos
@@ -280,8 +283,10 @@
 ./usr/lib/i386/libldap_r.so.6			base-compat-shlib	compat,ldap
 ./usr/lib/i386/libldap_r.so.6.0			base-compat-shlib	compat,ldap
 ./usr/lib/i386/liblsan.so			base-compat-shlib	compat,cxx,gcc
-./usr/lib/i386/liblsan.so.2			base-compat-shlib	compat,cxx,gcc
-./usr/lib/i386/liblsan.so.2.0			base-compat-shlib	compat,cxx,gcc
+./usr/lib/i386/liblsan.so.2			base-compat-shlib	compat,cxx,gcc=10
+./usr/lib/i386/liblsan.so.2.0			base-compat-shlib	compat,cxx,gcc=10
+./usr/lib/i386/liblsan.so.3			base-compat-shlib	compat,cxx,gcc=12
+./usr/lib/i386/liblsan.so.3.0			base-compat-shlib	compat,cxx,gcc=12
 ./usr/lib/i386/liblua.so			base-compat-shlib	compat
 ./usr/lib/i386/liblua.so.6			base-compat-shlib	compat
 ./usr/lib/i386/liblua.so.6.1			base-compat-shlib	compat
@@ -324,9 +329,9 @@
 ./usr/lib/i386/libossaudio.so			base-compat-shlib	compat
 ./usr/lib/i386/libossaudio.so.1			base-compat-shlib	compat
 ./usr/lib/i386/libossaudio.so.1.1		base-compat-shlib	compat
-./usr/lib/i386/libp2k.so			base-compat-shlib	compat
-./usr/lib/i386/libp2k.so.2			base-compat-shlib	compat
-./usr/lib/i386/libp2k.so.2.0			base-compat-shlib	compat
+./usr/lib/i386/libp2k.so			base-compat-shlib	compat,rump
+./usr/lib/i386/libp2k.so.2			base-compat-shlib	compat,rump
+./usr/lib/i386/libp2k.so.2.0			base-compat-shlib	compat,rump
 ./usr/lib/i386/libpam.so			base-compat-shlib	compat
 ./usr/lib/i386/libpam.so.4			base-compat-shlib	compat
 ./usr/lib/i386/libpam.so.4.1			base-compat-shlib	compat
@@ -428,7 +433,8 @@
 ./usr/lib/i386/libssl.so.15.0			base-compat-shlib	compat
 ./usr/lib/i386/libstdc++.so			base-compat-shlib	compat,gcc,cxx,libstdcxx
 ./usr/lib/i386/libstdc++.so.9			base-compat-shlib	compat,gcc,cxx,libstdcxx
-./usr/lib/i386/libstdc++.so.9.0			base-compat-shlib	compat,gcc,cxx,libstdcxx
+./usr/lib/i386/libstdc++.so.9.0			base-compat-shlib	compat,gcc=10,cxx,libstdcxx
+./usr/lib/i386/libstdc++.so.9.1			base-compat-shlib	compat,gcc=12,cxx,libstdcxx
 ./usr/lib/i386/libtermcap.so			base-compat-shlib	compat
 ./usr/lib/i386/libtermcap.so.0			base-compat-shlib	compat
 ./usr/lib/i386/libtermcap.so.0.6		base-compat-shlib	compat
@@ -442,11 +448,13 @@
 ./usr/lib/i386/libtre.so.0			base-compat-shlib	compat
 ./usr/lib/i386/libtre.so.0.8			base-compat-shlib	compat
 ./usr/lib/i386/libubsan.so			base-compat-shlib	compat,gcc,cxx
-./usr/lib/i386/libubsan.so.4			base-compat-shlib	compat,gcc,cxx
-./usr/lib/i386/libubsan.so.4.0			base-compat-shlib	compat,gcc,cxx
-./usr/lib/i386/libukfs.so			base-compat-shlib	compat
-./usr/lib/i386/libukfs.so.1			base-compat-shlib	compat
-./usr/lib/i386/libukfs.so.1.0		

CVS commit: src/distrib/sets/lists/base32

2024-04-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Apr 30 01:18:40 UTC 2024

Modified Files:
src/distrib/sets/lists/base32: md.amd64

Log Message:
sprinkle gcc=12 and rump attributes


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/distrib/sets/lists/base32/md.amd64

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



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

2024-04-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Apr 24 11:49:58 UTC 2024

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
allow userland to switch to 16bit colour


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.96 src/sys/arch/sparc/dev/cgfourteen.c:1.97
--- src/sys/arch/sparc/dev/cgfourteen.c:1.96	Wed Dec 20 05:33:18 2023
+++ src/sys/arch/sparc/dev/cgfourteen.c	Wed Apr 24 11:49:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.96 2023/12/20 05:33:18 thorpej Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.97 2024/04/24 11:49:58 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -1072,22 +1072,28 @@ cg14_set_depth(struct cgfourteen_softc *
 			CG14_MCTL, CG14_MCTL_ENABLEVID | 
 			CG14_MCTL_PIXMODE_8 | CG14_MCTL_POWERCTL);
 			sc->sc_depth = 8;
-			/* everything is CLUT1 */
-			for (i = 0; i < CG14_CLUT_SIZE; i++)
-			 sc->sc_xlut->xlut_lut[i] = 0;
+			break;
+		case 16:
+			bus_space_write_1(sc->sc_bustag, sc->sc_regh,
+			CG14_MCTL, CG14_MCTL_ENABLEVID | 
+			CG14_MCTL_PIXMODE_16 | CG14_MCTL_POWERCTL);
+			sc->sc_depth = 16;
 			break;
 		case 32:
 			bus_space_write_1(sc->sc_bustag, sc->sc_regh,
 			CG14_MCTL, CG14_MCTL_ENABLEVID | 
 			CG14_MCTL_PIXMODE_32 | CG14_MCTL_POWERCTL);
 			sc->sc_depth = 32;
-			for (i = 0; i < CG14_CLUT_SIZE; i++)
-			 sc->sc_xlut->xlut_lut[i] = 0;
 			break;
 		default:
 			printf("%s: can't change to depth %d\n",
 			device_xname(sc->sc_dev), depth);
+			return;
 	}
+	/* everything is CLUT1 */
+	for (i = 0; i < CG14_CLUT_SIZE; i++)
+	 sc->sc_xlut->xlut_lut[i] = 0;
+
 }
 
 static void
@@ -1432,7 +1438,7 @@ cg14_bitblt_gc(void *cookie, int xs, int
 
 	saddr = sc->sc_fb_paddr + xs + stride * ys;
 	daddr = sc->sc_fb_paddr + xd + stride * yd;
-
+		
 	if (saddr & 3) {
 		swi += saddr & 3;
 		dreg += saddr & 3;



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

2024-04-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Apr 24 11:49:58 UTC 2024

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
allow userland to switch to 16bit colour


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/sparc/dev/cgfourteen.c

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



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2024-04-24 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Apr 24 11:42:06 UTC 2024

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_driver.c

Log Message:
don't enable xrender support unless we have 24bit colour


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.20 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.21
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.20	Sun Jan  8 22:03:02 2023
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c	Wed Apr 24 11:42:06 2024
@@ -395,6 +395,12 @@ CG14PreInit(ScrnInfoPtr pScrn, int flags
 pCg14->use_xrender = xf86ReturnOptValBool(pCg14->Options, OPTION_XRENDER,
 FALSE);
 
+if (pScrn->depth < 24) {
+	if (pCg14->use_xrender)
+	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling xrender on depth < 24\n");
+	pCg14->use_xrender = FALSE;
+}
+
 /*
  * This must happen after pScrn->display has been set because
  * xf86SetWeight references it.



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2024-04-24 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Apr 24 11:42:06 UTC 2024

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14_driver.c

Log Message:
don't enable xrender support unless we have 24bit colour


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c

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



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

2024-04-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Apr 18 04:52:43 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
allow mapping of blitter registers


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hppa/dev/gftfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.13 src/sys/arch/hppa/dev/gftfb.c:1.14
--- src/sys/arch/hppa/dev/gftfb.c:1.13	Mon Apr  1 09:48:58 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Thu Apr 18 04:52:43 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.13 2024/04/01 09:48:58 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.14 2024/04/18 04:52:43 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -237,7 +237,8 @@ gftfb_attach(device_t parent, device_t s
 	}
 	rom = (struct sti_rom *)kmem_zalloc(sizeof(*rom), KM_SLEEP);
 	rom->rom_softc = >sc_base;
-	ret = sti_rom_setup(rom, paa->pa_iot, paa->pa_memt, sc->sc_romh, sc->sc_base.bases, STI_CODEBASE_MAIN);
+	ret = sti_rom_setup(rom, paa->pa_iot, paa->pa_memt, sc->sc_romh,
+	sc->sc_base.bases, STI_CODEBASE_MAIN);
 	if (ret != 0) {
 		kmem_free(rom, sizeof(*rom));
 		return;
@@ -889,16 +890,22 @@ gftfb_mmap(void *v, void *vs, off_t offs
 	struct vcons_data *vd = v;
 	struct gftfb_softc *sc = vd->cookie;
 	struct sti_rom *rom = sc->sc_base.sc_rom;
-	paddr_t pa;
+	paddr_t pa = -1;
 
-	if (offset < 0 || offset >= sc->sc_scr.fblen)
-		return -1;
 
-	if (sc->sc_mode != WSDISPLAYIO_MODE_DUMBFB)
+	if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)
 		return -1;
 
-	pa = bus_space_mmap(rom->memt, sc->sc_scr.fbaddr, offset, prot,
-	BUS_SPACE_MAP_LINEAR);
+	if (offset >= 0 || offset < sc->sc_scr.fblen) {
+		/* framebuffer */
+		pa = bus_space_mmap(rom->memt, sc->sc_scr.fbaddr, offset,
+		prot, BUS_SPACE_MAP_LINEAR);
+	} else if (offset >= 0x8000 && offset < 0x804) {
+		/* blitter registers etc. */
+		pa = bus_space_mmap(rom->memt, rom->regh[2],
+		offset - 0x8000, prot, BUS_SPACE_MAP_LINEAR);
+	}
+
 	return pa;
 }
 



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

2024-04-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Apr 18 04:52:43 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
allow mapping of blitter registers


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

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



CVS commit: src/sys/arch/hppa/hppa

2024-04-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Apr 17 07:47:48 UTC 2024

Modified Files:
src/sys/arch/hppa/hppa: machdep.c

Log Message:
turn LEDs off when shutting down


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/hppa/hppa/machdep.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/hppa/hppa/machdep.c
diff -u src/sys/arch/hppa/hppa/machdep.c:1.20 src/sys/arch/hppa/hppa/machdep.c:1.21
--- src/sys/arch/hppa/hppa/machdep.c:1.20	Tue Mar  5 14:15:32 2024
+++ src/sys/arch/hppa/hppa/machdep.c	Wed Apr 17 07:47:48 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.20 2024/03/05 14:15:32 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.21 2024/04/17 07:47:48 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.20 2024/03/05 14:15:32 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.21 2024/04/17 07:47:48 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -1415,6 +1415,8 @@ cpu_reboot(int howto, char *user_boot_st
 	if (cold_hook)
 		(*cold_hook)(HPPA_COLD_COLD);
 
+	hppa_led_ctl(0xf, 0, 0);
+
 	if (howto & RB_HALT) {
 		if ((howto & RB_POWERDOWN) == RB_POWERDOWN && cold_hook) {
 			printf("Powering off...");



CVS commit: src/sys/arch/hppa/hppa

2024-04-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Apr 17 07:47:48 UTC 2024

Modified Files:
src/sys/arch/hppa/hppa: machdep.c

Log Message:
turn LEDs off when shutting down


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/hppa/hppa/machdep.c

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



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

2024-04-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Apr  1 09:48:58 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
make gftfb_restore_palette() grab the default colour map from rasops instead
of just writing the driver's map into the hardware ( which may have been
modified by the likes of wsfb )
With this we get a readable console even when exiting X in a less than
graceful manner.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hppa/dev/gftfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.12 src/sys/arch/hppa/dev/gftfb.c:1.13
--- src/sys/arch/hppa/dev/gftfb.c:1.12	Thu Mar 28 12:50:31 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Mon Apr  1 09:48:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.12 2024/03/28 12:50:31 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.13 2024/04/01 09:48:58 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -212,8 +212,7 @@ gftfb_attach(device_t parent, device_t s
 	struct rasops_info *ri;
 	struct wsemuldisplaydev_attach_args aa;
 	unsigned long defattr = 0;
-	int ret, is_console = 0, i, j;
-	uint8_t cmap[768];
+	int ret, is_console = 0;
 
 	sc->sc_dev = self;
 
@@ -329,15 +328,7 @@ gftfb_attach(device_t parent, device_t s
 defattr);
 	}
 
-	j = 0;
-	rasops_get_cmap(ri, cmap, sizeof(cmap));
-	for (i = 0; i < 256; i++) {
-		sc->sc_cmap_red[i] = cmap[j];
-		sc->sc_cmap_green[i] = cmap[j + 1];
-		sc->sc_cmap_blue[i] = cmap[j + 2];
-		gftfb_putpalreg(sc, i, cmap[j], cmap[j + 1], cmap[j + 2]);
-		j += 3;
-	}
+	gftfb_restore_palette(sc);
 
 	/* no suspend/resume support yet */
 	if (!pmf_device_register(sc->sc_dev, NULL, NULL))
@@ -1008,11 +999,17 @@ gftfb_getcmap(struct gftfb_softc *sc, st
 static void
 gftfb_restore_palette(struct gftfb_softc *sc)
 {
-	int i;
+	uint8_t cmap[768];
+	int i, j;
 
+	j = 0;
+	rasops_get_cmap(>sc_console_screen.scr_ri, cmap, sizeof(cmap));
 	for (i = 0; i < 256; i++) {
-		gftfb_putpalreg(sc, i, sc->sc_cmap_red[i],
-		sc->sc_cmap_green[i], sc->sc_cmap_blue[i]);
+		sc->sc_cmap_red[i] = cmap[j];
+		sc->sc_cmap_green[i] = cmap[j + 1];
+		sc->sc_cmap_blue[i] = cmap[j + 2];
+		gftfb_putpalreg(sc, i, cmap[j], cmap[j + 1], cmap[j + 2]);
+		j += 3;
 	}
 }
 



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

2024-04-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Apr  1 09:48:58 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
make gftfb_restore_palette() grab the default colour map from rasops instead
of just writing the driver's map into the hardware ( which may have been
modified by the likes of wsfb )
With this we get a readable console even when exiting X in a less than
graceful manner.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hppa/dev/gftfb.c

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



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

2024-03-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Mar 28 12:50:31 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
For some reason the drawing engine occasionally scribbles past the right
boundary when filling rectangles, especially annoying when we draw whitespaces
As a workaround we draw all rectangles less than 50 pixels wide by drawing
a 50 pixel rectangle into off-screen memory to the right of the visible fb and
then copy the portion we want. Keeps track of the colour and size of the
off-screen rectangle so we can avoid redrawing it whenever possible.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hppa/dev/gftfb.c

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



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

2024-03-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Mar 28 12:50:31 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
For some reason the drawing engine occasionally scribbles past the right
boundary when filling rectangles, especially annoying when we draw whitespaces
As a workaround we draw all rectangles less than 50 pixels wide by drawing
a 50 pixel rectangle into off-screen memory to the right of the visible fb and
then copy the portion we want. Keeps track of the colour and size of the
off-screen rectangle so we can avoid redrawing it whenever possible.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hppa/dev/gftfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.11 src/sys/arch/hppa/dev/gftfb.c:1.12
--- src/sys/arch/hppa/dev/gftfb.c:1.11	Wed Mar 27 09:08:38 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Thu Mar 28 12:50:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.11 2024/03/27 09:08:38 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.12 2024/03/28 12:50:31 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -88,6 +88,7 @@ struct	gftfb_softc {
 #define HW_FB	0
 #define HW_FILL	1
 #define HW_BLIT	2
+	uint32_t sc_rect_colour, sc_rect_height;
 	/* cursor stuff */
 	int sc_cursor_x, sc_cursor_y;
 	int sc_hot_x, sc_hot_y, sc_enabled;
@@ -250,7 +251,9 @@ gftfb_attach(device_t parent, device_t s
 
 	sc->sc_width = sc->sc_scr.scr_cfg.scr_width;
 	sc->sc_height = sc->sc_scr.scr_cfg.scr_height;
-	
+	sc->sc_rect_colour = 0xf000;
+	sc->sc_rect_height = 0;
+
 	aprint_normal_dev(sc->sc_dev, "%s at %dx%d\n", sc->sc_scr.name, 
 	sc->sc_width, sc->sc_height);
 	gftfb_setup(sc);
@@ -687,6 +690,9 @@ gftfb_setup(struct gftfb_softc *sc)
 	sc->sc_enabled = 0;
 	sc->sc_video_on = 1;
 
+	sc->sc_rect_colour = 0xf000;
+	sc->sc_rect_height = 0;
+
 	/* set Bt458 read mask register to all planes */
 	gftfb_wait(sc);
 	ngle_bt458_write(memt, memh, 0x08, 0x04);
@@ -1051,7 +1057,7 @@ gftfb_wait_fifo(struct gftfb_softc *sc, 
 }
 
 static void
-gftfb_rectfill(struct gftfb_softc *sc, int x, int y, int wi, int he,
+gftfb_real_rectfill(struct gftfb_softc *sc, int x, int y, int wi, int he,
 		  uint32_t bg)
 {
 	struct sti_rom *rom = sc->sc_base.sc_rom;
@@ -1081,6 +1087,30 @@ gftfb_rectfill(struct gftfb_softc *sc, i
 
 }
 
+static void
+gftfb_rectfill(struct gftfb_softc *sc, int x, int y, int wi, int he,
+		  uint32_t bg)
+{
+	/*
+	 * For some reason my 4MB VisEG always draws rectangles at least 32
+	 * pixels wide - no idea why, the bitblt command doesn't have this
+	 * problem.
+	 * So, as a workaround, we draw a 50xFontHeight rectangle to the right
+	 * of the visible fb, keep track of the colour so we don't need to
+	 * redraw every time, and bitblt the portion we need
+	 */
+	if (wi < 50) {
+		if ((bg != sc->sc_rect_colour) ||
+		(he > sc->sc_rect_height)) {
+			gftfb_real_rectfill(sc, sc->sc_width + 10, 0, 50, 
+			he, bg);
+			sc->sc_rect_colour = bg;
+			sc->sc_rect_height = he;
+		}
+		gftfb_bitblt(sc, sc->sc_width + 10, 0, x, y, wi, he, RopSrc);
+	} else
+		gftfb_real_rectfill(sc, x, y, wi, he, bg);
+}
 
 static void
 gftfb_bitblt(void *cookie, int xs, int ys, int xd, int yd, int wi,
@@ -1161,9 +1191,8 @@ gftfb_putchar(void *cookie, int row, int
 	struct vcons_screen *scr = ri->ri_hw;
 	struct gftfb_softc *sc = scr->scr_cookie;
 	int x, y, wi, he, rv = GC_NOPE;
-#if 0
 	uint32_t bg;
-#endif
+
 	if (sc->sc_mode != WSDISPLAYIO_MODE_EMUL)
 		return;
 
@@ -1179,20 +1208,14 @@ gftfb_putchar(void *cookie, int row, int
 
 	x = ri->ri_xorigin + col * wi;
 	y = ri->ri_yorigin + row * he;
-#if 0
+
 	bg = ri->ri_devcmap[(attr >> 16) & 0xf];
 
-	/* XXX
-	 * rectfill currently draws rectangles less than 32 pixels wide as
-	 * 32 pixels wide, no idea why. So until I figure that one out we 
-	 * draw blanks by software
-	 * bitblt doesn't seem to have this problem
-	 */
 	if (c == 0x20) {
 		gftfb_rectfill(sc, x, y, wi, he, bg);
 		return;
 	}
-#endif
+
 	rv = glyphcache_try(>sc_gc, c, x, y, attr);
 	if (rv == GC_OK)
 		return;



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

2024-03-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar 27 09:08:38 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
fix brainfart - only update fbi_fbsize, not the size of the visible fb...


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hppa/dev/gftfb.c

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



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

2024-03-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar 27 09:08:38 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
fix brainfart - only update fbi_fbsize, not the size of the visible fb...


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hppa/dev/gftfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.10 src/sys/arch/hppa/dev/gftfb.c:1.11
--- src/sys/arch/hppa/dev/gftfb.c:1.10	Wed Mar 27 06:52:03 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Wed Mar 27 09:08:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.10 2024/03/27 06:52:03 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.11 2024/03/27 09:08:38 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -839,7 +839,6 @@ gftfb_ioctl(void *v, void *vs, u_long cm
 			int ret;
 
 			ret = wsdisplayio_get_fbinfo(>scr_ri, fbi);
-			fbi->fbi_height = sc->sc_scr.fbheight;
 			fbi->fbi_fbsize = sc->sc_scr.fbheight * 2048;
 			return ret;
 		}



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

2024-03-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar 27 06:52:03 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
in gftfb_ioctl():
- identify ourselves as WSDISPLAY_TYPE_STI
- return full fb geometry in WSDISPLAYIO_GET_FBINFO


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hppa/dev/gftfb.c

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



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

2024-03-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar 27 06:52:03 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
in gftfb_ioctl():
- identify ourselves as WSDISPLAY_TYPE_STI
- return full fb geometry in WSDISPLAYIO_GET_FBINFO


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hppa/dev/gftfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.9 src/sys/arch/hppa/dev/gftfb.c:1.10
--- src/sys/arch/hppa/dev/gftfb.c:1.9	Wed Mar  6 08:19:44 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Wed Mar 27 06:52:03 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.9 2024/03/06 08:19:44 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.10 2024/03/27 06:52:03 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -780,7 +780,7 @@ gftfb_ioctl(void *v, void *vs, u_long cm
 
 	switch (cmd) {
 	case WSDISPLAYIO_GTYPE:
-		*(u_int *)data = WSDISPLAY_TYPE_PCIMISC;
+		*(u_int *)data = WSDISPLAY_TYPE_STI;
 		return 0;
 
 	/* PCI config read/write passthrough. */
@@ -834,11 +834,15 @@ gftfb_ioctl(void *v, void *vs, u_long cm
 		return 0;
 
 	case WSDISPLAYIO_GET_FBINFO:
-	{
+		{
 			struct wsdisplayio_fbinfo *fbi = data;
+			int ret;
 
-		return wsdisplayio_get_fbinfo(>scr_ri, fbi);
-	}
+			ret = wsdisplayio_get_fbinfo(>scr_ri, fbi);
+			fbi->fbi_height = sc->sc_scr.fbheight;
+			fbi->fbi_fbsize = sc->sc_scr.fbheight * 2048;
+			return ret;
+		}
 
 	case WSDISPLAYIO_GCURPOS:
 		{



CVS commit: src/sys/arch/hppa/conf

2024-03-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Mar 14 13:18:36 UTC 2024

Modified Files:
src/sys/arch/hppa/conf: GENERIC

Log Message:
add gftfb


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/hppa/conf/GENERIC

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/hppa/conf/GENERIC
diff -u src/sys/arch/hppa/conf/GENERIC:1.43 src/sys/arch/hppa/conf/GENERIC:1.44
--- src/sys/arch/hppa/conf/GENERIC:1.43	Mon Jan 29 18:27:12 2024
+++ src/sys/arch/hppa/conf/GENERIC	Thu Mar 14 13:18:35 2024
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.43 2024/01/29 18:27:12 christos Exp $
+# $NetBSD: GENERIC,v 1.44 2024/03/14 13:18:35 macallan Exp $
 #
 # GENERIC machine description file
 #
@@ -23,7 +23,7 @@ include 	"arch/hppa/conf/std.hppa"
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
 
-#ident 		"GENERIC-$Revision: 1.43 $"
+#ident 		"GENERIC-$Revision: 1.44 $"
 
 maxusers	32		# estimated number of users
 
@@ -283,6 +283,7 @@ sti*	at mainbus0		# [H]CRX-{8,24,48}[Z] 
 sti*	at phantomas?		# [H]CRX-{8,24,48}[Z] and Visualize graphics
 sti*	at uturn?
 sti*	at pci?			# EG-PCI, FX*
+gftfb* 	at pci?			# PCI Visualize EG
 
 # Human Interface Loop
 hil*		at gsc? irq 1	# Human Interface Loop, kbd and mouse
@@ -298,7 +299,9 @@ wskbd*		at pckbd? console ?
 wsmouse*	at pms? mux 0
 wskbd*		at hilkbd? console ?
 wsmouse*	at hilms? mux 0
-wsdisplay*	at sti?
+# make sure the console display is always wsdisplay0
+wsdisplay0	at wsemuldisplaydev? console 1
+wsdisplay*	at wsemuldisplaydev?
 
 # Serial Devices
 



CVS commit: src/sys/arch/hppa/conf

2024-03-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Mar 14 13:18:36 UTC 2024

Modified Files:
src/sys/arch/hppa/conf: GENERIC

Log Message:
add gftfb


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/hppa/conf/GENERIC

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



CVS commit: xsrc/local/programs/bdfload

2024-03-12 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Tue Mar 12 09:42:55 UTC 2024

Modified Files:
xsrc/local/programs/bdfload: bdfload.c

Log Message:
remove accidentally left in debug goop


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 xsrc/local/programs/bdfload/bdfload.c

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



CVS commit: xsrc/local/programs/bdfload

2024-03-12 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Tue Mar 12 09:42:55 UTC 2024

Modified Files:
xsrc/local/programs/bdfload: bdfload.c

Log Message:
remove accidentally left in debug goop


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 xsrc/local/programs/bdfload/bdfload.c

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

Modified files:

Index: xsrc/local/programs/bdfload/bdfload.c
diff -u xsrc/local/programs/bdfload/bdfload.c:1.22 xsrc/local/programs/bdfload/bdfload.c:1.23
--- xsrc/local/programs/bdfload/bdfload.c:1.22	Tue Mar 12 09:36:06 2024
+++ xsrc/local/programs/bdfload/bdfload.c	Tue Mar 12 09:42:55 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bdfload.c,v 1.22 2024/03/12 09:36:06 macallan Exp $	*/
+/*	$NetBSD: bdfload.c,v 1.23 2024/03/12 09:42:55 macallan Exp $	*/
 
 /*
  * Copyright (c) 2018 Michael Lorenz
@@ -520,21 +520,6 @@ interpret(FILE *foo)
 		f.stride = stride;
 		f.data = [first * charsize];
 	}
-if (0) {
-	int i;
-	uint16_t pixbuf[16];
-	double_pixels([charsize * 'Q'], pixbuf, charsize);
-	fill_dup(pixbuf, charsize);
-	for (i = 0; i < charsize * 2; i++) {	
-		printf("%2d: ", i);
-		dump_line((char *)[i], 2); 
-	}
-	smoothe_pixels(pixbuf, charsize * 2);
-	for (i = 0; i < charsize * 2; i++) {	
-		printf("%2d: ", i);
-		dump_line((char *)[i], 2); 
-	}
-}
 
 	if (ofile == NULL) {
 		int fdev = open("/dev/wsfont", O_RDWR, 0);



CVS commit: xsrc/local/programs/bdfload

2024-03-12 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Tue Mar 12 09:36:06 UTC 2024

Modified Files:
xsrc/local/programs/bdfload: README bdfload.c

Log Message:
use uint8_t for all 8bit masks and data to avoid sign extending weirdness
found by running this on hppa with gcc12


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 xsrc/local/programs/bdfload/README
cvs rdiff -u -r1.21 -r1.22 xsrc/local/programs/bdfload/bdfload.c

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

Modified files:

Index: xsrc/local/programs/bdfload/README
diff -u xsrc/local/programs/bdfload/README:1.2 xsrc/local/programs/bdfload/README:1.3
--- xsrc/local/programs/bdfload/README:1.2	Thu Jul 27 08:30:02 2023
+++ xsrc/local/programs/bdfload/README	Tue Mar 12 09:36:06 2024
@@ -15,6 +15,8 @@ Command line options:
  -d dump glyph shapes to the console, mostly for font debugging
  -e  override the font's encoding
  -N  override the font's name for both file output and wsdisplay
+ -2 double the size of a font
+ -s smoothe pixel staircases when enlarging
 
 Caveats:
 - fonts wider than 16 pixels won't work yet

Index: xsrc/local/programs/bdfload/bdfload.c
diff -u xsrc/local/programs/bdfload/bdfload.c:1.21 xsrc/local/programs/bdfload/bdfload.c:1.22
--- xsrc/local/programs/bdfload/bdfload.c:1.21	Mon Jan  8 18:09:33 2024
+++ xsrc/local/programs/bdfload/bdfload.c	Tue Mar 12 09:36:06 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bdfload.c,v 1.21 2024/01/08 18:09:33 macallan Exp $	*/
+/*	$NetBSD: bdfload.c,v 1.22 2024/03/12 09:36:06 macallan Exp $	*/
 
 /*
  * Copyright (c) 2018 Michael Lorenz
@@ -168,9 +168,10 @@ int
 write_header(const char *filename, struct wsdisplay_font *f)
 {
 	FILE *output;
-	char *buffer = f->data;
+	uint8_t *buffer = f->data;
+	uint8_t c, msk;
 	int i, j, x, y, idx, pxls, left;
-	char name[64], c, msk;
+	char name[64];
 	
 	/* now output as a header file */
 	snprintf(name, sizeof(name), "%s_%dx%d", f->name, 



CVS commit: xsrc/local/programs/bdfload

2024-03-12 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Tue Mar 12 09:36:06 UTC 2024

Modified Files:
xsrc/local/programs/bdfload: README bdfload.c

Log Message:
use uint8_t for all 8bit masks and data to avoid sign extending weirdness
found by running this on hppa with gcc12


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 xsrc/local/programs/bdfload/README
cvs rdiff -u -r1.21 -r1.22 xsrc/local/programs/bdfload/bdfload.c

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



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

2024-03-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar  6 08:19:44 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
if the framebuffer is wider than the visible area, use the full width for the
glyphcache


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/hppa/dev/gftfb.c

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



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

2024-03-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar  6 08:19:44 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
if the framebuffer is wider than the visible area, use the full width for the
glyphcache


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/hppa/dev/gftfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.8 src/sys/arch/hppa/dev/gftfb.c:1.9
--- src/sys/arch/hppa/dev/gftfb.c:1.8	Wed Feb 28 14:12:12 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Wed Mar  6 08:19:44 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.8 2024/02/28 14:12:12 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.9 2024/03/06 08:19:44 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -294,7 +294,7 @@ gftfb_attach(device_t parent, device_t s
 
 		glyphcache_init(>sc_gc, sc->sc_height + 5,
 sc->sc_scr.fbheight - sc->sc_height - 5,
-sc->sc_width,
+sc->sc_scr.fbwidth,
 ri->ri_font->fontwidth,
 ri->ri_font->fontheight,
 defattr);
@@ -320,7 +320,7 @@ gftfb_attach(device_t parent, device_t s
 
 		glyphcache_init(>sc_gc, sc->sc_height + 5,
 sc->sc_scr.fbheight - sc->sc_height - 5,
-sc->sc_width,
+sc->sc_scr.fbwidth,
 ri->ri_font->fontwidth,
 ri->ri_font->fontheight,
 defattr);



CVS commit: src

2024-03-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Mar  4 10:19:14 UTC 2024

Modified Files:
src/distrib/sets/lists/comp: mi
src/sys/dev/ic: Makefile

Log Message:
install stireg.h


To generate a diff of this commit:
cvs rdiff -u -r1.2455 -r1.2456 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/ic/Makefile

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2455 src/distrib/sets/lists/comp/mi:1.2456
--- src/distrib/sets/lists/comp/mi:1.2455	Fri Mar  1 15:48:24 2024
+++ src/distrib/sets/lists/comp/mi	Mon Mar  4 10:19:13 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2455 2024/03/01 15:48:24 christos Exp $
+#	$NetBSD: mi,v 1.2456 2024/03/04 10:19:13 macallan Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -645,6 +645,7 @@
 ./usr/include/dev/ic/smc91cxxvar.h		comp-obsolete		obsolete
 ./usr/include/dev/ic/smc93cx6var.h		comp-obsolete		obsolete
 ./usr/include/dev/ic/st16650reg.h		comp-obsolete		obsolete
+./usr/include/dev/ic/stireg.h			comp-c-include
 ./usr/include/dev/ic/tms320av110reg.h		comp-obsolete		obsolete
 ./usr/include/dev/ic/tms320av110var.h		comp-obsolete		obsolete
 ./usr/include/dev/ic/uhareg.h			comp-obsolete		obsolete

Index: src/sys/dev/ic/Makefile
diff -u src/sys/dev/ic/Makefile:1.28 src/sys/dev/ic/Makefile:1.29
--- src/sys/dev/ic/Makefile:1.28	Tue Dec  7 17:39:54 2021
+++ src/sys/dev/ic/Makefile	Mon Mar  4 10:19:14 2024
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.28 2021/12/07 17:39:54 brad Exp $
+#	$NetBSD: Makefile,v 1.29 2024/03/04 10:19:14 macallan Exp $
 
 INCSDIR= /usr/include/dev/ic
 
 # Only install includes which are used by userland
 INCS=	athioctl.h bt8xx.h hd44780var.h icpreg.h icp_ioctl.h isp_ioctl.h \
-	mlxreg.h mlxio.h nvmeio.h nvmereg.h qemufwcfgio.h scmdreg.h wdcreg.h \
-	wi_ieee.h
+	mlxreg.h mlxio.h nvmeio.h nvmereg.h qemufwcfgio.h scmdreg.h stireg.h \
+	wdcreg.h wi_ieee.h
 
 .include 



CVS commit: src

2024-03-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Mar  4 10:19:14 UTC 2024

Modified Files:
src/distrib/sets/lists/comp: mi
src/sys/dev/ic: Makefile

Log Message:
install stireg.h


To generate a diff of this commit:
cvs rdiff -u -r1.2455 -r1.2456 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/ic/Makefile

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



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

2024-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Feb 28 14:12:12 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
support WSDISPLAYIO_SVIDEO so X can turn the monitor off
so far I only know how to turn off video output, not sync(s). Better than
nothing though.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hppa/dev/gftfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.7 src/sys/arch/hppa/dev/gftfb.c:1.8
--- src/sys/arch/hppa/dev/gftfb.c:1.7	Wed Feb 28 10:25:36 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Wed Feb 28 14:12:12 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.7 2024/02/28 10:25:36 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.8 2024/02/28 14:12:12 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -91,7 +91,7 @@ struct	gftfb_softc {
 	/* cursor stuff */
 	int sc_cursor_x, sc_cursor_y;
 	int sc_hot_x, sc_hot_y, sc_enabled;
-	uint32_t sc_pos;
+	int sc_video_on;
 	glyphcache sc_gc;
 };
 
@@ -148,6 +148,8 @@ static void	gftfb_eraserows(void *, int,
 static void	gftfb_move_cursor(struct gftfb_softc *, int, int);
 static int	gftfb_do_cursor(struct gftfb_softc *, struct wsdisplay_cursor *);
 
+static void	gftfb_set_video(struct gftfb_softc *, int);
+
 struct wsdisplay_accessops gftfb_accessops = {
 	gftfb_ioctl,
 	gftfb_mmap,
@@ -683,6 +685,7 @@ gftfb_setup(struct gftfb_softc *sc)
 	sc->sc_hot_x = 0;
 	sc->sc_hot_y = 0;
 	sc->sc_enabled = 0;
+	sc->sc_video_on = 1;
 
 	/* set Bt458 read mask register to all planes */
 	gftfb_wait(sc);
@@ -824,6 +827,7 @@ gftfb_ioctl(void *v, void *vs, u_long cm
 sc->sc_height, ms->scr_ri.ri_devcmap[
 (ms->scr_defattr >> 16) & 0xff]);
 vcons_redraw_screen(ms);
+gftfb_set_video(sc, 1);
 			}
 		}
 		}
@@ -868,8 +872,14 @@ gftfb_ioctl(void *v, void *vs, u_long cm
 
 			return gftfb_do_cursor(sc, cursor);
 		}
-	}
 
+	case WSDISPLAYIO_SVIDEO:
+		gftfb_set_video(sc, *(int *)data);
+		return 0;
+	case WSDISPLAYIO_GVIDEO:
+		return sc->sc_video_on ? 
+		WSDISPLAYIO_VIDEO_ON : WSDISPLAYIO_VIDEO_OFF;
+	}
 	return EPASSTHROUGH;
 }
 
@@ -1464,3 +1474,29 @@ gftfb_do_cursor(struct gftfb_softc *sc, 
 
 	return 0;
 }
+
+static void
+gftfb_set_video(struct gftfb_softc *sc, int on)
+{
+	struct sti_rom *rom = sc->sc_base.sc_rom;
+	bus_space_tag_t memt = rom->memt;
+	bus_space_handle_t memh = rom->regh[2];
+
+	if (sc->sc_video_on == on)
+		return;
+		
+	sc->sc_video_on = on;
+
+	gftfb_wait(sc);
+	if (on) {
+		bus_space_write_stream_4(memt, memh, NGLE_REG_21,
+		bus_space_read_stream_4(memt, memh, NGLE_REG_21) | 0x0a00);
+		bus_space_write_stream_4(memt, memh, NGLE_REG_27,
+		bus_space_read_stream_4(memt, memh, NGLE_REG_27) | 0x0080);
+	} else {
+		bus_space_write_stream_4(memt, memh, NGLE_REG_21,
+		bus_space_read_stream_4(memt, memh, NGLE_REG_21) &  ~0x0a00);
+		bus_space_write_stream_4(memt, memh, NGLE_REG_27,
+		bus_space_read_stream_4(memt, memh, NGLE_REG_27) & ~0x0080);
+	}
+}



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

2024-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Feb 28 14:12:12 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
support WSDISPLAYIO_SVIDEO so X can turn the monitor off
so far I only know how to turn off video output, not sync(s). Better than
nothing though.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hppa/dev/gftfb.c

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



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

2024-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Feb 28 10:25:36 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
add hardware cursor support, mostly for X


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/hppa/dev/gftfb.c

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



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

2024-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Feb 28 10:25:36 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
add hardware cursor support, mostly for X


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/hppa/dev/gftfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.6 src/sys/arch/hppa/dev/gftfb.c:1.7
--- src/sys/arch/hppa/dev/gftfb.c:1.6	Wed Feb 21 13:24:40 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Wed Feb 28 10:25:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.6 2024/02/21 13:24:40 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.7 2024/02/28 10:25:36 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -82,10 +83,15 @@ struct	gftfb_softc {
 	u_char sc_cmap_red[256];
 	u_char sc_cmap_green[256];
 	u_char sc_cmap_blue[256];
+	kmutex_t sc_hwlock;
 	uint32_t sc_hwmode;
 #define HW_FB	0
 #define HW_FILL	1
 #define HW_BLIT	2
+	/* cursor stuff */
+	int sc_cursor_x, sc_cursor_y;
+	int sc_hot_x, sc_hot_y, sc_enabled;
+	uint32_t sc_pos;
 	glyphcache sc_gc;
 };
 
@@ -139,6 +145,9 @@ static void	gftfb_erasecols(void *, int,
 static void	gftfb_copyrows(void *, int, int, int);
 static void	gftfb_eraserows(void *, int, int, long);
 
+static void	gftfb_move_cursor(struct gftfb_softc *, int, int);
+static int	gftfb_do_cursor(struct gftfb_softc *, struct wsdisplay_cursor *);
+
 struct wsdisplay_accessops gftfb_accessops = {
 	gftfb_ioctl,
 	gftfb_mmap,
@@ -175,6 +184,8 @@ struct wsdisplay_accessops gftfb_accesso
 #define	MaskDynamic	1	/* Mask register reloaded by direct access */
 #define	MaskOtc	0	/* Mask contains Object Count valid bits */
 
+static inline void gftfb_wait_fifo(struct gftfb_softc *, uint32_t);
+
 int
 gftfb_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -209,6 +220,9 @@ gftfb_attach(device_t parent, device_t s
 	sc->sc_base.sc_enable_rom = gftfb_enable_rom;
 	sc->sc_base.sc_disable_rom = gftfb_disable_rom;
 
+	/* we can *not* be interrupted when doing colour map accesses */
+	mutex_init(>sc_hwlock, MUTEX_DEFAULT, IPL_HIGH);
+
 	aprint_normal("\n");
 
 	if (gftfb_check_rom(sc, paa) != 0)
@@ -663,8 +677,12 @@ gftfb_setup(struct gftfb_softc *sc)
 	struct sti_rom *rom = sc->sc_base.sc_rom;
 	bus_space_tag_t memt = rom->memt;
 	bus_space_handle_t memh = rom->regh[2];
+	int i;	
 
 	sc->sc_hwmode = HW_FB;
+	sc->sc_hot_x = 0;
+	sc->sc_hot_y = 0;
+	sc->sc_enabled = 0;
 
 	/* set Bt458 read mask register to all planes */
 	gftfb_wait(sc);
@@ -702,6 +720,50 @@ gftfb_setup(struct gftfb_softc *sc)
 	bus_space_read_stream_4(memt, memh, NGLE_REG_21) | 0x0a00);
 	bus_space_write_stream_4(memt, memh, NGLE_REG_27,
 	bus_space_read_stream_4(memt, memh, NGLE_REG_27) | 0x0080);
+
+	/* initialize cursor sprite */
+	gftfb_wait(sc);
+	
+	/* cursor mask */
+	gftfb_wait(sc);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_14, 0x300);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_13, 0x);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_11, 0x28A07000);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_3, 0);
+	for (i = 0; i < 64; i++) {
+		bus_space_write_stream_4(memt, memh, NGLE_REG_4, 0x);
+		bus_space_write_stream_4(memt, memh, NGLE_REG_5, 0x);
+	}
+
+	/* cursor image */
+	gftfb_wait(sc);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_14, 0x300);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_13, 0x);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_11, 0x28A06000);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_3, 0);
+	for (i = 0; i < 64; i++) {
+		bus_space_write_stream_4(memt, memh, NGLE_REG_4, 0xff00ff00);
+		bus_space_write_stream_4(memt, memh, NGLE_REG_5, 0xff00ff00);
+	}
+
+	/* colour map */
+	gftfb_wait(sc);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_10, 0xBBE0F000);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_14, 0x03000300);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_13, 0x);
+	gftfb_wait(sc);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_3, 0);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_4, 0);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_4, 0);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_4, 0x00ff);	/* BG */
+	bus_space_write_stream_4(memt, memh, NGLE_REG_4, 0x00ff);	/* FG */
+	gftfb_wait(sc);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_2, 0);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_26, 0x80008004);
+	gftfb_setup_fb(sc);	
+
+	gftfb_move_cursor(sc, 100, 100);
+
 }
 
 static int
@@ -773,7 +835,41 @@ gftfb_ioctl(void *v, void *vs, u_long cm
 
 		return wsdisplayio_get_fbinfo(>scr_ri, fbi);
 	}
+
+	case WSDISPLAYIO_GCURPOS:
+		{
+			struct wsdisplay_curpos *cp = (void *)data;
+
+			cp->x = sc->sc_cursor_x;
+			cp->y = sc->sc_cursor_y;
+		}
+		return 

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

2024-02-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Feb 21 13:24:40 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
avoid one more instance of unnecessary blitter stalling


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hppa/dev/gftfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.5 src/sys/arch/hppa/dev/gftfb.c:1.6
--- src/sys/arch/hppa/dev/gftfb.c:1.5	Wed Feb 21 13:04:01 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Wed Feb 21 13:24:40 2024
@@ -1,9 +1,10 @@
-/*	$NetBSD: gftfb.c,v 1.5 2024/02/21 13:04:01 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.6 2024/02/21 13:24:40 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
 /*
  * Copyright (c) 2006, 2007 Miodrag Vallat.
+ ^ 2024 Michael Lorenz
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -19,6 +20,11 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+/*
+ * a native driver for HP Visualize EG PCI graphics cards
+ * STI portions are from Miodrag Vallat's sti_pci.c
+ */
+
 #include 
 #include 
 #include 
@@ -974,15 +980,17 @@ gftfb_bitblt(void *cookie, int xs, int y
 	bus_space_tag_t memt = rom->memt;
 	bus_space_handle_t memh = rom->regh[2];
 
-	gftfb_wait(sc);
-	bus_space_write_stream_4(memt, memh, NGLE_REG_10, 0x13a01000);
+	if (sc->sc_hwmode != HW_BLIT) {
+		gftfb_wait(sc);
+		bus_space_write_stream_4(memt, memh, NGLE_REG_10, 0x13a01000);
+		sc->sc_hwmode = HW_BLIT;
+	}
 	gftfb_wait_fifo(sc, 5);
 	bus_space_write_stream_4(memt, memh, NGLE_REG_14, ((rop << 8) & 0xf00) | 0x2300);
 	bus_space_write_stream_4(memt, memh, NGLE_REG_13, 0xff);
 	bus_space_write_stream_4(memt, memh, NGLE_REG_24, (xs << 16) | ys);
 	bus_space_write_stream_4(memt, memh, NGLE_REG_7, (wi << 16) | he);
 	bus_space_write_stream_4(memt, memh, NGLE_REG_25, (xd << 16) | yd);
-	sc->sc_hwmode = HW_BLIT;
 }
 
 static void



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

2024-02-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Feb 21 13:24:40 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
avoid one more instance of unnecessary blitter stalling


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hppa/dev/gftfb.c

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



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

2024-02-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Feb 21 13:04:01 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
keep track of hw settings for blitter, fill of fb access to avoid unnecessary
register writes
while there, remove some accidentially left in debug goop


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hppa/dev/gftfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.4 src/sys/arch/hppa/dev/gftfb.c:1.5
--- src/sys/arch/hppa/dev/gftfb.c:1.4	Tue Feb 20 15:54:44 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Wed Feb 21 13:04:01 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.4 2024/02/20 15:54:44 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.5 2024/02/21 13:04:01 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -76,7 +76,10 @@ struct	gftfb_softc {
 	u_char sc_cmap_red[256];
 	u_char sc_cmap_green[256];
 	u_char sc_cmap_blue[256];
-	uint32_t sc_reg10;
+	uint32_t sc_hwmode;
+#define HW_FB	0
+#define HW_FILL	1
+#define HW_BLIT	2
 	glyphcache sc_gc;
 };
 
@@ -645,6 +648,7 @@ gftfb_setup_fb(struct gftfb_softc *sc)
 	bus_space_write_stream_4(memt, memh, NGLE_REG_14, 0x83000300);
 	gftfb_wait(sc);
 	bus_space_write_1(memt, memh, NGLE_REG_16b1, 1);
+	sc->sc_hwmode = HW_FB;
 }
 
 void
@@ -654,7 +658,7 @@ gftfb_setup(struct gftfb_softc *sc)
 	bus_space_tag_t memt = rom->memt;
 	bus_space_handle_t memh = rom->regh[2];
 
-	sc->sc_reg10 = 0;
+	sc->sc_hwmode = HW_FB;
 
 	/* set Bt458 read mask register to all planes */
 	gftfb_wait(sc);
@@ -674,6 +678,10 @@ gftfb_setup(struct gftfb_softc *sc)
 	bus_space_write_stream_4(memt, memh, NGLE_REG_6, 0x);
 	bus_space_write_stream_4(memt, memh, NGLE_REG_9,
 	(sc->sc_scr.scr_cfg.scr_width << 16) | sc->sc_scr.scr_cfg.scr_height);
+	/*
+	 * blit into offscreen memory to force flush previous - apparently 
+	 * some chips have a bug this works around
+	 */
 	bus_space_write_stream_4(memt, memh, NGLE_REG_6, 0x0500);
 	bus_space_write_stream_4(memt, memh, NGLE_REG_9, 0x00040001);
 
@@ -682,6 +690,7 @@ gftfb_setup(struct gftfb_softc *sc)
 
 	gftfb_setup_fb(sc);
 
+	/* make sure video output is enabled */
 	gftfb_wait(sc);
 	bus_space_write_stream_4(memt, memh, NGLE_REG_21,
 	bus_space_read_stream_4(memt, memh, NGLE_REG_21) | 0x0a00);
@@ -741,7 +750,7 @@ gftfb_ioctl(void *v, void *vs, u_long cm
 			sc->sc_mode = new_mode;
 			if(new_mode == WSDISPLAYIO_MODE_EMUL) {
 gftfb_setup(sc);
-if (0) gftfb_restore_palette(sc);
+gftfb_restore_palette(sc);
 glyphcache_wipe(>sc_gc);
 gftfb_rectfill(sc, 0, 0, sc->sc_width,
 sc->sc_height, ms->scr_ri.ri_devcmap[
@@ -932,19 +941,22 @@ gftfb_rectfill(struct gftfb_softc *sc, i
 	bus_space_tag_t memt = rom->memt;
 	bus_space_handle_t memh = rom->regh[2];
 
-	gftfb_wait_fifo(sc, 5);
-	/* transfer data */
-	bus_space_write_stream_4(memt, memh, NGLE_REG_8, 0x);
+	if (sc->sc_hwmode != HW_FILL) {
+		gftfb_wait_fifo(sc, 4);
+		/* transfer data */
+		bus_space_write_stream_4(memt, memh, NGLE_REG_8, 0x);
+		/* plane mask */
+		bus_space_write_stream_4(memt, memh, NGLE_REG_13, 0xff);
+		/* bitmap op */
+		bus_space_write_stream_4(memt, memh, NGLE_REG_14, 
+		IBOvals(RopSrc, 0, BitmapExtent08, 0, DataDynamic, MaskOtc, 0, 0));
+		/* dst bitmap access */
+		bus_space_write_stream_4(memt, memh, NGLE_REG_11,
+		BA(IndexedDcd, Otc32, OtsIndirect, AddrLong, 0, BINapp0I, 0));
+		sc->sc_hwmode = HW_FILL;
+	}
+	gftfb_wait_fifo(sc, 3);
 	bus_space_write_stream_4(memt, memh, NGLE_REG_35, bg);
-	/* plane mask */
-	bus_space_write_stream_4(memt, memh, NGLE_REG_13, 0xff);
-	/* bitmap op */
-	bus_space_write_stream_4(memt, memh, NGLE_REG_14, 
-	IBOvals(RopSrc, 0, BitmapExtent08, 0, DataDynamic, MaskOtc, 0, 0));
-	/* dst bitmap access */
-	bus_space_write_stream_4(memt, memh, NGLE_REG_11,
-	BA(IndexedDcd, Otc32, OtsIndirect, AddrLong, 0, BINapp0I, 0));
-	gftfb_wait_fifo(sc, 2);
 	/* dst XY */
 	bus_space_write_stream_4(memt, memh, NGLE_REG_6, (x << 16) | y);
 	/* len XY start */
@@ -970,6 +982,7 @@ gftfb_bitblt(void *cookie, int xs, int y
 	bus_space_write_stream_4(memt, memh, NGLE_REG_24, (xs << 16) | ys);
 	bus_space_write_stream_4(memt, memh, NGLE_REG_7, (wi << 16) | he);
 	bus_space_write_stream_4(memt, memh, NGLE_REG_25, (xd << 16) | yd);
+	sc->sc_hwmode = HW_BLIT;
 }
 
 static void
@@ -1065,7 +1078,7 @@ gftfb_putchar(void *cookie, int row, int
 	if (rv == GC_OK)
 		return;
 
-	gftfb_setup_fb(sc);
+	if (sc->sc_hwmode != HW_FB) gftfb_setup_fb(sc);
 	sc->sc_putchar(cookie, row, col, c, attr);
 
 	if (rv == GC_ADD)



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

2024-02-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Feb 21 13:04:01 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
keep track of hw settings for blitter, fill of fb access to avoid unnecessary
register writes
while there, remove some accidentially left in debug goop


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hppa/dev/gftfb.c

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



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

2024-02-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Feb 20 15:54:44 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
play the same lazy cursor (un)draw trick as cgsix and friends
visible speedup in things like systat


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/dev/gftfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.3 src/sys/arch/hppa/dev/gftfb.c:1.4
--- src/sys/arch/hppa/dev/gftfb.c:1.3	Tue Feb 20 11:37:43 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Tue Feb 20 15:54:44 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.3 2024/02/20 11:37:43 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.4 2024/02/20 15:54:44 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -973,6 +973,23 @@ gftfb_bitblt(void *cookie, int xs, int y
 }
 
 static void
+gftfb_nuke_cursor(struct rasops_info *ri)
+{
+	struct vcons_screen *scr = ri->ri_hw;
+	struct gftfb_softc *sc = scr->scr_cookie;
+	int wi, he, x, y;
+		
+	if (ri->ri_flg & RI_CURSOR) {
+		wi = ri->ri_font->fontwidth;
+		he = ri->ri_font->fontheight;
+		x = ri->ri_ccol * wi + ri->ri_xorigin;
+		y = ri->ri_crow * he + ri->ri_yorigin;
+		gftfb_bitblt(sc, x, y, x, y, wi, he, RopInv);
+		ri->ri_flg &= ~RI_CURSOR;
+	}
+}
+
+static void
 gftfb_cursor(void *cookie, int on, int row, int col)
 {
 	struct rasops_info *ri = cookie;
@@ -984,24 +1001,22 @@ gftfb_cursor(void *cookie, int on, int r
 	he = ri->ri_font->fontheight;
 	
 	if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
-		if (ri->ri_flg & RI_CURSOR) {
-			x = ri->ri_ccol * wi + ri->ri_xorigin;
-			y = ri->ri_crow * he + ri->ri_yorigin;
-			gftfb_bitblt(sc, x, y, x, y, wi, he, RopInv);
-			ri->ri_flg &= ~RI_CURSOR;
-		}
-		ri->ri_crow = row;
-		ri->ri_ccol = col;
 		if (on) {
-			x = ri->ri_ccol * wi + ri->ri_xorigin;
-			y = ri->ri_crow * he + ri->ri_yorigin;
+			if (ri->ri_flg & RI_CURSOR) {
+gftfb_nuke_cursor(ri);
+			}
+			x = col * wi + ri->ri_xorigin;
+			y = row * he + ri->ri_yorigin;
 			gftfb_bitblt(sc, x, y, x, y, wi, he, RopInv);
 			ri->ri_flg |= RI_CURSOR;
 		}
-	} else {
-		scr->scr_ri.ri_crow = row;
-		scr->scr_ri.ri_ccol = col;
-		scr->scr_ri.ri_flg &= ~RI_CURSOR;
+		ri->ri_crow = row;
+		ri->ri_ccol = col;
+	} else
+	{
+		ri->ri_crow = row;
+		ri->ri_ccol = col;
+		ri->ri_flg &= ~RI_CURSOR;
 	}
 
 }
@@ -1023,6 +1038,10 @@ gftfb_putchar(void *cookie, int row, int
 	if (!CHAR_IN_FONT(c, font))
 		return;
 
+	if (row == ri->ri_crow && col == ri->ri_ccol) {
+		ri->ri_flg &= ~RI_CURSOR;
+	}
+
 	wi = font->fontwidth;
 	he = font->fontheight;
 
@@ -1062,12 +1081,21 @@ gftfb_copycols(void *cookie, int row, in
 	int32_t xs, xd, y, width, height;
 	
 	if ((sc->sc_locked == 0) && (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)) {
+		if (ri->ri_crow == row && 
+		   (ri->ri_ccol >= srccol && ri->ri_ccol < (srccol + ncols)) &&
+		   (ri->ri_flg & RI_CURSOR)) {
+			gftfb_nuke_cursor(ri);
+		}
+
 		xs = ri->ri_xorigin + ri->ri_font->fontwidth * srccol;
 		xd = ri->ri_xorigin + ri->ri_font->fontwidth * dstcol;
 		y = ri->ri_yorigin + ri->ri_font->fontheight * row;
 		width = ri->ri_font->fontwidth * ncols;
 		height = ri->ri_font->fontheight;
 		gftfb_bitblt(sc, xs, y, xd, y, width, height, RopSrc);
+		if (ri->ri_crow == row && 
+		   (ri->ri_ccol >= dstcol && ri->ri_ccol < (dstcol + ncols)))
+			ri->ri_flg &= ~RI_CURSOR;
 	}
 }
 
@@ -1087,6 +1115,9 @@ gftfb_erasecols(void *cookie, int row, i
 		rasops_unpack_attr(fillattr, , , );
 
 		gftfb_rectfill(sc, x, y, width, height, ri->ri_devcmap[bg]);
+		if (ri->ri_crow == row && 
+		   (ri->ri_ccol >= startcol && ri->ri_ccol < (startcol + ncols)))
+			ri->ri_flg &= ~RI_CURSOR;
 	}
 }
 
@@ -1099,12 +1130,18 @@ gftfb_copyrows(void *cookie, int srcrow,
 	int32_t x, ys, yd, width, height;
 
 	if ((sc->sc_locked == 0) && (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)) {
+		if ((ri->ri_crow >= srcrow && ri->ri_crow < (srcrow + nrows)) &&
+		   (ri->ri_flg & RI_CURSOR)) {
+			gftfb_nuke_cursor(ri);
+		}
 		x = ri->ri_xorigin;
 		ys = ri->ri_yorigin + ri->ri_font->fontheight * srcrow;
 		yd = ri->ri_yorigin + ri->ri_font->fontheight * dstrow;
 		width = ri->ri_emuwidth;
 		height = ri->ri_font->fontheight * nrows;
 		gftfb_bitblt(sc, x, ys, x, yd, width, height, RopSrc);
+		if (ri->ri_crow >= dstrow && ri->ri_crow < (dstrow + nrows))
+			ri->ri_flg &= ~RI_CURSOR;
 	}
 }
 
@@ -1124,5 +1161,8 @@ gftfb_eraserows(void *cookie, int row, i
 		rasops_unpack_attr(fillattr, , , );
 
 		gftfb_rectfill(sc, x, y, width, height, ri->ri_devcmap[bg]);
+
+		if (ri->ri_crow >= row && ri->ri_crow < (row + nrows))
+			ri->ri_flg &= ~RI_CURSOR;
 	}
 }



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

2024-02-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Feb 20 15:54:44 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
play the same lazy cursor (un)draw trick as cgsix and friends
visible speedup in things like systat


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/dev/gftfb.c

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



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

2024-02-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Feb 20 11:37:43 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
enable glyph cache, anti-aliased fonts etc.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/hppa/dev/gftfb.c

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



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

2024-02-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Feb 20 11:37:43 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
enable glyph cache, anti-aliased fonts etc.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/hppa/dev/gftfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.2 src/sys/arch/hppa/dev/gftfb.c:1.3
--- src/sys/arch/hppa/dev/gftfb.c:1.2	Thu Feb 15 16:17:32 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Tue Feb 20 11:37:43 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.2 2024/02/15 16:17:32 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.3 2024/02/20 11:37:43 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -76,6 +76,7 @@ struct	gftfb_softc {
 	u_char sc_cmap_red[256];
 	u_char sc_cmap_green[256];
 	u_char sc_cmap_blue[256];
+	uint32_t sc_reg10;
 	glyphcache sc_gc;
 };
 
@@ -90,15 +91,12 @@ void	gftfb_enable_rom_internal(struct gf
 void	gftfb_disable_rom_internal(struct gftfb_softc *);
 
 void 	gftfb_setup(struct gftfb_softc *);
-void 	gftfb_wait(struct gftfb_softc *);
-void	gftfb_wait_fifo(struct gftfb_softc *, uint32_t);
 
 #define	ngle_bt458_write(memt, memh, r, v) \
 	bus_space_write_stream_4(memt, memh, NGLE_REG_RAMDAC + ((r) << 2), (v) << 24)
 
-void gftfb_setup_fb(struct gftfb_softc *);
 
-/* XXX these really need o go into their own header */
+/* XXX these really need to go into their own header */
 int	sti_pci_is_console(struct pci_attach_args *, bus_addr_t *);
 int	sti_rom_setup(struct sti_rom *, bus_space_tag_t, bus_space_tag_t,
 	bus_space_handle_t, bus_addr_t *, u_int);
@@ -143,6 +141,31 @@ struct wsdisplay_accessops gftfb_accesso
 	NULL	/* scroll */
 };
 
+#define BA(F,C,S,A,J,B,I)		\
+	(((F)<<31)|((C)<<27)|((S)<<24)|((A)<<21)|((J)<<16)|((B)<<12)|(I))
+
+#define IBOvals(R,M,X,S,D,L,B,F)	\
+	(((R)<<8)|((M)<<16)|((X)<<24)|((S)<<29)|((D)<<28)|((L)<<31)|((B)<<1)|(F))
+
+#define	IndexedDcd	0	/* Pixel data is indexed (pseudo) color */
+#define	Otc04	2	/* Pixels in each longword transfer (4) */
+#define	Otc32	5	/* Pixels in each longword transfer (32) */
+#define	Ots08	3	/* Each pixel is size (8)d transfer (1) */
+#define	OtsIndirect	6	/* Each bit goes through FG/BG color(8) */
+#define	AddrLong	5	/* FB address is Long aligned (pixel) */
+#define	BINovly	0x2	/* 8 bit overlay */
+#define	BINapp0I	0x0	/* Application Buffer 0, Indexed */
+#define	BINapp1I	0x1	/* Application Buffer 1, Indexed */
+#define	BINapp0F8	0xa	/* Application Buffer 0, Fractional 8-8-8 */
+#define	BINattr	0xd	/* Attribute Bitmap */
+#define	RopSrc 	0x3
+#define	RopInv 	0xc
+#define	BitmapExtent08  3	/* Each write hits ( 8) bits in depth */
+#define	BitmapExtent32  5	/* Each write hits (32) bits in depth */
+#define	DataDynamic	0	/* Data register reloaded by direct access */
+#define	MaskDynamic	1	/* Mask register reloaded by direct access */
+#define	MaskOtc	0	/* Mask contains Object Count valid bits */
+
 int
 gftfb_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -165,7 +188,7 @@ gftfb_attach(device_t parent, device_t s
 	struct sti_rom *rom;
 	struct rasops_info *ri;
 	struct wsemuldisplaydev_attach_args aa;
-	unsigned long defattr;
+	unsigned long defattr = 0;
 	int ret, is_console = 0, i, j;
 	uint8_t cmap[768];
 
@@ -230,11 +253,10 @@ gftfb_attach(device_t parent, device_t s
 
 	ri = >sc_console_screen.scr_ri;
 
-#if 0
 	sc->sc_gc.gc_bitblt = gftfb_bitblt;
 	sc->sc_gc.gc_blitcookie = sc;
-	sc->sc_gc.gc_rop = 0x0c;
-#endif
+	sc->sc_gc.gc_rop = RopSrc;
+
 	if (is_console) {
 		vcons_init_screen(>vd, >sc_console_screen, 1,
 		);
@@ -244,14 +266,14 @@ gftfb_attach(device_t parent, device_t s
 		sc->sc_defaultscreen_descr.capabilities = ri->ri_caps;
 		sc->sc_defaultscreen_descr.nrows = ri->ri_rows;
 		sc->sc_defaultscreen_descr.ncols = ri->ri_cols;
-#if 0
+
 		glyphcache_init(>sc_gc, sc->sc_height + 5,
-(0x80 / sc->sc_stride) - sc->sc_height - 5,
+sc->sc_scr.fbheight - sc->sc_height - 5,
 sc->sc_width,
 ri->ri_font->fontwidth,
 ri->ri_font->fontheight,
 defattr);
-#endif
+
 		wsdisplay_cnattach(>sc_defaultscreen_descr, ri, 0, 0,
 		defattr);
 
@@ -270,14 +292,13 @@ gftfb_attach(device_t parent, device_t s
 			);
 		} else
 			(*ri->ri_ops.allocattr)(ri, 0, 0, 0, );
-#if 0
+
 		glyphcache_init(>sc_gc, sc->sc_height + 5,
-(0x80 / sc->sc_stride) - sc->sc_height - 5,
+sc->sc_scr.fbheight - sc->sc_height - 5,
 sc->sc_width,
 ri->ri_font->fontwidth,
 ri->ri_font->fontheight,
 defattr);
-#endif
 	}
 
 	j = 0;
@@ -597,7 +618,7 @@ gftfb_disable_rom(struct sti_softc *sc)
 	CLR(sc->sc_flags, STI_ROM_ENABLED);
 }
 
-void
+static inline void
 gftfb_wait(struct gftfb_softc *sc)
 {
 	struct sti_rom *rom = 

CVS commit: src/sys/dev/wscons

2024-02-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Feb 20 09:53:16 UTC 2024

Modified Files:
src/sys/dev/wscons: wsdisplay_glyphcache.c

Log Message:
remove check for unused bits in attr2idx() - this really wasn't helpful


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/wscons/wsdisplay_glyphcache.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/wscons/wsdisplay_glyphcache.c
diff -u src/sys/dev/wscons/wsdisplay_glyphcache.c:1.12 src/sys/dev/wscons/wsdisplay_glyphcache.c:1.13
--- src/sys/dev/wscons/wsdisplay_glyphcache.c:1.12	Thu Jun  8 05:48:41 2023
+++ src/sys/dev/wscons/wsdisplay_glyphcache.c	Tue Feb 20 09:53:16 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_glyphcache.c,v 1.12 2023/06/08 05:48:41 macallan Exp $	*/
+/*	$NetBSD: wsdisplay_glyphcache.c,v 1.13 2024/02/20 09:53:16 macallan Exp $	*/
 
 /*
  * Copyright (c) 2012 Michael Lorenz
@@ -53,9 +53,6 @@
 static inline int
 attr2idx(long attr)
 {
-	if ((attr & 0xf0f00ff8) != 0)
-		return -1;
-	
 	return (((attr >> 16) & 0x0f) | ((attr >> 20) & 0xf0));
 }
 



CVS commit: src/sys/dev/wscons

2024-02-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Feb 20 09:53:16 UTC 2024

Modified Files:
src/sys/dev/wscons: wsdisplay_glyphcache.c

Log Message:
remove check for unused bits in attr2idx() - this really wasn't helpful


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/wscons/wsdisplay_glyphcache.c

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



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

2024-02-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 15 16:17:32 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
blitter time!
everything except drawing characters i now done by hardware
next step - glyphcache


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/hppa/dev/gftfb.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/hppa/dev/gftfb.c
diff -u src/sys/arch/hppa/dev/gftfb.c:1.1 src/sys/arch/hppa/dev/gftfb.c:1.2
--- src/sys/arch/hppa/dev/gftfb.c:1.1	Tue Feb 13 13:40:13 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Thu Feb 15 16:17:32 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gftfb.c,v 1.1 2024/02/13 13:40:13 macallan Exp $	*/
+/*	$NetBSD: gftfb.c,v 1.2 2024/02/15 16:17:32 macallan Exp $	*/
 
 /*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
 
@@ -72,6 +72,7 @@ struct	gftfb_softc {
 	struct wsscreen_list sc_screenlist;
 	struct vcons_data vd;
 	int sc_mode;
+	void (*sc_putchar)(void *, int, int, u_int, long);
 	u_char sc_cmap_red[256];
 	u_char sc_cmap_green[256];
 	u_char sc_cmap_blue[256];
@@ -90,6 +91,7 @@ void	gftfb_disable_rom_internal(struct g
 
 void 	gftfb_setup(struct gftfb_softc *);
 void 	gftfb_wait(struct gftfb_softc *);
+void	gftfb_wait_fifo(struct gftfb_softc *, uint32_t);
 
 #define	ngle_bt458_write(memt, memh, r, v) \
 	bus_space_write_stream_4(memt, memh, NGLE_REG_RAMDAC + ((r) << 2), (v) << 24)
@@ -118,7 +120,6 @@ static void	gftfb_restore_palette(struct
 static int 	gftfb_putpalreg(struct gftfb_softc *, uint8_t, uint8_t,
 			uint8_t, uint8_t);
 
-#if 0
 static void	gftfb_rectfill(struct gftfb_softc *, int, int, int, int,
 			uint32_t);
 static void	gftfb_bitblt(void *, int, int, int, int, int,
@@ -126,12 +127,10 @@ static void	gftfb_bitblt(void *, int, in
 
 static void	gftfb_cursor(void *, int, int, int);
 static void	gftfb_putchar(void *, int, int, u_int, long);
-static void	gftfb_putchar_aa(void *, int, int, u_int, long);
 static void	gftfb_copycols(void *, int, int, int, int);
 static void	gftfb_erasecols(void *, int, int, int, long);
 static void	gftfb_copyrows(void *, int, int, int);
 static void	gftfb_eraserows(void *, int, int, long);
-#endif
 
 struct wsdisplay_accessops gftfb_accessops = {
 	gftfb_ioctl,
@@ -241,10 +240,6 @@ gftfb_attach(device_t parent, device_t s
 		);
 		sc->sc_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC;
 
-#if 0
-		gftfb_rectfill(sc, 0, 0, sc->sc_width, sc->sc_height,
-		ri->ri_devcmap[(defattr >> 16) & 0xff]);
-#endif
 		sc->sc_defaultscreen_descr.textops = >ri_ops;
 		sc->sc_defaultscreen_descr.capabilities = ri->ri_caps;
 		sc->sc_defaultscreen_descr.nrows = ri->ri_rows;
@@ -259,6 +254,10 @@ gftfb_attach(device_t parent, device_t s
 #endif
 		wsdisplay_cnattach(>sc_defaultscreen_descr, ri, 0, 0,
 		defattr);
+
+		gftfb_rectfill(sc, 0, 0, sc->sc_width, sc->sc_height,
+		ri->ri_devcmap[(defattr >> 16) & 0xff]);
+
 		vcons_replay_msgbuf(>sc_console_screen);
 	} else {
 		/*
@@ -718,12 +717,12 @@ gftfb_ioctl(void *v, void *vs, u_long cm
 		if (new_mode != sc->sc_mode) {
 			sc->sc_mode = new_mode;
 			if(new_mode == WSDISPLAYIO_MODE_EMUL) {
-//r128fb_init(sc);
-gftfb_restore_palette(sc);
+gftfb_setup(sc);
+if (0) gftfb_restore_palette(sc);
 //glyphcache_wipe(>sc_gc);
-//r128fb_rectfill(sc, 0, 0, sc->sc_width,
-//sc->sc_height, ms->scr_ri.ri_devcmap[
-//(ms->scr_defattr >> 16) & 0xff]);
+gftfb_rectfill(sc, 0, 0, sc->sc_width,
+sc->sc_height, ms->scr_ri.ri_devcmap[
+(ms->scr_defattr >> 16) & 0xff]);
 vcons_redraw_screen(ms);
 			}
 		}
@@ -743,12 +742,20 @@ gftfb_ioctl(void *v, void *vs, u_long cm
 static paddr_t
 gftfb_mmap(void *v, void *vs, off_t offset, int prot)
 {
-#if 0
 	struct vcons_data *vd = v;
 	struct gftfb_softc *sc = vd->cookie;
+	struct sti_rom *rom = sc->sc_base.sc_rom;
 	paddr_t pa;
-#endif
-	return -1;
+
+	if (offset < 0 || offset >= sc->sc_scr.fblen)
+		return -1;
+
+	if (sc->sc_mode != WSDISPLAYIO_MODE_DUMBFB)
+		return -1;
+
+	pa = bus_space_mmap(rom->memt, sc->sc_scr.fbaddr, offset, prot,
+	BUS_SPACE_MAP_LINEAR);
+	return pa;
 }
 
 static void
@@ -764,7 +771,7 @@ gftfb_init_screen(void *cookie, struct v
 	ri->ri_stride = 2048;
 	ri->ri_flg = RI_CENTER;
 	if (scr->scr_flags & VCONS_SCREEN_IS_STATIC)
-		ri->ri_flg |= RI_FULLCLEAR | RI_CLEAR;
+		ri->ri_flg |= (RI_FULLCLEAR | RI_CLEAR);
 	ri->ri_bits = (void *)sc->sc_scr.fbaddr;
 #if 0
 	if (sc->sc_depth == 8)
@@ -774,24 +781,19 @@ gftfb_init_screen(void *cookie, struct v
 	rasops_init(ri, 0, 0);
 	ri->ri_caps = WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE |
 		  WSSCREEN_RESIZE;
-	scr->scr_flags |= VCONS_DONT_READ;
 	scr->scr_flags |= VCONS_LOADFONT;
 
 	rasops_reconfig(ri, sc->sc_height / ri->ri_font->fontheight,
 		sc->sc_width / ri->ri_font->fontwidth);
 
 	ri->ri_hw = scr;
-#if 0
+	sc->sc_putchar = 

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

2024-02-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 15 16:17:32 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
blitter time!
everything except drawing characters i now done by hardware
next step - glyphcache


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/hppa/dev/gftfb.c

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



CVS commit: src/sys/arch/hppa

2024-02-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Feb 13 13:40:13 UTC 2024

Modified Files:
src/sys/arch/hppa/conf: files.hppa
Added Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
crude beginning of a native driver for PCI Visualize EG cards
so far it supports:
- colour
- virtual consoles
todo:
- mmap
- hardware acceleration
- STI refactoring


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/hppa/conf/files.hppa
cvs rdiff -u -r0 -r1.1 src/sys/arch/hppa/dev/gftfb.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/hppa/conf/files.hppa
diff -u src/sys/arch/hppa/conf/files.hppa:1.24 src/sys/arch/hppa/conf/files.hppa:1.25
--- src/sys/arch/hppa/conf/files.hppa:1.24	Wed Mar 23 17:35:41 2022
+++ src/sys/arch/hppa/conf/files.hppa	Tue Feb 13 13:40:13 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.hppa,v 1.24 2022/03/23 17:35:41 macallan Exp $
+#	$NetBSD: files.hppa,v 1.25 2024/02/13 13:40:13 macallan Exp $
 #
 #	$OpenBSD: files.hppa,v 1.31 2001/06/26 02:41:25 mickey Exp $
 #
@@ -271,6 +271,10 @@ file	arch/hppa/gsc/com_harmony.c	com_har
 #attach	myri at pci
 #file	dev/pci/myri.c			myri
 
+# PCI Visualize EG 
+device	gftfb: wsemuldisplaydev, rasops8, vcons, glyphcache, sti_pci, sti
+attach	gftfb at pci
+file	arch/hppa/dev/gftfb.c		gftfb
 
 # Memory Disk
 file dev/md_root.c			memory_disk_hooks

Added files:

Index: src/sys/arch/hppa/dev/gftfb.c
diff -u /dev/null src/sys/arch/hppa/dev/gftfb.c:1.1
--- /dev/null	Tue Feb 13 13:40:13 2024
+++ src/sys/arch/hppa/dev/gftfb.c	Tue Feb 13 13:40:13 2024
@@ -0,0 +1,895 @@
+/*	$NetBSD: gftfb.c,v 1.1 2024/02/13 13:40:13 macallan Exp $	*/
+
+/*	$OpenBSD: sti_pci.c,v 1.7 2009/02/06 22:51:04 miod Exp $	*/
+
+/*
+ * Copyright (c) 2006, 2007 Miodrag Vallat.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice, this permission notice, and the disclaimer below
+ * appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#ifdef STIDEBUG
+#define	DPRINTF(s)	do {	\
+	if (stidebug)		\
+		printf s;	\
+} while(0)
+
+extern int stidebug;
+#else
+#define	DPRINTF(s)	/* */
+#endif
+
+int	gftfb_match(device_t, cfdata_t, void *);
+void	gftfb_attach(device_t, device_t, void *);
+
+struct	gftfb_softc {
+	device_t		sc_dev;
+	pci_chipset_tag_t	sc_pc;
+	pcitag_t		sc_tag;
+
+	/* stuff we need in order to use the STI ROM */
+	struct sti_softc	sc_base;
+	struct sti_screen 	sc_scr;
+	bus_space_handle_t	sc_romh;
+
+	int sc_width, sc_height;
+	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];
+	glyphcache sc_gc;
+};
+
+CFATTACH_DECL_NEW(gftfb, sizeof(struct gftfb_softc),
+gftfb_match, gftfb_attach, NULL, NULL);
+
+int	gftfb_readbar(struct sti_softc *, struct pci_attach_args *, u_int, int);
+int	gftfb_check_rom(struct gftfb_softc *, struct pci_attach_args *);
+void	gftfb_enable_rom(struct sti_softc *);
+void	gftfb_disable_rom(struct sti_softc *);
+void	gftfb_enable_rom_internal(struct gftfb_softc *);
+void	gftfb_disable_rom_internal(struct gftfb_softc *);
+
+void 	gftfb_setup(struct gftfb_softc *);
+void 	gftfb_wait(struct gftfb_softc *);
+
+#define	ngle_bt458_write(memt, memh, r, v) \
+	bus_space_write_stream_4(memt, memh, NGLE_REG_RAMDAC + ((r) << 2), (v) << 24)
+
+void gftfb_setup_fb(struct gftfb_softc *);
+
+/* XXX these really need o go into their own header */
+int	sti_pci_is_console(struct pci_attach_args *, bus_addr_t *);
+int	sti_rom_setup(struct sti_rom *, bus_space_tag_t, bus_space_tag_t,
+	bus_space_handle_t, bus_addr_t *, u_int);
+int	sti_screen_setup(struct sti_screen *, int);
+void	sti_describe_screen(struct sti_softc *, struct sti_screen *);
+
+#define PCI_ROM_SIZE(mr)\
+(PCI_MAPREG_ROM_ADDR(mr) & -PCI_MAPREG_ROM_ADDR(mr))
+
+/* wsdisplay stuff */
+static int	gftfb_ioctl(void *, void *, u_long, void *, int,
+			 struct lwp *);

CVS commit: src/sys/arch/hppa

2024-02-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Feb 13 13:40:13 UTC 2024

Modified Files:
src/sys/arch/hppa/conf: files.hppa
Added Files:
src/sys/arch/hppa/dev: gftfb.c

Log Message:
crude beginning of a native driver for PCI Visualize EG cards
so far it supports:
- colour
- virtual consoles
todo:
- mmap
- hardware acceleration
- STI refactoring


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/hppa/conf/files.hppa
cvs rdiff -u -r0 -r1.1 src/sys/arch/hppa/dev/gftfb.c

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



  1   2   3   4   5   6   7   8   9   10   >