Module Name:    src
Committed By:   macallan
Date:           Tue Oct  1 07:44:22 UTC 2024

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

Log Message:
simplify putchar() a bit, use 16bit accesses for fonts that are more than 8
pixels wide


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

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

Modified files:

Index: src/sys/arch/hppa/dev/hyperfb.c
diff -u src/sys/arch/hppa/dev/hyperfb.c:1.16 src/sys/arch/hppa/dev/hyperfb.c:1.17
--- src/sys/arch/hppa/dev/hyperfb.c:1.16	Tue Oct  1 06:21:10 2024
+++ src/sys/arch/hppa/dev/hyperfb.c	Tue Oct  1 07:44:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperfb.c,v 1.16 2024/10/01 06:21:10 macallan Exp $	*/
+/*	$NetBSD: hyperfb.c,v 1.17 2024/10/01 07:44:22 macallan Exp $	*/
 
 /*
  * Copyright (c) 2024 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.16 2024/10/01 06:21:10 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperfb.c,v 1.17 2024/10/01 07:44:22 macallan Exp $");
 
 #include "opt_cputype.h"
 #include "opt_hyperfb.h"
@@ -1120,7 +1120,7 @@ hyperfb_putchar(void *cookie, int row, i
 	struct wsdisplay_font *font = PICK_FONT(ri, c);
 	struct vcons_screen *scr = ri->ri_hw;
 	struct hyperfb_softc *sc = scr->scr_cookie;
-	uint8_t *data;
+	void *data;
 	int i, x, y, wi, he/*, rv = GC_NOPE*/;
 	uint32_t bg, fg, mask;
 
@@ -1171,22 +1171,22 @@ hyperfb_putchar(void *cookie, int row, i
 	 * character
 	 */
 	if (ri->ri_font->stride == 1) {
+		uint8_t *data8 = data;
 		for (i = 0; i < he; i++) {
 			hyperfb_wait_fifo(sc, 2);
-			mask = ((uint32_t)*data) << 24;
-			hyperfb_write4(sc, NGLE_REG_8, mask);	
+			mask = *data8;
+			hyperfb_write4(sc, NGLE_REG_8, mask << 24);	
 			hyperfb_write4(sc, NGLE_REG_9, (wi << 16) | 1);
-			data++;
+			data8++;
 		}
 	} else {
+		uint16_t *data16 = data;
 		for (i = 0; i < he; i++) {
 			hyperfb_wait_fifo(sc, 2);
-			mask = ((uint32_t)*data) << 8;
-			data++;
-			mask |= *data;
-			data++;
+			mask = *data16;
 			hyperfb_write4(sc, NGLE_REG_8, mask << 16);	
 			hyperfb_write4(sc, NGLE_REG_9, (wi << 16) | 1);
+			data16++;
 		}
 	}
 #if 0

Reply via email to