summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2014-06-27 19:57:57 +0000
committermarius <marius@FreeBSD.org>2014-06-27 19:57:57 +0000
commit15fe259895ce22ded690e2608d9f322a37a0a525 (patch)
tree5659c928ca0c4b04ac6a04a7214171d103c50f90 /sys/dev
parent8015212d04e705b06b7914e7f1a706cede984a3b (diff)
downloadFreeBSD-src-15fe259895ce22ded690e2608d9f322a37a0a525.zip
FreeBSD-src-15fe259895ce22ded690e2608d9f322a37a0a525.tar.gz
In order to get vt(4) a bit closer to the feature set provided by sc(4),
implement options TERMINAL_{KERN,NORM}_ATTR. These are aliased to SC_{KERNEL_CONS,NORM}_ATTR and like these latter, allow to change the default colors of normal and kernel text respectively. Note on the naming: Although affecting the output of vt(4), technically kern/subr_terminal.c is primarily concerned with changing default colors so it would be inconsistent to term these options VT_{KERN,NORM}_ATTR. Actually, if the architecture and abstraction of terminal+teken+vt would be perfect, dev/vt/* wouldn't be touched by this commit at all. Reviewed by: emaste MFC after: 3 days Sponsored by: Bally Wulff Games & Entertainment GmbH
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/vt/vt.h2
-rw-r--r--sys/dev/vt/vt_buf.c20
-rw-r--r--sys/dev/vt/vt_core.c13
3 files changed, 27 insertions, 8 deletions
diff --git a/sys/dev/vt/vt.h b/sys/dev/vt/vt.h
index 9728946..cd6aa5b 100644
--- a/sys/dev/vt/vt.h
+++ b/sys/dev/vt/vt.h
@@ -224,7 +224,7 @@ void vtbuf_extract_marked(struct vt_buf *vb, term_char_t *buf, int sz);
((mask)->vbm_row & ((uint64_t)1 << ((row) % 64)))
#define VTBUF_DIRTYCOL(mask, col) \
((mask)->vbm_col & ((uint64_t)1 << ((col) % 64)))
-#define VTBUF_SPACE_CHAR (' ' | TC_WHITE << 26 | TC_BLACK << 29)
+#define VTBUF_SPACE_CHAR(attr) (' ' | (attr))
#define VHS_SET 0
#define VHS_CUR 1
diff --git a/sys/dev/vt/vt_buf.c b/sys/dev/vt/vt_buf.c
index d8602f8..14e02f1 100644
--- a/sys/dev/vt/vt_buf.c
+++ b/sys/dev/vt/vt_buf.c
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
+#include <sys/reboot.h>
#include <sys/systm.h>
#include <dev/vt/vt.h>
@@ -385,13 +386,13 @@ vtbuf_init_rows(struct vt_buf *vb)
vb->vb_history_size = MAX(vb->vb_history_size, vb->vb_scr_size.tp_row);
for (r = 0; r < vb->vb_history_size; r++)
- vb->vb_rows[r] = &vb->vb_buffer[r *
- vb->vb_scr_size.tp_col];
+ vb->vb_rows[r] = &vb->vb_buffer[r * vb->vb_scr_size.tp_col];
}
void
vtbuf_init_early(struct vt_buf *vb)
{
+ term_rect_t rect;
vb->vb_flags |= VBF_CURSOR;
vb->vb_roffset = 0;
@@ -402,6 +403,10 @@ vtbuf_init_early(struct vt_buf *vb)
vb->vb_mark_end.tp_col = 0;
vtbuf_init_rows(vb);
+ rect.tr_begin.tp_row = rect.tr_begin.tp_col = 0;
+ rect.tr_end = vb->vb_scr_size;
+ vtbuf_fill(vb, &rect, VTBUF_SPACE_CHAR((boothowto & RB_MUTE) == 0 ?
+ TERMINAL_KERN_ATTR : TERMINAL_NORM_ATTR));
vtbuf_make_undirty(vb);
if ((vb->vb_flags & VBF_MTX_INIT) == 0) {
mtx_init(&vb->vb_lock, "vtbuf", NULL, MTX_SPIN);
@@ -474,20 +479,27 @@ vtbuf_grow(struct vt_buf *vb, const term_pos_t *p, int history_size)
/* Copy history and fill extra space. */
for (r = 0; r < history_size; r ++) {
+ /*
+ * XXX VTBUF_SPACE_CHAR(TERMINAL_NORM_ATTR) will
+ * extended lines of kernel text using the wrong
+ * background color.
+ */
row = rows[r];
if (r < h) { /* Copy. */
memmove(rows[r], copyrows[r],
MIN(p->tp_col, w) * sizeof(term_char_t));
for (c = MIN(p->tp_col, w); c < p->tp_col;
c++) {
- row[c] = VTBUF_SPACE_CHAR;
+ row[c] = VTBUF_SPACE_CHAR(
+ TERMINAL_NORM_ATTR);
}
} else { /* Just fill. */
rect.tr_begin.tp_col = 0;
rect.tr_begin.tp_row = r;
rect.tr_end.tp_col = p->tp_col;
rect.tr_end.tp_row = p->tp_row;
- vtbuf_fill(vb, &rect, VTBUF_SPACE_CHAR);
+ vtbuf_fill(vb, &rect,
+ VTBUF_SPACE_CHAR(TERMINAL_NORM_ATTR));
break;
}
}
diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
index 21d530a..ad90463 100644
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -958,6 +958,8 @@ vtterm_cnprobe(struct terminal *tm, struct consdev *cp)
struct vt_window *vw = tm->tm_softc;
struct vt_device *vd = vw->vw_device;
struct winsize wsz;
+ term_attr_t attr;
+ term_char_t c;
if (!vty_enabled(VTY_VT))
return;
@@ -1002,7 +1004,12 @@ vtterm_cnprobe(struct terminal *tm, struct consdev *cp)
vtbuf_init_early(&vw->vw_buf);
vt_winsize(vd, vw->vw_font, &wsz);
- terminal_set_winsize(tm, &wsz);
+ c = (boothowto & RB_MUTE) == 0 ? TERMINAL_KERN_ATTR :
+ TERMINAL_NORM_ATTR;
+ attr.ta_format = TCHAR_FORMAT(c);
+ attr.ta_fgcolor = TCHAR_FGCOLOR(c);
+ attr.ta_bgcolor = TCHAR_BGCOLOR(c);
+ terminal_set_winsize_blank(tm, &wsz, 1, &attr);
if (vtdbest != NULL) {
#ifdef DEV_SPLASH
@@ -1160,7 +1167,7 @@ vt_change_font(struct vt_window *vw, struct vt_font *vf)
/* Grow the screen buffer and terminal. */
terminal_mute(tm, 1);
vtbuf_grow(&vw->vw_buf, &size, vw->vw_buf.vb_history_size);
- terminal_set_winsize_blank(tm, &wsz, 0);
+ terminal_set_winsize_blank(tm, &wsz, 0, NULL);
terminal_mute(tm, 0);
/* Actually apply the font to the current window. */
@@ -2127,7 +2134,7 @@ vt_allocate(struct vt_driver *drv, void *softc)
/* Update console window sizes to actual. */
vt_winsize(vd, vd->vd_windows[VT_CONSWINDOW]->vw_font, &wsz);
terminal_set_winsize_blank(vd->vd_windows[VT_CONSWINDOW]->vw_terminal,
- &wsz, 0);
+ &wsz, 0, NULL);
}
void
OpenPOWER on IntegriCloud