Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev rasops reused wscons attribute bits for internal con...



details:   https://anonhg.NetBSD.org/src/rev/ae21fb185792
branches:  trunk
changeset: 837431:ae21fb185792
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Tue Dec 04 09:27:59 2018 +0000

description:
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.

diffstat:

 sys/dev/rasops/rasops.c       |  20 ++++++++++----------
 sys/dev/rasops/rasops1.c      |  12 ++++++------
 sys/dev/rasops/rasops15.c     |  14 +++++++-------
 sys/dev/rasops/rasops2.c      |  14 +++++++-------
 sys/dev/rasops/rasops24.c     |  16 ++++++++--------
 sys/dev/rasops/rasops4.c      |  14 +++++++-------
 sys/dev/rasops/rasops8.c      |  14 +++++++-------
 sys/dev/wscons/wsdisplayvar.h |   8 +++++++-
 8 files changed, 59 insertions(+), 53 deletions(-)

diffs (truncated from 480 to 300 lines):

diff -r aacc24842b30 -r ae21fb185792 sys/dev/rasops/rasops.c
--- a/sys/dev/rasops/rasops.c   Tue Dec 04 08:02:14 2018 +0000
+++ b/sys/dev/rasops/rasops.c   Tue Dec 04 09:27:59 2018 +0000
@@ -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 @@
        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 @@
        *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 @@
 
        /* 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 @@
        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 @@
 
        /* 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 @@
        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--) {
diff -r aacc24842b30 -r ae21fb185792 sys/dev/rasops/rasops1.c
--- a/sys/dev/rasops/rasops1.c  Tue Dec 04 08:02:14 2018 +0000
+++ b/sys/dev/rasops/rasops1.c  Tue Dec 04 09:27:59 2018 +0000
@@ -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 @@
                }
 
                /* 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 @@
                }
 
                /* 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 @@
        }
 
        /* 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 @@
        }
 
        /* 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) {
diff -r aacc24842b30 -r ae21fb185792 sys/dev/rasops/rasops15.c
--- a/sys/dev/rasops/rasops15.c Tue Dec 04 08:02:14 2018 +0000
+++ b/sys/dev/rasops/rasops15.c Tue Dec 04 09:27:59 2018 +0000
@@ -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 @@
        }
 
        /* 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 @@
        }
 
        /* 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 @@
        }
 
        /* 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 @@
        }
 
        /* 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 @@
        }
 
        /* Do underline */
-       if (attr & 1) {
+       if (attr & WSATTR_UNDERLINE) {
                int32_t c = STAMP_READ(28);
 
                DELTA(rp, -(ri->ri_stride << 1), int32_t *);
diff -r aacc24842b30 -r ae21fb185792 sys/dev/rasops/rasops2.c
--- a/sys/dev/rasops/rasops2.c  Tue Dec 04 08:02:14 2018 +0000
+++ b/sys/dev/rasops/rasops2.c  Tue Dec 04 09:27:59 2018 +0000
@@ -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 @@
                }
 
                /* 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 @@
                }
 
                /* 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 @@
        }
 
        /* 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 @@
        }
 
        /* 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 @@
        }
 
        /* Do underline */
-       if ((attr & 1) != 0)
+       if ((attr & WSATTR_UNDERLINE) != 0)
                *(int32_t *)(rp - (ri->ri_stride << 1)) = stamp[15];
 
        stamp_mutex--;
diff -r aacc24842b30 -r ae21fb185792 sys/dev/rasops/rasops24.c
--- a/sys/dev/rasops/rasops24.c Tue Dec 04 08:02:14 2018 +0000
+++ b/sys/dev/rasops/rasops24.c Tue Dec 04 09:27:59 2018 +0000
@@ -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 @@
        }
 
        /* 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 @@
        }
 
        /* 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 @@
        }
 
        /* Do underline */



Home | Main Index | Thread Index | Old Index