CVS commit: src/sys/dev/rasops

2022-05-15 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun May 15 16:43:39 UTC 2022

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

Log Message:
rasops: fix automagic box chars for stride > 1 on little endian

This makes DEC line drawing (acsc) work correctly for "iso" fonts of
large sizes, e.g. spleen16x32 on x86.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/dev/rasops/rasops.c

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.127 src/sys/dev/rasops/rasops.c:1.128
--- src/sys/dev/rasops/rasops.c:1.127	Sun May 15 16:12:52 2022
+++ src/sys/dev/rasops/rasops.c	Sun May 15 16:43:39 2022
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.127 2022/05/15 16:12:52 uwe Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.128 2022/05/15 16:43:39 uwe Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.127 2022/05/15 16:12:52 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.128 2022/05/15 16:43:39 uwe Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -1195,6 +1195,11 @@ rasops_make_box_chars_16(struct rasops_i
 	vert_mask = 0xc000U >> ((ri->ri_font->fontwidth >> 1) - 1);
 	hmask_left = 0xff00U << (8 - (ri->ri_font->fontwidth >> 1));
 	hmask_right = hmask_left >> ((ri->ri_font->fontwidth + 1) >> 1);
+
+	vert_mask = htobe16(vert_mask);
+	hmask_left = htobe16(hmask_left);
+	hmask_right = htobe16(hmask_right);
+
 	mid = (ri->ri_font->fontheight + 1) >> 1;
 
 	/* 0x00 would be empty anyway so don't bother */
@@ -1234,6 +1239,7 @@ rasops_make_box_chars_8(struct rasops_in
 	vert_mask = 0xc0U >> ((ri->ri_font->fontwidth >> 1) - 1);
 	hmask_left = 0xf0U << (4 - (ri->ri_font->fontwidth >> 1));
 	hmask_right = hmask_left >> ((ri->ri_font->fontwidth + 1) >> 1);
+
 	mid = (ri->ri_font->fontheight + 1) >> 1;
 
 	/* 0x00 would be empty anyway so don't bother */
@@ -1273,6 +1279,11 @@ rasops_make_box_chars_32(struct rasops_i
 	vert_mask = 0xc000U >> ((ri->ri_font->fontwidth >> 1) - 1);
 	hmask_left = 0xU << (16 - (ri->ri_font->fontwidth >> 1));
 	hmask_right = hmask_left >> ((ri->ri_font->fontwidth + 1) >> 1);
+
+	vert_mask = htobe32(vert_mask);
+	hmask_left = htobe32(hmask_left);
+	hmask_right = htobe32(hmask_right);
+
 	mid = (ri->ri_font->fontheight + 1) >> 1;
 
 	/* 0x00 would be empty anyway so don't bother */



CVS commit: src/sys/dev/rasops

2022-05-15 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun May 15 16:43:39 UTC 2022

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

Log Message:
rasops: fix automagic box chars for stride > 1 on little endian

This makes DEC line drawing (acsc) work correctly for "iso" fonts of
large sizes, e.g. spleen16x32 on x86.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/dev/rasops/rasops.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/rasops

2022-05-15 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun May 15 16:12:52 UTC 2022

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

Log Message:
rasops_mapchar: cosmetics, same object code.

Don't hide the important function call inside an if condition.  Don't
reuse a variable, changing what it means in the middle of an
expression.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/dev/rasops/rasops.c

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.126 src/sys/dev/rasops/rasops.c:1.127
--- src/sys/dev/rasops/rasops.c:1.126	Sun May 15 10:29:20 2022
+++ src/sys/dev/rasops/rasops.c	Sun May 15 16:12:52 2022
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.126 2022/05/15 10:29:20 uwe Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.127 2022/05/15 16:12:52 uwe Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.126 2022/05/15 10:29:20 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.127 2022/05/15 16:12:52 uwe Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -596,13 +596,13 @@ rasops_mapchar(void *cookie, int c, u_in
 
 	KASSERT(ri->ri_font != NULL);
 
-	if ((c = wsfont_map_unichar(ri->ri_font, c)) < 0 ||
-	!CHAR_IN_FONT(c, PICK_FONT(ri, c))) {
+	int glyph = wsfont_map_unichar(ri->ri_font, c);
+	if (glyph < 0 || !CHAR_IN_FONT(glyph, PICK_FONT(ri, glyph))) {
 		*cp = ' ';
 		return 0;
 	}
 
-	*cp = c;
+	*cp = glyph;
 	return 5;
 }
 



CVS commit: src/sys/dev/rasops

2022-05-15 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun May 15 16:12:52 UTC 2022

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

Log Message:
rasops_mapchar: cosmetics, same object code.

Don't hide the important function call inside an if condition.  Don't
reuse a variable, changing what it means in the middle of an
expression.


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/dev/rasops/rasops.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/rasops

2022-05-15 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun May 15 10:29:20 UTC 2022

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

Log Message:
rasops: make autogenerated box drawing chars actually used

Fix mapchar to use PICK_FONT() to match what putchar does.  Otherwise
putchar will never get to see the glyph codes for the autogenerated
box drawing chars.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/dev/rasops/rasops.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/rasops

2022-05-15 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun May 15 10:29:20 UTC 2022

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

Log Message:
rasops: make autogenerated box drawing chars actually used

Fix mapchar to use PICK_FONT() to match what putchar does.  Otherwise
putchar will never get to see the glyph codes for the autogenerated
box drawing chars.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/dev/rasops/rasops.c

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.125 src/sys/dev/rasops/rasops.c:1.126
--- src/sys/dev/rasops/rasops.c:1.125	Fri Dec 24 18:12:58 2021
+++ src/sys/dev/rasops/rasops.c	Sun May 15 10:29:20 2022
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.125 2021/12/24 18:12:58 jmcneill Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.126 2022/05/15 10:29:20 uwe Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.125 2021/12/24 18:12:58 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.126 2022/05/15 10:29:20 uwe Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -597,7 +597,7 @@ rasops_mapchar(void *cookie, int c, u_in
 	KASSERT(ri->ri_font != NULL);
 
 	if ((c = wsfont_map_unichar(ri->ri_font, c)) < 0 ||
-	!CHAR_IN_FONT(c, ri->ri_font)) {
+	!CHAR_IN_FONT(c, PICK_FONT(ri, c))) {
 		*cp = ' ';
 		return 0;
 	}



CVS commit: src/sys/dev/rasops

2021-10-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Oct  4 12:26:29 UTC 2021

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

Log Message:
rasops_reconfig: Do not abort even if font stride is not supported by
rasops_make_box_chars_*() functions; Stop using ri_optfont instead.

XXX
Add rasops_make_box_chars_24().


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/dev/rasops/rasops.c

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.123 src/sys/dev/rasops/rasops.c:1.124
--- src/sys/dev/rasops/rasops.c:1.123	Thu Jul  2 07:49:44 2020
+++ src/sys/dev/rasops/rasops.c	Mon Oct  4 12:26:29 2021
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.123 2020/07/02 07:49:44 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.124 2021/10/04 12:26:29 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.123 2020/07/02 07:49:44 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.124 2021/10/04 12:26:29 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -376,11 +376,12 @@ rasops_reconfig(struct rasops_info *ri, 
 rasops_make_box_chars_32(ri);
 break;
 			default:
-aprint_error(
+kmem_free(ri->ri_optfont.data, len);
+ri->ri_optfont.data = NULL;
+aprint_verbose(
 "%s: font stride assumptions botched",
 __func__);
-splx(s);
-return -1;
+break;
 			}
 		}
 	} else



CVS commit: src/sys/dev/rasops

2021-10-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Oct  4 12:26:29 UTC 2021

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

Log Message:
rasops_reconfig: Do not abort even if font stride is not supported by
rasops_make_box_chars_*() functions; Stop using ri_optfont instead.

XXX
Add rasops_make_box_chars_24().


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/dev/rasops/rasops.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/rasops

2019-11-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Nov  2 01:14:57 UTC 2019

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

Log Message:
Fix "Alignment Fault 3" kernel failure of NetBSD/zaurus 8.1 GENERIC.

#ifdef switch per kernel config options in definition of device driver
structure in header files could be problematic.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/31/msg79.html

Should be pulled up to netbsd-8 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/rasops/rasops.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/rasops

2019-11-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Nov  2 01:14:57 UTC 2019

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

Log Message:
Fix "Alignment Fault 3" kernel failure of NetBSD/zaurus 8.1 GENERIC.

#ifdef switch per kernel config options in definition of device driver
structure in header files could be problematic.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/31/msg79.html

Should be pulled up to netbsd-8 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/rasops/rasops.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/rasops/rasops.h
diff -u src/sys/dev/rasops/rasops.h:1.48 src/sys/dev/rasops/rasops.h:1.49
--- src/sys/dev/rasops/rasops.h:1.48	Wed Aug 14 00:51:10 2019
+++ src/sys/dev/rasops/rasops.h	Sat Nov  2 01:14:57 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops.h,v 1.48 2019/08/14 00:51:10 rin Exp $ */
+/* 	$NetBSD: rasops.h,v 1.49 2019/11/02 01:14:57 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -149,10 +149,8 @@ struct rasops_info {
 	/* Callbacks so we can share some code */
 	void	(*ri_do_cursor)(struct rasops_info *);
 
-#if NRASOPS_ROTATION > 0
 	/* Used to intercept putchar to permit display rotation */
 	struct	wsdisplay_emulops ri_real_ops;
-#endif
 };
 
 #define CHAR_IN_FONT(c, font)		\



CVS commit: src/sys/dev/rasops

2019-08-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug 14 00:51:11 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.h rasops15.c rasops2.c rasops24.c rasops32.c
rasops4.c rasops8.c rasops_putchar_width.h

Log Message:
When using stamp, drop attributions other than back and foreground
colors so that stamp is not updated unnecessarily.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/rasops/rasops.h
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/rasops/rasops15.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/rasops/rasops2.c
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/rasops/rasops24.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/rasops/rasops32.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/rasops/rasops4.c
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/rasops/rasops8.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/rasops/rasops_putchar_width.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/rasops/rasops.h
diff -u src/sys/dev/rasops/rasops.h:1.47 src/sys/dev/rasops/rasops.h:1.48
--- src/sys/dev/rasops/rasops.h:1.47	Sat Aug 10 01:24:17 2019
+++ src/sys/dev/rasops/rasops.h	Wed Aug 14 00:51:10 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops.h,v 1.47 2019/08/10 01:24:17 rin Exp $ */
+/* 	$NetBSD: rasops.h,v 1.48 2019/08/14 00:51:10 rin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -203,6 +203,9 @@ void	rasops32_init(struct rasops_info *)
 #define	ATTR_BG(ri, attr) ((ri)->ri_devcmap[((uint32_t)(attr) >> 16) & 0xf])
 #define	ATTR_FG(ri, attr) ((ri)->ri_devcmap[((uint32_t)(attr) >> 24) & 0xf])
 
+#define	ATTR_MASK_BG __BITS(16, 19)
+#define	ATTR_MASK_FG __BITS(24, 27)
+
 #define	DELTA(p, d, cast) ((p) = (cast)((uint8_t *)(p) + (d)))
 
 #define	FBOFFSET(ri, row, col)		\

Index: src/sys/dev/rasops/rasops15.c
diff -u src/sys/dev/rasops/rasops15.c:1.38 src/sys/dev/rasops/rasops15.c:1.39
--- src/sys/dev/rasops/rasops15.c:1.38	Sat Aug 10 01:24:17 2019
+++ src/sys/dev/rasops/rasops15.c	Wed Aug 14 00:51:10 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops15.c,v 1.38 2019/08/10 01:24:17 rin Exp $	*/
+/* 	$NetBSD: rasops15.c,v 1.39 2019/08/14 00:51:10 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.38 2019/08/10 01:24:17 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.39 2019/08/14 00:51:10 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -109,7 +109,7 @@ rasops15_init(struct rasops_info *ri)
 	}
 
 #ifndef RASOPS_SMALL
-	stamp_attr = 0;
+	stamp_attr = -1;
 	stamp_ri = NULL;
 #endif
 }

Index: src/sys/dev/rasops/rasops2.c
diff -u src/sys/dev/rasops/rasops2.c:1.32 src/sys/dev/rasops/rasops2.c:1.33
--- src/sys/dev/rasops/rasops2.c:1.32	Sat Aug 10 01:24:17 2019
+++ src/sys/dev/rasops/rasops2.c	Wed Aug 14 00:51:10 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops2.c,v 1.32 2019/08/10 01:24:17 rin Exp $	*/
+/* 	$NetBSD: rasops2.c,v 1.33 2019/08/14 00:51:10 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.32 2019/08/10 01:24:17 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.33 2019/08/14 00:51:10 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -111,7 +111,7 @@ rasops2_init(struct rasops_info *ri)
 	}
 
 #ifndef RASOPS_SMALL
-	stamp_attr = 0;
+	stamp_attr = -1;
 	stamp_ri = NULL;
 #endif
 }

Index: src/sys/dev/rasops/rasops24.c
diff -u src/sys/dev/rasops/rasops24.c:1.49 src/sys/dev/rasops/rasops24.c:1.50
--- src/sys/dev/rasops/rasops24.c:1.49	Sat Aug 10 01:24:17 2019
+++ src/sys/dev/rasops/rasops24.c	Wed Aug 14 00:51:10 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops24.c,v 1.49 2019/08/10 01:24:17 rin Exp $	*/
+/* 	$NetBSD: rasops24.c,v 1.50 2019/08/14 00:51:10 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.49 2019/08/10 01:24:17 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.50 2019/08/14 00:51:10 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -120,7 +120,7 @@ rasops24_init(struct rasops_info *ri)
 	}
 
 #ifndef RASOPS_SMALL
-	stamp_attr = 0;
+	stamp_attr = -1;
 	stamp_ri = NULL;
 #endif
 }

Index: src/sys/dev/rasops/rasops32.c
diff -u src/sys/dev/rasops/rasops32.c:1.45 src/sys/dev/rasops/rasops32.c:1.46
--- src/sys/dev/rasops/rasops32.c:1.45	Sat Aug 10 01:24:17 2019
+++ src/sys/dev/rasops/rasops32.c	Wed Aug 14 00:51:10 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops32.c,v 1.45 2019/08/10 01:24:17 rin Exp $	*/
+/*	 $NetBSD: rasops32.c,v 1.46 2019/08/14 00:51:10 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.45 2019/08/10 01:24:17 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.46 2019/08/14 00:51:10 rin Exp $");
 
 #ifdef _KERNEL_OPT
 

CVS commit: src/sys/dev/rasops

2019-08-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug 14 00:51:11 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.h rasops15.c rasops2.c rasops24.c rasops32.c
rasops4.c rasops8.c rasops_putchar_width.h

Log Message:
When using stamp, drop attributions other than back and foreground
colors so that stamp is not updated unnecessarily.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/rasops/rasops.h
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/rasops/rasops15.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/rasops/rasops2.c
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/rasops/rasops24.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/rasops/rasops32.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/rasops/rasops4.c
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/rasops/rasops8.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/rasops/rasops_putchar_width.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/rasops

2019-08-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Aug 10 01:24:17 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops.h rasops1-4_putchar.h rasops1.c
rasops15.c rasops1_putchar_width.h rasops2.c rasops24.c rasops32.c
rasops4.c rasops8.c rasops_bitops.h rasops_masks.c rasops_masks.h
rasops_putchar.h rasops_putchar_width.h

Log Message:
Misc style clean up's.
- Introduce and use proper macros.
- Use not ambiguous variable names.
- Unify similar functions as possible as I can.
- G/C unused headers.
- Use #include  instead of "foo.h"
No particular functional changes intended.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/rasops/rasops.h
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/rasops/rasops1-4_putchar.h
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/rasops/rasops1.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/rasops/rasops15.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/rasops/rasops1_putchar_width.h
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/rasops/rasops2.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/rasops/rasops24.c
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/rasops/rasops32.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/rasops/rasops4.c
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/rasops/rasops8.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/rasops/rasops_bitops.h
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/rasops/rasops_masks.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/rasops/rasops_masks.h
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/rasops/rasops_putchar.h
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/rasops/rasops_putchar_width.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/rasops

2019-08-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Aug 10 01:24:17 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops.h rasops1-4_putchar.h rasops1.c
rasops15.c rasops1_putchar_width.h rasops2.c rasops24.c rasops32.c
rasops4.c rasops8.c rasops_bitops.h rasops_masks.c rasops_masks.h
rasops_putchar.h rasops_putchar_width.h

Log Message:
Misc style clean up's.
- Introduce and use proper macros.
- Use not ambiguous variable names.
- Unify similar functions as possible as I can.
- G/C unused headers.
- Use #include  instead of "foo.h"
No particular functional changes intended.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/rasops/rasops.h
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/rasops/rasops1-4_putchar.h
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/rasops/rasops1.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/rasops/rasops15.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/rasops/rasops1_putchar_width.h
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/rasops/rasops2.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/rasops/rasops24.c
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/rasops/rasops32.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/rasops/rasops4.c
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/rasops/rasops8.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/rasops/rasops_bitops.h
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/rasops/rasops_masks.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/rasops/rasops_masks.h
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/rasops/rasops_putchar.h
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/rasops/rasops_putchar_width.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/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.121 src/sys/dev/rasops/rasops.c:1.122
--- src/sys/dev/rasops/rasops.c:1.121	Sat Aug 10 01:20:47 2019
+++ src/sys/dev/rasops/rasops.c	Sat Aug 10 01:24:17 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.121 2019/08/10 01:20:47 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.122 2019/08/10 01:24:17 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,20 +30,17 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.121 2019/08/10 01:20:47 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.122 2019/08/10 01:24:17 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
 #include "opt_wsmsgattrs.h"
-#endif
-
 #include "rasops_glue.h"
+#endif
 
 #include 
 #include 
 #include 
-#include 
-#include 
 
 #include 
 
@@ -202,6 +199,10 @@ static int	rasops_allocattr_color(void *
 static int	rasops_allocattr_mono(void *, int, int, int, long *);
 static void	rasops_do_cursor(struct rasops_info *);
 static void	rasops_init_devcmap(struct rasops_info *);
+static void	rasops_make_box_chars_8(struct rasops_info *);
+static void	rasops_make_box_chars_16(struct rasops_info *);
+static void	rasops_make_box_chars_32(struct rasops_info *);
+static void	rasops_make_box_chars_alpha(struct rasops_info *);
 
 #if NRASOPS_ROTATION > 0
 static void	rasops_rotate_font(int *, int);
@@ -233,11 +234,6 @@ struct rotatedfont {
 };
 #endif	/* NRASOPS_ROTATION > 0 */
 
-void	rasops_make_box_chars_8(struct rasops_info *);
-void	rasops_make_box_chars_16(struct rasops_info *);
-void	rasops_make_box_chars_32(struct rasops_info *);
-void	rasops_make_box_chars_alpha(struct rasops_info *);
-
 /*
  * Initialize a 'rasops_info' descriptor.
  */
@@ -623,6 +619,7 @@ rasops_allocattr_color(void *cookie, int
 	fg &= 7;
 	bg &= 7;
 #endif
+
 	if ((flg & WSATTR_BLINK) != 0)
 		return EINVAL;
 
@@ -691,8 +688,8 @@ static void
 rasops_copyrows(void *cookie, int src, int dst, int num)
 {
 	struct rasops_info *ri = (struct rasops_info *)cookie;
+	int stride;
 	uint8_t *sp, *dp, *hp;
-	int n, stride;
 
 	hp = NULL;	/* XXX GCC */
 
@@ -720,12 +717,10 @@ rasops_copyrows(void *cookie, int src, i
 		return;
 #endif
 
-	num *= ri->ri_font->fontheight;
-	n = ri->ri_emustride;
-	stride = ri->ri_stride;
-
 	src *= ri->ri_yscale;
 	dst *= ri->ri_yscale;
+	num *= ri->ri_font->fontheight;
+	stride = ri->ri_stride;
 
 	if (src < dst) {
 		/* backward copy */
@@ -740,12 +735,12 @@ rasops_copyrows(void *cookie, int src, i
 		hp = ri->ri_hwbits + dst;
 
 	while (num--) {
-		memcpy(dp, sp, n);
-		sp += stride;
+		memcpy(dp, sp, ri->ri_emustride);
 		if (ri->ri_hwbits) {
-			memcpy(hp, dp, n);
+			memcpy(hp, dp, ri->ri_emustride);
 			hp += stride;
 		}
+		sp += stride;
 		dp += stride;
 	}
 }
@@ -760,8 +755,8 @@ static void
 rasops_copycols(void *cookie, int row, int src, int dst, int num)
 {
 	struct rasops_info *ri = (struct rasops_info *)cookie;
-	uint8_t *sp, *dp, *hp;
 	int height;
+	uint8_t *sp, *dp, *hp;
 
 	hp = NULL;	/* XXX GCC */
 
@@ -793,9 +788,9 @@ rasops_copycols(void *cookie, int row, i
 		return;
 #endif
 
-	num *= ri->ri_xscale;
-	row *= ri->ri_yscale;
 	height = ri->ri_font->fontheight;
+	row *= ri->ri_yscale;
+	num *= 

CVS commit: src/sys/dev/rasops

2019-08-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Aug 10 01:20:47 UTC 2019

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

Log Message:
Set 4-bpp devcmap in a similar manner to non-RGB case of 8-bpp.
No functional changes since this is not in use (4-bpp is monochrome).


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/dev/rasops/rasops.c

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.120 src/sys/dev/rasops/rasops.c:1.121
--- src/sys/dev/rasops/rasops.c:1.120	Fri Aug  9 12:05:51 2019
+++ src/sys/dev/rasops/rasops.c	Sat Aug 10 01:20:47 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.120 2019/08/09 12:05:51 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.121 2019/08/10 01:20:47 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.120 2019/08/09 12:05:51 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.121 2019/08/10 01:20:47 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -876,18 +876,18 @@ rasops_init_devcmap(struct rasops_info *
 		ri->ri_devcmap[15] = -1;
 		return;
 
-#ifdef RASOPS_APPLE_PALETTE
 	case 4:
 		for (i = 0; i < 16; i++) {
+#ifdef RASOPS_APPLE_PALETTE
 			c = apple4_devcmap[i];
+#else
+			c = i;
+#endif
 			ri->ri_devcmap[i] =
 			(c <<  0) | (c <<  4) | (c <<  8) | (c << 12) |
 			(c << 16) | (c << 20) | (c << 24) | (c << 28);
 		}
 		return;
-#else
-	/* XXXRO What should we do here? */
-#endif
 
 	case 8:
 		if ((ri->ri_flg & RI_8BIT_IS_RGB) == 0) {



CVS commit: src/sys/dev/rasops

2019-08-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Aug 10 01:20:47 UTC 2019

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

Log Message:
Set 4-bpp devcmap in a similar manner to non-RGB case of 8-bpp.
No functional changes since this is not in use (4-bpp is monochrome).


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

2019-08-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  9 12:05:52 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops1-4_putchar.h rasops1.c
rasops1_putchar_width.h rasops_putchar.h rasops_putchar_width.h

Log Message:
Correctly check whether character is in font in rasops_mapchar().
Also, make sure that in putchar functions for completeness.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/rasops/rasops1-4_putchar.h
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/rasops/rasops1.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/rasops/rasops1_putchar_width.h
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/rasops/rasops_putchar.h
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/rasops/rasops_putchar_width.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/rasops

2019-08-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  9 12:05:52 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops1-4_putchar.h rasops1.c
rasops1_putchar_width.h rasops_putchar.h rasops_putchar_width.h

Log Message:
Correctly check whether character is in font in rasops_mapchar().
Also, make sure that in putchar functions for completeness.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/rasops/rasops1-4_putchar.h
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/rasops/rasops1.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/rasops/rasops1_putchar_width.h
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/rasops/rasops_putchar.h
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/rasops/rasops_putchar_width.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/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.119 src/sys/dev/rasops/rasops.c:1.120
--- src/sys/dev/rasops/rasops.c:1.119	Fri Aug  9 11:42:03 2019
+++ src/sys/dev/rasops/rasops.c	Fri Aug  9 12:05:51 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.119 2019/08/09 11:42:03 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.120 2019/08/09 12:05:51 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.119 2019/08/09 11:42:03 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.120 2019/08/09 12:05:51 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -598,18 +598,11 @@ rasops_mapchar(void *cookie, int c, u_in
 	KASSERT(ri->ri_font != NULL);
 
 	if ((c = wsfont_map_unichar(ri->ri_font, c)) < 0 ||
-	c < ri->ri_font->firstchar) {
+	!CHAR_IN_FONT(c, ri->ri_font)) {
 		*cp = ' ';
 		return 0;
 	}
 
-#if 0 /* XXXRO */
-	if (CHAR_IN_FONT(c, ri->ri_font)) {
-		*cp = ' ';
-		return 0;
-	}
-#endif
-
 	*cp = c;
 	return 5;
 }

Index: src/sys/dev/rasops/rasops1-4_putchar.h
diff -u src/sys/dev/rasops/rasops1-4_putchar.h:1.1 src/sys/dev/rasops/rasops1-4_putchar.h:1.2
--- src/sys/dev/rasops/rasops1-4_putchar.h:1.1	Wed Aug  7 12:36:36 2019
+++ src/sys/dev/rasops/rasops1-4_putchar.h	Fri Aug  9 12:05:51 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops1-4_putchar.h,v 1.1 2019/08/07 12:36:36 rin Exp $ */
+/* $NetBSD: rasops1-4_putchar.h,v 1.2 2019/08/09 12:05:51 rin Exp $ */
 
 /* NetBSD: rasops_bitops.h,v 1.23 2019/08/02 04:39:09 rin Exp */
 /*-
@@ -97,6 +97,9 @@ NAME(RASOPS_DEPTH)(void *cookie, int row
 
 	hp = NULL;	/* XXX GCC */
 
+	if (__predict_false(!CHAR_IN_FONT(uc, font)))
+		return;
+
 #ifdef RASOPS_CLIPPING
 	/* Catches 'row < 0' case too */
 	if ((unsigned)row >= (unsigned)ri->ri_rows)

Index: src/sys/dev/rasops/rasops1.c
diff -u src/sys/dev/rasops/rasops1.c:1.35 src/sys/dev/rasops/rasops1.c:1.36
--- src/sys/dev/rasops/rasops1.c:1.35	Wed Aug  7 12:27:49 2019
+++ src/sys/dev/rasops/rasops1.c	Fri Aug  9 12:05:51 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops1.c,v 1.35 2019/08/07 12:27:49 rin Exp $	*/
+/* 	$NetBSD: rasops1.c,v 1.36 2019/08/09 12:05:51 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.35 2019/08/07 12:27:49 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.36 2019/08/09 12:05:51 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -100,6 +100,9 @@ rasops1_putchar(void *cookie, int row, i
 
 	hp = NULL;	/* XXX GCC */
 
+	if (__predict_false(!CHAR_IN_FONT(uc, font)))
+		return;
+
 #ifdef RASOPS_CLIPPING
 	/* Catches 'row < 0' case too */
 	if ((unsigned)row >= (unsigned)ri->ri_rows)

Index: src/sys/dev/rasops/rasops1_putchar_width.h
diff -u src/sys/dev/rasops/rasops1_putchar_width.h:1.4 src/sys/dev/rasops/rasops1_putchar_width.h:1.5
--- src/sys/dev/rasops/rasops1_putchar_width.h:1.4	Wed Aug  7 12:27:49 2019
+++ src/sys/dev/rasops/rasops1_putchar_width.h	Fri Aug  9 12:05:51 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops1_putchar_width.h,v 1.4 2019/08/07 12:27:49 rin Exp $ */
+/* $NetBSD: rasops1_putchar_width.h,v 1.5 2019/08/09 12:05:51 rin Exp $ */
 
 /* NetBSD: rasops1.c,v 1.28 2019/07/25 03:02:44 rin Exp */
 /*-
@@ -69,6 +69,9 @@ PUTCHAR_WIDTH(RASOPS_WIDTH)(void *cookie
 
 	hp = NULL;	/* XXX GCC */
 
+	if (__predict_false(!CHAR_IN_FONT(uc, font)))
+		return;
+
 #ifdef RASOPS_CLIPPING
 	/* Catches 'row < 0' case too */
 	if ((unsigned)row >= (unsigned)ri->ri_rows)

Index: src/sys/dev/rasops/rasops_putchar.h
diff -u src/sys/dev/rasops/rasops_putchar.h:1.6 src/sys/dev/rasops/rasops_putchar.h:1.7
--- src/sys/dev/rasops/rasops_putchar.h:1.6	Wed Aug  7 12:33:48 2019
+++ src/sys/dev/rasops/rasops_putchar.h	Fri Aug  9 12:05:51 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops_putchar.h,v 1.6 2019/08/07 12:33:48 rin Exp $ */
+/* $NetBSD: rasops_putchar.h,v 1.7 2019/08/09 12:05:51 rin Exp $ */
 
 /* NetBSD: rasops8.c,v 1.41 2019/07/25 03:02:44 rin Exp  */
 /*-
@@ -106,7 +106,7 @@ NAME(RASOPS_DEPTH)(void 

CVS commit: src/sys/dev/rasops

2019-08-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  9 11:42:03 UTC 2019

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

Log Message:
Fix color range overflow; we cannot make bright colors more brighter.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/dev/rasops/rasops.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/rasops

2019-08-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  9 11:42:03 UTC 2019

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

Log Message:
Fix color range overflow; we cannot make bright colors more brighter.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/dev/rasops/rasops.c

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.118 src/sys/dev/rasops/rasops.c:1.119
--- src/sys/dev/rasops/rasops.c:1.118	Fri Aug  9 11:08:20 2019
+++ src/sys/dev/rasops/rasops.c	Fri Aug  9 11:42:03 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.118 2019/08/09 11:08:20 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.119 2019/08/09 11:42:03 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.118 2019/08/09 11:08:20 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.119 2019/08/09 11:42:03 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -646,7 +646,7 @@ rasops_allocattr_color(void *cookie, int
 #endif
 	}
 
-	if ((flg & WSATTR_HILIT) != 0)
+	if ((flg & WSATTR_HILIT) != 0 && fg < 8)
 		fg += 8;
 
 	if ((flg & WSATTR_REVERSE) != 0) {



CVS commit: src/sys/dev/rasops

2019-08-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  9 11:08:20 UTC 2019

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

Log Message:
When legacy Apple 4-bpp color palette is used, make green dark so that
kernel messages are printed nicely on white background.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/dev/rasops/rasops.c

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.117 src/sys/dev/rasops/rasops.c:1.118
--- src/sys/dev/rasops/rasops.c:1.117	Wed Aug  7 12:27:49 2019
+++ src/sys/dev/rasops/rasops.c	Fri Aug  9 11:08:20 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.117 2019/08/07 12:27:49 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.118 2019/08/09 11:08:20 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.117 2019/08/07 12:27:49 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.118 2019/08/09 11:08:20 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -175,7 +175,7 @@ static const uint8_t apple8_devcmap[16] 
 static const uint8_t apple4_devcmap[16] = {
 	15,	/* black	*/
 	 3,	/* red		*/
-	 8,	/* green	*/
+	 9,	/* dark green	*/
 	 1,	/* yellow	*/
 	 6,	/* blue		*/
 	 4,	/* magenta	*/
@@ -184,7 +184,7 @@ static const uint8_t apple4_devcmap[16] 
 
 	13,	/* medium grey	*/
 	 3,	/* red		*/
-	 8,	/* green	*/
+	 9,	/* dark green	*/
 	 1,	/* yellow	*/
 	 6,	/* blue		*/
 	 4,	/* magenta	*/



CVS commit: src/sys/dev/rasops

2019-08-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  9 11:08:20 UTC 2019

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

Log Message:
When legacy Apple 4-bpp color palette is used, make green dark so that
kernel messages are printed nicely on white background.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/dev/rasops/rasops.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/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 16:14:51 UTC 2019

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

Log Message:
Make rasops_erase{rows,cols}() public again; hp300/diofb uses them.

Pointed out by martin.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/rasops/rasops.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/rasops/rasops.h
diff -u src/sys/dev/rasops/rasops.h:1.45 src/sys/dev/rasops/rasops.h:1.46
--- src/sys/dev/rasops/rasops.h:1.45	Wed Aug  7 12:09:30 2019
+++ src/sys/dev/rasops/rasops.h	Wed Aug  7 16:14:51 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops.h,v 1.45 2019/08/07 12:09:30 rin Exp $ */
+/* 	$NetBSD: rasops.h,v 1.46 2019/08/07 16:14:51 rin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -181,14 +181,13 @@ struct rasops_info {
 int	rasops_init(struct rasops_info *, int, int);
 int	rasops_reconfig(struct rasops_info *, int, int);
 void	rasops_unpack_attr(long, int *, int *, int *);
+void	rasops_eraserows(void *, int, int, long);
+void	rasops_erasecols(void *, int, int, int, long);
 int	rasops_get_cmap(struct rasops_info *, uint8_t *, size_t);
 
 extern const uint8_t	rasops_cmap[256 * 3];
 
 #ifdef _RASOPS_PRIVATE
-void	rasops_eraserows(void *, int, int, long);
-void	rasops_erasecols(void *, int, int, int, long);
-
 /*
  * Per-depth initialization functions.
  */



CVS commit: src/sys/dev/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 16:14:51 UTC 2019

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

Log Message:
Make rasops_erase{rows,cols}() public again; hp300/diofb uses them.

Pointed out by martin.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/rasops/rasops.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/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 12:36:36 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops2.c rasops4.c rasops_bitops.h
Added Files:
src/sys/dev/rasops: rasops1-4_putchar.h

Log Message:
Separate general putchar for 1-4bpp from rasops_bitops:
- Support anti-aliasing for 2bpp, which works perfectly!
- Support scaling underline dimensions with font height.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/rasops/rasops1-4_putchar.h
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/rasops/rasops2.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/rasops/rasops4.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/rasops/rasops_bitops.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/rasops/rasops2.c
diff -u src/sys/dev/rasops/rasops2.c:1.30 src/sys/dev/rasops/rasops2.c:1.31
--- src/sys/dev/rasops/rasops2.c:1.30	Wed Aug  7 11:47:33 2019
+++ src/sys/dev/rasops/rasops2.c	Wed Aug  7 12:36:36 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops2.c,v 1.30 2019/08/07 11:47:33 rin Exp $	*/
+/* 	$NetBSD: rasops2.c,v 1.31 2019/08/07 12:36:36 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.30 2019/08/07 11:47:33 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.31 2019/08/07 12:36:36 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -51,6 +51,7 @@ static void	rasops2_copycols(void *, int
 static void	rasops2_erasecols(void *, int, int, int, long);
 static void	rasops2_do_cursor(struct rasops_info *);
 static void	rasops2_putchar(void *, int, int col, u_int, long);
+static void	rasops2_putchar_aa(void *, int, int col, u_int, long);
 #ifndef RASOPS_SMALL
 static void	rasops2_putchar8(void *, int, int col, u_int, long);
 static void	rasops2_putchar12(void *, int, int col, u_int, long);
@@ -86,6 +87,11 @@ rasops2_init(struct rasops_info *ri)
 		ri->ri_do_cursor = rasops2_do_cursor;
 	}
 
+	if (FONT_IS_ALPHA(ri->ri_font)) {
+		ri->ri_ops.putchar = rasops2_putchar_aa;
+		return;
+	}
+
 	switch (ri->ri_font->fontwidth) {
 #ifndef RASOPS_SMALL
 	case 8:
@@ -163,4 +169,11 @@ rasops2_makestamp(struct rasops_info *ri
 /*
  * Grab routines common to depths where (bpp < 8)
  */
+#undef	RASOPS_AA
+#include "rasops1-4_putchar.h"
+
+#define	RASOPS_AA
+#include "rasops1-4_putchar.h"
+#undef	RASOPS_AA
+
 #include 

Index: src/sys/dev/rasops/rasops4.c
diff -u src/sys/dev/rasops/rasops4.c:1.25 src/sys/dev/rasops/rasops4.c:1.26
--- src/sys/dev/rasops/rasops4.c:1.25	Wed Aug  7 11:47:33 2019
+++ src/sys/dev/rasops/rasops4.c	Wed Aug  7 12:36:36 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops4.c,v 1.25 2019/08/07 11:47:33 rin Exp $	*/
+/* 	$NetBSD: rasops4.c,v 1.26 2019/08/07 12:36:36 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops4.c,v 1.25 2019/08/07 11:47:33 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops4.c,v 1.26 2019/08/07 12:36:36 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -163,4 +163,7 @@ rasops4_makestamp(struct rasops_info *ri
 /*
  * Grab routines common to depths where (bpp < 8)
  */
+#undef	RASOPS_AA
+#include "rasops1-4_putchar.h"
+
 #include 

Index: src/sys/dev/rasops/rasops_bitops.h
diff -u src/sys/dev/rasops/rasops_bitops.h:1.23 src/sys/dev/rasops/rasops_bitops.h:1.24
--- src/sys/dev/rasops/rasops_bitops.h:1.23	Fri Aug  2 04:39:09 2019
+++ src/sys/dev/rasops/rasops_bitops.h	Wed Aug  7 12:36:36 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops_bitops.h,v 1.23 2019/08/02 04:39:09 rin Exp $	*/
+/* 	$NetBSD: rasops_bitops.h,v 1.24 2019/08/07 12:36:36 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -32,10 +32,6 @@
 #ifndef _RASOPS_BITOPS_H_
 #define _RASOPS_BITOPS_H_ 1
 
-#define	NAME(name)		NAME1(RASOPS_DEPTH, name)
-#define	NAME1(depth, name)	NAME2(depth, name)
-#define	NAME2(depth, name)	rasops ## depth ## _ ## name
-
 #if   RASOPS_DEPTH == 1
 #define	PIXEL_SHIFT	0
 #elif RASOPS_DEPTH == 2
@@ -46,218 +42,9 @@
 #error "Depth not supported"
 #endif
 
-#define	PIXEL_BITS	RASOPS_DEPTH
-#define	COLOR_MASK	__BITS(32 - PIXEL_BITS, 31)
-
-#if RASOPS_DEPTH != 1
-/*
- * Paint a single character. This function is also applicable to
- * monochrome, but that in rasops1.c is much simpler and faster.
- */
-static void
-NAME(putchar)(void *cookie, int row, int col, u_int uc, long attr)
-{
-	struct rasops_info *ri = (struct rasops_info *)cookie;
-	struct wsdisplay_font *font = PICK_FONT(ri, uc);
-	int full, cnt, bit;
-	uint32_t fs, rs, fb, bg, fg, lmask, rmask, lbg, rbg, clr[2];
-	uint32_t height, width;
-	uint32_t *rp, *bp, *hp, tmp;
-	uint8_t *fr;
-	bool space;
-
-	hp = NULL;	/* XXX GCC */
-
-#ifdef RASOPS_CLIPPING
-	/* Catches 'row < 0' case too */
-	if ((unsigned)row >= (unsigned)ri->ri_rows)
-		return;
-
-	if ((unsigned)col >= (unsigned)ri->ri_cols)
-		return;
-#endif
-
-	width = font->fontwidth << 

CVS commit: src/sys/dev/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 12:36:36 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops2.c rasops4.c rasops_bitops.h
Added Files:
src/sys/dev/rasops: rasops1-4_putchar.h

Log Message:
Separate general putchar for 1-4bpp from rasops_bitops:
- Support anti-aliasing for 2bpp, which works perfectly!
- Support scaling underline dimensions with font height.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/rasops/rasops1-4_putchar.h
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/rasops/rasops2.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/rasops/rasops4.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/rasops/rasops_bitops.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/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 12:33:48 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops15.c rasops24.c rasops32.c rasops8.c
rasops_putchar.h
Removed Files:
src/sys/dev/rasops: rasops_putchar_aa.h

Log Message:
Merge rasops_putchar_aa.h into rasops_putchar.h.
Support scaling underline dimensions by font height.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/rasops/rasops15.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/rasops/rasops24.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/rasops/rasops32.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/rasops/rasops8.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/rasops/rasops_putchar.h
cvs rdiff -u -r1.6 -r0 src/sys/dev/rasops/rasops_putchar_aa.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/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 12:33:48 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops15.c rasops24.c rasops32.c rasops8.c
rasops_putchar.h
Removed Files:
src/sys/dev/rasops: rasops_putchar_aa.h

Log Message:
Merge rasops_putchar_aa.h into rasops_putchar.h.
Support scaling underline dimensions by font height.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/rasops/rasops15.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/rasops/rasops24.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/rasops/rasops32.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/rasops/rasops8.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/rasops/rasops_putchar.h
cvs rdiff -u -r1.6 -r0 src/sys/dev/rasops/rasops_putchar_aa.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/rasops/rasops15.c
diff -u src/sys/dev/rasops/rasops15.c:1.36 src/sys/dev/rasops/rasops15.c:1.37
--- src/sys/dev/rasops/rasops15.c:1.36	Wed Aug  7 11:48:43 2019
+++ src/sys/dev/rasops/rasops15.c	Wed Aug  7 12:33:48 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops15.c,v 1.36 2019/08/07 11:48:43 rin Exp $	*/
+/* 	$NetBSD: rasops15.c,v 1.37 2019/08/07 12:33:48 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.36 2019/08/07 11:48:43 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.37 2019/08/07 12:33:48 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -114,8 +114,12 @@ rasops15_init(struct rasops_info *ri)
 #endif
 }
 
+#undef	RASOPS_AA
 #include "rasops_putchar.h"
-#include "rasops_putchar_aa.h"
+
+#define	RASOPS_AA
+#include "rasops_putchar.h"
+#undef	RASOPS_AA
 
 #ifndef RASOPS_SMALL
 /*

Index: src/sys/dev/rasops/rasops24.c
diff -u src/sys/dev/rasops/rasops24.c:1.47 src/sys/dev/rasops/rasops24.c:1.48
--- src/sys/dev/rasops/rasops24.c:1.47	Wed Aug  7 11:47:33 2019
+++ src/sys/dev/rasops/rasops24.c	Wed Aug  7 12:33:48 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops24.c,v 1.47 2019/08/07 11:47:33 rin Exp $	*/
+/* 	$NetBSD: rasops24.c,v 1.48 2019/08/07 12:33:48 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.47 2019/08/07 11:47:33 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.48 2019/08/07 12:33:48 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -125,8 +125,12 @@ rasops24_init(struct rasops_info *ri)
 #endif
 }
 
+#undef	RASOPS_AA
 #include "rasops_putchar.h"
-#include "rasops_putchar_aa.h"
+
+#define	RASOPS_AA
+#include "rasops_putchar.h"
+#undef	RASOPS_AA
 
 static __inline void
 rasops24_makestamp1(struct rasops_info *ri, uint32_t *xstamp,

Index: src/sys/dev/rasops/rasops32.c
diff -u src/sys/dev/rasops/rasops32.c:1.43 src/sys/dev/rasops/rasops32.c:1.44
--- src/sys/dev/rasops/rasops32.c:1.43	Wed Aug  7 11:47:33 2019
+++ src/sys/dev/rasops/rasops32.c	Wed Aug  7 12:33:48 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops32.c,v 1.43 2019/08/07 11:47:33 rin Exp $	*/
+/*	 $NetBSD: rasops32.c,v 1.44 2019/08/07 12:33:48 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.43 2019/08/07 11:47:33 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.44 2019/08/07 12:33:48 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -115,8 +115,12 @@ rasops32_init(struct rasops_info *ri)
 #endif
 }
 
+#undef	RASOPS_AA
 #include "rasops_putchar.h"
-#include "rasops_putchar_aa.h"
+
+#define	RASOPS_AA
+#include "rasops_putchar.h"
+#undef	RASOPS_AA
 
 #ifndef RASOPS_SMALL
 /*

Index: src/sys/dev/rasops/rasops8.c
diff -u src/sys/dev/rasops/rasops8.c:1.48 src/sys/dev/rasops/rasops8.c:1.49
--- src/sys/dev/rasops/rasops8.c:1.48	Wed Aug  7 11:47:33 2019
+++ src/sys/dev/rasops/rasops8.c	Wed Aug  7 12:33:48 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops8.c,v 1.48 2019/08/07 11:47:33 rin Exp $	*/
+/* 	$NetBSD: rasops8.c,v 1.49 2019/08/07 12:33:48 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.48 2019/08/07 11:47:33 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.49 2019/08/07 12:33:48 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -113,8 +113,12 @@ rasops8_init(struct rasops_info *ri)
 #endif
 }
 
+#undef	RASOPS_AA
 #include "rasops_putchar.h"
-#include "rasops_putchar_aa.h"
+
+#define	RASOPS_AA
+#include "rasops_putchar.h"
+#undef	RASOPS_AA
 
 #ifndef RASOPS_SMALL
 /*

Index: src/sys/dev/rasops/rasops_putchar.h
diff -u src/sys/dev/rasops/rasops_putchar.h:1.5 src/sys/dev/rasops/rasops_putchar.h:1.6
--- src/sys/dev/rasops/rasops_putchar.h:1.5	Tue Jul 30 15:29:40 2019
+++ src/sys/dev/rasops/rasops_putchar.h	Wed Aug  7 12:33:48 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops_putchar.h,v 1.5 2019/07/30 15:29:40 rin Exp $ */
+/* $NetBSD: rasops_putchar.h,v 1.6 

CVS commit: src/sys/dev/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 12:27:49 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops1.c rasops1_putchar_width.h
rasops_putchar_width.h

Log Message:
Scaling dimensions of underline by font height.

Currently,
- offset of underline is fixed to 1-row from bottom of characters, and
- height of underline is fixed to 1.

Both are good for standard 8x16 fonts. However, it is too thin for
larger fonts, especially when used on display of high resolution.

Also, 1-row offset of underline is ugly for small fonts, e.g.,
spleen5x8.

Therefore, adjust offset and height as,
- no changes for standard 16-height fonts.
- scaling by font height for larger fonts.
- set offset to zero for fonts of height smaller than 16.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/rasops/rasops1.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/rasops/rasops1_putchar_width.h
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/rasops/rasops_putchar_width.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/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.116 src/sys/dev/rasops/rasops.c:1.117
--- src/sys/dev/rasops/rasops.c:1.116	Wed Aug  7 11:57:40 2019
+++ src/sys/dev/rasops/rasops.c	Wed Aug  7 12:27:49 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.116 2019/08/07 11:57:40 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.117 2019/08/07 12:27:49 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.116 2019/08/07 11:57:40 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.117 2019/08/07 12:27:49 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -332,7 +332,7 @@ rasops_init(struct rasops_info *ri, int 
 int
 rasops_reconfig(struct rasops_info *ri, int wantrows, int wantcols)
 {
-	int bpp, s;
+	int bpp, height, s;
 	size_t len;
 
 	s = splhigh();
@@ -483,6 +483,11 @@ rasops_reconfig(struct rasops_info *ri, 
 	} else
 		ri->ri_xorigin = ri->ri_yorigin = 0;
 
+	/* Scaling underline by font height */
+	height = ri->ri_font->fontheight;
+	ri->ri_ul.off = rounddown(height, 16) / 16;	/* offset from bottom */
+	ri->ri_ul.height = roundup(height, 16) / 16;	/* height */
+
 	/*
 	 * Fill in defaults for operations set.  XXX this nukes private
 	 * routines used by accelerated fb drivers.

Index: src/sys/dev/rasops/rasops1.c
diff -u src/sys/dev/rasops/rasops1.c:1.34 src/sys/dev/rasops/rasops1.c:1.35
--- src/sys/dev/rasops/rasops1.c:1.34	Fri Aug  2 04:39:09 2019
+++ src/sys/dev/rasops/rasops1.c	Wed Aug  7 12:27:49 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops1.c,v 1.34 2019/08/02 04:39:09 rin Exp $	*/
+/* 	$NetBSD: rasops1.c,v 1.35 2019/08/07 12:27:49 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.34 2019/08/02 04:39:09 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.35 2019/08/07 12:27:49 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -170,12 +170,18 @@ rasops1_putchar(void *cookie, int row, i
 
 		/* Do underline */
 		if ((attr & WSATTR_UNDERLINE) != 0) {
-			DELTA(rp, -(ri->ri_stride << 1), uint32_t *);
-			tmp = (*rp & lmask) | (fg & rmask);
-			*rp = tmp;
-			if (ri->ri_hwbits) {
-DELTA(hp, -(ri->ri_stride << 1), uint32_t *);
-*hp = tmp;
+			DELTA(rp, - ri->ri_stride * ri->ri_ul.off, uint32_t *);
+			if (ri->ri_hwbits)
+DELTA(hp, - ri->ri_stride * ri->ri_ul.off,
+uint32_t *);
+			for (height = ri->ri_ul.height; height; height--) {
+DELTA(rp, - ri->ri_stride, uint32_t *);
+tmp = (*rp & lmask) | (fg & rmask);
+*rp = tmp;
+if (ri->ri_hwbits) {
+	DELTA(hp, - ri->ri_stride, uint32_t *);
+	*hp = tmp;
+}
 			}
 		}
 	} else {
@@ -223,15 +229,21 @@ rasops1_putchar(void *cookie, int row, i
 
 		/* Do underline */
 		if ((attr & WSATTR_UNDERLINE) != 0) {
-			DELTA(rp, -(ri->ri_stride << 1), uint32_t *);
-			tmp0 = (rp[0] & lmask) | (fg & ~lmask);
-			tmp1 = (rp[1] & rmask) | (fg & ~rmask);
-			rp[0] = tmp0;
-			rp[1] = tmp1;
-			if (ri->ri_hwbits) {
-DELTA(hp, -(ri->ri_stride << 1), uint32_t *);
-hp[0] = tmp0;
-hp[1] = tmp1;
+			DELTA(rp, - ri->ri_stride * ri->ri_ul.off, uint32_t *);
+			if (ri->ri_hwbits)
+DELTA(hp, - ri->ri_stride * ri->ri_ul.off,
+uint32_t *);
+			for (height = ri->ri_ul.height; height; height--) {
+DELTA(rp, - ri->ri_stride, uint32_t *);
+tmp0 = (rp[0] & lmask) | (fg & ~lmask);
+tmp1 = (rp[1] & rmask) | (fg & ~rmask);
+rp[0] = tmp0;
+rp[1] = tmp1;
+if (ri->ri_hwbits) {
+	DELTA(hp, - ri->ri_stride, uint32_t *);
+	hp[0] = tmp0;
+	hp[1] = tmp1;
+}
 			}
 		}
 	}

Index: src/sys/dev/rasops/rasops1_putchar_width.h
diff -u src/sys/dev/rasops/rasops1_putchar_width.h:1.3 

CVS commit: src/sys/dev/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 12:27:49 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops1.c rasops1_putchar_width.h
rasops_putchar_width.h

Log Message:
Scaling dimensions of underline by font height.

Currently,
- offset of underline is fixed to 1-row from bottom of characters, and
- height of underline is fixed to 1.

Both are good for standard 8x16 fonts. However, it is too thin for
larger fonts, especially when used on display of high resolution.

Also, 1-row offset of underline is ugly for small fonts, e.g.,
spleen5x8.

Therefore, adjust offset and height as,
- no changes for standard 16-height fonts.
- scaling by font height for larger fonts.
- set offset to zero for fonts of height smaller than 16.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/rasops/rasops1.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/rasops/rasops1_putchar_width.h
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/rasops/rasops_putchar_width.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/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 12:09:31 UTC 2019

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

Log Message:
Modify struct rasops_info again (ride 9.99.4 bump).
- remove ri_buf and friends.
- remove ri_stamp and frieds.
- introduce ri_ul, which will be used for scaling underline with font.

Also add hack for ri_ul; adjust its size to obsoleted member, ri_delta,
which was only used rasops routines internally. Now, size and offsets of
all members of struct rasops_info become same with netbsd-9, -8, and -7,
again. So we can safelly pull up fixes to any release branches!


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

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 12:09:31 UTC 2019

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

Log Message:
Modify struct rasops_info again (ride 9.99.4 bump).
- remove ri_buf and friends.
- remove ri_stamp and frieds.
- introduce ri_ul, which will be used for scaling underline with font.

Also add hack for ri_ul; adjust its size to obsoleted member, ri_delta,
which was only used rasops routines internally. Now, size and offsets of
all members of struct rasops_info become same with netbsd-9, -8, and -7,
again. So we can safelly pull up fixes to any release branches!


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/rasops/rasops.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/rasops/rasops.h
diff -u src/sys/dev/rasops/rasops.h:1.44 src/sys/dev/rasops/rasops.h:1.45
--- src/sys/dev/rasops/rasops.h:1.44	Wed Aug  7 11:47:33 2019
+++ src/sys/dev/rasops/rasops.h	Wed Aug  7 12:09:30 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops.h,v 1.44 2019/08/07 11:47:33 rin Exp $ */
+/* 	$NetBSD: rasops.h,v 1.45 2019/08/07 12:09:30 rin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -32,6 +32,8 @@
 #ifndef _RASOPS_H_
 #define _RASOPS_H_ 1
 
+#include 
+
 #include 
 #include 
 
@@ -113,6 +115,22 @@ struct rasops_info {
 	int	ri_emustride;	/* bytes per row we actually care about */
 	int	ri_rows;	/* number of rows (characters, not pels) */
 	int	ri_cols;	/* number of columns (characters, not pels) */
+#if __NetBSD_Prereq__(9, 99, 1)
+	struct {
+		int	off;	/* offset of underline from bottom */
+		int	height;	/* height of underline */
+	} ri_ul;
+#else
+	/*
+	 * XXX
+	 * hack to keep ABI compatibility for netbsd-9, -8, and -7.
+	 */
+	// int	ri_delta;	/* obsoleted */
+	struct {
+		short	off;
+		short	height;
+	} __packed ri_ul;
+#endif
 	int	ri_pelbytes;	/* bytes per pel (may be zero) */
 	int	ri_fontscale;	/* fontheight * fontstride */
 	int	ri_xscale;	/* fontwidth * pelbytes */
@@ -131,15 +149,6 @@ struct rasops_info {
 	/* Callbacks so we can share some code */
 	void	(*ri_do_cursor)(struct rasops_info *);
 
-	/* buffer capable of single-row pixels */
-	void	*ri_buf;
-	size_t	ri_buflen;
-
-	/* 4x1 stamp for optimized character blitting */
-	void	*ri_stamp;
-	long	ri_stamp_attr;
-	size_t	ri_stamp_len;
-
 #if NRASOPS_ROTATION > 0
 	/* Used to intercept putchar to permit display rotation */
 	struct	wsdisplay_emulops ri_real_ops;



CVS commit: src/sys/dev/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 11:57:40 UTC 2019

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

Log Message:
If RI_CLEAR is set, do not forget to clear real framebuffer.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/dev/rasops/rasops.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/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 11:57:40 UTC 2019

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

Log Message:
If RI_CLEAR is set, do not forget to clear real framebuffer.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/dev/rasops/rasops.c

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.115 src/sys/dev/rasops/rasops.c:1.116
--- src/sys/dev/rasops/rasops.c:1.115	Wed Aug  7 11:47:33 2019
+++ src/sys/dev/rasops/rasops.c	Wed Aug  7 11:57:40 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.115 2019/08/07 11:47:33 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.116 2019/08/07 11:57:40 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.115 2019/08/07 11:47:33 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.116 2019/08/07 11:57:40 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -442,8 +442,12 @@ rasops_reconfig(struct rasops_info *ri, 
 	ri->ri_hworigbits = ri->ri_hwbits;
 
 	/* Clear the entire display */
-	if ((ri->ri_flg & RI_CLEAR) != 0)
-		memset(ri->ri_bits, 0, ri->ri_stride * ri->ri_height);
+	if ((ri->ri_flg & RI_CLEAR) != 0) {
+		rasops_memset32(ri->ri_bits, 0, ri->ri_stride * ri->ri_height);
+		if (ri->ri_hwbits)
+			rasops_memset32(ri->ri_hwbits, 0,
+			ri->ri_stride * ri->ri_height);
+	}
 
 	/* Now centre our window if needs be */
 	if ((ri->ri_flg & RI_CENTER) != 0) {



CVS commit: src/sys/dev/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 11:48:44 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops15.c

Log Message:
Oops, revert an unintentional change for now.


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

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

Modified files:

Index: src/sys/dev/rasops/rasops15.c
diff -u src/sys/dev/rasops/rasops15.c:1.35 src/sys/dev/rasops/rasops15.c:1.36
--- src/sys/dev/rasops/rasops15.c:1.35	Wed Aug  7 11:47:33 2019
+++ src/sys/dev/rasops/rasops15.c	Wed Aug  7 11:48:43 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops15.c,v 1.35 2019/08/07 11:47:33 rin Exp $	*/
+/* 	$NetBSD: rasops15.c,v 1.36 2019/08/07 11:48:43 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.35 2019/08/07 11:47:33 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.36 2019/08/07 11:48:43 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -114,12 +114,8 @@ rasops15_init(struct rasops_info *ri)
 #endif
 }
 
-#undef	RASOPS_AA
 #include "rasops_putchar.h"
-
-#define	RASOPS_AA
-#include "rasops_putchar.h"
-#undef	RASOPS_AA
+#include "rasops_putchar_aa.h"
 
 #ifndef RASOPS_SMALL
 /*



CVS commit: src/sys/dev/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 11:48:44 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops15.c

Log Message:
Oops, revert an unintentional change for now.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/rasops/rasops15.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/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 11:47:33 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops.h rasops15.c rasops2.c rasops24.c
rasops32.c rasops4.c rasops8.c rasops_putchar_width.h

Log Message:
Stop allocating ri_buf and ri_stamp dynamically. As commented in
rasops.h, it is not safe to use kmem_alloc(9) in rasops_init();
rasops routines can be used for early putchar, which means that
UVM is not fully initialized.

Should fix a problem reported by macallan:
http://mail-index.netbsd.org/tech-kern/2019/08/02/msg025327.html

Instead of using ri_buf, inline function rasops_memcpy32() is
introduced to fill 32bit data efficiently.

Instead of using ri_stamp (per device stamp), stamp_ri is
introduced to distinguish for which device stamp is calculated.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/rasops/rasops.h
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/rasops/rasops15.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/rasops/rasops2.c
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/rasops/rasops24.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/rasops/rasops32.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/rasops/rasops4.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/rasops/rasops8.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/rasops/rasops_putchar_width.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/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.114 src/sys/dev/rasops/rasops.c:1.115
--- src/sys/dev/rasops/rasops.c:1.114	Wed Aug  7 11:08:44 2019
+++ src/sys/dev/rasops/rasops.c	Wed Aug  7 11:47:33 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.114 2019/08/07 11:08:44 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.115 2019/08/07 11:47:33 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.114 2019/08/07 11:08:44 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.115 2019/08/07 11:47:33 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -509,21 +509,6 @@ rasops_reconfig(struct rasops_info *ri, 
 		WSSCREEN_WSCOLORS | WSSCREEN_REVERSE;
 	}
 
-	if (ri->ri_buf != NULL) {
-		kmem_free(ri->ri_buf, ri->ri_buflen);
-		ri->ri_buf = NULL;
-	}
-	len = (ri->ri_flg & RI_FULLCLEAR) ? ri->ri_stride : ri->ri_emustride;
-	ri->ri_buflen = len;
-	ri->ri_buf = kmem_alloc(len, KM_SLEEP);
-
-#ifndef RASOPS_SMALL
-	if (ri->ri_stamp != NULL) {
-		kmem_free(ri->ri_stamp, ri->ri_stamp_len);
-		ri->ri_stamp = NULL;
-	}
-#endif
-
 	switch (ri->ri_depth) {
 #if NRASOPS1 > 0
 	case 1:
@@ -1004,9 +989,8 @@ void
 rasops_eraserows(void *cookie, int row, int num, long attr)
 {
 	struct rasops_info *ri = (struct rasops_info *)cookie;
-	uint32_t *buf = (uint32_t *)ri->ri_buf;
 	uint32_t *rp, *hp, clr;
-	int stride, cnt;
+	int stride;
 
 	hp = NULL;	/* XXX GCC */
 
@@ -1045,13 +1029,10 @@ rasops_eraserows(void *cookie, int row, 
 			hp = (uint32_t *)(ri->ri_hwbits + row * ri->ri_yscale);
 	}
 
-	for (cnt = 0; cnt < stride >> 2; cnt++)
-		buf[cnt] = clr;
-
 	while (num--) {
-		memcpy(rp, buf, stride);
+		rasops_memset32(rp, clr, stride);
 		if (ri->ri_hwbits) {
-			memcpy(hp, buf, stride);
+			memcpy(hp, rp, stride);
 			DELTA(hp, ri->ri_stride, uint32_t *);
 		}
 		DELTA(rp, ri->ri_stride, uint32_t *);
@@ -1166,9 +1147,8 @@ void
 rasops_erasecols(void *cookie, int row, int col, int num, long attr)
 {
 	struct rasops_info *ri = (struct rasops_info *)cookie;
-	uint32_t *buf = ri->ri_buf;
-	int height, cnt, clr;
-	uint32_t *dp, *rp, *hp;
+	int height, clr;
+	uint32_t *rp, *hp;
 
 	hp = NULL;	/* XXX GCC */
 
@@ -1196,25 +1176,13 @@ rasops_erasecols(void *cookie, int row, 
 	height = ri->ri_font->fontheight;
 	clr = ri->ri_devcmap[((uint32_t)attr >> 16) & 0xf];
 
-	dp = buf;
-
-	/* Write 4 bytes per loop */
-	for (cnt = num >> 2; cnt; cnt--)
-		*dp++ = clr;
-
-	/* Write unaligned trailing slop */
-	for (cnt = num & 3; cnt; cnt--) {
-		*(uint8_t *)dp = clr;
-		DELTA(dp, 1, uint32_t *);
-	}
-
 	while (height--) {
-		memcpy(rp, buf, num);
-		DELTA(rp, ri->ri_stride, uint32_t *);
+		rasops_memset32(rp, clr, num);
 		if (ri->ri_hwbits) {
-			memcpy(hp, buf, num);
+			memcpy(hp, rp, num);
 			DELTA(hp, ri->ri_stride, uint32_t *);
 		}
+		DELTA(rp, ri->ri_stride, uint32_t *);
 	}
 }
 
@@ -1689,15 +1657,3 @@ rasops_get_cmap(struct rasops_info *ri, 
 		memcpy(palette, rasops_cmap, uimin(bytes, sizeof(rasops_cmap)));
 	return 0;
 }
-
-#ifndef RASOPS_SMALL
-void
-rasops_allocstamp(struct rasops_info *ri, size_t len)
-{
-
-	KASSERT(ri->ri_stamp == NULL);
-	ri->ri_stamp_len = len;
-	ri->ri_stamp = kmem_zalloc(len, KM_SLEEP);
-	ri->ri_stamp_attr = 0;
-}
-#endif

Index: src/sys/dev/rasops/rasops.h
diff -u src/sys/dev/rasops/rasops.h:1.43 src/sys/dev/rasops/rasops.h:1.44
--- src/sys/dev/rasops/rasops.h:1.43	Sat Aug  3 06:29:52 2019
+++ 

CVS commit: src/sys/dev/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 11:47:33 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops.h rasops15.c rasops2.c rasops24.c
rasops32.c rasops4.c rasops8.c rasops_putchar_width.h

Log Message:
Stop allocating ri_buf and ri_stamp dynamically. As commented in
rasops.h, it is not safe to use kmem_alloc(9) in rasops_init();
rasops routines can be used for early putchar, which means that
UVM is not fully initialized.

Should fix a problem reported by macallan:
http://mail-index.netbsd.org/tech-kern/2019/08/02/msg025327.html

Instead of using ri_buf, inline function rasops_memcpy32() is
introduced to fill 32bit data efficiently.

Instead of using ri_stamp (per device stamp), stamp_ri is
introduced to distinguish for which device stamp is calculated.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/rasops/rasops.h
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/rasops/rasops15.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/rasops/rasops2.c
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/rasops/rasops24.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/rasops/rasops32.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/rasops/rasops4.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/rasops/rasops8.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/rasops/rasops_putchar_width.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/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 11:13:20 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops1_putchar_width.h

Log Message:
Use "hp" instead of "hrp" consistently with other files.
No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/rasops/rasops1_putchar_width.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/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 11:13:20 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops1_putchar_width.h

Log Message:
Use "hp" instead of "hrp" consistently with other files.
No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/rasops/rasops1_putchar_width.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/rasops/rasops1_putchar_width.h
diff -u src/sys/dev/rasops/rasops1_putchar_width.h:1.2 src/sys/dev/rasops/rasops1_putchar_width.h:1.3
--- src/sys/dev/rasops/rasops1_putchar_width.h:1.2	Mon Jul 29 17:22:19 2019
+++ src/sys/dev/rasops/rasops1_putchar_width.h	Wed Aug  7 11:13:20 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops1_putchar_width.h,v 1.2 2019/07/29 17:22:19 rin Exp $ */
+/* $NetBSD: rasops1_putchar_width.h,v 1.3 2019/08/07 11:13:20 rin Exp $ */
 
 /* NetBSD: rasops1.c,v 1.28 2019/07/25 03:02:44 rin Exp */
 /*-
@@ -44,7 +44,7 @@
 
 #if RASOPS_WIDTH == 16
 /*
- * rp and hrp are always half-word aligned, whereas
+ * rp and hp are always half-word aligned, whereas
  * fr may not be aligned in half-word boundary.
  */
 #define	COPY_UNIT	uint16_t
@@ -65,9 +65,9 @@ PUTCHAR_WIDTH(RASOPS_WIDTH)(void *cookie
 	struct wsdisplay_font *font = PICK_FONT(ri, uc);
 	int height, fs, rs, bg, fg;
 	uint8_t *fr;
-	COPY_UNIT *rp, *hrp, tmp;
+	COPY_UNIT *rp, *hp, tmp;
 
-	hrp = NULL;	/* XXX GCC */
+	hp = NULL;	/* XXX GCC */
 
 #ifdef RASOPS_CLIPPING
 	/* Catches 'row < 0' case too */
@@ -81,7 +81,7 @@ PUTCHAR_WIDTH(RASOPS_WIDTH)(void *cookie
 	rp = (COPY_UNIT *)(ri->ri_bits + row * ri->ri_yscale +
 	col * sizeof(COPY_UNIT));
 	if (ri->ri_hwbits)
-		hrp = (COPY_UNIT *)(ri->ri_hwbits + row * ri->ri_yscale +
+		hp = (COPY_UNIT *)(ri->ri_hwbits + row * ri->ri_yscale +
 		col * sizeof(COPY_UNIT));
 	height = font->fontheight;
 	rs = ri->ri_stride;
@@ -95,8 +95,8 @@ PUTCHAR_WIDTH(RASOPS_WIDTH)(void *cookie
 			*rp = bg;
 			DELTA(rp, rs, COPY_UNIT *);
 			if (ri->ri_hwbits) {
-*hrp = bg;
-DELTA(hrp, rs, COPY_UNIT *);
+*hp = bg;
+DELTA(hp, rs, COPY_UNIT *);
 			}
 		}
 	} else {
@@ -110,8 +110,8 @@ PUTCHAR_WIDTH(RASOPS_WIDTH)(void *cookie
 			*rp = tmp;
 			DELTA(rp, rs, COPY_UNIT *);
 			if (ri->ri_hwbits) {
-*hrp = tmp;
-DELTA(hrp, rs, COPY_UNIT *);
+*hp = tmp;
+DELTA(hp, rs, COPY_UNIT *);
 			}
 			fr += fs;
 		}
@@ -122,8 +122,8 @@ PUTCHAR_WIDTH(RASOPS_WIDTH)(void *cookie
 		DELTA(rp, -(ri->ri_stride << 1), COPY_UNIT *);
 		*rp = fg;
 		if (ri->ri_hwbits) {
-			DELTA(hrp, -(ri->ri_stride << 1), COPY_UNIT *);
-			*hrp = fg;
+			DELTA(hp, -(ri->ri_stride << 1), COPY_UNIT *);
+			*hp = fg;
 		}
 	}
 }



CVS commit: src/sys/dev/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 11:08:44 UTC 2019

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

Log Message:
Simplify rasops_do_cursor():

- Use static masks similar to that used in rasops_bitops.h,
  rather than generating them on the fly.
- Use pointer for proper type to avoid unnecessary casts.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/rasops/rasops.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/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 11:08:44 UTC 2019

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

Log Message:
Simplify rasops_do_cursor():

- Use static masks similar to that used in rasops_bitops.h,
  rather than generating them on the fly.
- Use pointer for proper type to avoid unnecessary casts.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/rasops/rasops.c

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.113 src/sys/dev/rasops/rasops.c:1.114
--- src/sys/dev/rasops/rasops.c:1.113	Wed Aug  7 11:03:14 2019
+++ src/sys/dev/rasops/rasops.c	Wed Aug  7 11:08:44 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.113 2019/08/07 11:03:14 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.114 2019/08/07 11:08:44 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.113 2019/08/07 11:03:14 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.114 2019/08/07 11:08:44 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -53,6 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1
 
 #define	_RASOPS_PRIVATE
 #include 
+#include 	/* XXX for MBE */
 
 #ifndef _KERNEL
 #include 
@@ -72,6 +73,16 @@ struct rasops_matchdata {
 	int ident;
 };	
 
+static const uint32_t rasops_lmask32[4 + 1] = {
+	MBE(0x), MBE(0x00ff), MBE(0x), MBE(0x00ff),
+	MBE(0x),
+};
+
+static const uint32_t rasops_rmask32[4 + 1] = {
+	MBE(0x), MBE(0xff00), MBE(0x), MBE(0xff00),
+	MBE(0x),
+};
+
 /* ANSI colormap (R,G,B). Upper 8 are high-intensity */
 const uint8_t rasops_cmap[256 * 3] = {
 	0x00, 0x00, 0x00, /* black */
@@ -1055,9 +1066,8 @@ static void
 rasops_do_cursor(struct rasops_info *ri)
 {
 	int full, height, cnt, slop1, slop2, row, col;
-	uint32_t tmp32, msk1, msk2;
-	uint8_t tmp8;
-	uint8_t *dp, *rp, *hp;
+	uint32_t mask1, mask2, *dp;
+	uint8_t tmp8, *rp, *hp;
 
 	hp = NULL;	/* XXX GCC */
 
@@ -1121,28 +1131,24 @@ rasops_do_cursor(struct rasops_info *ri)
 	rp = (uint8_t *)((uintptr_t)rp & ~3);
 	hp = (uint8_t *)((uintptr_t)hp & ~3);
 
-	msk1 = !slop1 ? 0 : be32toh(0xU >> (32 - (8 * slop1)));
-	msk2 = !slop2 ? 0 : be32toh(0xU << (32 - (8 * slop2)));
+	mask1 = rasops_lmask32[4 - slop1];
+	mask2 = rasops_rmask32[slop2];
 
 	while (height--) {
-		dp = rp;
+		dp = (uint32_t *)rp;
 
 		if (slop1) {
-			tmp32 = *(uint32_t *)dp ^ msk1;
-			*(uint32_t *)dp = tmp32;
-			dp += 4;
+			*dp = *dp ^ mask1;
+			dp++;
 		}
 
 		for (cnt = full; cnt; cnt--) {
-			tmp32 = ~*(uint32_t *)dp;
-			*(uint32_t *)dp = tmp32;
-			dp += 4;
+			*dp = ~*(uint32_t *)dp;
+			dp++;
 		}
 
-		if (slop2) {
-			tmp32 = *(uint32_t *)dp ^ msk2;
-			*(uint32_t *)dp = tmp32;
-		}
+		if (slop2)
+			*dp = *dp ^ mask2;
 
 		if (ri->ri_hwbits) {
 			memcpy(hp, rp, ((slop1 != 0) + full +



CVS commit: src/sys/dev/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 11:03:14 UTC 2019

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

Log Message:
Fix a critical bug for rasops_copyrows() introduced in rev. 1.90:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/rasops/rasops.c#rev1.90

When src < dst, we have to copy backward.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/rasops/rasops.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/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 10:59:51 UTC 2019

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

Log Message:
Depth 2 is monochrome.

IMO, it is impossible to support ANSI colors on 2-bpp display; fore-
and background can be same value even if they are different colors
logically.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/dev/rasops/rasops.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/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 10:59:51 UTC 2019

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

Log Message:
Depth 2 is monochrome.

IMO, it is impossible to support ANSI colors on 2-bpp display; fore-
and background can be same value even if they are different colors
logically.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/dev/rasops/rasops.c

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.111 src/sys/dev/rasops/rasops.c:1.112
--- src/sys/dev/rasops/rasops.c:1.111	Wed Aug  7 10:55:51 2019
+++ src/sys/dev/rasops/rasops.c	Wed Aug  7 10:59:51 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.111 2019/08/07 10:55:51 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.112 2019/08/07 10:59:51 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.111 2019/08/07 10:55:51 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.112 2019/08/07 10:59:51 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -484,10 +484,10 @@ rasops_reconfig(struct rasops_info *ri, 
 		WSSCREEN_WSCOLORS | WSSCREEN_REVERSE);
 
 	if ((ri->ri_flg & RI_FORCEMONO) != 0 ||
-#ifdef RASOPS_APPLE_PALETTE
-	ri->ri_depth == 1
-#else
+#ifndef RASOPS_APPLE_PALETTE
 	ri->ri_depth < 8
+#else
+	ri->ri_depth < 4
 #endif
 	) {
 		ri->ri_ops.allocattr = rasops_allocattr_mono;



CVS commit: src/sys/dev/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 10:55:51 UTC 2019

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

Log Message:
Fix black color-attribution for depths 2 and 4.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/rasops/rasops.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/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 10:55:51 UTC 2019

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

Log Message:
Fix black color-attribution for depths 2 and 4.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/rasops/rasops.c

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.110 src/sys/dev/rasops/rasops.c:1.111
--- src/sys/dev/rasops/rasops.c:1.110	Wed Aug  7 10:53:41 2019
+++ src/sys/dev/rasops/rasops.c	Wed Aug  7 10:55:51 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.110 2019/08/07 10:53:41 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.111 2019/08/07 10:55:51 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.110 2019/08/07 10:53:41 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.111 2019/08/07 10:55:51 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -673,7 +673,7 @@ rasops_allocattr_mono(void *cookie, int 
 	if ((flg & (WSATTR_BLINK | WSATTR_HILIT | WSATTR_WSCOLORS)) != 0)
 		return EINVAL;
 
-	fg = 1;
+	fg = 0xff;
 	bg = 0;
 
 	if ((flg & WSATTR_REVERSE) != 0) {



CVS commit: src/sys/dev/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 10:53:41 UTC 2019

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

Log Message:
Simplify calculation for 12-byte alignment.
No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/dev/rasops/rasops.c

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.109 src/sys/dev/rasops/rasops.c:1.110
--- src/sys/dev/rasops/rasops.c:1.109	Wed Aug  7 10:51:57 2019
+++ src/sys/dev/rasops/rasops.c	Wed Aug  7 10:53:41 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.109 2019/08/07 10:51:57 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.110 2019/08/07 10:53:41 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.109 2019/08/07 10:51:57 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.110 2019/08/07 10:53:41 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -446,9 +446,9 @@ rasops_reconfig(struct rasops_info *ri, 
 			xoff &= ~3;
 		} else {
 			/*
-			 * Truncate to word and 24-bit color boundary.
+			 * Truncate to both word and 24-bit color boundary.
 			 */
-			xoff = (xoff / (4 * 3)) * (4 * 3);
+			xoff -= xoff % 12;
 		}
 
 		yoff = ((ri->ri_height - ri->ri_emuheight) >> 1) *



CVS commit: src/sys/dev/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 10:53:41 UTC 2019

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

Log Message:
Simplify calculation for 12-byte alignment.
No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/dev/rasops/rasops.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/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 10:51:57 UTC 2019

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

Log Message:
Use _KERNEL_OPT.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/dev/rasops/rasops.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/rasops

2019-08-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug  7 10:51:57 UTC 2019

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

Log Message:
Use _KERNEL_OPT.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/dev/rasops/rasops.c

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.108 src/sys/dev/rasops/rasops.c:1.109
--- src/sys/dev/rasops/rasops.c:1.108	Fri Aug  2 23:24:37 2019
+++ src/sys/dev/rasops/rasops.c	Wed Aug  7 10:51:57 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.108 2019/08/02 23:24:37 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.109 2019/08/07 10:51:57 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,11 +30,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.108 2019/08/02 23:24:37 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.109 2019/08/07 10:51:57 rin Exp $");
 
+#ifdef _KERNEL_OPT
 #include "opt_rasops.h"
-#include "rasops_glue.h"
 #include "opt_wsmsgattrs.h"
+#endif
+
+#include "rasops_glue.h"
 
 #include 
 #include 



CVS commit: src/sys/dev/rasops

2019-08-03 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Aug  3 06:29:52 UTC 2019

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

Log Message:
Protect rasops_copy{rows,cols}() by _RASOPS_PRIVATE.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/rasops/rasops.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/rasops/rasops.h
diff -u src/sys/dev/rasops/rasops.h:1.42 src/sys/dev/rasops/rasops.h:1.43
--- src/sys/dev/rasops/rasops.h:1.42	Wed Jul 31 04:45:44 2019
+++ src/sys/dev/rasops/rasops.h	Sat Aug  3 06:29:52 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops.h,v 1.42 2019/07/31 04:45:44 rin Exp $ */
+/* 	$NetBSD: rasops.h,v 1.43 2019/08/03 06:29:52 rin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -172,13 +172,14 @@ struct rasops_info {
 int	rasops_init(struct rasops_info *, int, int);
 int	rasops_reconfig(struct rasops_info *, int, int);
 void	rasops_unpack_attr(long, int *, int *, int *);
-void	rasops_eraserows(void *, int, int, long);
-void	rasops_erasecols(void *, int, int, int, long);
 int	rasops_get_cmap(struct rasops_info *, uint8_t *, size_t);
 
 extern const uint8_t	rasops_cmap[256 * 3];
 
 #ifdef _RASOPS_PRIVATE
+void	rasops_eraserows(void *, int, int, long);
+void	rasops_erasecols(void *, int, int, int, long);
+
 /*
  * Per-depth initialization functions.
  */



CVS commit: src/sys/dev/rasops

2019-08-03 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Aug  3 06:29:52 UTC 2019

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

Log Message:
Protect rasops_copy{rows,cols}() by _RASOPS_PRIVATE.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/rasops/rasops.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/rasops

2019-08-02 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 23:24:37 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops24.c

Log Message:
Real fix for 24-bpp color:
- When centering screen, locate effective base address of framebuffer to
  both word and 24-bit color boundary.
- Consistently convert ri_devcmap to ``big endian'' if not RI_BSWAP.

Also, fix possible bug for 15/16-bpp with RI_BSWAP (not tested).


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/rasops/rasops24.c

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.107 src/sys/dev/rasops/rasops.c:1.108
--- src/sys/dev/rasops/rasops.c:1.107	Fri Aug  2 04:22:04 2019
+++ src/sys/dev/rasops/rasops.c	Fri Aug  2 23:24:37 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.107 2019/08/02 04:22:04 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.108 2019/08/02 23:24:37 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.107 2019/08/02 04:22:04 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.108 2019/08/02 23:24:37 rin Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -412,7 +412,6 @@ rasops_reconfig(struct rasops_info *ri, 
 	} else
 #endif
 	{
-
 		ri->ri_cols = ri->ri_emuwidth / ri->ri_font->fontwidth;
 		ri->ri_rows = ri->ri_emuheight / ri->ri_font->fontheight;
 	}
@@ -434,17 +433,31 @@ rasops_reconfig(struct rasops_info *ri, 
 
 	/* Now centre our window if needs be */
 	if ((ri->ri_flg & RI_CENTER) != 0) {
-		ri->ri_bits += (((ri->ri_width * bpp >> 3) -
-		ri->ri_emustride) >> 1) & ~3;
-		ri->ri_bits += ((ri->ri_height - ri->ri_emuheight) >> 1) *
+		uint32_t xoff, yoff;
+
+		xoff = ((ri->ri_width * bpp >> 3) - ri->ri_emustride) >> 1;
+		if (ri->ri_depth != 24) {
+			/*
+			 * Truncate to word boundary.
+			 */
+			xoff &= ~3;
+		} else {
+			/*
+			 * Truncate to word and 24-bit color boundary.
+			 */
+			xoff = (xoff / (4 * 3)) * (4 * 3);
+		}
+
+		yoff = ((ri->ri_height - ri->ri_emuheight) >> 1) *
 		ri->ri_stride;
+
+		ri->ri_bits += xoff;
+		ri->ri_bits += yoff;
 		if (ri->ri_hwbits != NULL) {
-			ri->ri_hwbits += (((ri->ri_width * bpp >> 3) -
-			ri->ri_emustride) >> 1) & ~3;
-			ri->ri_hwbits +=
-			((ri->ri_height - ri->ri_emuheight) >> 1) *
-			ri->ri_stride;
+			ri->ri_hwbits += xoff;
+			ri->ri_hwbits += yoff;
 		}
+
 		ri->ri_yorigin = (int)(ri->ri_bits - ri->ri_origbits) /
 		ri->ri_stride;
 		ri->ri_xorigin = (((int)(ri->ri_bits - ri->ri_origbits) %
@@ -901,39 +914,49 @@ rasops_init_devcmap(struct rasops_info *
 			c |= (uint32_t)(*p << (ri->ri_bnum - 8)) << ri->ri_bpos;
 		p++;
 
-		/* Fill the word for generic routines, which want this */
-		if (ri->ri_depth == 8) {
+		/*
+		 * Swap byte order if necessary. Then, fill the word for
+		 * generic routines, which want this.
+		 */
+		switch (ri->ri_depth) {
+		case 8:
 			c |= c << 8;
 			c |= c << 16;
-		} else if (ri->ri_depth == 15 || ri->ri_depth == 16)
+			break;
+		case 15:
+		case 16:
+			if ((ri->ri_flg & RI_BSWAP) != 0)
+c = bswap16(c);
 			c |= c << 16;
-		else if (ri->ri_depth == 24) {
+			break;
+		case 24:
 #if BYTE_ORDER == LITTLE_ENDIAN
-#  ifndef RASOPS_SMALL
-			if (ri->ri_font->fontwidth != 12)
-#  endif
-c = (c & 0xff) << 16 | (c & 0x00ff00) |
-(c & 0xff) >> 16;
-#  ifndef RASOPS_SMALL
-			else
-c = (c & 0xff) | (c & 0x00ff00) << 8 |
-(c & 0xff) >> 8;
-#  endif
+			if ((ri->ri_flg & RI_BSWAP) == 0)
 #else
-			/* XXXRO What should we do here? */
+			if ((ri->ri_flg & RI_BSWAP) != 0)
 #endif
+			{
+/*
+ * Convert to ``big endian'' if not RI_BSWAP.
+ */
+c = (c & 0xff) << 16|
+(c & 0x00ff00) |
+(c & 0xff) >> 16;
+			}
+
+			/*
+			 * No worries, we use generic routines only for
+			 * gray colors, where all 3 bytes are same.
+			 */
 			c |= (c & 0xff) << 24;
+			break;
+		case 32:
+			if ((ri->ri_flg & RI_BSWAP) != 0)
+c = bswap32(c);
+			break;
 		}
 
-		/* 24bpp does bswap on the fly. {32,16,15}bpp do it here. */
-		if ((ri->ri_flg & RI_BSWAP) == 0)
-			ri->ri_devcmap[i] = c;
-		else if (ri->ri_depth == 15 || ri->ri_depth == 16)
-			ri->ri_devcmap[i] = bswap16(c);
-		else if (ri->ri_depth == 32)
-			ri->ri_devcmap[i] = bswap32(c);
-		else /* 8, 24 */
-			ri->ri_devcmap[i] = c;
+		ri->ri_devcmap[i] = c;
 	}
 }
 

Index: src/sys/dev/rasops/rasops24.c
diff -u src/sys/dev/rasops/rasops24.c:1.45 src/sys/dev/rasops/rasops24.c:1.46
--- src/sys/dev/rasops/rasops24.c:1.45	Fri Aug  2 23:05:42 2019
+++ src/sys/dev/rasops/rasops24.c	Fri Aug  2 23:24:37 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops24.c,v 1.45 2019/08/02 23:05:42 rin Exp $	*/
+/* 	$NetBSD: rasops24.c,v 1.46 2019/08/02 23:24:37 rin Exp $	*/
 
 /*-
  

CVS commit: src/sys/dev/rasops

2019-08-02 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 23:24:37 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops24.c

Log Message:
Real fix for 24-bpp color:
- When centering screen, locate effective base address of framebuffer to
  both word and 24-bit color boundary.
- Consistently convert ri_devcmap to ``big endian'' if not RI_BSWAP.

Also, fix possible bug for 15/16-bpp with RI_BSWAP (not tested).


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/rasops/rasops24.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/rasops

2019-08-02 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 23:05:43 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops24.c

Log Message:
Fix unaligned word write's to buffer, introduced in rev 1.42:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/rasops/rasops24.c#rev1.42


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/rasops/rasops24.c

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

Modified files:

Index: src/sys/dev/rasops/rasops24.c
diff -u src/sys/dev/rasops/rasops24.c:1.44 src/sys/dev/rasops/rasops24.c:1.45
--- src/sys/dev/rasops/rasops24.c:1.44	Fri Aug  2 04:39:09 2019
+++ src/sys/dev/rasops/rasops24.c	Fri Aug  2 23:05:42 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops24.c,v 1.44 2019/08/02 04:39:09 rin Exp $	*/
+/* 	$NetBSD: rasops24.c,v 1.45 2019/08/02 23:05:42 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.44 2019/08/02 04:39:09 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.45 2019/08/02 23:05:42 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -276,8 +276,8 @@ static void
 rasops24_erasecols(void *cookie, int row, int col, int num, long attr)
 {
 	struct rasops_info *ri = (struct rasops_info *)cookie;
-	uint8_t *buf = (uint8_t *)ri->ri_buf;
-	int height, cnt, full, slop1, slop2, clr, stamp[3];
+	void *buf = ri->ri_buf;
+	int height, cnt, clr, stamp[3];
 	uint32_t *dp;
 	uint8_t *rp, *hp, *dbp;
 
@@ -319,33 +319,9 @@ rasops24_erasecols(void *cookie, int row
 	clr = ri->ri_devcmap[((uint32_t)attr >> 16) & 0xf] & 0xff;
 	rasops24_makestamp1(ri, stamp, clr, clr, clr, clr);
 
-	/*
-	 * The current byte offset mod 4 tells us the number of 24-bit pels
-	 * we need to write for alignment to 32-bits. Once we're aligned on
-	 * a 32-bit boundary, we're also aligned on a 4 pixel boundary, so
-	 * the stamp does not need to be rotated. The following shows the
-	 * layout of 4 pels in a 3 word region and illustrates this:
-	 *
-	 *	aaab bbcc cddd
-	 */
-	slop1 = (uintptr_t)rp & 3;
-	cnt = slop1;
-	full = (num /* - cnt */) / 4;
-	cnt += full * 4;
-	slop2 = num - cnt;
-
-	/* Align to 4 bytes */
-	/* XXX handle with masks, bring under control of RI_BSWAP */
-	dbp = buf;
-	for (cnt = slop1; cnt; cnt--) {
-		*dbp++ = (clr >> 16);
-		*dbp++ = (clr >> 8);
-		*dbp++ =  clr;
-	}
-
 	/* 4 pels per loop */
-	dp = (uint32_t *)dbp;
-	for (cnt = full; cnt; cnt--) {
+	dp = (uint32_t *)buf;
+	for (cnt = num >> 2; cnt; cnt--) {
 		dp[0] = stamp[0];
 		dp[1] = stamp[1];
 		dp[2] = stamp[2];
@@ -355,7 +331,7 @@ rasops24_erasecols(void *cookie, int row
 	/* Trailing slop */
 	/* XXX handle with masks, bring under control of RI_BSWAP */
 	dbp = (uint8_t *)dp;
-	for (cnt = slop2; cnt; cnt--) {
+	for (cnt = num & 3; cnt; cnt--) {
 		*dbp++ = (clr >> 16);
 		*dbp++ = (clr >> 8);
 		*dbp++ =  clr;



CVS commit: src/sys/dev/rasops

2019-08-02 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 23:05:43 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops24.c

Log Message:
Fix unaligned word write's to buffer, introduced in rev 1.42:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/rasops/rasops24.c#rev1.42


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/rasops/rasops24.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/rasops

2019-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 05:04:02 UTC 2019

Modified Files:
src/sys/dev/rasops: README

Log Message:
Reflect reality.


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

2019-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 05:04:02 UTC 2019

Modified Files:
src/sys/dev/rasops: README

Log Message:
Reflect reality.


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

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

Modified files:

Index: src/sys/dev/rasops/README
diff -u src/sys/dev/rasops/README:1.6 src/sys/dev/rasops/README:1.7
--- src/sys/dev/rasops/README:1.6	Mon Dec  2 14:05:51 2013
+++ src/sys/dev/rasops/README	Fri Aug  2 05:04:02 2019
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.6 2013/12/02 14:05:51 tsutsui Exp $
+$NetBSD: README,v 1.7 2019/08/02 05:04:02 rin Exp $
 
 This directory contains `rasops', a set of raster operations intended to
 replace the dev/rcons/raster stuff for both wscons and rcons. It yields
@@ -6,11 +6,9 @@ significantly improved performance, supp
 
 Issues/TODO:
 
-- There is no generic `putchar' function for 2bpp
 - Color handling for 2bpp is broken
 - 64-bit types are not used on machines that are 64-bit
 - We should never be doing reads/writes of less than 32-bits
-- Flags in attribute values are hardcoded
 - Need a manpage
 - Should handle multiple fonts simulatneously
 - Generate an `empty' box character when we have no match?



CVS commit: src/sys/dev/rasops

2019-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 04:40:53 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops15.c rasops32.c rasops8.c

Log Message:
Cosmetic changes. No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/rasops/rasops15.c
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/rasops/rasops32.c
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/rasops/rasops8.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/rasops

2019-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 04:40:53 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops15.c rasops32.c rasops8.c

Log Message:
Cosmetic changes. No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/rasops/rasops15.c
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/rasops/rasops32.c
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/rasops/rasops8.c

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

Modified files:

Index: src/sys/dev/rasops/rasops15.c
diff -u src/sys/dev/rasops/rasops15.c:1.33 src/sys/dev/rasops/rasops15.c:1.34
--- src/sys/dev/rasops/rasops15.c:1.33	Wed Jul 31 02:04:14 2019
+++ src/sys/dev/rasops/rasops15.c	Fri Aug  2 04:40:53 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops15.c,v 1.33 2019/07/31 02:04:14 rin Exp $	*/
+/* 	$NetBSD: rasops15.c,v 1.34 2019/08/02 04:40:53 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.33 2019/07/31 02:04:14 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.34 2019/08/02 04:40:53 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: rasops15.c,v
 #include 
 
 #define	_RASOPS_PRIVATE
+#define	RASOPS_DEPTH	15
 #include 
 
 static void 	rasops15_putchar(void *, int, int, u_int, long);
@@ -107,7 +108,6 @@ rasops15_init(struct rasops_info *ri)
 #endif
 }
 
-#define	RASOPS_DEPTH	15
 #include "rasops_putchar.h"
 #include "rasops_putchar_aa.h"
 

Index: src/sys/dev/rasops/rasops32.c
diff -u src/sys/dev/rasops/rasops32.c:1.41 src/sys/dev/rasops/rasops32.c:1.42
--- src/sys/dev/rasops/rasops32.c:1.41	Wed Jul 31 02:04:14 2019
+++ src/sys/dev/rasops/rasops32.c	Fri Aug  2 04:40:53 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops32.c,v 1.41 2019/07/31 02:04:14 rin Exp $	*/
+/*	 $NetBSD: rasops32.c,v 1.42 2019/08/02 04:40:53 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.41 2019/07/31 02:04:14 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.42 2019/08/02 04:40:53 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: rasops32.c,v
 #include 
 
 #define	_RASOPS_PRIVATE
+#define	RASOPS_DEPTH	32
 #include 
 
 static void 	rasops32_putchar(void *, int, int, u_int, long);
@@ -106,7 +107,6 @@ rasops32_init(struct rasops_info *ri)
 #endif
 }
 
-#define	RASOPS_DEPTH	32
 #include "rasops_putchar.h"
 #include "rasops_putchar_aa.h"
 

Index: src/sys/dev/rasops/rasops8.c
diff -u src/sys/dev/rasops/rasops8.c:1.46 src/sys/dev/rasops/rasops8.c:1.47
--- src/sys/dev/rasops/rasops8.c:1.46	Wed Jul 31 02:04:14 2019
+++ src/sys/dev/rasops/rasops8.c	Fri Aug  2 04:40:53 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops8.c,v 1.46 2019/07/31 02:04:14 rin Exp $	*/
+/* 	$NetBSD: rasops8.c,v 1.47 2019/08/02 04:40:53 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.46 2019/07/31 02:04:14 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.47 2019/08/02 04:40:53 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 
 #include 
 
 #define	_RASOPS_PRIVATE
+#define	RASOPS_DEPTH	8
 #include 
 
 static void 	rasops8_putchar(void *, int, int, u_int, long);
@@ -104,7 +105,6 @@ rasops8_init(struct rasops_info *ri)
 #endif
 }
 
-#define	RASOPS_DEPTH	8
 #include "rasops_putchar.h"
 #include "rasops_putchar_aa.h"
 



CVS commit: src/sys/dev/rasops

2019-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 04:39:09 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops1.c rasops2.c rasops24.c rasops4.c
rasops_bitops.h

Log Message:
Add general putchar functions for 2 and 4bpp.

Note that 1bpp continues to use its local version in rasops1.c,
which is much faster and simpler.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/rasops/rasops1.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/rasops/rasops2.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/rasops/rasops24.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/rasops/rasops4.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/rasops/rasops_bitops.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/rasops/rasops1.c
diff -u src/sys/dev/rasops/rasops1.c:1.33 src/sys/dev/rasops/rasops1.c:1.34
--- src/sys/dev/rasops/rasops1.c:1.33	Fri Aug  2 04:23:20 2019
+++ src/sys/dev/rasops/rasops1.c	Fri Aug  2 04:39:09 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops1.c,v 1.33 2019/08/02 04:23:20 rin Exp $	*/
+/* 	$NetBSD: rasops1.c,v 1.34 2019/08/02 04:39:09 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.33 2019/08/02 04:23:20 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.34 2019/08/02 04:39:09 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 
 #include 
 
 #define	_RASOPS_PRIVATE
+#define	RASOPS_DEPTH	1
 #include 
 #include 
 
@@ -251,7 +252,4 @@ rasops1_putchar(void *cookie, int row, i
 /*
  * Grab routines common to depths where (bpp < 8)
  */
-#define NAME(ident)	rasops1_##ident
-#define PIXEL_SHIFT	0
-
 #include 

Index: src/sys/dev/rasops/rasops2.c
diff -u src/sys/dev/rasops/rasops2.c:1.28 src/sys/dev/rasops/rasops2.c:1.29
--- src/sys/dev/rasops/rasops2.c:1.28	Wed Jul 31 02:04:14 2019
+++ src/sys/dev/rasops/rasops2.c	Fri Aug  2 04:39:09 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops2.c,v 1.28 2019/07/31 02:04:14 rin Exp $	*/
+/* 	$NetBSD: rasops2.c,v 1.29 2019/08/02 04:39:09 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.28 2019/07/31 02:04:14 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.29 2019/08/02 04:39:09 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 
 #include 
 
 #define	_RASOPS_PRIVATE
+#define	RASOPS_DEPTH	2
 #include 
 #include 
 
@@ -91,7 +92,6 @@ rasops2_init(struct rasops_info *ri)
 		break;
 #endif	/* !RASOPS_SMALL */
 	default:
-		panic("fontwidth not 8/12/16 or RASOPS_SMALL - fixme!");
 		ri->ri_ops.putchar = rasops2_putchar;
 		return;
 	}
@@ -101,16 +101,6 @@ rasops2_init(struct rasops_info *ri)
 #endif
 }
 
-/*
- * Put a single character. This is the generic version.
- */
-static void
-rasops2_putchar(void *cookie, int row, int col, u_int uc, long attr)
-{
-
-	/* XXX punt */
-}
-
 #ifndef RASOPS_SMALL
 /*
  * Recompute the blitting stamp.
@@ -147,8 +137,6 @@ rasops2_makestamp(struct rasops_info *ri
 	}
 }
 
-#define	RASOPS_DEPTH	2
-
 #define	RASOPS_WIDTH	8
 #include "rasops_putchar_width.h"
 #undef	RASOPS_WIDTH
@@ -166,7 +154,4 @@ rasops2_makestamp(struct rasops_info *ri
 /*
  * Grab routines common to depths where (bpp < 8)
  */
-#define NAME(ident)	rasops2_##ident
-#define PIXEL_SHIFT	1
-
 #include 

Index: src/sys/dev/rasops/rasops24.c
diff -u src/sys/dev/rasops/rasops24.c:1.43 src/sys/dev/rasops/rasops24.c:1.44
--- src/sys/dev/rasops/rasops24.c:1.43	Wed Jul 31 05:08:10 2019
+++ src/sys/dev/rasops/rasops24.c	Fri Aug  2 04:39:09 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops24.c,v 1.43 2019/07/31 05:08:10 rin Exp $	*/
+/* 	$NetBSD: rasops24.c,v 1.44 2019/08/02 04:39:09 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.43 2019/07/31 05:08:10 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.44 2019/08/02 04:39:09 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: rasops24.c,v
 #include 
 
 #define	_RASOPS_PRIVATE
+#define	RASOPS_DEPTH	24
 #include 
 
 static void 	rasops24_erasecols(void *, int, int, int, long);
@@ -116,7 +117,6 @@ rasops24_init(struct rasops_info *ri)
 #endif
 }
 
-#define	RASOPS_DEPTH	24
 #include "rasops_putchar.h"
 #include "rasops_putchar_aa.h"
 

Index: src/sys/dev/rasops/rasops4.c
diff -u src/sys/dev/rasops/rasops4.c:1.23 src/sys/dev/rasops/rasops4.c:1.24
--- src/sys/dev/rasops/rasops4.c:1.23	Thu Aug  1 03:38:12 2019
+++ src/sys/dev/rasops/rasops4.c	Fri Aug  2 04:39:09 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops4.c,v 1.23 2019/08/01 03:38:12 rin Exp $	*/
+/* 	$NetBSD: rasops4.c,v 1.24 2019/08/02 04:39:09 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 

CVS commit: src/sys/dev/rasops

2019-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 04:39:09 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops1.c rasops2.c rasops24.c rasops4.c
rasops_bitops.h

Log Message:
Add general putchar functions for 2 and 4bpp.

Note that 1bpp continues to use its local version in rasops1.c,
which is much faster and simpler.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/rasops/rasops1.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/rasops/rasops2.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/rasops/rasops24.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/rasops/rasops4.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/rasops/rasops_bitops.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/rasops

2019-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 04:35:54 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops_bitops.h

Log Message:
Fix a bug in shadow fb support for copycols on 1, 2, and 4bpp screen,
which was introduced in 1.18:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/rasops/rasops_bitops.h#rev1.18


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/rasops/rasops_bitops.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/rasops/rasops_bitops.h
diff -u src/sys/dev/rasops/rasops_bitops.h:1.21 src/sys/dev/rasops/rasops_bitops.h:1.22
--- src/sys/dev/rasops/rasops_bitops.h:1.21	Fri Aug  2 04:31:54 2019
+++ src/sys/dev/rasops/rasops_bitops.h	Fri Aug  2 04:35:54 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops_bitops.h,v 1.21 2019/08/02 04:31:54 rin Exp $	*/
+/* 	$NetBSD: rasops_bitops.h,v 1.22 2019/08/02 04:35:54 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -298,8 +298,6 @@ NAME(copycols)(void *cookie, int row, in
 		while (height--) {
 			sp = srp;
 			dp = drp;
-			DELTA(srp, ri->ri_stride, uint32_t *);
-			DELTA(drp, ri->ri_stride, uint32_t *);
 
 			if (rnum) {
 GETBITS(sp, sboff, rnum, tmp);
@@ -324,11 +322,14 @@ NAME(copycols)(void *cookie, int row, in
 
 			if (ri->ri_hwbits) {
 hp = dhp;
-hp -= full + (lmask != 0);
-memcpy(hp, dp, ((rmask != 0) + cnt +
-(lmask != 0)) << 2);
+hp -= (lmask != 0) + full;
+memcpy(hp, dp, ((lmask != 0) + full +
+(rnum != 0)) << 2);
 DELTA(dhp, ri->ri_stride, uint32_t *);
 			}
+
+			DELTA(srp, ri->ri_stride, uint32_t *);
+			DELTA(drp, ri->ri_stride, uint32_t *);
  		}
 	} else {
 		/* Copy left-to-right */



CVS commit: src/sys/dev/rasops

2019-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 04:35:54 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops_bitops.h

Log Message:
Fix a bug in shadow fb support for copycols on 1, 2, and 4bpp screen,
which was introduced in 1.18:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/rasops/rasops_bitops.h#rev1.18


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

2019-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 04:31:54 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops_bitops.h

Log Message:
Correct copy count. This affects ``left-to-right'' copy for region
including word boundary.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/rasops/rasops_bitops.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/rasops/rasops_bitops.h
diff -u src/sys/dev/rasops/rasops_bitops.h:1.20 src/sys/dev/rasops/rasops_bitops.h:1.21
--- src/sys/dev/rasops/rasops_bitops.h:1.20	Fri Aug  2 04:26:44 2019
+++ src/sys/dev/rasops/rasops_bitops.h	Fri Aug  2 04:31:54 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops_bitops.h,v 1.20 2019/08/02 04:26:44 rin Exp $	*/
+/* 	$NetBSD: rasops_bitops.h,v 1.21 2019/08/02 04:31:54 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -270,7 +270,7 @@ NAME(copycols)(void *cookie, int row, in
 	rnum = (dst + num) & 31;
 
 	if (lmask)
-		full = (num - (32 - (dst & 31))) >> 5;
+		full = (num - lnum) >> 5;
 	else
 		full = num >> 5;
 



CVS commit: src/sys/dev/rasops

2019-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 04:31:54 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops_bitops.h

Log Message:
Correct copy count. This affects ``left-to-right'' copy for region
including word boundary.


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

2019-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 04:26:44 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops_bitops.h

Log Message:
Remove duplicate substitution. Style. No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/rasops/rasops_bitops.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/rasops/rasops_bitops.h
diff -u src/sys/dev/rasops/rasops_bitops.h:1.19 src/sys/dev/rasops/rasops_bitops.h:1.20
--- src/sys/dev/rasops/rasops_bitops.h:1.19	Thu Aug  1 03:43:54 2019
+++ src/sys/dev/rasops/rasops_bitops.h	Fri Aug  2 04:26:44 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops_bitops.h,v 1.19 2019/08/01 03:43:54 rin Exp $	*/
+/* 	$NetBSD: rasops_bitops.h,v 1.20 2019/08/02 04:26:44 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -45,7 +45,6 @@ NAME(erasecols)(void *cookie, int row, i
 
 	hp = NULL;	/* XXX GCC */
 
-
 #ifdef RASOPS_CLIPPING
 	if ((unsigned)row >= (unsigned)ri->ri_rows)
 		return;
@@ -61,6 +60,7 @@ NAME(erasecols)(void *cookie, int row, i
 	if (num <= 0)
 		return;
 #endif
+
 	col *= ri->ri_font->fontwidth << PIXEL_SHIFT;
 	num *= ri->ri_font->fontwidth << PIXEL_SHIFT;
 	height = ri->ri_font->fontheight;
@@ -186,6 +186,7 @@ NAME(do_cursor)(struct rasops_info *ri)
 (rmask != -1)) << 2);
 DELTA(hp, ri->ri_stride, uint32_t *);
 			}
+
 			DELTA(rp, ri->ri_stride, uint32_t *);
 		}
 	}
@@ -336,7 +337,6 @@ NAME(copycols)(void *cookie, int row, in
 		if (ri->ri_hwbits)
 			dhp = (uint32_t *)(ri->ri_hwbits + row +
 			((dst >> 3) & ~3));
-		db = dst & 31;
 
 		while (height--) {
 			sb = src & 31;
@@ -348,7 +348,8 @@ NAME(copycols)(void *cookie, int row, in
 PUTBITS(tmp, db, lnum, dp);
 dp++;
 
-if (sb += lnum > 31) {
+sb += lnum;
+if (sb > 31) {
 	sp++;
 	sb -= 32;
 }



CVS commit: src/sys/dev/rasops

2019-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 04:26:44 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops_bitops.h

Log Message:
Remove duplicate substitution. Style. No functional changes.


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

2019-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 04:23:20 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops1.c

Log Message:
Support font width 32 on monochrome screen.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/rasops/rasops1.c

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

Modified files:

Index: src/sys/dev/rasops/rasops1.c
diff -u src/sys/dev/rasops/rasops1.c:1.32 src/sys/dev/rasops/rasops1.c:1.33
--- src/sys/dev/rasops/rasops1.c:1.32	Wed Jul 31 00:14:25 2019
+++ src/sys/dev/rasops/rasops1.c	Fri Aug  2 04:23:20 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops1.c,v 1.32 2019/07/31 00:14:25 rin Exp $	*/
+/* 	$NetBSD: rasops1.c,v 1.33 2019/08/02 04:23:20 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.32 2019/07/31 00:14:25 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.33 2019/08/02 04:23:20 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -136,7 +136,7 @@ rasops1_putchar(void *cookie, int row, i
 	if (col + width <= 32) {
 		/* Single word, only one mask */
 
-		rmask = rasops_pmask[col][width];
+		rmask = rasops_pmask[col][width & 31];
 		lmask = ~rmask;
 
 		if (space) {



CVS commit: src/sys/dev/rasops

2019-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 04:23:20 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops1.c

Log Message:
Support font width 32 on monochrome screen.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/rasops/rasops1.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/rasops

2019-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 04:22:04 UTC 2019

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

Log Message:
Fix unaligned writes to buffer, that are introduced in 1.105:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/rasops/rasops.c#rev1.105


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/dev/rasops/rasops.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/rasops

2019-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 04:22:04 UTC 2019

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

Log Message:
Fix unaligned writes to buffer, that are introduced in 1.105:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/rasops/rasops.c#rev1.105


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/dev/rasops/rasops.c

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.106 src/sys/dev/rasops/rasops.c:1.107
--- src/sys/dev/rasops/rasops.c:1.106	Fri Aug  2 04:18:15 2019
+++ src/sys/dev/rasops/rasops.c	Fri Aug  2 04:22:04 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.106 2019/08/02 04:18:15 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.107 2019/08/02 04:22:04 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.106 2019/08/02 04:18:15 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.107 2019/08/02 04:22:04 rin Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -1124,8 +1124,8 @@ void
 rasops_erasecols(void *cookie, int row, int col, int num, long attr)
 {
 	struct rasops_info *ri = (struct rasops_info *)cookie;
-	void *buf = ri->ri_buf;
-	int height, cnt, slop1, slop2, clr;
+	uint32_t *buf = ri->ri_buf;
+	int height, cnt, clr;
 	uint32_t *dp, *rp, *hp;
 
 	hp = NULL;	/* XXX GCC */
@@ -1156,36 +1156,16 @@ rasops_erasecols(void *cookie, int row, 
 
 	dp = buf;
 
-	slop1 = (4 - ((uintptr_t)rp & 3)) & 3;
-	slop2 = (num - slop1) & 3;
-	num = (num - slop1 /* - slop2 */) >> 2;
-
-	/* Align span to 4 bytes */
-	if (slop1 & 1) {
-		*(uint8_t *)dp = clr;
-		DELTA(dp, 1, uint32_t *);
-	}
-
-	if (slop1 & 2) {
-		*(uint16_t *)dp = clr;
-		DELTA(dp, 2, uint32_t *);
-	}
-
 	/* Write 4 bytes per loop */
-	for (cnt = num; cnt; cnt--)
+	for (cnt = num >> 2; cnt; cnt--)
 		*dp++ = clr;
 
 	/* Write unaligned trailing slop */
-	if (slop2 & 1) {
+	for (cnt = num & 3; cnt; cnt--) {
 		*(uint8_t *)dp = clr;
 		DELTA(dp, 1, uint32_t *);
 	}
 
-	if (slop2 & 2)
-		*(uint16_t *)dp = clr;
-
-	num = slop1 + (num << 2) + slop2;
-
 	while (height--) {
 		memcpy(rp, buf, num);
 		DELTA(rp, ri->ri_stride, uint32_t *);



CVS commit: src/sys/dev/rasops

2019-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 04:18:15 UTC 2019

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

Log Message:
Oops, for rasops_copycols(), we cannot use memmove even if src == dst.
On the other hand, memmove is safe for rasops_copyrows().


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/dev/rasops/rasops.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/rasops

2019-08-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  2 04:18:15 UTC 2019

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

Log Message:
Oops, for rasops_copycols(), we cannot use memmove even if src == dst.
On the other hand, memmove is safe for rasops_copyrows().


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/dev/rasops/rasops.c

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.105 src/sys/dev/rasops/rasops.c:1.106
--- src/sys/dev/rasops/rasops.c:1.105	Wed Jul 31 04:45:44 2019
+++ src/sys/dev/rasops/rasops.c	Fri Aug  2 04:18:15 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.105 2019/07/31 04:45:44 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.106 2019/08/02 04:18:15 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.105 2019/07/31 04:45:44 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.106 2019/08/02 04:18:15 rin Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -779,12 +779,12 @@ rasops_copycols(void *cookie, int row, i
 		hp = ri->ri_hwbits + row + dst * ri->ri_xscale;
 
 	while (height--) {
-		memcpy(dp, sp, num);
-		dp += ri->ri_stride;
+		memmove(dp, sp, num);
 		if (ri->ri_hwbits) {
-			memcpy(hp, sp, num);
+			memcpy(hp, dp, num);
 			hp += ri->ri_stride;
 		}
+		dp += ri->ri_stride;
 		sp += ri->ri_stride;
 	}
 }



CVS commit: src/sys/dev/rasops

2019-07-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Aug  1 03:43:54 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops_bitops.h

Log Message:
Fix erasecols and do_cursor for font width >= 32 bits.
Also, some cosmetic clean-up's.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/rasops/rasops_bitops.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/rasops

2019-07-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Aug  1 03:43:54 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops_bitops.h

Log Message:
Fix erasecols and do_cursor for font width >= 32 bits.
Also, some cosmetic clean-up's.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/rasops/rasops_bitops.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/rasops/rasops_bitops.h
diff -u src/sys/dev/rasops/rasops_bitops.h:1.18 src/sys/dev/rasops/rasops_bitops.h:1.19
--- src/sys/dev/rasops/rasops_bitops.h:1.18	Tue Jul 30 15:29:40 2019
+++ src/sys/dev/rasops/rasops_bitops.h	Thu Aug  1 03:43:54 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops_bitops.h,v 1.18 2019/07/30 15:29:40 rin Exp $	*/
+/* 	$NetBSD: rasops_bitops.h,v 1.19 2019/08/01 03:43:54 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -38,14 +38,13 @@
 static void
 NAME(erasecols)(void *cookie, int row, int col, int num, long attr)
 {
-	int lclr, rclr, clr;
-	struct rasops_info *ri;
+	struct rasops_info *ri = (struct rasops_info *)cookie;
+	uint32_t lclr, rclr, clr;
 	uint32_t *dp, *rp, *hp, tmp, lmask, rmask;
 	int height, cnt;
 
 	hp = NULL;	/* XXX GCC */
 
-	ri = (struct rasops_info *)cookie;
 
 #ifdef RASOPS_CLIPPING
 	if ((unsigned)row >= (unsigned)ri->ri_rows)
@@ -56,7 +55,7 @@ NAME(erasecols)(void *cookie, int row, i
 		col = 0;
 	}
 
-	if ((col + num) > ri->ri_cols)
+	if (col + num > ri->ri_cols)
 		num = ri->ri_cols - col;
 
 	if (num <= 0)
@@ -70,8 +69,10 @@ NAME(erasecols)(void *cookie, int row, i
 	if (ri->ri_hwbits)
 		hp = (uint32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
 		((col >> 3) & ~3));
-	if ((col & 31) + num <= 32) {
-		lmask = ~rasops_pmask[col & 31][num];
+	col &= 31;
+
+	if (col + num <= 32) {
+		lmask = ~rasops_pmask[col][num & 31];
 		lclr = clr & ~lmask;
 
 		while (height--) {
@@ -86,11 +87,11 @@ NAME(erasecols)(void *cookie, int row, i
 			}
 		}
 	} else {
-		lmask = rasops_rmask[col & 31];
+		lmask = rasops_rmask[col];
 		rmask = rasops_lmask[(col + num) & 31];
 
 		if (lmask)
-			num = (num - (32 - (col & 31))) >> 5;
+			num = (num - (32 - col)) >> 5;
 		else
 			num = num >> 5;
 
@@ -127,10 +128,10 @@ NAME(erasecols)(void *cookie, int row, i
 static void
 NAME(do_cursor)(struct rasops_info *ri)
 {
-	int height, row, col, num;
-	uint32_t *dp, *rp, *hrp, *hp, tmp, lmask, rmask;
+	int height, row, col, num, cnt;
+	uint32_t *dp, *rp, *hp, tmp, lmask, rmask;
 
-	hrp = hp = NULL;	/* XXX GCC */
+	hp = NULL;	/* XXX GCC */
 
 	row = ri->ri_crow;
 	col = ri->ri_ccol * ri->ri_font->fontwidth << PIXEL_SHIFT;
@@ -139,49 +140,53 @@ NAME(do_cursor)(struct rasops_info *ri)
 	rp = (uint32_t *)(ri->ri_bits + row * ri->ri_yscale +
 	((col >> 3) & ~3));
 	if (ri->ri_hwbits)
-		hrp = (uint32_t *)(ri->ri_hwbits + row * ri->ri_yscale +
+		hp = (uint32_t *)(ri->ri_hwbits + row * ri->ri_yscale +
 		((col >> 3) & ~3));
+	col &= 31;
 
-	if ((col & 31) + num <= 32) {
-		lmask = rasops_pmask[col & 31][num];
+	if (col + num <= 32) {
+		lmask = rasops_pmask[col][num & 31];
 
 		while (height--) {
 			tmp = *rp ^ lmask;
 			*rp = tmp;
 			if (ri->ri_hwbits) {
-*hrp = tmp;
-DELTA(hrp, ri->ri_stride, uint32_t *);
+*hp = tmp;
+DELTA(hp, ri->ri_stride, uint32_t *);
 			}
 			DELTA(rp, ri->ri_stride, uint32_t *);
 		}
 	} else {
-		lmask = ~rasops_rmask[col & 31];
+		lmask = ~rasops_rmask[col];
 		rmask = ~rasops_lmask[(col + num) & 31];
 
+		if (lmask != -1)
+			num = (num - (32 - col)) >> 5;
+		else
+			num = num >> 5;
+
 		while (height--) {
 			dp = rp;
-			DELTA(rp, ri->ri_stride, uint32_t *);
-			if (ri->ri_hwbits) {
-hp = hrp;
-DELTA(hrp, ri->ri_stride, uint32_t *);
-			}
 
 			if (lmask != -1) {
-tmp = *dp ^ lmask;
-*dp = tmp;
+*dp = *dp ^ lmask;
 dp++;
-if (ri->ri_hwbits) {
-	*hp = tmp;
-	hp++;
-}
 			}
 
-			if (rmask != -1) {
-tmp = *dp ^ rmask;
-*dp = tmp;
-if (ri->ri_hwbits)
-	*hp = tmp;
+			for (cnt = num; cnt; cnt--) {
+*dp = ~*dp;
+dp++;
 			}
+
+			if (rmask != -1)
+*dp = *dp ^ rmask;
+
+			if (ri->ri_hwbits) {
+memcpy(hp, rp, ((lmask != -1) + num +
+(rmask != -1)) << 2);
+DELTA(hp, ri->ri_stride, uint32_t *);
+			}
+			DELTA(rp, ri->ri_stride, uint32_t *);
 		}
 	}
 }



CVS commit: src/sys/dev/rasops

2019-07-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Aug  1 03:38:12 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops4.c

Log Message:
4 is 1 << 2, not 1 << 3...


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/rasops/rasops4.c

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

Modified files:

Index: src/sys/dev/rasops/rasops4.c
diff -u src/sys/dev/rasops/rasops4.c:1.22 src/sys/dev/rasops/rasops4.c:1.23
--- src/sys/dev/rasops/rasops4.c:1.22	Wed Jul 31 02:04:14 2019
+++ src/sys/dev/rasops/rasops4.c	Thu Aug  1 03:38:12 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops4.c,v 1.22 2019/07/31 02:04:14 rin Exp $	*/
+/* 	$NetBSD: rasops4.c,v 1.23 2019/08/01 03:38:12 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops4.c,v 1.22 2019/07/31 02:04:14 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops4.c,v 1.23 2019/08/01 03:38:12 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -167,6 +167,6 @@ rasops4_makestamp(struct rasops_info *ri
  * Grab routines common to depths where (bpp < 8)
  */
 #define NAME(ident)	rasops4_##ident
-#define PIXEL_SHIFT	3
+#define PIXEL_SHIFT	2
 
 #include 



CVS commit: src/sys/dev/rasops

2019-07-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Aug  1 03:38:12 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops4.c

Log Message:
4 is 1 << 2, not 1 << 3...


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

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 31 05:08:10 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops24.c

Log Message:
Factor out copy-paste. No functional changes.


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

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

Modified files:

Index: src/sys/dev/rasops/rasops24.c
diff -u src/sys/dev/rasops/rasops24.c:1.42 src/sys/dev/rasops/rasops24.c:1.43
--- src/sys/dev/rasops/rasops24.c:1.42	Wed Jul 31 04:45:44 2019
+++ src/sys/dev/rasops/rasops24.c	Wed Jul 31 05:08:10 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops24.c,v 1.42 2019/07/31 04:45:44 rin Exp $	*/
+/* 	$NetBSD: rasops24.c,v 1.43 2019/07/31 05:08:10 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.42 2019/07/31 04:45:44 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.43 2019/07/31 05:08:10 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -51,6 +51,9 @@ static void 	rasops24_erasecols(void *, 
 static void 	rasops24_eraserows(void *, int, int, long);
 static void 	rasops24_putchar(void *, int, int, u_int, long);
 static void 	rasops24_putchar_aa(void *, int, int, u_int, long);
+static __inline void
+		rasops24_makestamp1(struct rasops_info *, uint32_t *,
+uint32_t, uint32_t, uint32_t, uint32_t);
 #ifndef RASOPS_SMALL
 static void 	rasops24_putchar8(void *, int, int, u_int, long);
 static void 	rasops24_putchar12(void *, int, int, u_int, long);
@@ -117,6 +120,27 @@ rasops24_init(struct rasops_info *ri)
 #include "rasops_putchar.h"
 #include "rasops_putchar_aa.h"
 
+static __inline void
+rasops24_makestamp1(struct rasops_info *ri, uint32_t *stamp,
+uint32_t c1, uint32_t c2, uint32_t c3, uint32_t c4)
+{
+
+	stamp[0] = (c1 <<  8) | (c2 >> 16);
+	stamp[1] = (c2 << 16) | (c3 >>  8);
+	stamp[2] = (c3 << 24) |  c4;
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+	if ((ri->ri_flg & RI_BSWAP) == 0)
+#else
+	if ((ri->ri_flg & RI_BSWAP) != 0)
+#endif
+	{
+		stamp[0] = bswap32(stamp[0]);
+		stamp[1] = bswap32(stamp[1]);
+		stamp[2] = bswap32(stamp[2]);
+	}
+}
+
 #ifndef RASOPS_SMALL
 /*
  * Recompute the blitting stamp.
@@ -144,19 +168,7 @@ rasops24_makestamp(struct rasops_info *r
 		c3 = i & 16 ? fg : bg;
 		c4 = i & 32 ? fg : bg;
 #endif
-		stamp[i + 0] = (c1 <<  8) | (c2 >> 16);
-		stamp[i + 1] = (c2 << 16) | (c3 >>  8);
-		stamp[i + 2] = (c3 << 24) |  c4;
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-		if ((ri->ri_flg & RI_BSWAP) == 0) {
-#else
-		if ((ri->ri_flg & RI_BSWAP) != 0) {
-#endif
-			stamp[i + 0] = bswap32(stamp[i + 0]);
-			stamp[i + 1] = bswap32(stamp[i + 1]);
-			stamp[i + 2] = bswap32(stamp[i + 2]);
-		}
+		rasops24_makestamp1(ri, [i], c1, c2, c3, c4);
 	}
 }
 
@@ -210,19 +222,7 @@ rasops24_eraserows(void *cookie, int row
 #endif
 
 	clr = ri->ri_devcmap[((uint32_t)attr >> 16) & 0xf] & 0xff;
-	stamp[0] = (clr <<  8) | (clr >> 16);
-	stamp[1] = (clr << 16) | (clr >>  8);
-	stamp[2] = (clr << 24) |  clr;
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-	if ((ri->ri_flg & RI_BSWAP) == 0) {
-#else
-	if ((ri->ri_flg & RI_BSWAP) != 0) {
-#endif
-		stamp[0] = bswap32(stamp[0]);
-		stamp[1] = bswap32(stamp[1]);
-		stamp[2] = bswap32(stamp[2]);
-	}
+	rasops24_makestamp1(ri, stamp, clr, clr, clr, clr);
 
 	/*
 	 * XXX the wsdisplay_emulops interface seems a little deficient in
@@ -317,19 +317,7 @@ rasops24_erasecols(void *cookie, int row
 	height = ri->ri_font->fontheight;
 
 	clr = ri->ri_devcmap[((uint32_t)attr >> 16) & 0xf] & 0xff;
-	stamp[0] = (clr <<  8) | (clr >> 16);
-	stamp[1] = (clr << 16) | (clr >>  8);
-	stamp[2] = (clr << 24) |  clr;
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-	if ((ri->ri_flg & RI_BSWAP) == 0) {
-#else
-	if ((ri->ri_flg & RI_BSWAP) != 0) {
-#endif
-		stamp[0] = bswap32(stamp[0]);
-		stamp[1] = bswap32(stamp[1]);
-		stamp[2] = bswap32(stamp[2]);
-	}
+	rasops24_makestamp1(ri, stamp, clr, clr, clr, clr);
 
 	/*
 	 * The current byte offset mod 4 tells us the number of 24-bit pels



CVS commit: src/sys/dev/rasops

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 31 05:08:10 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops24.c

Log Message:
Factor out copy-paste. No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/rasops/rasops24.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/rasops

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 31 04:45:44 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops.h rasops24.c rasops_putchar_aa.h

Log Message:
Provide buffer capable of single-row pixels in order to make things simpler.

XXX
Bump kernel version for rasops_info later.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/rasops/rasops.h \
src/sys/dev/rasops/rasops24.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/rasops/rasops_putchar_aa.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/rasops

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 31 04:45:44 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops.h rasops24.c rasops_putchar_aa.h

Log Message:
Provide buffer capable of single-row pixels in order to make things simpler.

XXX
Bump kernel version for rasops_info later.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/rasops/rasops.h \
src/sys/dev/rasops/rasops24.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/rasops/rasops_putchar_aa.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/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.104 src/sys/dev/rasops/rasops.c:1.105
--- src/sys/dev/rasops/rasops.c:1.104	Wed Jul 31 02:09:02 2019
+++ src/sys/dev/rasops/rasops.c	Wed Jul 31 04:45:44 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.104 2019/07/31 02:09:02 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.105 2019/07/31 04:45:44 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.104 2019/07/31 02:09:02 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.105 2019/07/31 04:45:44 rin Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -482,6 +482,14 @@ rasops_reconfig(struct rasops_info *ri, 
 		WSSCREEN_WSCOLORS | WSSCREEN_REVERSE;
 	}
 
+	if (ri->ri_buf != NULL) {
+		kmem_free(ri->ri_buf, ri->ri_buflen);
+		ri->ri_buf = NULL;
+	}
+	len = (ri->ri_flg & RI_FULLCLEAR) ? ri->ri_stride : ri->ri_emustride;
+	ri->ri_buflen = len;
+	ri->ri_buf = kmem_alloc(len, KM_SLEEP);
+
 #ifndef RASOPS_SMALL
 	if (ri->ri_stamp != NULL) {
 		kmem_free(ri->ri_stamp, ri->ri_stamp_len);
@@ -949,8 +957,9 @@ void
 rasops_eraserows(void *cookie, int row, int num, long attr)
 {
 	struct rasops_info *ri = (struct rasops_info *)cookie;
-	uint32_t *rp, *dp, *hp, clr;
-	int n, cnt;
+	uint32_t *buf = (uint32_t *)ri->ri_buf;
+	uint32_t *rp, *hp, clr;
+	int stride, cnt;
 
 	hp = NULL;	/* XXX GCC */
 
@@ -976,25 +985,26 @@ rasops_eraserows(void *cookie, int row, 
 	 * the RI_FULLCLEAR flag is set, clear the entire display.
 	 */
 	if (num == ri->ri_rows && (ri->ri_flg & RI_FULLCLEAR) != 0) {
-		n = ri->ri_stride >> 2;
+		stride = ri->ri_stride;
 		num = ri->ri_height;
 		rp = (uint32_t *)ri->ri_origbits;
 		if (ri->ri_hwbits)
 			hp = (uint32_t *)ri->ri_hworigbits;
 	} else {
-		n = ri->ri_emustride >> 2;
+		stride = ri->ri_emustride;
 		num *= ri->ri_font->fontheight;
 		rp = (uint32_t *)(ri->ri_bits + row * ri->ri_yscale);
 		if (ri->ri_hwbits)
 			hp = (uint32_t *)(ri->ri_hwbits + row * ri->ri_yscale);
 	}
 
+	for (cnt = 0; cnt < stride >> 2; cnt++)
+		buf[cnt] = clr;
+
 	while (num--) {
-		dp = rp;
-		for (cnt = n; cnt; cnt--)
-			*dp++ = clr;
+		memcpy(rp, buf, stride);
 		if (ri->ri_hwbits) {
-			memcpy(hp, rp, n << 2);
+			memcpy(hp, buf, stride);
 			DELTA(hp, ri->ri_stride, uint32_t *);
 		}
 		DELTA(rp, ri->ri_stride, uint32_t *);
@@ -1114,8 +1124,9 @@ void
 rasops_erasecols(void *cookie, int row, int col, int num, long attr)
 {
 	struct rasops_info *ri = (struct rasops_info *)cookie;
+	void *buf = ri->ri_buf;
 	int height, cnt, slop1, slop2, clr;
-	uint32_t *rp, *dp, *hp;
+	uint32_t *dp, *rp, *hp;
 
 	hp = NULL;	/* XXX GCC */
 
@@ -1143,95 +1154,45 @@ rasops_erasecols(void *cookie, int row, 
 	height = ri->ri_font->fontheight;
 	clr = ri->ri_devcmap[((uint32_t)attr >> 16) & 0xf];
 
-	/* Don't bother using the full loop for <= 32 pels */
-	if (num <= 32) {
-		if (((num | ri->ri_xscale) & 3) == 0) {
-			/* Word aligned blt */
-			num >>= 2;
-
-			while (height--) {
-dp = rp;
-for (cnt = num; cnt; cnt--)
-	*dp++ = clr;
-if (ri->ri_hwbits) {
-	memcpy(hp, rp, num << 2);
-	DELTA(hp, ri->ri_stride, uint32_t *);
-}
-DELTA(rp, ri->ri_stride, uint32_t *);
-			}
-		} else if (((num | ri->ri_xscale) & 1) == 0) {
-			/*
-			 * Halfword aligned blt. This is needed so the
-			 * 15/16 bit ops can use this function.
-			 */
-			num >>= 1;
-
-			while (height--) {
-dp = rp;
-for (cnt = num; cnt; cnt--) {
-	*(uint16_t *)dp = clr;
-	DELTA(dp, 2, uint32_t *);
-}
-if (ri->ri_hwbits) {
-	memcpy(hp, rp, num << 1);
-	DELTA(hp, ri->ri_stride, uint32_t *);
-}
-DELTA(rp, ri->ri_stride, uint32_t *);
-			}
-		} else {
-			while (height--) {
-dp = rp;
-for (cnt = num; cnt; cnt--) {
-	*(uint8_t *)dp = clr;
-	DELTA(dp, 1, uint32_t *);
-}
-if (ri->ri_hwbits) {
-	memcpy(hp, rp, num);
-	DELTA(hp, ri->ri_stride, uint32_t *);
-}
-DELTA(rp, ri->ri_stride, uint32_t *);
-			}
-		}
-
-		return;
-	}
+	dp = buf;
 
 	slop1 = (4 - ((uintptr_t)rp & 3)) & 3;
 	slop2 = (num - slop1) & 3;
 	num = (num - slop1 /* - slop2 */) >> 2;
 
-	while (height--) {
-		dp = rp;
+	/* Align span to 4 bytes */
+	if (slop1 & 1) {
+		*(uint8_t *)dp = clr;
+		

CVS commit: src/sys/dev/rasops

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 31 02:26:40 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops_putchar_aa.h

Log Message:
Reduce memcpy.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/rasops/rasops_putchar_aa.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/rasops

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 31 02:26:40 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops_putchar_aa.h

Log Message:
Reduce memcpy.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/rasops/rasops_putchar_aa.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/rasops/rasops_putchar_aa.h
diff -u src/sys/dev/rasops/rasops_putchar_aa.h:1.4 src/sys/dev/rasops/rasops_putchar_aa.h:1.5
--- src/sys/dev/rasops/rasops_putchar_aa.h:1.4	Tue Jul 30 15:29:40 2019
+++ src/sys/dev/rasops/rasops_putchar_aa.h	Wed Jul 31 02:26:40 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops_putchar_aa.h,v 1.4 2019/07/30 15:29:40 rin Exp $ */
+/* $NetBSD: rasops_putchar_aa.h,v 1.5 2019/07/31 02:26:40 rin Exp $ */
 
 /* NetBSD: rasops8.c,v 1.43 2019/07/28 12:06:10 rin Exp */
 /*-
@@ -148,9 +148,9 @@ PUTCHAR_AA(RASOPS_DEPTH)(void *cookie, i
 aval = *fr;
 fr++;
 if (aval == 0)
-	SET_PIXEL(buf, x, 0);
+	SET_PIXEL(rp, x, 0);
 else if (aval == 255)
-	SET_PIXEL(buf, x, 1);
+	SET_PIXEL(rp, x, 1);
 else {
 #define	AVERAGE(p, w)	((w * p[1] + (0xff - w) * p[0]) >> 8)
 	R = AVERAGE(r, aval);
@@ -163,7 +163,7 @@ PUTCHAR_AA(RASOPS_DEPTH)(void *cookie, i
 	(((_r) >> (8 - ri->ri_rnum)) << ri->ri_rpos) |	\
 	(((_g) >> (8 - ri->ri_gnum)) << ri->ri_gpos) |	\
 	(((_b) >> (8 - ri->ri_bnum)) << ri->ri_bpos)
-	buf[x] = RGB2PIXEL(R, G, B);
+	rp[x] = RGB2PIXEL(R, G, B);
 #undef	RGB2PIXEL
 #endif
 
@@ -177,21 +177,20 @@ PUTCHAR_AA(RASOPS_DEPTH)(void *cookie, i
 #define	GOFF	(2 - ri->ri_gpos / 8)
 #define	BOFF	(2 - ri->ri_bpos / 8)
 #  endif
-	buf[3 * x + ROFF] = R;
-	buf[3 * x + GOFF] = G;
-	buf[3 * x + BOFF] = B;
+	rp[3 * x + ROFF] = R;
+	rp[3 * x + GOFF] = G;
+	rp[3 * x + BOFF] = B;
 #undef	ROFF
 #undef	GOFF
 #undef	BOFF
 #endif
 }
 			}
-			memcpy(rp, buf, width * PIXEL_BYTES);
-			DELTA(rp, ri->ri_stride, PIXEL_TYPE *);
 			if (ri->ri_hwbits) {
-memcpy(hp, buf, width * PIXEL_BYTES);
+memcpy(hp, rp, width * PIXEL_BYTES);
 DELTA(hp, ri->ri_stride, PIXEL_TYPE *);
 			}
+			DELTA(rp, ri->ri_stride, PIXEL_TYPE *);
 		}
 	}
 



CVS commit: src/sys/dev/rasops

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 31 02:04:15 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops.h rasops15.c rasops2.c rasops24.c
rasops32.c rasops4.c rasops8.c rasops_putchar_width.h

Log Message:
Switch to per-device stamp, and retire stamp_mutex.

XXX
Bump kernel version after other changes for struct rasops_info.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/rasops/rasops.h
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/rasops/rasops15.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/rasops/rasops2.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/rasops/rasops24.c \
src/sys/dev/rasops/rasops32.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/rasops/rasops4.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/rasops/rasops8.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/rasops/rasops_putchar_width.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/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.102 src/sys/dev/rasops/rasops.c:1.103
--- src/sys/dev/rasops/rasops.c:1.102	Wed Jul 31 00:14:25 2019
+++ src/sys/dev/rasops/rasops.c	Wed Jul 31 02:04:14 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.102 2019/07/31 00:14:25 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.103 2019/07/31 02:04:14 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.102 2019/07/31 00:14:25 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.103 2019/07/31 02:04:14 rin Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -489,6 +489,13 @@ rasops_reconfig(struct rasops_info *ri, 
 		WSSCREEN_WSCOLORS | WSSCREEN_REVERSE;
 	}
 
+#ifndef RASOPS_SMALL
+	if (ri->ri_stamp != NULL) {
+		kmem_free(ri->ri_stamp, ri->ri_stamp_len);
+		ri->ri_stamp = NULL;
+	}
+#endif
+
 	switch (ri->ri_depth) {
 #if NRASOPS1 > 0
 	case 1:
@@ -1670,7 +1677,6 @@ rasops_make_box_chars_alpha(struct rasop
  * For now this is either a copy of rasops_cmap[] or an R3G3B2 map, it should
  * probably be a linear ( or gamma corrected? ) ramp for higher depths.
  */
- 
 int
 rasops_get_cmap(struct rasops_info *ri, uint8_t *palette, size_t bytes)
 {
@@ -1707,3 +1713,15 @@ rasops_get_cmap(struct rasops_info *ri, 
 		memcpy(palette, rasops_cmap, uimin(bytes, sizeof(rasops_cmap)));
 	return 0;
 }
+
+#ifndef RASOPS_SMALL
+void
+rasops_allocstamp(struct rasops_info *ri, size_t len)
+{
+
+	KASSERT(ri->ri_stamp == NULL);
+	ri->ri_stamp_len = len;
+	ri->ri_stamp = kmem_zalloc(len, KM_SLEEP);
+	ri->ri_stamp_attr = 0;
+}
+#endif

Index: src/sys/dev/rasops/rasops.h
diff -u src/sys/dev/rasops/rasops.h:1.39 src/sys/dev/rasops/rasops.h:1.40
--- src/sys/dev/rasops/rasops.h:1.39	Wed Jul 31 00:14:25 2019
+++ src/sys/dev/rasops/rasops.h	Wed Jul 31 02:04:14 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops.h,v 1.39 2019/07/31 00:14:25 rin Exp $ */
+/* 	$NetBSD: rasops.h,v 1.40 2019/07/31 02:04:14 rin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -132,6 +132,11 @@ struct rasops_info {
 	/* Callbacks so we can share some code */
 	void	(*ri_do_cursor)(struct rasops_info *);
 
+	/* 4x1 stamp for optimized character blitting */
+	void	*ri_stamp;
+	long	ri_stamp_attr;
+	size_t	ri_stamp_len;
+
 #if NRASOPS_ROTATION > 0
 	/* Used to intercept putchar to permit display rotation */
 	struct	wsdisplay_emulops ri_real_ops;
@@ -182,6 +187,8 @@ void	rasops15_init(struct rasops_info *)
 void	rasops24_init(struct rasops_info *);
 void	rasops32_init(struct rasops_info *);
 
+void	rasops_allocstamp(struct rasops_info *, size_t);
+
 #define	DELTA(p, d, cast) ((p) = (cast)((uint8_t *)(p) + (d)))
 
 #define	FONT_GLYPH(uc, font, ri)	\

Index: src/sys/dev/rasops/rasops15.c
diff -u src/sys/dev/rasops/rasops15.c:1.32 src/sys/dev/rasops/rasops15.c:1.33
--- src/sys/dev/rasops/rasops15.c:1.32	Wed Jul 31 00:14:25 2019
+++ src/sys/dev/rasops/rasops15.c	Wed Jul 31 02:04:14 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops15.c,v 1.32 2019/07/31 00:14:25 rin Exp $	*/
+/* 	$NetBSD: rasops15.c,v 1.33 2019/07/31 02:04:14 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.32 2019/07/31 00:14:25 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.33 2019/07/31 02:04:14 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -55,13 +55,6 @@ static void	rasops15_makestamp(struct ra
 
 #ifndef RASOPS_SMALL
 /*
- * 4x1 stamp for optimized character blitting
- */
-static uint32_t	stamp[32];
-static long	stamp_attr;
-static int	stamp_mutex;	/* XXX see note in readme */
-
-/*
  * offset = STAMP_SHIFT(fontbits, nibble #) & STAMP_MASK
  * destination uint32_t[0] = STAMP_READ(offset)
  * destination uint32_t[1] = STAMP_READ(offset + 4)
@@ -106,8 +99,12 @@ rasops15_init(struct rasops_info *ri)
 #endif	/* !RASOPS_SMALL */
 	

CVS commit: src/sys/dev/rasops

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 31 02:04:15 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops.h rasops15.c rasops2.c rasops24.c
rasops32.c rasops4.c rasops8.c rasops_putchar_width.h

Log Message:
Switch to per-device stamp, and retire stamp_mutex.

XXX
Bump kernel version after other changes for struct rasops_info.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/rasops/rasops.h
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/rasops/rasops15.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/rasops/rasops2.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/rasops/rasops24.c \
src/sys/dev/rasops/rasops32.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/rasops/rasops4.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/rasops/rasops8.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/rasops/rasops_putchar_width.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/rasops

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 31 00:14:26 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops.h rasops1.c rasops15.c rasops2.c
rasops24.c rasops32.c rasops4.c rasops8.c

Log Message:
Misc clean-up's:
- protect private stuff in rasops.h by _RASOPS_PRIVATE
- staticify rasops_copycols() and rasops_isgray[]
- G/C unused extern int cold


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/rasops/rasops.h
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/rasops/rasops1.c \
src/sys/dev/rasops/rasops15.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/rasops/rasops2.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/rasops/rasops24.c \
src/sys/dev/rasops/rasops32.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/rasops/rasops4.c
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/rasops/rasops8.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/rasops

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul 30 15:29:40 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops1.c rasops_bitops.h rasops_putchar.h
rasops_putchar_aa.h rasops_putchar_width.h

Log Message:
Try to improve performance when shadow framebuffer is present;
Use block copy from shadow fb to real fb, instead of repeating
the same operations to two fb's.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/rasops/rasops1.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/rasops/rasops_bitops.h
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/rasops/rasops_putchar.h
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/rasops/rasops_putchar_aa.h
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/rasops/rasops_putchar_width.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/rasops

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul 30 15:29:40 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops1.c rasops_bitops.h rasops_putchar.h
rasops_putchar_aa.h rasops_putchar_width.h

Log Message:
Try to improve performance when shadow framebuffer is present;
Use block copy from shadow fb to real fb, instead of repeating
the same operations to two fb's.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/rasops/rasops1.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/rasops/rasops_bitops.h
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/rasops/rasops_putchar.h
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/rasops/rasops_putchar_aa.h
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/rasops/rasops_putchar_width.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/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.100 src/sys/dev/rasops/rasops.c:1.101
--- src/sys/dev/rasops/rasops.c:1.100	Tue Jul 30 14:41:10 2019
+++ src/sys/dev/rasops/rasops.c	Tue Jul 30 15:29:40 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.100 2019/07/30 14:41:10 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.101 2019/07/30 15:29:40 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.100 2019/07/30 14:41:10 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.101 2019/07/30 15:29:40 rin Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -950,8 +950,8 @@ void
 rasops_eraserows(void *cookie, int row, int num, long attr)
 {
 	struct rasops_info *ri = (struct rasops_info *)cookie;
-	uint32_t *dp, *hp, clr;
-	int n, cnt, delta;
+	uint32_t *rp, *dp, *hp, clr;
+	int n, cnt;
 
 	hp = NULL;	/* XXX GCC */
 
@@ -979,29 +979,26 @@ rasops_eraserows(void *cookie, int row, 
 	if (num == ri->ri_rows && (ri->ri_flg & RI_FULLCLEAR) != 0) {
 		n = ri->ri_stride >> 2;
 		num = ri->ri_height;
-		dp = (uint32_t *)ri->ri_origbits;
+		rp = (uint32_t *)ri->ri_origbits;
 		if (ri->ri_hwbits)
 			hp = (uint32_t *)ri->ri_hworigbits;
-		delta = 0;
 	} else {
 		n = ri->ri_emustride >> 2;
 		num *= ri->ri_font->fontheight;
-		dp = (uint32_t *)(ri->ri_bits + row * ri->ri_yscale);
+		rp = (uint32_t *)(ri->ri_bits + row * ri->ri_yscale);
 		if (ri->ri_hwbits)
-			hp = (uint32_t *)(ri->ri_hwbits + row *
-			ri->ri_yscale);
-		delta = ri->ri_delta;
+			hp = (uint32_t *)(ri->ri_hwbits + row * ri->ri_yscale);
 	}
 
 	while (num--) {
-		for (cnt = n; cnt; cnt--) {
+		dp = rp;
+		for (cnt = n; cnt; cnt--)
 			*dp++ = clr;
-			if (ri->ri_hwbits)
-*hp++ = clr;
+		if (ri->ri_hwbits) {
+			memcpy(hp, rp, n << 2);
+			DELTA(hp, ri->ri_stride, uint32_t *);
 		}
-		DELTA(dp, delta, uint32_t *);
-		if (ri->ri_hwbits)
-			DELTA(hp, delta, uint32_t *);
+		DELTA(rp, ri->ri_stride, uint32_t *);
 	}
 }
 
@@ -1015,9 +1012,9 @@ rasops_do_cursor(struct rasops_info *ri)
 	int full, height, cnt, slop1, slop2, row, col;
 	uint32_t tmp32, msk1, msk2;
 	uint8_t tmp8;
-	uint8_t *dp, *rp, *hrp, *hp;
+	uint8_t *dp, *rp, *hp;
 
-	hrp = hp = NULL;	/* XXX GCC */
+	hp = NULL;	/* XXX GCC */
 
 #if NRASOPS_ROTATION > 0
 	if (ri->ri_flg & RI_ROTATE_MASK) {
@@ -1042,8 +1039,7 @@ rasops_do_cursor(struct rasops_info *ri)
 
 	rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
 	if (ri->ri_hwbits)
-		hrp = ri->ri_hwbits + row * ri->ri_yscale + col
-		* ri->ri_xscale;
+		hp = ri->ri_hwbits + row * ri->ri_yscale + col * ri->ri_xscale;
 	height = ri->ri_font->fontheight;
 
 	/*
@@ -1060,8 +1056,8 @@ rasops_do_cursor(struct rasops_info *ri)
 			rp += ri->ri_stride;
 
 			if (ri->ri_hwbits) {
-*hrp = tmp8;
-hrp += ri->ri_stride;
+*hp = tmp8;
+hp += ri->ri_stride;
 			}
 		}
 		return;
@@ -1078,45 +1074,37 @@ rasops_do_cursor(struct rasops_info *ri)
 	full = (ri->ri_xscale - slop1 /* - slop2 */) >> 2;
 
 	rp = (uint8_t *)((uintptr_t)rp & ~3);
-	hrp = (uint8_t *)((uintptr_t)hrp & ~3);
+	hp = (uint8_t *)((uintptr_t)hp & ~3);
 
 	msk1 = !slop1 ? 0 : be32toh(0xU >> (32 - (8 * slop1)));
 	msk2 = !slop2 ? 0 : be32toh(0xU << (32 - (8 * slop2)));
 
 	while (height--) {
 		dp = rp;
-		rp += ri->ri_stride;
-		if (ri->ri_hwbits) {
-			hp = hrp;
-			hrp += ri->ri_stride;
-		}
 
 		if (slop1) {
 			tmp32 = *(uint32_t *)dp ^ msk1;
 			*(uint32_t *)dp = tmp32;
 			dp += 4;
-			if (ri->ri_hwbits) {
-*(uint32_t *)hp = tmp32;
-hp += 4;
-			}
 		}
 
 		for (cnt = full; cnt; cnt--) {
 			tmp32 = ~*(uint32_t *)dp;
 			*(uint32_t *)dp = tmp32;
 			dp += 4;
-			if (ri->ri_hwbits) {
-*(uint32_t *)hp = tmp32;
-hp += 4;
-			}
 		}
 
 		if (slop2) {
 			tmp32 = *(uint32_t *)dp ^ msk2;
 			*(uint32_t *)dp = tmp32;
-			if (ri->ri_hwbits)
-*(uint32_t *)hp = tmp32;
 		}
+
+		if (ri->ri_hwbits) {
+			memcpy(hp, rp, ((slop1 != 0) + full +
+			(slop2 != 0)) << 2);
+			hp += 

CVS commit: src/sys/dev/rasops

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul 30 15:23:23 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops24.c

Log Message:
Support shadow framebuffer for 24bpp screen.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/rasops/rasops24.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/rasops

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul 30 15:23:23 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops24.c

Log Message:
Support shadow framebuffer for 24bpp screen.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/rasops/rasops24.c

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

Modified files:

Index: src/sys/dev/rasops/rasops24.c
diff -u src/sys/dev/rasops/rasops24.c:1.38 src/sys/dev/rasops/rasops24.c:1.39
--- src/sys/dev/rasops/rasops24.c:1.38	Mon Jul 29 16:17:29 2019
+++ src/sys/dev/rasops/rasops24.c	Tue Jul 30 15:23:23 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops24.c,v 1.38 2019/07/29 16:17:29 rin Exp $	*/
+/* 	$NetBSD: rasops24.c,v 1.39 2019/07/30 15:23:23 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.38 2019/07/29 16:17:29 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.39 2019/07/30 15:23:23 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -188,9 +188,11 @@ rasops24_makestamp(struct rasops_info *r
 static void
 rasops24_eraserows(void *cookie, int row, int num, long attr)
 {
-	int n9, n3, n1, cnt, stride, delta;
-	uint32_t *dp, clr, xstamp[3];
-	struct rasops_info *ri;
+	struct rasops_info *ri = (struct rasops_info *)cookie;
+	int n9, n3, n1, cnt, stride;
+	uint32_t *rp, *dp, *hp, clr, xstamp[3];
+
+	hp = NULL;	/* XXX GCC */
 
 	/*
 	 * If the color is gray, we can cheat and use the generic routines
@@ -201,15 +203,13 @@ rasops24_eraserows(void *cookie, int row
 		return;
 	}
 
-	ri = (struct rasops_info *)cookie;
-
 #ifdef RASOPS_CLIPPING
 	if (row < 0) {
 		num += row;
 		row = 0;
 	}
 
-	if ((row + num) > ri->ri_rows)
+	if (row + num > ri->ri_rows)
 		num = ri->ri_rows - row;
 
 	if (num <= 0)
@@ -219,7 +219,7 @@ rasops24_eraserows(void *cookie, int row
 	clr = ri->ri_devcmap[((uint32_t)attr >> 16) & 0xf] & 0xff;
 	xstamp[0] = (clr <<  8) | (clr >> 16);
 	xstamp[1] = (clr << 16) | (clr >>  8);
-	xstamp[2] = (clr << 24) | clr;
+	xstamp[2] = (clr << 24) |  clr;
 
 #if BYTE_ORDER == LITTLE_ENDIAN
 	if ((ri->ri_flg & RI_BSWAP) == 0) {
@@ -240,46 +240,45 @@ rasops24_eraserows(void *cookie, int row
 	if (num == ri->ri_rows && (ri->ri_flg & RI_FULLCLEAR) != 0) {
 		stride = ri->ri_stride;
 		num = ri->ri_height;
-		dp = (uint32_t *)ri->ri_origbits;
-		delta = 0;
+		rp = (uint32_t *)ri->ri_origbits;
+		if (ri->ri_hwbits)
+			hp = (uint32_t *)ri->ri_hworigbits;
 	} else {
 		stride = ri->ri_emustride;
 		num *= ri->ri_font->fontheight;
-		dp = (uint32_t *)(ri->ri_bits + row * ri->ri_yscale);
-		delta = ri->ri_delta;
+		rp = (uint32_t *)(ri->ri_bits + row * ri->ri_yscale);
+		if (ri->ri_hwbits)
+			hp = (uint32_t *)(ri->ri_hwbits + row * ri->ri_yscale);
 	}
 
-	n9 = stride / 36;
-	cnt = (n9 << 5) + (n9 << 2); /* (32*n9) + (4*n9) */
-	n3 = (stride - cnt) / 12;
-	cnt += (n3 << 3) + (n3 << 2); /* (8*n3) + (4*n3) */
-	n1 = (stride - cnt) >> 2;
+	n9 = stride / (4 * 9);
+	cnt = n9 * (4 * 9);
+	n3 = (stride - cnt) / (4 * 3);
+	cnt += n3 * (4 * 3);
+	n1 = (stride - cnt) / 4;
 
 	while (num--) {
+		dp = rp;
 		for (cnt = n9; cnt; cnt--) {
-			dp[0] = xstamp[0];
-			dp[1] = xstamp[1];
-			dp[2] = xstamp[2];
-			dp[3] = xstamp[0];
-			dp[4] = xstamp[1];
-			dp[5] = xstamp[2];
-			dp[6] = xstamp[0];
-			dp[7] = xstamp[1];
-			dp[8] = xstamp[2];
+			dp[0] = xstamp[0]; dp[1] = xstamp[1]; dp[2] = xstamp[2];
+			dp[3] = xstamp[0]; dp[4] = xstamp[1]; dp[5] = xstamp[2];
+			dp[6] = xstamp[0]; dp[7] = xstamp[1]; dp[8] = xstamp[2];
 			dp += 9;
 		}
 
 		for (cnt = n3; cnt; cnt--) {
-			dp[0] = xstamp[0];
-			dp[1] = xstamp[1];
-			dp[2] = xstamp[2];
+			dp[0] = xstamp[0]; dp[1] = xstamp[1]; dp[2] = xstamp[2];
 			dp += 3;
 		}
 
 		for (cnt = 0; cnt < n1; cnt++)
 			*dp++ = xstamp[cnt];
 
-		DELTA(dp, delta, uint32_t *);
+		if (ri->ri_hwbits) {
+			memcpy(hp, rp, stride);
+			DELTA(hp, ri->ri_stride, uint32_t *);
+		}
+		DELTA(rp, ri->ri_stride, uint32_t *);
 	}
 }
 
@@ -289,10 +288,12 @@ rasops24_eraserows(void *cookie, int row
 static void
 rasops24_erasecols(void *cookie, int row, int col, int num, long attr)
 {
-	int n12, n4, height, cnt, slop, clr, xstamp[3];
-	struct rasops_info *ri;
-	uint32_t *dp, *rp;
-	uint8_t *dbp;
+	struct rasops_info *ri = (struct rasops_info *)cookie;
+	int n12, n4, height, cnt, slop1, slop2, clr, xstamp[3];
+	uint32_t *dp;
+	uint8_t *rp, *hp, *dbp;
+
+	hp = NULL;	/* XXX GCC */
 
 	/*
 	 * If the color is gray, we can cheat and use the generic routines
@@ -303,8 +304,6 @@ rasops24_erasecols(void *cookie, int row
 		return;
 	}
 
-	ri = (struct rasops_info *)cookie;
-
 #ifdef RASOPS_CLIPPING
 	/* Catches 'row < 0' case too */
 	if ((unsigned)row >= (unsigned)ri->ri_rows)
@@ -315,21 +314,24 @@ rasops24_erasecols(void *cookie, int row
 		col = 0;
 	}
 
-	if ((col + num) > ri->ri_cols)
+	if (col + num > ri->ri_cols)
 		num = ri->ri_cols - col;
 
 	if (num <= 0)
 	

CVS commit: src/sys/dev/rasops

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul 30 14:41:10 UTC 2019

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

Log Message:
In rasops_copy{rows,cols}(), if src == dst, we have nothing to do.
Otherwise, we can use memcpy safely instead of memmove.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/rasops/rasops.c

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.99 src/sys/dev/rasops/rasops.c:1.100
--- src/sys/dev/rasops/rasops.c:1.99	Tue Jul 30 14:33:04 2019
+++ src/sys/dev/rasops/rasops.c	Tue Jul 30 14:41:10 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.99 2019/07/30 14:33:04 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.100 2019/07/30 14:41:10 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.99 2019/07/30 14:33:04 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.100 2019/07/30 14:41:10 rin Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -675,10 +675,10 @@ rasops_copyrows(void *cookie, int src, i
 
 	hp = NULL;	/* XXX GCC */
 
-#ifdef RASOPS_CLIPPING
-	if (dst == src)
+	if (__predict_false(dst == src))
 		return;
 
+#ifdef RASOPS_CLIPPING
 	if (src < 0) {
 		num += src;
 		src = 0;
@@ -709,7 +709,7 @@ rasops_copyrows(void *cookie, int src, i
 		hp = ri->ri_hwbits + dst * ri->ri_yscale;
 
 	while (num--) {
-		memmove(dp, sp, n);
+		memcpy(dp, sp, n);
 		dp += stride;
 		if (ri->ri_hwbits) {
 			memcpy(hp, sp, n);
@@ -734,10 +734,10 @@ rasops_copycols(void *cookie, int row, i
 
 	hp = NULL;	/* XXX GCC */
 
-#ifdef RASOPS_CLIPPING
-	if (dst == src)
+	if (__predict_false(dst == src))
 		return;
 
+#ifdef RASOPS_CLIPPING
 	/* Catches < 0 case too */
 	if ((unsigned)row >= (unsigned)ri->ri_rows)
 		return;
@@ -772,7 +772,7 @@ rasops_copycols(void *cookie, int row, i
 		hp = ri->ri_hwbits + row + dst * ri->ri_xscale;
 
 	while (height--) {
-		memmove(dp, sp, num);
+		memcpy(dp, sp, num);
 		dp += ri->ri_stride;
 		if (ri->ri_hwbits) {
 			memcpy(hp, sp, num);



CVS commit: src/sys/dev/rasops

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul 30 14:41:10 UTC 2019

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

Log Message:
In rasops_copy{rows,cols}(), if src == dst, we have nothing to do.
Otherwise, we can use memcpy safely instead of memmove.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/rasops/rasops.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/rasops

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul 30 14:33:05 UTC 2019

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

Log Message:
Fix catastrophe when ri_emustride != ri_stride in rasops_copyrows().


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/rasops/rasops.c

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.98 src/sys/dev/rasops/rasops.c:1.99
--- src/sys/dev/rasops/rasops.c:1.98	Tue Jul 30 12:20:24 2019
+++ src/sys/dev/rasops/rasops.c	Tue Jul 30 14:33:04 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.98 2019/07/30 12:20:24 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.99 2019/07/30 14:33:04 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.98 2019/07/30 12:20:24 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.99 2019/07/30 14:33:04 rin Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -671,7 +671,7 @@ rasops_copyrows(void *cookie, int src, i
 {
 	struct rasops_info *ri = (struct rasops_info *)cookie;
 	uint8_t *sp, *dp, *hp;
-	int n;
+	int n, stride;
 
 	hp = NULL;	/* XXX GCC */
 
@@ -701,6 +701,7 @@ rasops_copyrows(void *cookie, int src, i
 
 	num *= ri->ri_font->fontheight;
 	n = ri->ri_emustride;
+	stride = ri->ri_stride;
 
 	sp = ri->ri_bits + src * ri->ri_yscale;
 	dp = ri->ri_bits + dst * ri->ri_yscale;
@@ -709,12 +710,12 @@ rasops_copyrows(void *cookie, int src, i
 
 	while (num--) {
 		memmove(dp, sp, n);
-		dp += n;
+		dp += stride;
 		if (ri->ri_hwbits) {
 			memcpy(hp, sp, n);
-			hp += n;
+			hp += stride;
 		}
-		sp += n;
+		sp += stride;
 	}
 }
 



CVS commit: src/sys/dev/rasops

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul 30 14:33:05 UTC 2019

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

Log Message:
Fix catastrophe when ri_emustride != ri_stride in rasops_copyrows().


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/rasops/rasops.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/rasops

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul 30 12:20:24 UTC 2019

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

Log Message:
Treat highlighted and reversed text in the same manner to xterm.


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

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

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.97 src/sys/dev/rasops/rasops.c:1.98
--- src/sys/dev/rasops/rasops.c:1.97	Mon Jul 29 16:17:29 2019
+++ src/sys/dev/rasops/rasops.c	Tue Jul 30 12:20:24 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.97 2019/07/29 16:17:29 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.98 2019/07/30 12:20:24 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.97 2019/07/29 16:17:29 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.98 2019/07/30 12:20:24 rin Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -618,16 +618,16 @@ rasops_allocattr_color(void *cookie, int
 #endif
 	}
 
+	if ((flg & WSATTR_HILIT) != 0)
+		fg += 8;
+
 	if ((flg & WSATTR_REVERSE) != 0) {
 		uint32_t swap = fg;
 		fg = bg;
 		bg = swap;
 	}
 
-	if ((flg & WSATTR_HILIT) != 0)
-		fg += 8;
-
-	flg = flg & WSATTR_USERMASK;
+	flg &= WSATTR_USERMASK;
 
 	if (rasops_isgray[fg])
 		flg |= WSATTR_PRIVATE1;



CVS commit: src/sys/dev/rasops

2019-07-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul 30 12:20:24 UTC 2019

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

Log Message:
Treat highlighted and reversed text in the same manner to xterm.


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

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



Re: CVS commit: src/sys/dev/rasops

2019-07-29 Thread Rin Okuyama

Thank you for rapid response. I was relieved to hear that.
Let me apologize again for the breakage, and thank you
very much for bisectioning the problem.

rin

On 2019/07/30 2:34, Ryo ONODERA wrote:

Hi,

Rin Okuyama  writes:


I committed a (possible) fix:
http://mail-index.netbsd.org/source-changes/2019/07/29/msg107649.html

Could you try rasops_putchar_width.h 1.8?


With rasops_putchar_width.h 1.8, NetBSD/amd64-current on
my laptop works fine again.

Thanks for your quick fix.


Thanks,
rin




Re: CVS commit: src/sys/dev/rasops

2019-07-29 Thread Ryo ONODERA
Hi,

Rin Okuyama  writes:

> I committed a (possible) fix:
> http://mail-index.netbsd.org/source-changes/2019/07/29/msg107649.html
>
> Could you try rasops_putchar_width.h 1.8?

With rasops_putchar_width.h 1.8, NetBSD/amd64-current on
my laptop works fine again.

Thanks for your quick fix.

> Thanks,
> rin

-- 
Ryo ONODERA // r...@tetera.org
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3


  1   2   >