Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: deller@gmx.de, jirislaby@kernel.org, simona@ffwll.ch,
	linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-serial@vger.kernel.org, sashiko-reviews@lists.linux.dev
Subject: Re: [PATCH v2 1/5] vt: Add cursor-size helpers
Date: Wed, 23 Sep 2026 15:30:04 +0200	[thread overview]
Message-ID: <24cf3f9b-bc81-4f55-8ae2-416a2c46b881@suse.de> (raw)
In-Reply-To: <2026092347-try-railroad-7b00@gregkh>

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)



  reply	other threads:[~2026-09-23 13:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 12:29 [PATCH v2 0/5] fbcon,vgacon,vt: Share helpers for text cursors Thomas Zimmermann
2026-09-15 12:29 ` [PATCH v2 1/5] vt: Add cursor-size helpers Thomas Zimmermann
2026-09-15 12:40   ` sashiko-bot
2026-09-23 12:57   ` Greg KH
2026-09-23 13:30     ` Thomas Zimmermann [this message]
2026-09-15 12:29 ` [PATCH v2 2/5] vgacon: Remove trailing whitespaces Thomas Zimmermann
2026-09-15 12:35   ` sashiko-bot
2026-09-15 12:29 ` [PATCH v2 3/5] vgacon: Use vt_cursor_{start,end}() Thomas Zimmermann
2026-09-15 12:39   ` sashiko-bot
2026-09-15 12:29 ` [PATCH v2 4/5] lib/fonts: Add font_glyph_cursor() helper Thomas Zimmermann
2026-09-15 12:40   ` sashiko-bot
2026-09-15 12:29 ` [PATCH v2 5/5] fbcon: Replace fbcon_fill_cursor_mask() with fbcon_cursor_glyph() Thomas Zimmermann
2026-09-15 12:41   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=24cf3f9b-bc81-4f55-8ae2-416a2c46b881@suse.de \
    --to=tzimmermann@suse.de \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=simona@ffwll.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox