From 7749de244014a057b55552ea9d68fd8aeb262ea0 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sat, 23 Nov 2024 15:01:09 +0000 Subject: [PATCH] Add new kern.vt.slow_down tunable. On a laptop with no other console devices than the screen, things scroll of the screen faster than eye or camera can capture it. This tunable slows the console down and makes it update synchronously, so console output continues when timers or interrupts do not. Differential Revision: https://reviews.freebsd.org/D47710 --- share/man/man4/vt.4 | 11 +++++++++++ sys/dev/vt/vt_core.c | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/share/man/man4/vt.4 b/share/man/man4/vt.4 index 4c115b68a80d..d3d3c4b38013 100644 --- a/share/man/man4/vt.4 +++ b/share/man/man4/vt.4 @@ -50,6 +50,7 @@ In .Cd kern.vt.color..rgb="" .Cd kern.vt.fb.default_mode="x" .Cd kern.vt.fb.modes.="x" +.Cd kern.vt.slow_down=" .Cd screen.font="x" .Pp In @@ -266,6 +267,16 @@ It will contain a list of connectors and their associated tunables. This is currently only supported by the .Cm vt_fb backend when it is paired with a KMS video driver. +.It Va kern.vt.slow_down +When debugging the kernel on modern laptops, the screen is often +the only available console, and relevant information will scroll +out of view before it can be captured by eye or camera. +.Pp +Setting +.Va kern.vt.slow_down +to a non-zero number will make console output synchronous (ie: +not dependent on timers and interrupts) and slow it down in proportion +to the number. .It Va screen.font Set this value to the base name of the desired font file located in .Pa /boot/fonts . diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 87020b6e6f19..1be98466112e 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -132,6 +132,9 @@ static VT_SYSCTL_INT(debug, 0, "vt(9) debug level"); static VT_SYSCTL_INT(deadtimer, 15, "Time to wait busy process in VT_PROCESS mode"); static VT_SYSCTL_INT(suspendswitch, 1, "Switch to VT0 before suspend"); +/* Slow down and dont rely on timers and interrupts */ +static VT_SYSCTL_INT(slow_down, 0, "Non-zero make console slower and synchronous."); + /* Allow to disable some keyboard combinations. */ static VT_SYSCTL_INT(kbd_halt, 1, "Enable halt keyboard combination. " "See kbdmap(5) to configure."); @@ -1657,6 +1660,12 @@ vtterm_done(struct terminal *tm) } vd->vd_flags &= ~VDF_SPLASH; vt_flush(vd); + } else if (vt_slow_down > 0) { + int i, j; + for (i = 0; i < vt_slow_down; i++) { + for (j = 0; j < 1000; j++) + vt_flush(vd); + } } else if (!(vd->vd_flags & VDF_ASYNC)) { vt_flush(vd); }