History log of /freebsd-current/sys/dev/vt/vt_buf.c
Revision Date Author Comments
# fdafd315 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 90b89100 05-Oct-2022 Ivan Quitschal <tezeka@hotmail.com>

vt(4): When cutting a line, append a newline character.

While at it optimise "case 3" into a default.
This way there is no need to initialize the "mark" variable in the beginning,
because all cases set it.

MFC after: 1 week
Sponsored by: NVIDIA Networking
Differential Revision: https://reviews.freebsd.org/D36042


# 9971e6af 25-Jun-2022 Hans Petter Selasky <hselasky@FreeBSD.org>

vt: Improve multi lingual word separation.

Suggested by: Tomoaki AOKI <junchoon@dec.sakura.ne.jp>
Differential Revision: https://reviews.freebsd.org/D35552
PR: 263084
MFC after: 1 week
Sponsored by: NVIDIA Networking


# 5fe0a825 22-Jun-2022 Hans Petter Selasky <hselasky@FreeBSD.org>

vt: Fix contents of paste buffer for newcons.

Trim all word separators from end of line, except for last line and
only use '\r' to terminate the pasted lines as expected by TTY.

Submitted by: Ivan Quitschal <tezeka@hotmail.com>
Differential Revision: https://reviews.freebsd.org/D35552
PR: 263084
MFC after: 1 week
Sponsored by: NVIDIA Networking


# 521dbfd6 20-Feb-2022 Ed Maste <emaste@FreeBSD.org>

vt: fix double-click word selection for last word on line

Previously when double-clicking on the last word on a line we would
select from the beginning of the word to the cursor position, because
we searched forward for a space character to find the end of a word.
Now, use the end of the line if we do not find a space.

PR: 261553
Reviewed by: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34339


# 327da507 22-Feb-2022 Ed Maste <emaste@FreeBSD.org>

vt: whitespace and style(9) updates


# 692bb3f0 20-Feb-2022 Ed Maste <emaste@FreeBSD.org>

vt: fix double-click word selection for first word on line

Previously when double-clicking on the first word on a line we would
select from the cursor position to the end of the word, not from the
beginning of the line. This is because we searched backward for a
space to mark the beginning of a word.

Now, use the beginning of the line if we do not find a space.

PR: 261553
Reported by: Stefan B.
MFC after: 1 week
Sponsored by: The FreeBSD Foundation


# 9feff969 08-Aug-2021 Ed Maste <emaste@FreeBSD.org>

Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights

These ones were unambiguous cases where the Foundation was the only
listed copyright holder (in the associated license block).

Sponsored by: The FreeBSD Foundation


# d276d86e 01-Sep-2020 Mateusz Guzik <mjg@FreeBSD.org>

vt: clean up empty lines in .c and .h files


# ef1eabca 01-Jun-2020 Jason A. Harmening <jah@FreeBSD.org>

vt(4): reset scrollback and cursor position after clearing history buffer

r361601 implemented basic support for cleaing the console history buffer.
But after clearing the history buffer, it's not especially useful to be
able to scroll back through that buffer, or for the cursor position to
remain at (very likely) the bottom of the screen.

PR: 224436
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D25079


# 98f7cf02 28-May-2020 Jason A. Harmening <jah@FreeBSD.org>

vt(4): Add support for `vidcontrol -C'

Extract scrollback buffer initialization into a common routine, used both
during vt(4) init and in handling the CONS_CLRHIST ioctl.

PR: 224436
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D24815


# df1bc27a 25-Sep-2019 Toomas Soome <tsoome@FreeBSD.org>

vt: use colors from terminal emulator

Instead of hardcoded colors, use terminal state. This also means,
we need to record the pointer to terminal state with vtbuf.


# 547e74a8 16-May-2018 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

teken, vt(4): New callbacks to lock the terminal once

... to process input, instead of inside each smaller operations such as
appending a character or moving the cursor forward.

In other words, before we were doing (oversimplified):

teken_input()
<for each input character>
vtterm_putchar()
VTBUF_LOCK()
VTBUF_UNLOCK()
vtterm_cursor_position()
VTBUF_LOCK()
VTBUF_UNLOCK()

Now, we are doing:

vtterm_pre_input()
VTBUF_LOCK()
teken_input()
<for each input character>
vtterm_putchar()
vtterm_cursor_position()
vtterm_post_input()
VTBUF_UNLOCK()

The situation was even worse when the vtterm_copy() and vtterm_fill()
callbacks were involved.

The new callbacks are:
* struct terminal_class->tc_pre_input()
* struct terminal_class->tc_post_input()

They are called in teken_input(), surrounding the while() loop.

The goal is to improve input processing speed of vt(4). As a benchmark,
here is the time taken to write a text file of 360 000 lines (26 MiB) on
`ttyv0`:

* vt(4), unmodified: 1500 ms
* vt(4), with this patch: 1200 ms
* syscons(4): 700 ms

This is on a Haswell laptop with a GENERIC-NODEBUG kernel.

At the same time, the locking is changed in the vt_flush() function
which is responsible to draw the text on screen. So instead of
(indirectly) using VTBUF_LOCK() just to read and reset the dirty area
of the internal buffer, the lock is held for about the entire function,
including the drawing part.

The change is mostly visible while content is scrolling fast: before,
lines could appear garbled while scrolling because the internal buffer
was accessed without locks (once the scrolling was finished, the output
was correct). Now, the scrolling appears correct.

In the end, the locking model is closer to what syscons(4) does.

Differential Revision: https://reviews.freebsd.org/D15302


# e1734edf 05-Dec-2017 Ed Maste <emaste@FreeBSD.org>

Implement "vidcontrol -h <history_size>" for vt(4)

PR: 210415
Submitted by: Siva Mahadevan
Reviewed by: ray (earlier)
MFC after: 1 month
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D11814


# 718cf2cc 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


# 07a45594 15-Feb-2017 Ravi Pokala <rpokala@FreeBSD.org>

Un-break vt(4) for {powerpc,powerpc64,sparc64} LINT kernel builds

The {powerpc,powerpc64,sparc64} LINT kernel builds fail with this error:

sys/dev/vt/vt_buf.c:198: warning: 'vtbuf_htw' defined but not used

Move vtbuf_htw() inside the '#if SC_NO_CUTPASTE' block where it belongs, and
put it in the proper order.

This fixes the immedate issue w/ vt(4), but all three then fail on different
issues.

Reviewed by: emaste


# c0e295de 10-Feb-2017 Aleksandr Rybalko <ray@FreeBSD.org>

o Reset mouse selection when new lines reach selection lines.
o Fix how selection handled on display.

Submitted by: hselasky
Reviewed by: hselasky, emaste(previous version)
Todo: track mouse select direction.


# da49f6bc 01-Nov-2014 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

vt(4): Adjust the cursor position after changing the window size

A new terminal_set_cursor() is added: it wraps the existing
teken_set_cursor() function.

In vtbuf_grow(), the cursor position is adjusted at the end of the
function. In vt_change_font(), we call terminal_set_cursor() just after
terminal_set_winsize_blank(), while the terminal is mute.

This fixes a bug where, after loading a kernel video driver which
increases the terminal window size, the cursor remains at its old
position, in other words, in the middle of the display content.

PR: 194421
MFC after: 1 week


# a10068fd 20-Sep-2014 Bjoern A. Zeeb <bz@FreeBSD.org>

Make gcc happy by initialising the variable only set in a couple of
case statements without a default.

MFC after: 2 days
X-MFC with: r271871


# 1454439c 18-Sep-2014 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

vt(4): Rewrite history scrolling

It's now possible to scroll up the 500 hard-coded lines of history, not
just a fraction of them. For instance, one can reach the top of the boot
process.

Sometimes, when scrolling or when changing the screen size (by changing
the font or loading a KMS driver for instance), one could see the
history cycling (old content appeared below latest lines). This is
fixed.

Now, when the resolution changes are more lines can be shown, the
displayed area is adjusted so that, if the screen was filled with
content before, it's filled with content after as well: more history
is visible, instead of having blank lines below the previously visible
content.

MFC after: 3 days


# c3a05e54 19-Sep-2014 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

vt(4): Remove vt_buf->vb_dirtymask

This structure and the associated functions were unused since the
implementation of vd_bitblt_text_t callbacks.

MFC after: 3 days


# 44f751a2 12-Sep-2014 Aleksandr Rybalko <ray@FreeBSD.org>

Fix stray char on paste.

Tested by: dumbbell and me
MFC after: 1 week


# 13c6f8a0 10-Sep-2014 Aleksandr Rybalko <ray@FreeBSD.org>

spelling fixes

Submitted by: "Sam Fourman Jr." <sfourman@gmail.com>
MFC after: 1 week


# b7fe4961 29-Aug-2014 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

vt(4): Change vb_history_size from "int" to "unsigned int"

CID: 1230002, 1230003
MFC after: 1 week


# cb81897a 26-Aug-2014 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

vt(4): When creating a window buffer, fill it entirely

... not just the visible part.

This fixes a bug where, when switching from eg. vt_vga to vt_fb (ie. the
resolution goes up), the originally hidden, uninitialized area of the
buffer is displayed on the screen. This leads to a missing text cursor
when it's over an unitialized area.

This was also visible when selecting text: the uninitialized area was
not highlighted.

Internally, this area was zeroed: characters were all 0x00000000,
meaning the foreground and background color was black. Now, everything
is filled with a space with a gray foreground color, like the visible
area.

While here, remove the check for the mute flag and always use
TERMINAL_NORM_ATTR as the character attribute (ie. gray foreground,
black background).

MFC after: 1 week


# 82276bbb 22-Aug-2014 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

vt(4): Use the actual size of the mouse when marking its position as dirty

This fixes a bug where part of the cursor was not erased.

MFC after: 1 week


# c6e1a987 21-Aug-2014 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

vt(4): Constify vt_buf argument of vtbuf_iscursor()

MFC after: 1 week


# 00c33067 10-Aug-2014 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

vt(4): Add vtbuf_dirty*_locked() to lock vtbuf once, not twice

In several functions, vtbuf_putchar() in particular, the lock on vtbuf
is acquired twice:
1. once by the said functions;
2. once in vtbuf_dirty().

Now, vtbuf_dirty_locked() and vtbuf_dirty_cell_locked() allow to
acquire that lock only once.

This improves the input speed of vt(4). To measure the gain, a
50,000-lines file was displayed on the console using cat(1). The time
taken by cat(1) is reported below:
o On amd64, with vt_vga:
- before: 1.0"
- after: 0.5"
o On sparc64, with creator_vt:
- before: 13.6"
- after: 10.5"

MFC after: 1 week


# 7344ee18 27-Jun-2014 Marius Strobl <marius@FreeBSD.org>

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


# 7cd5ec40 29-May-2014 Ed Maste <emaste@FreeBSD.org>

Update size in vt_grow if we don't have to reallocate

vt_grow may be called with a new size that's larger than previous but
does not require reallocation - for example, when the number of columns
is the same and new number of rows is less than the history size.
Prior to this change we would fail to update vb_scr_size, and then hit
a KASSERT when trying to write to the newly visible rows.

Sponsored by: The FreeBSD Foundation


# ba23b435 29-May-2014 Ed Maste <emaste@FreeBSD.org>

Correct KASSERT strings

Rows refer to height and cols to width.


# 8a25d545 08-May-2014 Aleksandr Rybalko <ray@FreeBSD.org>

Fix scrollback.

Sponsored by: The FreeBSD Foundation


# 0f49db6e 09-Dec-2013 Aleksandr Rybalko <ray@FreeBSD.org>

Respect SC_NO_CUTPASTE option. It disable mouse cursor and cut/paste support
for vt(9). Note: /dev/sysmouse not affected.

Sponsored by: The FreeBSD Foundation


# 27cf7d04 05-Dec-2013 Aleksandr Rybalko <ray@FreeBSD.org>

Merge VT(9) project (a.k.a. newcons).

Reviewed by: nwhitehorn
MFC_to_10_after: re approval

Sponsored by: The FreeBSD Foundation