Hi
Am 23.09.26 um 14:57 schrieb Greg KH:
[...]
+ * Returns:
+ * The index of the cursor's first scanline within the character cell
+ */
+unsigned int vc_cursor_start(unsigned int cell_height, unsigned int
cursor_size)
+{
+ const unsigned int cursor_default_size =
CUR_SIZE(READ_ONCE(cur_default));
+
+retry:
+ switch (cursor_size) {
+ case CUR_NONE:
+ return cell_height;
+ case CUR_UNDERLINE:
+ if (cell_height < 10)
+ return cell_height - 1;
+ else
+ return cell_height - 3;
+ case CUR_LOWER_THIRD:
+ return cell_height - cell_height / 3;
+ case CUR_LOWER_HALF:
+ return cell_height - cell_height / 2;
+ case CUR_TWO_THIRDS:
+ return cell_height - (cell_height * 2) / 3;
+ case CUR_BLOCK:
+ return 0;
+ default:
+ pr_warn_once("Unknown cursor %u\n", cursor_size);
Can userspace trigger this? If not, who can?
Yes. There's the "vt.cur_default" parameter on the kernel's command line
[1], and apparently there's some escape sequence. [2] The cursor size
is the lowest 4 bits of that value, while
[1] https://elixir.bootlin.com/linux/v7.2.6/source/drivers/tty/vt/vt.c#L167
[2] https://elixir.bootlin.com/linux/v7.2.6/source/drivers/tty/vt/vt.c#L2523
Apart from that, I just noticed that this switch should certainly handle
CUR_DEF without printing a warning.
+ if (cursor_size != cursor_default_size)
+ cursor_size = cursor_default_size;
+ else
+ cursor_size = CUR_UNDERLINE;
Why underline as a default?
This has been the default all along. It is the default value of the
cur_default parameter and picked up by vt when starting up a console.
[3] VGA BIOSes tend to default to underline as well AFAICT. Only the old
cursor code in fbcon falls back to full-size blocks if nothing else
works. Using underline harmonizes behavior across components.
[3] https://elixir.bootlin.com/linux/v7.2.6/source/drivers/tty/vt/vt.c#L2297
Best regards
Thomas
thanks,
greg k-h
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)