Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/wscons make vcons_putchar_buffer() return a flag ind...
details: https://anonhg.NetBSD.org/src/rev/7ceb6cb271fd
branches: trunk
changeset: 373506:7ceb6cb271fd
user: macallan <macallan%NetBSD.org@localhost>
date: Tue Feb 14 08:14:02 2023 +0000
description:
make vcons_putchar_buffer() return a flag indicating if anything actually
changed, skip the actual drawing op if nothing did
diffstat:
sys/dev/wscons/wsdisplay_vcons.c | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 deletions(-)
diffs (85 lines):
diff -r fb97f74e2d60 -r 7ceb6cb271fd sys/dev/wscons/wsdisplay_vcons.c
--- a/sys/dev/wscons/wsdisplay_vcons.c Mon Feb 13 23:14:21 2023 +0000
+++ b/sys/dev/wscons/wsdisplay_vcons.c Tue Feb 14 08:14:02 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay_vcons.c,v 1.64 2022/07/18 11:09:22 martin Exp $ */
+/* $NetBSD: wsdisplay_vcons.c,v 1.65 2023/02/14 08:14:02 macallan Exp $ */
/*-
* Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.64 2022/07/18 11:09:22 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.65 2023/02/14 08:14:02 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -121,7 +121,7 @@
static void vcons_erasecols_buffer(void *, int, int, int, long);
static void vcons_copyrows_buffer(void *, int, int, int);
static void vcons_eraserows_buffer(void *, int, int, long);
-static void vcons_putchar_buffer(void *, int, int, u_int, long);
+static int vcons_putchar_buffer(void *, int, int, u_int, long);
/*
* actual wrapper methods which call both the _buffer ones above and the
@@ -1237,22 +1237,25 @@
vcons_unlock(scr);
}
-static void
+static int
vcons_putchar_buffer(void *cookie, int row, int col, u_int c, long attr)
{
struct rasops_info *ri = cookie;
struct vcons_screen *scr = ri->ri_hw;
int offset = vcons_offset_to_zero(scr);
- int pos;
+ int pos, ret = 0;
if ((row >= 0) && (row < ri->ri_rows) && (col >= 0) &&
(col < ri->ri_cols)) {
pos = col + row * ri->ri_cols;
+ ret = (scr->scr_attrs[pos + offset] != attr) ||
+ (scr->scr_chars[pos + offset] != c);
scr->scr_attrs[pos + offset] = attr;
scr->scr_chars[pos + offset] = c;
}
- vcons_dirty(scr);
+ if (ret) vcons_dirty(scr);
+ return ret;
}
#ifdef VCONS_DRAW_INTR
@@ -1282,8 +1285,9 @@
{
struct rasops_info *ri = cookie;
struct vcons_screen *scr = ri->ri_hw;
-
- vcons_putchar_buffer(cookie, row, col, c, attr);
+ int need_draw;
+
+ need_draw = vcons_putchar_buffer(cookie, row, col, c, attr);
if (vcons_use_intr(scr))
return;
@@ -1291,12 +1295,13 @@
vcons_lock(scr);
if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
#ifdef VCONS_DRAW_INTR
- vcons_putchar_cached(cookie, row, col, c, attr);
+ if (need_draw) vcons_putchar_cached(cookie, row, col, c, attr);
#else
if (row == ri->ri_crow && col == ri->ri_ccol) {
ri->ri_flg &= ~RI_CURSOR;
- }
- scr->putchar(cookie, row, col, c, attr);
+ scr->putchar(cookie, row, col, c, attr);
+ } else if (need_draw)
+ scr->putchar(cookie, row, col, c, attr);
#endif
}
vcons_unlock(scr);
Home |
Main Index |
Thread Index |
Old Index