summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-07-17 11:30:27 +0000
committerriastradh <riastradh@NetBSD.org>2022-07-17 11:30:27 +0000
commit44c32ff5f3329a27582143ee61e2c0aaa6dcbeae (patch)
treed19436ee19d1b00581ce99a8bb3a5a756300980f /sys/dev
parentbee84188b048b405b6df57842a8f8143dcc67acd (diff)
wsdisplay(4): Factor out scr_dirty setting.
Reduces #ifdefs. No functional change intended.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/wscons/wsdisplay_vcons.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/sys/dev/wscons/wsdisplay_vcons.c b/sys/dev/wscons/wsdisplay_vcons.c
index 12576ab49c1..c17eb8f3736 100644
--- a/sys/dev/wscons/wsdisplay_vcons.c
+++ b/sys/dev/wscons/wsdisplay_vcons.c
@@ -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 @@ vcons_use_intr(const struct vcons_screen *scr)
#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 @@ vcons_copycols_buffer(void *cookie, int row, int srccol, int dstcol, int ncols)
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 @@ vcons_erasecols_buffer(void *cookie, int row, int startcol, int ncols, long fill
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 @@ vcons_copyrows_buffer(void *cookie, int srcrow, int dstrow, int nrows)
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 @@ vcons_eraserows_buffer(void *cookie, int row, int nrows, long fillattr)
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 @@ vcons_putchar_buffer(void *cookie, int row, int col, u_int c, long attr)
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 @@ vcons_cursor(void *cookie, int on, int row, int col)
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 @@ vcons_disable_polling(struct vcons_data *vd)
vd->use_intr = 2;
if (scr)
- atomic_inc_uint(&scr->scr_dirty);
+ vcons_dirty(scr);
#endif
}