Module Name: src
Committed By: mlelstv
Date: Tue Dec 4 09:27:59 UTC 2018
Modified Files:
src/sys/dev/rasops: rasops.c rasops1.c rasops15.c rasops2.c rasops24.c
rasops4.c rasops8.c
src/sys/dev/wscons: wsdisplayvar.h
Log Message:
rasops reused wscons attribute bits for internal control.
- make upper 4 attribute bits available for such use
- use wscons flag names instead of literal constants.
To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/rasops/rasops1.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/rasops/rasops15.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/rasops/rasops2.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/rasops/rasops24.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/rasops/rasops4.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/rasops/rasops8.c
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/wscons/wsdisplayvar.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.78 src/sys/dev/rasops/rasops.c:1.79
--- src/sys/dev/rasops/rasops.c:1.78 Thu Nov 29 23:44:50 2018
+++ src/sys/dev/rasops/rasops.c Tue Dec 4 09:27:59 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops.c,v 1.78 2018/11/29 23:44:50 macallan Exp $ */
+/* $NetBSD: rasops.c,v 1.79 2018/12/04 09:27:59 mlelstv Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.78 2018/11/29 23:44:50 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.79 2018/12/04 09:27:59 mlelstv Exp $");
#include "opt_rasops.h"
#include "rasops_glue.h"
@@ -570,13 +570,13 @@ rasops_allocattr_color(void *cookie, int
if ((flg & WSATTR_HILIT) != 0)
fg += 8;
- flg = ((flg & WSATTR_UNDERLINE) ? 1 : 0);
+ flg = flg & WSATTR_USERMASK;
if (rasops_isgray[fg])
- flg |= 2;
+ flg |= WSATTR_PRIVATE1;
if (rasops_isgray[bg])
- flg |= 4;
+ flg |= WSATTR_PRIVATE2;
*attr = (bg << 16) | (fg << 24) | flg;
return (0);
@@ -903,7 +903,7 @@ rasops_unpack_attr(long attr, int *fg, i
*fg = ((u_int)attr >> 24) & 0xf;
*bg = ((u_int)attr >> 16) & 0xf;
if (underline != NULL)
- *underline = (u_int)attr & 1;
+ *underline = (u_int)attr & WSATTR_UNDERLINE;
}
/*
@@ -1366,7 +1366,7 @@ rasops_putchar_rotated_cw(void *cookie,
/* Do rotated char sans (side)underline */
ri->ri_real_ops.putchar(cookie, col, ri->ri_rows - row - 1, uc,
- attr & ~1);
+ attr & ~WSATTR_UNDERLINE);
/* Do rotated underline */
rp = ri->ri_bits + col * ri->ri_yscale + (ri->ri_rows - row - 1) *
@@ -1374,7 +1374,7 @@ rasops_putchar_rotated_cw(void *cookie,
height = ri->ri_font->fontheight;
/* XXX this assumes 16-bit color depth */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
int16_t c = (int16_t)ri->ri_devcmap[((u_int)attr >> 24) & 0xf];
while (height--) {
@@ -1493,7 +1493,7 @@ rasops_putchar_rotated_ccw(void *cookie,
/* Do rotated char sans (side)underline */
ri->ri_real_ops.putchar(cookie, ri->ri_cols - col - 1, row, uc,
- attr & ~1);
+ attr & ~WSATTR_UNDERLINE);
/* Do rotated underline */
rp = ri->ri_bits + (ri->ri_cols - col - 1) * ri->ri_yscale +
@@ -1502,7 +1502,7 @@ rasops_putchar_rotated_ccw(void *cookie,
height = ri->ri_font->fontheight;
/* XXX this assumes 16-bit color depth */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
int16_t c = (int16_t)ri->ri_devcmap[((u_int)attr >> 24) & 0xf];
while (height--) {
Index: src/sys/dev/rasops/rasops1.c
diff -u src/sys/dev/rasops/rasops1.c:1.23 src/sys/dev/rasops/rasops1.c:1.24
--- src/sys/dev/rasops/rasops1.c:1.23 Tue May 4 04:57:34 2010
+++ src/sys/dev/rasops/rasops1.c Tue Dec 4 09:27:59 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops1.c,v 1.23 2010/05/04 04:57:34 macallan Exp $ */
+/* $NetBSD: rasops1.c,v 1.24 2018/12/04 09:27:59 mlelstv Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.23 2010/05/04 04:57:34 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.24 2018/12/04 09:27:59 mlelstv Exp $");
#include "opt_rasops.h"
@@ -180,7 +180,7 @@ rasops1_putchar(void *cookie, int row, i
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
tmp = (*rp & lmask) | (fg & rmask);
*rp = tmp;
@@ -257,7 +257,7 @@ rasops1_putchar(void *cookie, int row, i
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
tmp = (rp[0] & lmask) | (fg & ~lmask);
tmp2 = (rp[1] & rmask) | (fg & ~rmask);
@@ -344,7 +344,7 @@ rasops1_putchar8(void *cookie, int row,
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
rp[-(ri->ri_stride << 1)] = fg;
if (ri->ri_hwbits) {
hrp[-(ri->ri_stride << 1)] = fg;
@@ -426,7 +426,7 @@ rasops1_putchar16(void *cookie, int row,
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
/* XXX alignment?! */
*(int16_t *)(rp - (ri->ri_stride << 1)) = fg;
if (ri->ri_hwbits) {
Index: src/sys/dev/rasops/rasops15.c
diff -u src/sys/dev/rasops/rasops15.c:1.21 src/sys/dev/rasops/rasops15.c:1.22
--- src/sys/dev/rasops/rasops15.c:1.21 Wed Jan 25 14:53:43 2017
+++ src/sys/dev/rasops/rasops15.c Tue Dec 4 09:27:59 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops15.c,v 1.21 2017/01/25 14:53:43 jakllsch Exp $ */
+/* $NetBSD: rasops15.c,v 1.22 2018/12/04 09:27:59 mlelstv Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.21 2017/01/25 14:53:43 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.22 2018/12/04 09:27:59 mlelstv Exp $");
#include "opt_rasops.h"
@@ -191,7 +191,7 @@ rasops15_putchar(void *cookie, int row,
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
int16_t c = (int16_t)clr[1];
rp -= ri->ri_stride << 1;
if (ri->ri_hwbits)
@@ -292,7 +292,7 @@ rasops15_putchar_aa(void *cookie, int ro
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
rp = (uint16_t *)rrp;
DELTA(rp, (ri->ri_stride * (height - 2)), int16_t *);
while (width--)
@@ -412,7 +412,7 @@ rasops15_putchar8(void *cookie, int row,
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
int32_t c = STAMP_READ(28);
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
@@ -518,7 +518,7 @@ rasops15_putchar12(void *cookie, int row
}
/* Do underline */
- if (attr & 1) {
+ if (attr & WSATTR_UNDERLINE) {
int32_t c = STAMP_READ(28);
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
@@ -633,7 +633,7 @@ rasops15_putchar16(void *cookie, int row
}
/* Do underline */
- if (attr & 1) {
+ if (attr & WSATTR_UNDERLINE) {
int32_t c = STAMP_READ(28);
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
Index: src/sys/dev/rasops/rasops2.c
diff -u src/sys/dev/rasops/rasops2.c:1.18 src/sys/dev/rasops/rasops2.c:1.19
--- src/sys/dev/rasops/rasops2.c:1.18 Sun Apr 21 04:28:05 2013
+++ src/sys/dev/rasops/rasops2.c Tue Dec 4 09:27:59 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops2.c,v 1.18 2013/04/21 04:28:05 kiyohara Exp $ */
+/* $NetBSD: rasops2.c,v 1.19 2018/12/04 09:27:59 mlelstv Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.18 2013/04/21 04:28:05 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.19 2018/12/04 09:27:59 mlelstv Exp $");
#include "opt_rasops.h"
@@ -159,7 +159,7 @@ rasops2_putchar(void *cookie, int row, i
}
/* Do underline */
- if (attr & 1) {
+ if (attr & WSATTR_UNDERLINE) {
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
*rp = (*rp & lmask) | (fg & rmask);
}
@@ -196,7 +196,7 @@ rasops2_putchar(void *cookie, int row, i
}
/* Do underline */
- if (attr & 1) {
+ if (attr & WSATTR_UNDERLINE) {
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
rp[0] = (rp[0] & lmask) | (fg & ~lmask);
rp[1] = (rp[1] & rmask) | (fg & ~rmask);
@@ -309,7 +309,7 @@ rasops2_putchar8(void *cookie, int row,
}
/* Do underline */
- if ((attr & 1) != 0)
+ if ((attr & WSATTR_UNDERLINE) != 0)
*(int16_t *)(rp - (ri->ri_stride << 1)) = stamp[15];
stamp_mutex--;
@@ -375,7 +375,7 @@ rasops2_putchar12(void *cookie, int row,
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
rp -= ri->ri_stride << 1;
rp[0] = rp[1] = rp[2] = stamp[15];
}
@@ -444,7 +444,7 @@ rasops2_putchar16(void *cookie, int row,
}
/* Do underline */
- if ((attr & 1) != 0)
+ if ((attr & WSATTR_UNDERLINE) != 0)
*(int32_t *)(rp - (ri->ri_stride << 1)) = stamp[15];
stamp_mutex--;
Index: src/sys/dev/rasops/rasops24.c
diff -u src/sys/dev/rasops/rasops24.c:1.29 src/sys/dev/rasops/rasops24.c:1.30
--- src/sys/dev/rasops/rasops24.c:1.29 Mon Jul 25 18:02:47 2011
+++ src/sys/dev/rasops/rasops24.c Tue Dec 4 09:27:59 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops24.c,v 1.29 2011/07/25 18:02:47 njoly Exp $ */
+/* $NetBSD: rasops24.c,v 1.30 2018/12/04 09:27:59 mlelstv Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.29 2011/07/25 18:02:47 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.30 2018/12/04 09:27:59 mlelstv Exp $");
#include "opt_rasops.h"
@@ -178,7 +178,7 @@ rasops24_putchar(void *cookie, int row,
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
u_char c = clr[1];
rp -= ri->ri_stride << 1;
@@ -299,7 +299,7 @@ rasops24_putchar8(void *cookie, int row,
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
int32_t c = STAMP_READ(52);
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
@@ -381,7 +381,7 @@ rasops24_putchar12(void *cookie, int row
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
int32_t c = STAMP_READ(52);
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
@@ -470,7 +470,7 @@ rasops24_putchar16(void *cookie, int row
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
int32_t c = STAMP_READ(52);
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
@@ -497,7 +497,7 @@ rasops24_eraserows(void *cookie, int row
* If the color is gray, we can cheat and use the generic routines
* (which are faster, hopefully) since the r,g,b values are the same.
*/
- if ((attr & 4) != 0) {
+ if ((attr & WSATTR_PRIVATE2) != 0) {
rasops_eraserows(cookie, row, num, attr);
return;
}
@@ -599,7 +599,7 @@ rasops24_erasecols(void *cookie, int row
* If the color is gray, we can cheat and use the generic routines
* (which are faster, hopefully) since the r,g,b values are the same.
*/
- if ((attr & 4) != 0) {
+ if ((attr & WSATTR_PRIVATE2) != 0) {
rasops_erasecols(cookie, row, col, num, attr);
return;
}
Index: src/sys/dev/rasops/rasops4.c
diff -u src/sys/dev/rasops/rasops4.c:1.11 src/sys/dev/rasops/rasops4.c:1.12
--- src/sys/dev/rasops/rasops4.c:1.11 Sun Apr 21 04:28:05 2013
+++ src/sys/dev/rasops/rasops4.c Tue Dec 4 09:27:59 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops4.c,v 1.11 2013/04/21 04:28:05 kiyohara Exp $ */
+/* $NetBSD: rasops4.c,v 1.12 2018/12/04 09:27:59 mlelstv Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops4.c,v 1.11 2013/04/21 04:28:05 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops4.c,v 1.12 2018/12/04 09:27:59 mlelstv Exp $");
#include "opt_rasops.h"
@@ -159,7 +159,7 @@ rasops4_putchar(void *cookie, int row, i
}
/* Do underline */
- if (attr & 1) {
+ if (attr & WS_UNDERLINE) {
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
*rp = (*rp & lmask) | (fg & rmask);
}
@@ -196,7 +196,7 @@ rasops4_putchar(void *cookie, int row, i
}
/* Do underline */
- if (attr & 1) {
+ if (attr & WS_UNDERLINE) {
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
rp[0] = (rp[0] & lmask) | (fg & ~lmask);
rp[1] = (rp[1] & rmask) | (fg & ~rmask);
@@ -311,7 +311,7 @@ rasops4_putchar8(void *cookie, int row,
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WS_UNDERLINE) != 0) {
rp -= (rs << 1);
rp[0] = stamp[15];
rp[1] = stamp[15];
@@ -383,7 +383,7 @@ rasops4_putchar12(void *cookie, int row,
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WS_UNDERLINE) != 0) {
rp -= (rs << 1);
rp[0] = stamp[15];
rp[1] = stamp[15];
@@ -458,7 +458,7 @@ rasops4_putchar16(void *cookie, int row,
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WS_UNDERLINE) != 0) {
rp -= (rs << 1);
rp[0] = stamp[15];
rp[1] = stamp[15];
Index: src/sys/dev/rasops/rasops8.c
diff -u src/sys/dev/rasops/rasops8.c:1.34 src/sys/dev/rasops/rasops8.c:1.35
--- src/sys/dev/rasops/rasops8.c:1.34 Sun Sep 15 09:41:55 2013
+++ src/sys/dev/rasops/rasops8.c Tue Dec 4 09:27:59 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops8.c,v 1.34 2013/09/15 09:41:55 martin Exp $ */
+/* $NetBSD: rasops8.c,v 1.35 2018/12/04 09:27:59 mlelstv Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.34 2013/09/15 09:41:55 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.35 2018/12/04 09:27:59 mlelstv Exp $");
#include "opt_rasops.h"
@@ -175,7 +175,7 @@ rasops8_putchar(void *cookie, int row, i
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
u_char c = clr[1];
rp -= (ri->ri_stride << 1);
@@ -278,7 +278,7 @@ rasops8_putchar_aa(void *cookie, int row
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
rp -= (ri->ri_stride << 1);
if (ri->ri_hwbits)
@@ -406,7 +406,7 @@ rasops8_putchar8(void *cookie, int row,
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
rp[0] = rp[1] = stamp[15];
if (ri->ri_hwbits) {
@@ -500,7 +500,7 @@ rasops8_putchar12(void *cookie, int row,
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
rp[0] = rp[1] = rp[2] = stamp[15];
if (ri->ri_hwbits) {
@@ -595,7 +595,7 @@ rasops8_putchar16(void *cookie, int row,
}
/* Do underline */
- if ((attr & 1) != 0) {
+ if ((attr & WSATTR_UNDERLINE) != 0) {
DELTA(rp, -(ri->ri_stride << 1), int32_t *);
rp[0] = rp[1] = rp[2] = rp[3] = stamp[15];
if (ri->ri_hwbits) {
Index: src/sys/dev/wscons/wsdisplayvar.h
diff -u src/sys/dev/wscons/wsdisplayvar.h:1.53 src/sys/dev/wscons/wsdisplayvar.h:1.54
--- src/sys/dev/wscons/wsdisplayvar.h:1.53 Wed Sep 26 09:04:12 2018
+++ src/sys/dev/wscons/wsdisplayvar.h Tue Dec 4 09:27:59 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplayvar.h,v 1.53 2018/09/26 09:04:12 bouyer Exp $ */
+/* $NetBSD: wsdisplayvar.h,v 1.54 2018/12/04 09:27:59 mlelstv Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -83,6 +83,12 @@ struct wsdisplay_emulops {
#define WSATTR_BLINK 4
#define WSATTR_UNDERLINE 8
#define WSATTR_WSCOLORS 16
+#define WSATTR_USERMASK 0x0fff
+/* private flags used by the driver */
+#define WSATTR_PRIVATE1 4096
+#define WSATTR_PRIVATE2 8192
+#define WSATTR_PRIVATE3 16384
+#define WSATTR_PRIVATE4 32768
/* XXX need a free_attr() ??? */
void (*replaceattr)(void *, long, long);
};