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.



CVS commit: src/sys/dev/ic

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

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

Log Message:
in sti_screen_setup() don't bother looking for fonts if STI_FBMODE is requested


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 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.34 src/sys/dev/ic/sti.c:1.35
--- src/sys/dev/ic/sti.c:1.34	Thu Feb  1 06:50:36 2024
+++ src/sys/dev/ic/sti.c	Tue Feb 13 13:17:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti.c,v 1.34 2024/02/01 06:50:36 skrll Exp $	*/
+/*	$NetBSD: sti.c,v 1.35 2024/02/13 13:17:51 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.34 2024/02/01 06:50:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.35 2024/02/13 13:17:51 macallan Exp $");
 
 #include "wsdisplay.h"
 
@@ -556,6 +556,12 @@ sti_screen_setup(struct sti_screen *scr,
 	scr->owidth = cfg.owidth;
 	memcpy(scr->name, cfg.name, sizeof(scr->name));
 
+	if (flags & STI_FBMODE) {
+		/* we're done here */
+		sti_init(scr, STI_FBMODE);
+		return 0;
+	}
+
 	if ((error = sti_init(scr, STI_TEXTMODE | flags))) {
 		aprint_error(": cannot initialize (%d)\n", error);
 		goto fail;



CVS commit: src/sys/dev/ic

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

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

Log Message:
in sti_screen_setup() don't bother looking for fonts if STI_FBMODE is requested


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 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-01-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan 31 08:15:00 UTC 2024

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

Log Message:
Make this work properly on PCI Visualize EG:
- use bus_space_*_stream() for all register accesses in order to avoid
  byte order conversion on PCI devices
- when switching to framebuffer mode, request as many text planes as STI allows
- request access to both text and non-text planes in fb mode
With this and the bus_space commit a few days ago I have usable X on my C360
and a PCI Visualize EG.
This needs testing on quite literally everything else.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 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-01-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan 31 08:15:00 UTC 2024

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

Log Message:
Make this work properly on PCI Visualize EG:
- use bus_space_*_stream() for all register accesses in order to avoid
  byte order conversion on PCI devices
- when switching to framebuffer mode, request as many text planes as STI allows
- request access to both text and non-text planes in fb mode
With this and the bus_space commit a few days ago I have usable X on my C360
and a PCI Visualize EG.
This needs testing on quite literally everything else.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 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.31 src/sys/dev/ic/sti.c:1.32
--- src/sys/dev/ic/sti.c:1.31	Sat Aug  7 16:19:12 2021
+++ src/sys/dev/ic/sti.c	Wed Jan 31 08:15:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: sti.c,v 1.31 2021/08/07 16:19:12 thorpej Exp $	*/
+/*	$NetBSD: sti.c,v 1.32 2024/01/31 08:15:00 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.31 2021/08/07 16:19:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sti.c,v 1.32 2024/01/31 08:15:00 macallan Exp $");
 
 #include "wsdisplay.h"
 
@@ -926,17 +926,30 @@ sti_init(struct sti_screen *scr, int mod
 	KASSERT(rom != NULL);
 	memset(, 0, sizeof(a));
 
-	a.flags.flags = STI_INITF_WAIT | STI_INITF_EBET;
+	a.flags.flags = STI_INITF_WAIT | STI_INITF_PBET | STI_INITF_PBETI;
 	if ((mode & STI_TEXTMODE) != 0) {
 		a.flags.flags |= STI_INITF_TEXT | STI_INITF_CMB |
 		STI_INITF_PBET | STI_INITF_PBETI | STI_INITF_ICMT;
+		a.in.text_planes = 1;
 	} else {
-		a.flags.flags |= STI_INITF_NTEXT;
+		a.flags.flags |= STI_INITF_TEXT | STI_INITF_NTEXT;
+		/* 
+		 * Request as many text palnes as STI will allow. 
+		 * The reason to do this - when switching to framebuffer mode
+		 * for X we need access to all planes. In theory STI should do
+		 * just that when we request access to both text and non-text
+		 * planes as above.
+		 * In reality though, at least on my PCI Visualize EG, some
+		 * planes and/or colour registers remain inaccessible if we
+		 * request only one text plane.
+		 * Clearly we're missing a register write or two here, but so
+		 * far I haven't found it.
+		 */
+		a.in.text_planes = 3;
 	}
 	if ((mode & STI_CLEARSCR) != 0)
 		a.flags.flags |= STI_INITF_CLEAR;
 
-	a.in.text_planes = 1;
 	a.in.ext_in = 
 
 	DPRINTF(("%s: init,%p(%x, %p, %p, %p)\n",
@@ -1060,7 +1073,7 @@ sti_ioctl(void *v, void *vs, u_long cmd,
 			break;
 		case WSDISPLAYIO_MODE_DUMBFB:
 			if (scr->scr_wsmode != WSDISPLAYIO_MODE_DUMBFB) {
-sti_init(scr, 0);
+ret = sti_init(scr, 0);
 if (scr->setupfb != NULL)
 	scr->setupfb(scr);
 else
@@ -1487,7 +1500,7 @@ void	ngle_setup_attr_planes(struct sti_s
 void	ngle_setup_bt458(struct sti_screen *scr);
 
 #define	ngle_bt458_write(memt, memh, r, v) \
-	bus_space_write_4(memt, memh, NGLE_REG_RAMDAC + ((r) << 2), (v) << 24)
+	bus_space_write_stream_4(memt, memh, NGLE_REG_RAMDAC + ((r) << 2), (v) << 24)
 
 void
 ngle_artist_setupfb(struct sti_screen *scr)
@@ -1504,10 +1517,10 @@ ngle_artist_setupfb(struct sti_screen *s
 	ngle_setup_attr_planes(scr);
 
 	ngle_setup_hw(memt, memh);
-	bus_space_write_4(memt, memh, NGLE_REG_21,
-	bus_space_read_4(memt, memh, NGLE_REG_21) | 0x0a00);
-	bus_space_write_4(memt, memh, NGLE_REG_27,
-	bus_space_read_4(memt, memh, NGLE_REG_27) | 0x0080);
+	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);
 }
 
 void
@@ -1566,19 +1579,19 @@ ngle_setup_attr_planes(struct sti_screen
 	bus_space_handle_t memh = rom->regh[2];
 
 	ngle_setup_hw(memt, memh);
-	bus_space_write_4(memt, memh, NGLE_REG_11, 0x2ea0d000);
-	bus_space_write_4(memt, memh, NGLE_REG_14, 0x23000302);
-	bus_space_write_4(memt, memh, NGLE_REG_12, scr->reg12_value);
-	bus_space_write_4(memt, memh, NGLE_REG_8, 0x);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_11, 0x2ea0d000);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_14, 0x23000302);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_12, scr->reg12_value);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_8, 0x);
 
-	bus_space_write_4(memt, memh, NGLE_REG_6, 0x);
-	bus_space_write_4(memt, memh, NGLE_REG_9,
+	bus_space_write_stream_4(memt, memh, NGLE_REG_6, 0x);
+	bus_space_write_stream_4(memt, memh, NGLE_REG_9,
 	(scr->scr_cfg.scr_width << 16) | scr->scr_cfg.scr_height);
-	bus_space_write_4(memt, memh, NGLE_REG_6, 0x0500);
-	bus_space_write_4(memt, memh, NGLE_REG_9, 0x00040001);
+	bus_space_write_stream_4(memt, 

CVS commit: src/sys/arch/hppa

2024-01-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Jan 28 09:03:22 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: dino.c elroy.c
src/sys/arch/hppa/hppa: mainbus.c
src/sys/arch/hppa/include: bus_defs.h bus_funcs.h

Log Message:
add missing bus_space_*_stream() methods instead of quietly aliasing them
to their potentially byte-swapping regular counterparts

ok skrll@


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hppa/dev/dino.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/hppa/dev/elroy.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hppa/hppa/mainbus.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/hppa/include/bus_defs.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/hppa/include/bus_funcs.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/hppa/dev/dino.c
diff -u src/sys/arch/hppa/dev/dino.c:1.16 src/sys/arch/hppa/dev/dino.c:1.17
--- src/sys/arch/hppa/dev/dino.c:1.16	Thu Sep 29 06:39:58 2022
+++ src/sys/arch/hppa/dev/dino.c	Sun Jan 28 09:03:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: dino.c,v 1.16 2022/09/29 06:39:58 skrll Exp $ */
+/*	$NetBSD: dino.c,v 1.17 2024/01/28 09:03:22 macallan Exp $ */
 
 /*	$OpenBSD: dino.c,v 1.5 2004/02/13 20:39:31 mickey Exp $	*/
 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dino.c,v 1.16 2022/09/29 06:39:58 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dino.c,v 1.17 2024/01/28 09:03:22 macallan Exp $");
 
 /* #include "cardbus.h" */
 
@@ -177,10 +177,16 @@ uint8_t dino_r1(void *, bus_space_handle
 uint16_t dino_r2(void *, bus_space_handle_t, bus_size_t);
 uint32_t dino_r4(void *, bus_space_handle_t, bus_size_t);
 uint64_t dino_r8(void *, bus_space_handle_t, bus_size_t);
+uint16_t dino_rs2(void *, bus_space_handle_t, bus_size_t);
+uint32_t dino_rs4(void *, bus_space_handle_t, bus_size_t);
+uint64_t dino_rs8(void *, bus_space_handle_t, bus_size_t);
 void dino_w1(void *, bus_space_handle_t, bus_size_t, uint8_t);
 void dino_w2(void *, bus_space_handle_t, bus_size_t, uint16_t);
 void dino_w4(void *, bus_space_handle_t, bus_size_t, uint32_t);
 void dino_w8(void *, bus_space_handle_t, bus_size_t, uint64_t);
+void dino_ws2(void *, bus_space_handle_t, bus_size_t, uint16_t);
+void dino_ws4(void *, bus_space_handle_t, bus_size_t, uint32_t);
+void dino_ws8(void *, bus_space_handle_t, bus_size_t, uint64_t);
 void dino_rm_1(void *, bus_space_handle_t, bus_size_t, uint8_t *, bus_size_t);
 void dino_rm_2(void *, bus_space_handle_t, bus_size_t, uint16_t *, bus_size_t);
 void dino_rm_4(void *, bus_space_handle_t, bus_size_t, uint32_t *, bus_size_t);
@@ -413,7 +419,7 @@ dino_intr_map(const struct pci_attach_ar
 	if (line == 0xff)
 		return 1;
 
-	*ihp = line;
+	*ihp = line ;
 
 	return 0;
 }
@@ -695,6 +701,59 @@ dino_r8(void *v, bus_space_handle_t h, b
 	return le64toh(data);
 }
 
+uint16_t
+dino_rs2(void *v, bus_space_handle_t h, bus_size_t o)
+{
+	volatile uint16_t *p;
+
+	h += o;
+	if (h & HPPA_IOSPACE)
+		p = (volatile uint16_t *)h;
+	else {
+		struct dino_softc *sc = v;
+		volatile struct dino_regs *r = sc->sc_regs;
+
+		r->pci_addr = h;
+		p = (volatile uint16_t *)>pci_io_data;
+		if (h & 2)
+			p++;
+	}
+	return *p;
+}
+
+uint32_t
+dino_rs4(void *v, bus_space_handle_t h, bus_size_t o)
+{
+	uint32_t data;
+
+	h += o;
+	if (h & HPPA_IOSPACE)
+		data = *(volatile uint32_t *)h;
+	else {
+		struct dino_softc *sc = v;
+		volatile struct dino_regs *r = sc->sc_regs;
+
+		r->pci_addr = h;
+		data = r->pci_io_data;
+	}
+
+	return data;
+}
+
+uint64_t
+dino_rs8(void *v, bus_space_handle_t h, bus_size_t o)
+{
+	uint64_t data;
+
+	h += o;
+	if (h & HPPA_IOSPACE)
+		data = *(volatile uint64_t *)h;
+	else
+		panic("dino_r8: not implemented");
+
+	return data;
+}
+
 void
 dino_w1(void *v, bus_space_handle_t h, bus_size_t o, uint8_t vv)
 {
@@ -757,6 +816,51 @@ dino_w8(void *v, bus_space_handle_t h, b
 		panic("dino_w8: not implemented");
 }
 
+void
+dino_ws2(void *v, bus_space_handle_t h, bus_size_t o, uint16_t vv)
+{
+	volatile uint16_t *p;
+
+	h += o;
+	if (h & HPPA_IOSPACE)
+		p = (volatile uint16_t *)h;
+	else {
+		struct dino_softc *sc = v;
+		volatile struct dino_regs *r = sc->sc_regs;
+
+		r->pci_addr = h;
+		p = (volatile uint16_t *)>pci_io_data;
+		if (h & 2)
+			p++;
+	}
+
+	*p = vv;
+}
+
+void
+dino_ws4(void *v, bus_space_handle_t h, bus_size_t o, uint32_t vv)
+{
+	h += o;
+	if (h & HPPA_IOSPACE)
+		*(volatile uint32_t *)h = vv;
+	else {
+		struct dino_softc *sc = v;
+		volatile struct dino_regs *r = sc->sc_regs;
+
+		r->pci_addr = h;
+		r->pci_io_data = vv;
+	}
+}
+
+void
+dino_ws8(void *v, bus_space_handle_t h, bus_size_t o, uint64_t vv)
+{
+	h += o;
+	if (h & HPPA_IOSPACE)
+		*(volatile uint64_t *)h = vv;
+	else
+		panic("dino_w8: not implemented");
+}
 
 void
 dino_rm_1(void *v, bus_space_handle_t h, bus_size_t o, uint8_t *a, bus_size_t c)
@@ -1454,7 +1558,9 @@ const struct hppa_bus_space_tag dino_iom
 	NULL, dino_unmap, dino_subregion, 

CVS commit: src/sys/arch/hppa

2024-01-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Jan 28 09:03:22 UTC 2024

Modified Files:
src/sys/arch/hppa/dev: dino.c elroy.c
src/sys/arch/hppa/hppa: mainbus.c
src/sys/arch/hppa/include: bus_defs.h bus_funcs.h

Log Message:
add missing bus_space_*_stream() methods instead of quietly aliasing them
to their potentially byte-swapping regular counterparts

ok skrll@


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/hppa/dev/dino.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/hppa/dev/elroy.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hppa/hppa/mainbus.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/hppa/include/bus_defs.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/hppa/include/bus_funcs.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/hppa

2024-01-18 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jan 18 10:34:29 UTC 2024

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

Log Message:
rearrange things so we:
- find machine_ledaddr on Cxxx and the like without lcd at mainbus
- build without options USELEDS


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hppa/hppa/mainbus.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-01-18 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jan 18 10:34:29 UTC 2024

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

Log Message:
rearrange things so we:
- find machine_ledaddr on Cxxx and the like without lcd at mainbus
- build without options USELEDS


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hppa/hppa/mainbus.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/mainbus.c
diff -u src/sys/arch/hppa/hppa/mainbus.c:1.11 src/sys/arch/hppa/hppa/mainbus.c:1.12
--- src/sys/arch/hppa/hppa/mainbus.c:1.11	Tue Oct 11 22:03:37 2022
+++ src/sys/arch/hppa/hppa/mainbus.c	Thu Jan 18 10:34:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.11 2022/10/11 22:03:37 andvar Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.12 2024/01/18 10:34:29 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,11 +58,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.11 2022/10/11 22:03:37 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.12 2024/01/18 10:34:29 macallan Exp $");
 
 #include "locators.h"
 #include "power.h"
 #include "lcd.h"
+#include "opt_useleds.h"
 
 #include 
 #include 
@@ -83,9 +84,7 @@ __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 
 #include 
 #include 
 
-#if NLCD > 0
 static struct pdc_chassis_info pdc_chassis_info;
-#endif
 
 #ifdef MBUSDEBUG
 
@@ -1362,9 +1361,7 @@ mbattach(device_t parent, device_t self,
 	struct mainbus_softc *sc = device_private(self);
 	struct confargs nca;
 	bus_space_handle_t ioh;
-#if NLCD > 0
 	int err;
-#endif
 
 	sc->sc_dv = self;
 	mb_attached = 1;
@@ -1409,11 +1406,11 @@ mbattach(device_t parent, device_t self,
 	config_found(self, , mbprint, CFARGS_NONE);
 #endif
 
-#if NLCD > 0
 	memset(, 0, sizeof(nca));
 	err = pdcproc_chassis_info(_chassis_info, _pcl);
 	if (!err) {
 		if (nca.ca_pcl.enabled) {
+#if NLCD > 0
 			nca.ca_name = "lcd";
 			nca.ca_dp.dp_bc[0] = nca.ca_dp.dp_bc[1] = nca.ca_dp.dp_bc[2] =
 			nca.ca_dp.dp_bc[3] = nca.ca_dp.dp_bc[4] = nca.ca_dp.dp_bc[5] = -1;
@@ -1423,13 +1420,15 @@ mbattach(device_t parent, device_t self,
 			nca.ca_hpa = nca.ca_pcl.cmd_addr;
 
 			config_found(self, , mbprint, CFARGS_NONE);
+#endif
 		} else if (nca.ca_pcl.model == 2) {
+#ifdef USELEDS
 			bus_space_map(_bustag, nca.ca_pcl.cmd_addr,
 		  	  4, 0, (bus_space_handle_t *)_ledaddr);
 		  	machine_ledword = 1;
+#endif
 		}
 	}
-#endif
 
 	hppa_modules_scan();
 



CVS commit: xsrc/local/programs/bdfload

2024-01-08 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Mon Jan  8 18:09:33 UTC 2024

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

Log Message:
add support for doubling a font's size, with optional smoothing
- works only on fonts up to 8 pixels wide for now
- smoothing attempts to detect pixel staircases and add pixels to smooth
  them out


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 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.20 xsrc/local/programs/bdfload/bdfload.c:1.21
--- xsrc/local/programs/bdfload/bdfload.c:1.20	Thu Jul 27 08:44:42 2023
+++ xsrc/local/programs/bdfload/bdfload.c	Mon Jan  8 18:09:33 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: bdfload.c,v 1.20 2023/07/27 08:44:42 macallan Exp $	*/
+/*	$NetBSD: bdfload.c,v 1.21 2024/01/08 18:09:33 macallan Exp $	*/
 
 /*
  * Copyright (c) 2018 Michael Lorenz
@@ -103,6 +103,8 @@ int verbose = 0;
 int dump = 0;
 int header = 0;
 int force = 0;
+int scale = 0;
+int smoothe = 0;
 char commentbuf[2048] = "";
 int commentptr = 0;
 char fontname[64] = "";
@@ -125,9 +127,11 @@ dump_line(char *gptr, int stride)
 }
  
 void
-write_wsf(const char *oname, struct wsdisplay_font *f, char *buffer, int buflen)
+write_wsf(const char *oname, struct wsdisplay_font *f)
 {
 	struct wsfthdr h;
+	uint8_t *buffer = f->data;
+	int buflen = f->numchars * f->stride * f->fontheight;
 
 	memset(, 0, sizeof(h));
 	strncpy(h.magic, "WSFT", sizeof(h.magic));
@@ -161,10 +165,10 @@ write_wsf(const char *oname, struct wsdi
 }
 
 int
-write_header(const char *filename, struct wsdisplay_font *f, 
- char *buffer, int buflen)
+write_header(const char *filename, struct wsdisplay_font *f)
 {
 	FILE *output;
+	char *buffer = f->data;
 	int i, j, x, y, idx, pxls, left;
 	char name[64], c, msk;
 	
@@ -200,11 +204,11 @@ write_header(const char *filename, struc
 	fprintf(output, "\t%s_data\t\t/* data */\n", name);
 	fprintf(output, "};\n\n");
 	fprintf(output, "static u_char %s_data[] = {\n", name);
-	for (i = f->firstchar; i < f->firstchar + f->numchars; i++) {
+	for (i = 0; i < f->numchars; i++) {
 		if (names[i] != NULL) {
-			fprintf(output, "\t/* %d %s */\n", i, names[i]);
+			fprintf(output, "\t/* %d %s */\n", i + f->firstchar, names[i]);
 		} else			
-			fprintf(output, "\t/* %d */\n", i);
+			fprintf(output, "\t/* %d */\n", i + f->firstchar);
 		idx = i * f->stride * f->fontheight;
 		for (y = 0; y < f->fontheight; y++) {
 			for (x = 0; x < f->stride; x++) {
@@ -234,6 +238,79 @@ write_header(const char *filename, struc
 }
 
 void
+double_pixels(uint8_t *inbuf, uint16_t *outbuf, int bytes)
+{
+	int i, j;
+	uint16_t outmask, out;
+	uint8_t in, inmask;
+
+	for (i = 0; i < bytes; i++) {
+		inmask = 0x80;
+		outmask = 0xc000;
+		out = 0;
+		in = inbuf[i];
+		for (j = 0; j < 8; j++) {
+			if (in & inmask) {
+out |= outmask;
+			}
+			inmask = inmask >> 1;
+			outmask = outmask >> 2;
+		}
+		outbuf[i * 2] = htobe16(out);
+	}
+}
+
+void fill_dup(uint16_t *buf, int lines)
+{
+	int i;
+	for (i = 0; i < lines; i++) {
+		buf[2 * i + 1] = buf[2 * i];
+	}
+}
+
+void smoothe_pixels(uint16_t *buf, int lines)
+{
+	int i, j, topright, topleft, botright, botleft;
+	uint16_t pmask, in, prev, next, out;
+	for (i = 0; i < lines; i++) {
+		pmask = 0xc000;
+		in = be16toh(buf[i]);
+		out = in;
+		prev = next = 0;
+		if (i > 1) prev = be16toh(buf[i - 2]);
+		if (i < (lines - 2)) next = be16toh(buf[i + 2]);
+		for (j = 0; j < 8; j++) {
+			if ((in & pmask) == 0) {
+/* empty pixel, check surroundings */
+topright = topleft = botright = botleft = 0;
+if (((i & 1) == 0) && (j < 6))
+	topright = (((prev & pmask) == pmask) &&
+		((prev & (pmask >> 2)) != 0) &&
+		((in & (pmask >> 2)) != 0));
+if (((i & 1) == 0) && (j > 0))
+	topleft = (((prev & pmask) == pmask) &&
+		((prev & (pmask << 2)) != 0) &&
+		((in & (pmask << 2)) != 0));
+if ((i & 1) && (j < 6))
+	botright = (((next & pmask) == pmask) &&
+		((next & (pmask >> 2)) != 0) &&
+		((in & (pmask >> 2)) != 0));
+if ((i & 1) && (j > 0))
+	botleft = (((next & pmask) == pmask) &&
+		((next & (pmask << 2)) != 0) &&
+		((in & (pmask << 2)) != 0));
+if ((topright + topleft + botright + botleft) == 1) {
+	if (topleft || botleft) out |= pmask << 1;
+	if (topright || botright) out |

CVS commit: xsrc/local/programs/bdfload

2024-01-08 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Mon Jan  8 18:09:33 UTC 2024

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

Log Message:
add support for doubling a font's size, with optional smoothing
- works only on fonts up to 8 pixels wide for now
- smoothing attempts to detect pixel staircases and add pixels to smooth
  them out


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 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/macppc/conf

2023-10-03 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Oct  3 08:23:07 UTC 2023

Modified Files:
src/sys/arch/macppc/conf: POWERMAC_G5_11_2

Log Message:
add xhci


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/macppc/conf/POWERMAC_G5_11_2

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/macppc/conf/POWERMAC_G5_11_2
diff -u src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.22 src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.23
--- src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.22	Sun Aug  7 02:52:27 2022
+++ src/sys/arch/macppc/conf/POWERMAC_G5_11_2	Tue Oct  3 08:23:07 2023
@@ -155,9 +155,13 @@ ukphy*	at mii? phy ?			# generic unknown
 # PCI USB controllers
 ohci*	at pci? dev ? function ?	# USB Open Host Controller
 ehci*	at pci? dev ? function ?	# USB Enhanced Host Controller
+# No G5 ships with USB 3.0 but xhci 1.0 cards have been confirmed working
+# in PCIe models
+xhci*	at pci? dev ? function ?	# USB 3.0
 
 usb*	at ohci?	# USB bus support
 usb*	at ehci?	# USB bus support
+usb*	at xhci?	# USB bus support
 uhub*	at usb?		# USB Hubs
 uhub*	at uhub? port ?
 uhidev*	at uhub? port ? configuration ? interface ?	# USB HID device



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

2023-10-03 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Oct  3 08:23:07 UTC 2023

Modified Files:
src/sys/arch/macppc/conf: POWERMAC_G5_11_2

Log Message:
add xhci


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/macppc/conf/POWERMAC_G5_11_2

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



CVS commit: src/sys/dev

2023-09-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Sep 25 08:42:05 UTC 2023

Modified Files:
src/sys/dev: files.audio

Log Message:
defflag AUDIO_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/files.audio

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



CVS commit: src/sys/dev

2023-09-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Sep 25 08:42:05 UTC 2023

Modified Files:
src/sys/dev: files.audio

Log Message:
defflag AUDIO_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/files.audio

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/files.audio
diff -u src/sys/dev/files.audio:1.16 src/sys/dev/files.audio:1.17
--- src/sys/dev/files.audio:1.16	Sat Jun  4 20:12:10 2022
+++ src/sys/dev/files.audio	Mon Sep 25 08:42:05 2023
@@ -1,6 +1,7 @@
-#	$NetBSD: files.audio,v 1.16 2022/06/04 20:12:10 pgoyette Exp $
+#	$NetBSD: files.audio,v 1.17 2023/09/25 08:42:05 macallan Exp $
 
 defparam opt_audio.h	AUDIO_BLK_MS
+defflag opt_audio.h AUDIO_DEBUG
 
 define	audiobus	{ }
 define	midibus		{ }



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

2023-09-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep  6 08:14:42 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: cuda.c

Log Message:
yet another tsleep/wakeup -> cv_*


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/macppc/dev/cuda.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/macppc/dev/cuda.c
diff -u src/sys/arch/macppc/dev/cuda.c:1.29 src/sys/arch/macppc/dev/cuda.c:1.30
--- src/sys/arch/macppc/dev/cuda.c:1.29	Sat Aug  7 16:18:57 2021
+++ src/sys/arch/macppc/dev/cuda.c	Wed Sep  6 08:14:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cuda.c,v 1.29 2021/08/07 16:18:57 thorpej Exp $ */
+/*	$NetBSD: cuda.c,v 1.30 2023/09/06 08:14:42 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cuda.c,v 1.29 2021/08/07 16:18:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cuda.c,v 1.30 2023/09/06 08:14:42 macallan Exp $");
 
 #include 
 #include 
@@ -93,7 +93,8 @@ struct cuda_softc {
 	/* time */
 	uint32_t sc_tod;
 	uint32_t sc_autopoll;
-	uint32_t sc_todev;
+	kcondvar_t sc_todev;
+	kmutex_t sc_todevmtx;
 	/* ADB */
 	void (*sc_adb_handler)(void *, int, uint8_t *);
 	void *sc_adb_cookie;
@@ -197,6 +198,9 @@ cuda_attach(device_t parent, device_t se
 	sc->sc_error = 0;
 	sc->sc_i2c_read_len = 0;
 
+	cv_init(>sc_todev, "cuda_event");
+	mutex_init(>sc_todevmtx, MUTEX_DEFAULT, IPL_NONE);
+
 	if (bus_space_map(sc->sc_memt, ca->ca_reg[0] + ca->ca_baseaddr,
 	ca->ca_reg[1], 0, >sc_memh) != 0) {
 
@@ -728,7 +732,8 @@ cuda_error_handler(void *cookie, int len
 	 * byte 3 seems to be the failed command
 	 */
 	sc->sc_error = 1;
-	wakeup(>sc_todev);
+	DPRINTF("cuda error %02x %02x %02x %02x\n", data[0], data[1], data[2], data[3]);
+	cv_signal(>sc_todev);
 	return 0;
 }
 
@@ -763,7 +768,7 @@ cuda_todr_handler(void *cookie, int len,
 			sc->sc_iic_done = len;
 			break;
 	}
-	wakeup(>sc_todev);
+	cv_signal(>sc_todev);
 	return 0;
 }
 
@@ -781,7 +786,10 @@ cuda_todr_get(todr_chip_handle_t tch, st
 		cuda_send(sc, 0, 2, cmd);
 
 		while ((sc->sc_tod == 0) && (cnt < 10)) {
-			tsleep(>sc_todev, 0, "todr", 10);
+			mutex_enter(>sc_todevmtx);
+			cv_timedwait(>sc_todev, >sc_todevmtx, hz);
+			mutex_exit(>sc_todevmtx);
+
 			cnt++;
 		}
 
@@ -817,7 +825,9 @@ cuda_todr_set(todr_chip_handle_t tch, st
 	sc->sc_tod = 0;
 	if (cuda_send(sc, 0, 6, cmd) == 0) {
 		while (sc->sc_tod == 0) {
-			tsleep(>sc_todev, 0, "todr", 10);
+			mutex_enter(>sc_todevmtx);
+			cv_timedwait(>sc_todev, >sc_todevmtx, hz);
+			mutex_exit(>sc_todevmtx);
 		}
 		return 0;
 	}
@@ -874,8 +884,11 @@ cuda_autopoll(void *cookie, int flag)
 	while(sc->sc_autopoll == -1) {
 		if (sc->sc_polling || cold) {
 			cuda_poll(sc);
-		} else
-			tsleep(>sc_todev, 0, "autopoll", 100);
+		} else {
+			mutex_enter(>sc_todevmtx);
+			cv_timedwait(>sc_todev, >sc_todevmtx, hz);
+			mutex_exit(>sc_todevmtx);
+		}
 	}
 }
 	
@@ -962,8 +975,11 @@ cuda_i2c_exec(void *cookie, i2c_op_t op,
 	while ((sc->sc_iic_done == 0) && (sc->sc_error == 0)) {
 		if (sc->sc_polling || cold) {
 			cuda_poll(sc);
-		} else
-			tsleep(>sc_todev, 0, "i2c", 1000);
+		} else {
+			mutex_enter(>sc_todevmtx);
+			cv_timedwait(>sc_todev, >sc_todevmtx, hz);
+			mutex_exit(>sc_todevmtx);
+		}
 	}
 
 	if (sc->sc_error) {
@@ -988,8 +1004,11 @@ cuda_i2c_exec(void *cookie, i2c_op_t op,
 		while ((sc->sc_iic_done == 0) && (sc->sc_error == 0)) {
 			if (sc->sc_polling || cold) {
 cuda_poll(sc);
-			} else
-tsleep(>sc_todev, 0, "i2c", 1000);
+			} else {
+mutex_enter(>sc_todevmtx);
+cv_timedwait(>sc_todev, >sc_todevmtx, hz);
+mutex_exit(>sc_todevmtx);
+			}
 		}
 
 		if (sc->sc_error) {



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

2023-09-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep  6 08:14:42 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: cuda.c

Log Message:
yet another tsleep/wakeup -> cv_*


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/macppc/dev/cuda.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/macppc/dev

2023-08-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 30 08:38:51 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: awacs.c

Log Message:
don't abuse the interrupt lock for waits in the event thread


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/macppc/dev/awacs.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/macppc/dev/awacs.c
diff -u src/sys/arch/macppc/dev/awacs.c:1.51 src/sys/arch/macppc/dev/awacs.c:1.52
--- src/sys/arch/macppc/dev/awacs.c:1.51	Fri Mar  5 07:15:53 2021
+++ src/sys/arch/macppc/dev/awacs.c	Wed Aug 30 08:38:51 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: awacs.c,v 1.51 2021/03/05 07:15:53 rin Exp $	*/
+/*	$NetBSD: awacs.c,v 1.52 2023/08/30 08:38:51 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awacs.c,v 1.51 2021/03/05 07:15:53 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awacs.c,v 1.52 2023/08/30 08:38:51 macallan Exp $");
 
 #include 
 #include 
@@ -102,6 +102,7 @@ struct awacs_softc {
 	struct dbdma_command *sc_idmacmd;
 
 	kmutex_t sc_lock;
+	kmutex_t sc_event_lock;
 	kmutex_t sc_intr_lock;
 };
 
@@ -375,6 +376,7 @@ awacs_attach(device_t parent, device_t s
 	intr_xname);
 
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(>sc_event_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_AUDIO);
 
 	cv_init(>sc_event, "awacs_wait");
@@ -1274,9 +1276,10 @@ awacs_thread(void *cookie)
 {
 	struct awacs_softc *sc = cookie;
 	
-	mutex_enter(>sc_intr_lock);
 	while (1) {
-		cv_timedwait(>sc_event, >sc_intr_lock, hz);
+		mutex_enter(>sc_event_lock);
+		cv_timedwait(>sc_event, >sc_event_lock, hz);
+		mutex_exit(>sc_event_lock);
 		if (sc->sc_output_wanted == sc->sc_output_mask)
 			continue;
 



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

2023-08-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 30 08:38:51 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: awacs.c

Log Message:
don't abuse the interrupt lock for waits in the event thread


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/macppc/dev/awacs.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/macppc/dev

2023-08-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 30 07:42:41 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: pmu.c

Log Message:
remove ancient #if 0 block
NFC


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/macppc/dev/pmu.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/macppc/dev/pmu.c
diff -u src/sys/arch/macppc/dev/pmu.c:1.40 src/sys/arch/macppc/dev/pmu.c:1.41
--- src/sys/arch/macppc/dev/pmu.c:1.40	Tue Aug 22 06:43:34 2023
+++ src/sys/arch/macppc/dev/pmu.c	Wed Aug 30 07:42:41 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmu.c,v 1.40 2023/08/22 06:43:34 macallan Exp $ */
+/*	$NetBSD: pmu.c,v 1.41 2023/08/30 07:42:41 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.40 2023/08/22 06:43:34 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.41 2023/08/30 07:42:41 macallan Exp $");
 
 #include 
 #include 
@@ -762,21 +762,6 @@ done:
 	return 1;
 }
 
-#if 0
-static int
-pmu_error_handler(void *cookie, int len, uint8_t *data)
-{
-	struct pmu_softc *sc = cookie;
-
-	/* 
-	 * something went wrong
-	 * byte 3 seems to be the failed command
-	 */
-	sc->sc_error = 1;
-	wakeup(>sc_todev);
-	return 0;
-}
-#endif
 #define DIFF19041970 2082844800
 
 static int



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

2023-08-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 30 07:42:41 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: pmu.c

Log Message:
remove ancient #if 0 block
NFC


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/macppc/dev/pmu.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/macppc/dev

2023-08-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug 22 06:43:34 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: pmu.c

Log Message:
tsleep()/wakeup() -> cv_*


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/macppc/dev/pmu.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/macppc/dev/pmu.c
diff -u src/sys/arch/macppc/dev/pmu.c:1.39 src/sys/arch/macppc/dev/pmu.c:1.40
--- src/sys/arch/macppc/dev/pmu.c:1.39	Sat Aug  7 16:18:58 2021
+++ src/sys/arch/macppc/dev/pmu.c	Tue Aug 22 06:43:34 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmu.c,v 1.39 2021/08/07 16:18:58 thorpej Exp $ */
+/*	$NetBSD: pmu.c,v 1.40 2023/08/22 06:43:34 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.39 2021/08/07 16:18:58 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.40 2023/08/22 06:43:34 macallan Exp $");
 
 #include 
 #include 
@@ -36,6 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.39
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -105,7 +106,8 @@ struct pmu_softc {
 	lwp_t *sc_thread;
 	int sc_pending;
 	/* signalling the event thread */
-	int sc_event;
+	kcondvar_t sc_event;
+	kmutex_t sc_evmtx;
 	/* ADB */
 	void (*sc_adb_handler)(void *, int, uint8_t *);
 	void *sc_adb_cookie;
@@ -296,6 +298,9 @@ pmu_attach(device_t parent, device_t sel
 	sc->sc_button = 0;
 	sc->sc_env_mask = 0xff;
 
+	cv_init(>sc_event, "pmu_event");
+	mutex_init(>sc_evmtx, MUTEX_DEFAULT, IPL_NONE);
+	
 	/*
 	 * core99 PowerMacs like to send environment messages with the lid
 	 * switch bit set - since that doesn't make any sense here and it
@@ -699,14 +704,14 @@ pmu_intr(void *arg)
 		DPRINTF("brightness: %d volume %d\n", resp[2], resp[3]);
 		sc->sc_brightness_wanted = resp[2];
 		sc->sc_volume_wanted = resp[3];
-		wakeup(>sc_event);
+		cv_signal(>sc_event);
 		goto done;
 	}
 	if (resp[1] & PMU_INT_PCEJECT) {
 		/* deal with PCMCIA eject buttons */
 		DPRINTF("card eject %d\n", resp[3]);
 		atomic_or_32(>sc_pending, (resp[3] & 3));
-		wakeup(>sc_event);
+		cv_signal(>sc_event);
 		goto done;
 	}
 	if (resp[1] & PMU_INT_BATTERY) {
@@ -719,7 +724,7 @@ pmu_intr(void *arg)
 	}
 	if (resp[1] & PMU_INT_ENVIRONMENT) {
 		uint8_t diff;
-#ifdef PMU_VERBOSE
+#ifdef PMU_DEBUG
 		/* deal with environment messages */
 		printf("environment:");
 		for (i = 2; i < len; i++)
@@ -732,12 +737,12 @@ pmu_intr(void *arg)
 		if (diff & PMU_ENV_LID_CLOSED) {
 			sc->sc_lid_closed = (resp[2] & PMU_ENV_LID_CLOSED) != 0;
 			atomic_or_32(>sc_pending, PMU_EV_LID);
-			wakeup(>sc_event);
+			cv_signal(>sc_event);
 		}
 		if (diff & PMU_ENV_POWER_BUTTON) {
 			sc->sc_button = (resp[2] & PMU_ENV_POWER_BUTTON) != 0;
 			atomic_or_32(>sc_pending, PMU_EV_BUTTON);
-			wakeup(>sc_event);
+			cv_signal(>sc_event);
 		}
 		goto done;
 	}
@@ -1054,7 +1059,8 @@ pmu_thread(void *cookie)
 	int ticks = hz, i;
 	
 	while (1) {
-		tsleep(>sc_event, PWAIT, "wait", ticks);
+		mutex_enter(>sc_evmtx);
+		cv_timedwait(>sc_event, >sc_evmtx, ticks);
 		if ((sc->sc_pending & 3) != 0) {
 			DPRINTF("eject %d\n", sc->sc_pending & 3);
 			for (i = 1; i < 3; i++) {
@@ -1062,7 +1068,7 @@ pmu_thread(void *cookie)
 	pmu_eject_card(sc, i);
 			}
 		}
-
+		mutex_exit(>sc_evmtx);
 		/* see if we need to update brightness */
 		if (sc->sc_brightness_wanted != sc->sc_brightness) {
 			pmu_update_brightness(sc);



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

2023-08-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug 22 06:43:34 UTC 2023

Modified Files:
src/sys/arch/macppc/dev: pmu.c

Log Message:
tsleep()/wakeup() -> cv_*


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/macppc/dev/pmu.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

2023-08-02 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug  2 09:18:14 UTC 2023

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

Log Message:
check for empty ranges in pmap_page_physload() itself


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/sys/arch/hppa/hppa/pmap.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/pmap.c
diff -u src/sys/arch/hppa/hppa/pmap.c:1.121 src/sys/arch/hppa/hppa/pmap.c:1.122
--- src/sys/arch/hppa/hppa/pmap.c:1.121	Wed Aug  2 08:54:42 2023
+++ src/sys/arch/hppa/hppa/pmap.c	Wed Aug  2 09:18:14 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.121 2023/08/02 08:54:42 macallan Exp $	*/
+/*	$NetBSD: pmap.c,v 1.122 2023/08/02 09:18:14 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2020 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.121 2023/08/02 08:54:42 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.122 2023/08/02 09:18:14 macallan Exp $");
 
 #include "opt_cputype.h"
 
@@ -767,6 +767,9 @@ static void
 pmap_page_physload(paddr_t spa, paddr_t epa)
 {
 
+	if (spa == epa)
+		return;
+
 	if (spa < FIRST_16M && epa <= FIRST_16M) {
 		uvm_page_physload(spa, epa, spa, epa, VM_FREELIST_ISADMA);
 	} else if (spa < FIRST_16M && epa > FIRST_16M) {
@@ -1090,8 +1093,7 @@ pmap_bootstrap(vaddr_t vstart)
 	availphysmem = 0;
 
 	pmap_page_physload(resvmem, atop(ksrx));
-	if (atop(kero) != atop(ksrw))
-		pmap_page_physload(atop(kero), atop(ksrw));
+	pmap_page_physload(atop(kero), atop(ksrw));
 	pmap_page_physload(atop(kerw), physmem);
 
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_NONE);



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

2023-08-02 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug  2 09:18:14 UTC 2023

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

Log Message:
check for empty ranges in pmap_page_physload() itself


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/sys/arch/hppa/hppa/pmap.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

2023-08-02 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug  2 08:54:42 UTC 2023

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

Log Message:
avoid calling pmap_page_physload() with an empty range
this avoids a panic in uvm_pmap_physload()
now my C360 boots again


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/hppa/hppa/pmap.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

2023-08-02 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug  2 08:54:42 UTC 2023

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

Log Message:
avoid calling pmap_page_physload() with an empty range
this avoids a panic in uvm_pmap_physload()
now my C360 boots again


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/hppa/hppa/pmap.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/pmap.c
diff -u src/sys/arch/hppa/hppa/pmap.c:1.120 src/sys/arch/hppa/hppa/pmap.c:1.121
--- src/sys/arch/hppa/hppa/pmap.c:1.120	Thu Jun 16 06:25:42 2022
+++ src/sys/arch/hppa/hppa/pmap.c	Wed Aug  2 08:54:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.120 2022/06/16 06:25:42 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.121 2023/08/02 08:54:42 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2020 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.120 2022/06/16 06:25:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.121 2023/08/02 08:54:42 macallan Exp $");
 
 #include "opt_cputype.h"
 
@@ -1090,7 +1090,8 @@ pmap_bootstrap(vaddr_t vstart)
 	availphysmem = 0;
 
 	pmap_page_physload(resvmem, atop(ksrx));
-	pmap_page_physload(atop(kero), atop(ksrw));
+	if (atop(kero) != atop(ksrw))
+		pmap_page_physload(atop(kero), atop(ksrw));
 	pmap_page_physload(atop(kerw), physmem);
 
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_NONE);



CVS commit: xsrc/local/programs/bdfload

2023-07-27 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Jul 27 08:44:42 UTC 2023

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

Log Message:
include glyph name in -d output


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 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.19 xsrc/local/programs/bdfload/bdfload.c:1.20
--- xsrc/local/programs/bdfload/bdfload.c:1.19	Tue Oct 25 13:36:35 2022
+++ xsrc/local/programs/bdfload/bdfload.c	Thu Jul 27 08:44:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bdfload.c,v 1.19 2022/10/25 13:36:35 macallan Exp $	*/
+/*	$NetBSD: bdfload.c,v 1.20 2023/07/27 08:44:42 macallan Exp $	*/
 
 /*
  * Copyright (c) 2018 Michael Lorenz
@@ -320,6 +320,9 @@ interpret(FILE *foo)
 			"syntax error - no valid FONTBOUNDINGBOX\n");
 			memset(cbitmap, 0, charsize);
 			strlcpy(charname, arg, 64);
+			if (dump && (strlen(charname) > 0))
+printf("name: %s\n", charname);
+
 		} else if (strcmp(line, "ENDCHAR") == 0) {
 			in_char = 0;
 			/* only commit the glyph if it's in range */



CVS commit: xsrc/local/programs/bdfload

2023-07-27 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Jul 27 08:44:42 UTC 2023

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

Log Message:
include glyph name in -d output


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 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

2023-07-27 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Jul 27 08:30:02 UTC 2023

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

Log Message:
document command line option


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

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.1 xsrc/local/programs/bdfload/README:1.2
--- xsrc/local/programs/bdfload/README:1.1	Wed Jan  2 22:05:24 2019
+++ xsrc/local/programs/bdfload/README	Thu Jul 27 08:30:02 2023
@@ -1,10 +1,22 @@
 This will attempt to load a .bdf font into wsdisplay, to be used with
 wsconsctl -dw font=
+Optionally it can:
+- produce a header to be used with src/sys/dev/wsfont/
+- write a .wsf file to be used with wsfontload
+- produce debug output
+
+Command line options:
+ -o  will write a file instead of trying to feed the font to wsdisplay,
+default format is wsf
+ -h to be used with -o, will write a header usable with dev/wsfont/
+ -f force bdfload to use a non-monospaced font, which would otherwise be
+rejected. Use with caution, results will look uneven.
+ -v be verbose. This will dump various font parameters to the console.
+ -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
+
 Caveats:
 - fonts wider than 16 pixels won't work yet
-- the program does not distinguish between monospace and proportional fonts,
-  and terminal output is necessarily monospace. Proportional fonts should
-  work but the glyphs will be left justified in the character cell so things
-  will look uneven.
 - some drivers may have trouble with font widths that are not a multiple of 4
 - no attempt has been made to make this play nice with vga text mode



CVS commit: xsrc/local/programs/bdfload

2023-07-27 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Jul 27 08:30:02 UTC 2023

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

Log Message:
document command line option


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

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



CVS commit: src/sys/dev/sbus

2023-07-19 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 19 10:22:15 UTC 2023

Modified Files:
src/sys/dev/sbus: files.sbus mgx.c

Log Message:
- make colour depth in fb mode configurable, default to 8bit
- support ioctl(FBIO*CMAP)


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/sbus/files.sbus
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/sbus/mgx.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/sbus/files.sbus
diff -u src/sys/dev/sbus/files.sbus:1.44 src/sys/dev/sbus/files.sbus:1.45
--- src/sys/dev/sbus/files.sbus:1.44	Wed May  8 13:40:19 2019
+++ src/sys/dev/sbus/files.sbus	Wed Jul 19 10:22:15 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sbus,v 1.44 2019/05/08 13:40:19 isaki Exp $
+#	$NetBSD: files.sbus,v 1.45 2023/07/19 10:22:15 macallan Exp $
 #
 # Config file and device description for machine-independent SBUS code.
 # Included by ports that need it.
@@ -153,6 +153,7 @@ file	dev/sbus/cgtwelve.c		cgtwelve
 # SSB MGX
 defflag 	opt_mgx.h	MGX_DEBUG
 defparam	opt_mgx.h	MGX_DEPTH=8
+defparam	opt_mgx.h	MGX_X_DEPTH=8
 device	mgx: fb, rasops8, rasops32, wsemuldisplaydev, vcons, glyphcache
 attach	mgx at sbus
 file	dev/sbus/mgx.c			mgx

Index: src/sys/dev/sbus/mgx.c
diff -u src/sys/dev/sbus/mgx.c:1.23 src/sys/dev/sbus/mgx.c:1.24
--- src/sys/dev/sbus/mgx.c:1.23	Wed Jun 28 11:08:47 2023
+++ src/sys/dev/sbus/mgx.c	Wed Jul 19 10:22:15 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mgx.c,v 1.23 2023/06/28 11:08:47 macallan Exp $ */
+/*	$NetBSD: mgx.c,v 1.24 2023/07/19 10:22:15 macallan Exp $ */
 
 /*-
  * Copyright (c) 2014 Michael Lorenz
@@ -29,7 +29,7 @@
 /* a console driver for the SSB 4096V-MGX graphics card */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.23 2023/06/28 11:08:47 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.24 2023/07/19 10:22:15 macallan Exp $");
 
 #include 
 #include 
@@ -1055,7 +1055,7 @@ mgx_ioctl(void *v, void *vs, u_long cmd,
 	mgx_init_palette(sc);
 	vcons_redraw_screen(ms);
 } else {
-	mgx_setup(sc, 32);
+	mgx_setup(sc, MGX_X_DEPTH);
 	mgx_init_palette(sc);
 }
 			}
@@ -1068,6 +1068,32 @@ mgx_ioctl(void *v, void *vs, u_long cmd,
 	case WSDISPLAYIO_PUTCMAP:
 		return mgx_putcmap(sc, (struct wsdisplay_cmap *)data);
 
+	case FBIOGETCMAP:
+#define	p ((struct fbcmap *)data)
+		{
+			struct wsdisplay_cmap c = {
+.index = p->index,
+.count = p->count,
+.red = p->red,
+.green = p->green,
+.blue = p->blue
+			};
+			return mgx_getcmap(sc, );
+		}
+		break;
+	case FBIOPUTCMAP:
+		{
+			struct wsdisplay_cmap c = {
+.index = p->index,
+.count = p->count,
+.red = p->red,
+.green = p->green,
+.blue = p->blue
+			};
+			return mgx_putcmap(sc, );
+		}
+		break;
+#undef p		
 	case WSDISPLAYIO_GCURPOS:
 		{
 			struct wsdisplay_curpos *cp = (void *)data;
@@ -1336,7 +1362,7 @@ mgxopen(dev_t dev, int flags, int mode, 
 	if (sc->sc_mode == WSDISPLAYIO_MODE_MAPPED)
 		return 0;
 	sc->sc_mode = WSDISPLAYIO_MODE_MAPPED;
-	mgx_setup(sc, 32);
+	mgx_setup(sc, MGX_X_DEPTH);
 	mgx_init_palette(sc);
 	return 0;
 }



CVS commit: src/sys/dev/sbus

2023-07-19 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jul 19 10:22:15 UTC 2023

Modified Files:
src/sys/dev/sbus: files.sbus mgx.c

Log Message:
- make colour depth in fb mode configurable, default to 8bit
- support ioctl(FBIO*CMAP)


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/sbus/files.sbus
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/sbus/mgx.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/sbus

2023-06-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jun 28 11:08:47 UTC 2023

Modified Files:
src/sys/dev/sbus: mgx.c

Log Message:
following a hunch...
- cache DEC and FG registers, only write them if the value actually changes
- wait for the engine to go idle before writing DEC
- wait for FIFO slots on everything else
with this we avoid waiting if possible and still avoid overlapping blit and
fill commands


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/sbus/mgx.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/sbus/mgx.c
diff -u src/sys/dev/sbus/mgx.c:1.22 src/sys/dev/sbus/mgx.c:1.23
--- src/sys/dev/sbus/mgx.c:1.22	Wed Jun 28 08:53:43 2023
+++ src/sys/dev/sbus/mgx.c	Wed Jun 28 11:08:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mgx.c,v 1.22 2023/06/28 08:53:43 macallan Exp $ */
+/*	$NetBSD: mgx.c,v 1.23 2023/06/28 11:08:47 macallan Exp $ */
 
 /*-
  * Copyright (c) 2014 Michael Lorenz
@@ -29,7 +29,7 @@
 /* a console driver for the SSB 4096V-MGX graphics card */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.22 2023/06/28 08:53:43 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.23 2023/06/28 11:08:47 macallan Exp $");
 
 #include 
 #include 
@@ -80,7 +80,7 @@ struct mgx_softc {
 	int		sc_fbsize;
 	int		sc_mode;
 	char		sc_name[8];
-	uint32_t	sc_dec;
+	uint32_t	sc_dec, sc_r_dec, sc_r_fg;
 	u_char		sc_cmap_red[256];
 	u_char		sc_cmap_green[256];
 	u_char		sc_cmap_blue[256];
@@ -216,6 +216,24 @@ mgx_write_4(struct mgx_softc *sc, uint32
 	bus_space_write_4(sc->sc_tag, sc->sc_blith, reg, val);
 }
 
+static inline void
+mgx_set_dec(struct mgx_softc *sc, uint32_t dec)
+{
+	if (dec == sc->sc_r_dec) return;
+	sc->sc_r_dec = dec;
+	mgx_wait_engine(sc);
+	mgx_write_4(sc, ATR_DEC, dec);
+}
+
+static inline void
+mgx_set_fg(struct mgx_softc *sc, uint32_t fg)
+{
+	if (fg == sc->sc_r_fg) return;
+	sc->sc_r_fg = fg;
+	mgx_wait_fifo(sc, 1);	
+	mgx_write_4(sc, ATR_FG, fg);
+}
+
 static int
 mgx_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -531,6 +549,8 @@ mgx_setup(struct mgx_softc *sc, int dept
 	int i;
 	uint8_t reg;
 
+	sc->sc_r_dec = 0x;
+	sc->sc_r_fg = 0x12345678;
 	/* wait for everything to go idle */
 	if (mgx_wait_engine(sc) == 0)
 		return;
@@ -643,9 +663,9 @@ mgx_bitblt(void *cookie, int xs, int ys,
 		yd += he - 1;
 		dec |= DEC_DIR_Y_REVERSE;
 	}
-	mgx_wait_fifo(sc, 5);
+	mgx_set_dec(sc, dec);
+	mgx_wait_fifo(sc, 4);
 	mgx_write_1(sc, ATR_ROP, rop);
-	mgx_write_4(sc, ATR_DEC, dec);
 	mgx_write_4(sc, ATR_SRC_XY, (ys << 16) | xs);
 	mgx_write_4(sc, ATR_DST_XY, (yd << 16) | xd);
 	mgx_write_4(sc, ATR_WH, (he << 16) | wi);
@@ -666,11 +686,10 @@ mgx_rectfill(void *cookie, int x, int y,
 	dec = sc->sc_dec;
 	dec |= (DEC_COMMAND_RECT << DEC_COMMAND_SHIFT) |
 	   (DEC_START_DIMX << DEC_START_SHIFT);
-	//mgx_wait_fifo(sc, 5);
-	mgx_wait_engine(sc);
+	mgx_set_dec(sc, dec);
+	mgx_set_fg(sc, col);
+	mgx_wait_fifo(sc, 3);
 	mgx_write_1(sc, ATR_ROP, ROP_SRC);
-	mgx_write_4(sc, ATR_FG, col);
-	mgx_write_4(sc, ATR_DEC, dec);
 	mgx_write_4(sc, ATR_DST_XY, (y << 16) | x);
 	mgx_write_4(sc, ATR_WH, (he << 16) | wi);
 }
@@ -754,8 +773,8 @@ mgx_putchar_mono(void *cookie, int row, 
 		return;
 	}
 
-	mgx_wait_fifo(sc, 3);
-	mgx_write_4(sc, ATR_FG, ri->ri_devcmap[fg]);
+	mgx_set_fg(sc, ri->ri_devcmap[fg]);
+	mgx_wait_fifo(sc, 2);
 	mgx_write_4(sc, ATR_BG, ri->ri_devcmap[bg]);
 	mgx_write_1(sc, ATR_ROP, ROP_SRC);
 
@@ -790,10 +809,10 @@ mgx_putchar_mono(void *cookie, int row, 
 		for (i = 0; i < ri->ri_fontscale; i++)
 			d[i] = s[i];
 	}
-	mgx_wait_fifo(sc, 5);
-	mgx_write_4(sc, ATR_DEC, sc->sc_dec | (DEC_COMMAND_BLT << DEC_COMMAND_SHIFT) |
+	mgx_set_dec(sc, sc->sc_dec | (DEC_COMMAND_BLT << DEC_COMMAND_SHIFT) |
 	   (DEC_START_DIMX << DEC_START_SHIFT) |
 	   DEC_SRC_LINEAR | DEC_SRC_CONTIGUOUS | DEC_MONOCHROME);
+	mgx_wait_fifo(sc, 3);
 	mgx_write_4(sc, ATR_SRC_XY, ((scratch & 0xfff000) << 4) | (scratch & 0xfff));
 	mgx_write_4(sc, ATR_DST_XY, (y << 16) | x);
 	mgx_write_4(sc, ATR_WH, (he << 16) | wi);



CVS commit: src/sys/dev/sbus

2023-06-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jun 28 11:08:47 UTC 2023

Modified Files:
src/sys/dev/sbus: mgx.c

Log Message:
following a hunch...
- cache DEC and FG registers, only write them if the value actually changes
- wait for the engine to go idle before writing DEC
- wait for FIFO slots on everything else
with this we avoid waiting if possible and still avoid overlapping blit and
fill commands


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/sbus/mgx.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/sbus

2023-06-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jun 28 08:53:43 UTC 2023

Modified Files:
src/sys/dev/sbus: mgx.c

Log Message:
wait for the engine to go idle before issuing rectfill commands
we get occasional overlap with blit commands if we just wait for fifo slots
needs further investigation, it is possible that not all writes to drawing
engine registers are pipelined and of course we don't have docs


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/sbus/mgx.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/sbus/mgx.c
diff -u src/sys/dev/sbus/mgx.c:1.21 src/sys/dev/sbus/mgx.c:1.22
--- src/sys/dev/sbus/mgx.c:1.21	Wed Jun 28 08:11:52 2023
+++ src/sys/dev/sbus/mgx.c	Wed Jun 28 08:53:43 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mgx.c,v 1.21 2023/06/28 08:11:52 macallan Exp $ */
+/*	$NetBSD: mgx.c,v 1.22 2023/06/28 08:53:43 macallan Exp $ */
 
 /*-
  * Copyright (c) 2014 Michael Lorenz
@@ -29,7 +29,7 @@
 /* a console driver for the SSB 4096V-MGX graphics card */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.21 2023/06/28 08:11:52 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.22 2023/06/28 08:53:43 macallan Exp $");
 
 #include 
 #include 
@@ -666,7 +666,8 @@ mgx_rectfill(void *cookie, int x, int y,
 	dec = sc->sc_dec;
 	dec |= (DEC_COMMAND_RECT << DEC_COMMAND_SHIFT) |
 	   (DEC_START_DIMX << DEC_START_SHIFT);
-	mgx_wait_fifo(sc, 5);
+	//mgx_wait_fifo(sc, 5);
+	mgx_wait_engine(sc);
 	mgx_write_1(sc, ATR_ROP, ROP_SRC);
 	mgx_write_4(sc, ATR_FG, col);
 	mgx_write_4(sc, ATR_DEC, dec);



CVS commit: src/sys/dev/sbus

2023-06-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jun 28 08:53:43 UTC 2023

Modified Files:
src/sys/dev/sbus: mgx.c

Log Message:
wait for the engine to go idle before issuing rectfill commands
we get occasional overlap with blit commands if we just wait for fifo slots
needs further investigation, it is possible that not all writes to drawing
engine registers are pipelined and of course we don't have docs


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/sbus/mgx.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/sbus

2023-06-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jun 28 08:11:52 UTC 2023

Modified Files:
src/sys/dev/sbus: mgx.c

Log Message:
fix tpyo - now the glyph cache can actually work...


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/sbus/mgx.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/sbus/mgx.c
diff -u src/sys/dev/sbus/mgx.c:1.20 src/sys/dev/sbus/mgx.c:1.21
--- src/sys/dev/sbus/mgx.c:1.20	Thu Nov 11 19:37:30 2021
+++ src/sys/dev/sbus/mgx.c	Wed Jun 28 08:11:52 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mgx.c,v 1.20 2021/11/11 19:37:30 macallan Exp $ */
+/*	$NetBSD: mgx.c,v 1.21 2023/06/28 08:11:52 macallan Exp $ */
 
 /*-
  * Copyright (c) 2014 Michael Lorenz
@@ -29,7 +29,7 @@
 /* a console driver for the SSB 4096V-MGX graphics card */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.20 2021/11/11 19:37:30 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.21 2023/06/28 08:11:52 macallan Exp $");
 
 #include 
 #include 
@@ -342,7 +342,7 @@ mgx_attach(device_t parent, device_t sel
 	 * leave some room between visible screen and glyph cache for upload
 	 * buffers used by putchar_mono()
 	 */
-	bsize = (32 * 1024 * sc->sc_stride - 1) / sc->sc_stride;
+	bsize = (32 * 1024 + sc->sc_stride - 1) / sc->sc_stride;
 	glyphcache_init(>sc_gc,
 	sc->sc_height + bsize,
 	(0x40 / sc->sc_stride) - (sc->sc_height + bsize),



CVS commit: src/sys/dev/sbus

2023-06-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jun 28 08:11:52 UTC 2023

Modified Files:
src/sys/dev/sbus: mgx.c

Log Message:
fix tpyo - now the glyph cache can actually work...


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/sbus/mgx.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

2023-06-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jun 13 10:11:17 UTC 2023

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

Log Message:
- use sx_wait() to avoid stalling the MBus
- request 32bit alignment for glyphcache cells


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 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

2023-06-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jun 13 10:11:17 UTC 2023

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

Log Message:
- use sx_wait() to avoid stalling the MBus
- request 32bit alignment for glyphcache cells


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 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.94 src/sys/arch/sparc/dev/cgfourteen.c:1.95
--- src/sys/arch/sparc/dev/cgfourteen.c:1.94	Tue May 23 10:20:12 2023
+++ src/sys/arch/sparc/dev/cgfourteen.c	Tue Jun 13 10:11:17 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.94 2023/05/23 10:20:12 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.95 2023/06/13 10:11:17 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -173,7 +173,9 @@ static void cg14_eraserows(void *, int, 
  * issue ALU instruction:
  * sxi(OPCODE, srcA, srcB, dest, count)
  */
-#define sxi(inst, a, b, d, cnt) sx_write(sc->sc_sx, SX_INSTRUCTIONS, inst((a), (b), (d), (cnt)))
+#define sxi(inst, a, b, d, cnt) \
+	sx_wait(sc->sc_sx); \
+	sx_write(sc->sc_sx, SX_INSTRUCTIONS, inst((a), (b), (d), (cnt)))
 
 /*
  * issue memory referencing instruction:
@@ -770,13 +772,13 @@ cg14_setup_wsdisplay(struct cgfourteen_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;
-		glyphcache_init(>sc_gc, sc->sc_fb.fb_type.fb_height + 5,
+		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);
+			defattr, 4);
 	if (is_cons) {
 		wsdisplay_cnattach(>sc_defaultscreen_descr, ri, 0, 0,
 		defattr);



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

2023-06-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jun 13 10:09:32 UTC 2023

Modified Files:
src/sys/arch/sparc/dev: sx.c sxvar.h

Log Message:
add counter to periodically drain the instruction queue in order to avoid
stalling the MBus during long SX operations
adapted from xf86-video-suncg14


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc/dev/sx.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc/dev/sxvar.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/sx.c
diff -u src/sys/arch/sparc/dev/sx.c:1.6 src/sys/arch/sparc/dev/sx.c:1.7
--- src/sys/arch/sparc/dev/sx.c:1.6	Thu Apr 13 13:07:48 2023
+++ src/sys/arch/sparc/dev/sx.c	Tue Jun 13 10:09:31 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sx.c,v 1.6 2023/04/13 13:07:48 macallan Exp $	*/
+/*	$NetBSD: sx.c,v 1.7 2023/06/13 10:09:31 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sx.c,v 1.6 2023/04/13 13:07:48 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sx.c,v 1.7 2023/06/13 10:09:31 macallan Exp $");
 
 #include "locators.h"
 
@@ -84,6 +84,7 @@ sx_attach(device_t parent, device_t self
 	sc->sc_dev = self;
 	sc->sc_tag = ma->ma_bustag;
 	sc->sc_uregs = ma->ma_paddr + 0x1000;
+	sc->sc_cnt = 0;
 
 	if (bus_space_map(sc->sc_tag, ma->ma_paddr, 0x1000, 0, >sc_regh)) {
 		aprint_error_dev(self, "failed to map registers\n");

Index: src/sys/arch/sparc/dev/sxvar.h
diff -u src/sys/arch/sparc/dev/sxvar.h:1.4 src/sys/arch/sparc/dev/sxvar.h:1.5
--- src/sys/arch/sparc/dev/sxvar.h:1.4	Fri Mar  1 02:30:42 2019
+++ src/sys/arch/sparc/dev/sxvar.h	Tue Jun 13 10:09:31 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sxvar.h,v 1.4 2019/03/01 02:30:42 macallan Exp $	*/
+/*	$NetBSD: sxvar.h,v 1.5 2023/06/13 10:09:31 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,11 +32,14 @@
 #ifndef SXVAR_H
 #define SXVAR_H
 
+#include 
+
 struct sx_softc {
 	device_t		sc_dev;
 	bus_addr_t		sc_uregs;
 	bus_space_tag_t		sc_tag;
 	bus_space_handle_t	sc_regh;
+	int			sc_cnt;
 };
 
 static inline void
@@ -51,6 +54,26 @@ sx_read(struct sx_softc *sc, int addr)
 	return bus_space_read_4(sc->sc_tag, sc->sc_regh, addr);
 }
 
+/*
+ * to be used before issuing SX instructions
+ * this will periodically allow the instruction queue to drain in order
+ * to avoid excessive MBus relinquish & retry cycles during long SX ops
+ * which may cause us to lose interrupts
+ */
+static inline void
+sx_wait(struct sx_softc *sc)
+{
+	uint32_t reg;
+	if (sc->sc_cnt > 6) {
+		do {
+			reg = bus_space_read_4(sc->sc_tag, sc->sc_regh,
+		 SX_CONTROL_STATUS);
+		} while ((reg & SX_MT) == 0);
+		sc->sc_cnt = 0;
+	} else
+		sc->sc_cnt++;
+}
+
 void sx_dump(void);
 
 #endif



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

2023-06-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jun 13 10:09:32 UTC 2023

Modified Files:
src/sys/arch/sparc/dev: sx.c sxvar.h

Log Message:
add counter to periodically drain the instruction queue in order to avoid
stalling the MBus during long SX operations
adapted from xf86-video-suncg14


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc/dev/sx.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc/dev/sxvar.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/wscons

2023-06-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jun  8 05:48:41 UTC 2023

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

Log Message:
allow drivers to specify horizontal alignment of glyph cache cells
for things like SX which have alignment restrictions


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/wscons/wsdisplay_glyphcache.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/wscons/wsdisplay_glyphcachevar.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/wscons/wsdisplay_glyphcache.c
diff -u src/sys/dev/wscons/wsdisplay_glyphcache.c:1.11 src/sys/dev/wscons/wsdisplay_glyphcache.c:1.12
--- src/sys/dev/wscons/wsdisplay_glyphcache.c:1.11	Mon Sep  3 16:29:34 2018
+++ src/sys/dev/wscons/wsdisplay_glyphcache.c	Thu Jun  8 05:48:41 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_glyphcache.c,v 1.11 2018/09/03 16:29:34 riastradh Exp $	*/
+/*	$NetBSD: wsdisplay_glyphcache.c,v 1.12 2023/06/08 05:48:41 macallan Exp $	*/
 
 /*
  * Copyright (c) 2012 Michael Lorenz
@@ -53,17 +53,24 @@
 static inline int
 attr2idx(long attr)
 {
-	if ((attr & 0xf0f0fff8) != 0)
+	if ((attr & 0xf0f00ff8) != 0)
 		return -1;
 	
 	return (((attr >> 16) & 0x0f) | ((attr >> 20) & 0xf0));
 }
 
-/* first line, lines, width, attr */
 int
 glyphcache_init(glyphcache *gc, int first, int lines, int width,
 int cellwidth, int cellheight, long attr)
 {
+	return glyphcache_init_align(gc, first, lines, width, cellwidth, cellheight,
+	attr, 0);
+}
+
+int
+glyphcache_init_align(glyphcache *gc, int first, int lines, int width,
+int cellwidth, int cellheight, long attr, int alignment)
+{
 
 	/* first the geometry stuff */
 	if (lines < 0) lines = 0;
@@ -72,6 +79,7 @@ glyphcache_init(glyphcache *gc, int firs
 	gc->gc_cellheight = -1;
 	gc->gc_firstline = first;
 	gc->gc_lines = lines;
+	gc->gc_cellalign = alignment;
 	gc->gc_buckets = NULL;
 	gc->gc_numbuckets = 0;
 	// XXX: Never free?
@@ -97,9 +105,16 @@ glyphcache_reconfig(glyphcache *gc, int 
 	}
 
 	gc->gc_cellwidth = cellwidth;
+	if (gc->gc_cellalign != 0) {
+		/* alignment in bytes */
+		gc->gc_cellstride = 
+		(gc->gc_cellwidth + gc->gc_cellalign - 1) &
+		~(gc->gc_cellalign - 1);
+	} else
+		gc->gc_cellstride = cellwidth;
 	gc->gc_cellheight = cellheight;
 
-	gc->gc_cellsperline = gc->gc_width / cellwidth;
+	gc->gc_cellsperline = gc->gc_width / gc->gc_cellstride;
 
 	cache_lines = gc->gc_lines / cellheight;
 	gc->gc_numcells = cache_lines * gc->gc_cellsperline;
@@ -144,6 +159,8 @@ glyphcache_reconfig(glyphcache *gc, int 
 	glyphcache_wipe(gc);
 	DPRINTF("%s: using %d cells total, from %d width %d\n", __func__,
 	gc->gc_numcells, gc->gc_firstline, gc->gc_cellsperline);
+	DPRINTF("%s: cell size %d x %d, stride %d\n", __func__,
+	gc->gc_cellwidth, gc->gc_cellheight, gc->gc_cellstride);
 	return 0;
 }
 
@@ -209,7 +226,7 @@ glyphcache_add(glyphcache *gc, int c, in
 	cell += b->gb_firstcell;
 	cy = gc->gc_firstline +
 	(cell / gc->gc_cellsperline) * gc->gc_cellheight;
-	cx = (cell % gc->gc_cellsperline) * gc->gc_cellwidth;
+	cx = (cell % gc->gc_cellsperline) * gc->gc_cellstride;
 	b->gb_map[c - 33] = (cx << 16) | cy;
 	gc->gc_bitblt(gc->gc_blitcookie, x, y, cx, cy,
 	gc->gc_cellwidth, gc->gc_cellheight, gc->gc_rop);

Index: src/sys/dev/wscons/wsdisplay_glyphcachevar.h
diff -u src/sys/dev/wscons/wsdisplay_glyphcachevar.h:1.5 src/sys/dev/wscons/wsdisplay_glyphcachevar.h:1.6
--- src/sys/dev/wscons/wsdisplay_glyphcachevar.h:1.5	Fri Jun  2 19:30:10 2017
+++ src/sys/dev/wscons/wsdisplay_glyphcachevar.h	Thu Jun  8 05:48:41 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_glyphcachevar.h,v 1.5 2017/06/02 19:30:10 macallan Exp $	*/
+/*	$NetBSD: wsdisplay_glyphcachevar.h,v 1.6 2023/06/08 05:48:41 macallan Exp $	*/
 
 /*
  * Copyright (c) 2012 Michael Lorenz
@@ -45,6 +45,8 @@ typedef struct _glyphcache {
 	/* geometry */
 	int gc_numcells;
 	int gc_cellwidth;
+	int gc_cellstride;
+	int gc_cellalign;
 	int gc_cellheight;
 	int gc_cellsperline;
 	int gc_firstline;	/* first line in vram to use for glyphs */
@@ -71,6 +73,9 @@ typedef struct _glyphcache {
 /* first line, lines, width, cellwidth, cellheight, attr */
 int glyphcache_init(glyphcache *, int, int, int, int, int, long);
 
+/* first line, lines, width, cellwidth, cellheight, attr, alignment */
+int glyphcache_init_align(glyphcache *, int, int, int, int, int, long, int);
+
 /* adapt to changed font */
 int glyphcache_reconfig(glyphcache *, int, int, long);
 



CVS commit: src/sys/dev/wscons

2023-06-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Jun  8 05:48:41 UTC 2023

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

Log Message:
allow drivers to specify horizontal alignment of glyph cache cells
for things like SX which have alignment restrictions


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/wscons/wsdisplay_glyphcache.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/wscons/wsdisplay_glyphcachevar.h

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   >