linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Pitre <nicolas.pitre@linaro.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Dave Mielke <Dave@mielke.cc>,
	Samuel Thibault <samuel.thibault@ens-lyon.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/4] have the vt console preserve unicode characters
Date: Sun, 17 Jun 2018 15:07:02 -0400	[thread overview]
Message-ID: <20180617190706.14614-1-nicolas.pitre@linaro.org> (raw)

The vt code translates UTF-8 strings into glyph index values and stores
those glyph values directly in the screen buffer. Because there can only
be at most 512 glyphs, it is impossible to represent most unicode
characters, in which case a default glyph (often '?') is displayed
instead. The original unicode value is then lost.

This also means that the /dev/vcs* devices only provide user space with
glyph index values, and then user applications must get hold of the
unicode-to-glyph table the kernel is using in order to back-translate
those into actual characters. It is not possible to get back the original
unicode value when multiple unicode characters map to the same glyph,
especially for the vast majority that maps to the default replacement
glyph.

The 512-glyph limitation is inherent to VGA displays, but users of
/dev/vcs* shouldn't have to be restricted to a narrow unicode space from
lossy screen content because of that. This is especially true for
accessibility applications such as BRLTTY that rely on /dev/vcs to rander
screen content onto braille terminals.

This patch series introduces unicode support to /dev/vcs* devices,
allowing full unicode access from userspace to the vt console which
can, amongst other purposes, appropriately translate actual unicode
screen content into braille. Memory is allocated, and possible CPU
overhead introduced, only if /dev/vcsu is read at least once.

I'm a prime user of this feature, as well as the BRLTTY maintainer Dave Mielke
who implemented support for this in BRLTTY. There is therefore a vested
interest in maintaining this feature as necessary. And this received
extensive testing as well at this point.

Patch #4 was used for validation and is included for completeness, however
if people think it is unappropriate for mainline then it can be dropped.

This is also available on top of v4.18-rc1 here:

  git://git.linaro.org/people/nicolas.pitre/linux vt-unicode

Changes from v1:

- Rebased to v4.18-rc1.
- Dropped first patch (now in mainline as commit 4b4ecd9cb8).
- Removed a printk instance from an error path easily triggerable
  from user space.
- Minor cleanup.

Diffstat:

 drivers/tty/vt/vc_screen.c     |  90 +++++++--
 drivers/tty/vt/vt.c            | 347 +++++++++++++++++++++++++++++++++--
 include/linux/console_struct.h |   2 +
 include/linux/selection.h      |   5 +
 4 files changed, 419 insertions(+), 25 deletions(-)


             reply	other threads:[~2018-06-17 19:07 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-17 19:07 Nicolas Pitre [this message]
2018-06-17 19:07 ` [PATCH v2 1/4] vt: preserve unicode values corresponding to screen characters Nicolas Pitre
2018-06-17 22:59   ` valdis.kletnieks
2018-06-17 23:17     ` Nicolas Pitre
2018-06-17 23:23       ` valdis.kletnieks
2018-06-17 19:07 ` [PATCH v2 2/4] vt: introduce unicode mode for /dev/vcs Nicolas Pitre
2018-06-17 19:07 ` [PATCH v2 3/4] vt: unicode fallback for scrollback Nicolas Pitre
2018-06-17 19:07 ` [PATCH v2 4/4] vt: coherence validation code for the unicode screen buffer Nicolas Pitre
2018-06-18 22:01   ` Andy Shevchenko
2018-06-19  1:50     ` Nicolas Pitre
2018-06-19  4:52       ` Joe Perches
2018-06-19 12:14         ` Nicolas Pitre
2018-06-19 13:09 ` [PATCH v2 0/4] have the vt console preserve unicode characters Adam Borowski
2018-06-19 13:52   ` Dave Mielke
2018-06-19 15:14     ` Adam Borowski
2018-06-19 15:30       ` Dave Mielke
2018-06-19 15:34   ` Nicolas Pitre
2018-06-21  1:43     ` Adam Borowski
2018-06-21  2:21       ` Dave Mielke
2018-06-21  3:03         ` Nicolas Pitre
2018-06-22  1:54         ` Adam Borowski
2018-06-22  6:41           ` Samuel Thibault
2018-06-22 15:59           ` Alan Cox
2018-06-22 16:28             ` Nicolas Pitre
2018-06-22 17:51               ` Alan Cox
2018-06-21  2:59       ` Nicolas Pitre
2018-06-25  0:33         ` Adam Borowski

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=20180617190706.14614-1-nicolas.pitre@linaro.org \
    --to=nicolas.pitre@linaro.org \
    --cc=Dave@mielke.cc \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samuel.thibault@ens-lyon.org \
    /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;
as well as URLs for NNTP newsgroup(s).