Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/wscons wsdisplay(4): Factor out scr_dirty setting.



details:   https://anonhg.NetBSD.org/src/rev/b548ee496db8
branches:  trunk
changeset: 368520:b548ee496db8
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Jul 17 11:30:27 2022 +0000

description:
wsdisplay(4): Factor out scr_dirty setting.

Reduces #ifdefs.  No functional change intended.

diffstat:

 sys/dev/wscons/wsdisplay_vcons.c |  38 +++++++++++++++++---------------------
 1 files changed, 17 insertions(+), 21 deletions(-)

diffs (108 lines):

diff -r 8ab0c429dca9 -r b548ee496db8 sys/dev/wscons/wsdisplay_vcons.c
--- a/sys/dev/wscons/wsdisplay_vcons.c  Sun Jul 17 11:20:04 2022 +0000
+++ b/sys/dev/wscons/wsdisplay_vcons.c  Sun Jul 17 11:30:27 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wsdisplay_vcons.c,v 1.57 2022/07/17 11:20:04 riastradh Exp $ */
+/*     $NetBSD: wsdisplay_vcons.c,v 1.58 2022/07/17 11:30:27 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.57 2022/07/17 11:20:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.58 2022/07/17 11:30:27 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -135,6 +135,14 @@
 #endif
 }
 
+static inline void
+vcons_dirty(struct vcons_screen *scr)
+{
+#ifdef VCONS_DRAW_INTR
+       atomic_inc_uint(&scr->scr_dirty);
+#endif
+}
+
 static int
 vcons_init_common(struct vcons_data *vd, void *cookie,
     struct wsscreen_descr *def, struct wsdisplay_accessops *ao,
@@ -895,9 +903,7 @@
        memmove(&scr->scr_chars[offset + to], &scr->scr_chars[offset + from],
            ncols * sizeof(uint32_t));
 
-#ifdef VCONS_DRAW_INTR
-       atomic_inc_uint(&scr->scr_dirty);
-#endif
+       vcons_dirty(scr);
 }
 
 static void
@@ -979,9 +985,7 @@
                scr->scr_chars[offset + i] = 0x20;
        }
 
-#ifdef VCONS_DRAW_INTR
-       atomic_inc_uint(&scr->scr_dirty);
-#endif
+       vcons_dirty(scr);
 }
 
 #ifdef VCONS_DRAW_INTR
@@ -1051,9 +1055,7 @@
        memmove(&scr->scr_chars[to], &scr->scr_chars[from],
            len * sizeof(uint32_t));
 
-#ifdef VCONS_DRAW_INTR
-       atomic_inc_uint(&scr->scr_dirty);
-#endif
+       vcons_dirty(scr);
 }
 
 static void
@@ -1137,9 +1139,7 @@
                scr->scr_chars[i] = 0x20;
        }
 
-#ifdef VCONS_DRAW_INTR
-       atomic_inc_uint(&scr->scr_dirty);
-#endif
+       vcons_dirty(scr);
 }
 
 #ifdef VCONS_DRAW_INTR
@@ -1196,9 +1196,7 @@
                scr->scr_chars[pos + offset] = c;
        }
 
-#ifdef VCONS_DRAW_INTR
-       atomic_inc_uint(&scr->scr_dirty);
-#endif
+       vcons_dirty(scr);
 }
 
 #ifdef VCONS_DRAW_INTR
@@ -1258,9 +1256,7 @@
                if (scr->scr_ri.ri_crow != row || scr->scr_ri.ri_ccol != col) {
                        scr->scr_ri.ri_crow = row;
                        scr->scr_ri.ri_ccol = col;
-#if defined(VCONS_DRAW_INTR)
-                       atomic_inc_uint(&scr->scr_dirty);
-#endif
+                       vcons_dirty(scr);
                }
                vcons_unlock(scr);
                return;
@@ -1576,7 +1572,7 @@
 
        vd->use_intr = 2;
        if (scr)
-               atomic_inc_uint(&scr->scr_dirty);
+               vcons_dirty(scr);
 #endif
 }
 



Home | Main Index | Thread Index | Old Index