linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* why were GIO_FONTX/PIO_FONTX dropped? i was using them
@ 2021-06-22  7:18 nick black
  2021-06-22 10:40 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: nick black @ 2021-06-22  7:18 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Greg Kroah-Hartman, Maciej W. Rozycki, Linus Torvalds, linux-kernel

Jiri et al,

I'm the author of Notcurses, a library for "blingful terminal
UIs". As part of this, I was using the GIO_FONTX and PIO_FONTX
ioctl()s to reprogram the Linux console fonts. I proposed this
functionality on 2019-12-22 in Notcurses bug #201:

 https://github.com/dankamongmen/notcurses/issues/201

On 2020-05-13, I began using these two ioctls (along with their
_UNIMAP equivalents), as documented in console_ioctl(2), to
recover the font, scan it for Unicode block- and line-drawing
characters, and add them if absent:

 https://github.com/dankamongmen/notcurses/pull/795/files
 https://github.com/dankamongmen/notcurses/pull/794/files

some happy initial results were saved for posterity; i've
reproduced them here:

 https://nick-black.com/images/you-stole-my-ioctls.jpg

this worked perfectly, and I extended my Quadblitter to it, and
cheerfully considered this a completed feature. You can see the
results in this video from September 2020. it starts at 192s in,
though you ought just watch the whole thing because it's
awesome [0]:

 https://www.youtube.com/watch?v=cYhZ7myXyyg&t=192s

How sad, then, when a few weeks back I noticed that this
working code was no longer working on newer kernels:

 https://github.com/dankamongmen/notcurses/issues/1726

I assumed it was my bug, having heard something over the years
of Linux's commitment to APIs and not breaking working code. but
today i went through the console_ioctl(2) man page (2017-09-15),
and my code, and strace, and finally the kbd 2.3.3 source, where
i found out about KDFONTOP. ok, but why weren't FONTX working?
then i found ff2047fb755d4415ec3c70ac799889371151796d:

 "As was demonstrated by commit 90bfdeef83f1 (tty: make FONTX ioctl use
  the tty pointer they were actually passed), these ioctls are not used
  from userspace, as:
  1) they used to be broken (set up font on current console, not the open
     one) and racy (before the commit above)
  2) KDFONTOP ioctl is used for years instead"
    
as hopefully demonstrated here, they *were* used from userspace.
i'm happy to move to KDFONTOP (since it doesn't appear to be in
the 5.11 man pages, maybe i'll write it up), but this was
somewhat rude, and maybe the ioctls weren't as broken as you
think?

also, i notice the definitions weren't removed. if no userspace
was using them, they could have been, right? that would have
been better than the ioctl()s mysteriously failing with ENOTTY.

i'll go ahead and switch to KDFONTOP, and send in a patch for
the man page. hack on! and watch out for we little poeple =].

--nick

[0] just kidding, that one's old. check this out:
    
    https://www.youtube.com/watch?v=dcjkezf1ARY
   
    or if you hate youtube,

    https://notcurses.com/notcurses-3-the-saga-continues.m4v

-- 
nick black -=- https://www.nick-black.com
to make an apple pie from scratch,
you need first invent a universe.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: why were GIO_FONTX/PIO_FONTX dropped? i was using them
  2021-06-22  7:18 why were GIO_FONTX/PIO_FONTX dropped? i was using them nick black
@ 2021-06-22 10:40 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2021-06-22 10:40 UTC (permalink / raw)
  To: nick black; +Cc: Jiri Slaby, Maciej W. Rozycki, Linus Torvalds, linux-kernel

On Tue, Jun 22, 2021 at 03:18:28AM -0400, nick black wrote:
> Jiri et al,
> 
> I'm the author of Notcurses, a library for "blingful terminal
> UIs". As part of this, I was using the GIO_FONTX and PIO_FONTX
> ioctl()s to reprogram the Linux console fonts. I proposed this
> functionality on 2019-12-22 in Notcurses bug #201:
> 
>  https://github.com/dankamongmen/notcurses/issues/201
> 
> On 2020-05-13, I began using these two ioctls (along with their
> _UNIMAP equivalents), as documented in console_ioctl(2), to
> recover the font, scan it for Unicode block- and line-drawing
> characters, and add them if absent:
> 
>  https://github.com/dankamongmen/notcurses/pull/795/files
>  https://github.com/dankamongmen/notcurses/pull/794/files
> 
> some happy initial results were saved for posterity; i've
> reproduced them here:
> 
>  https://nick-black.com/images/you-stole-my-ioctls.jpg
> 
> this worked perfectly, and I extended my Quadblitter to it, and
> cheerfully considered this a completed feature. You can see the
> results in this video from September 2020. it starts at 192s in,
> though you ought just watch the whole thing because it's
> awesome [0]:
> 
>  https://www.youtube.com/watch?v=cYhZ7myXyyg&t=192s
> 
> How sad, then, when a few weeks back I noticed that this
> working code was no longer working on newer kernels:
> 
>  https://github.com/dankamongmen/notcurses/issues/1726
> 
> I assumed it was my bug, having heard something over the years
> of Linux's commitment to APIs and not breaking working code. but
> today i went through the console_ioctl(2) man page (2017-09-15),
> and my code, and strace, and finally the kbd 2.3.3 source, where
> i found out about KDFONTOP. ok, but why weren't FONTX working?
> then i found ff2047fb755d4415ec3c70ac799889371151796d:
> 
>  "As was demonstrated by commit 90bfdeef83f1 (tty: make FONTX ioctl use
>   the tty pointer they were actually passed), these ioctls are not used
>   from userspace, as:
>   1) they used to be broken (set up font on current console, not the open
>      one) and racy (before the commit above)
>   2) KDFONTOP ioctl is used for years instead"
>     
> as hopefully demonstrated here, they *were* used from userspace.
> i'm happy to move to KDFONTOP (since it doesn't appear to be in
> the 5.11 man pages, maybe i'll write it up), but this was
> somewhat rude, and maybe the ioctls weren't as broken as you
> think?

They were still quite broken and racy and given that we could not find
any users in our search, we felt it was safe to remove them.

As you say, moving to KDFONTOP works, that's great, all is well, sorry
for breaking the existing code you had, but part of removing things is
seeing if there are valid users that can not change.  Sorry for missing
your usages.

> also, i notice the definitions weren't removed. if no userspace
> was using them, they could have been, right? that would have
> been better than the ioctl()s mysteriously failing with ENOTTY.

We can remove them, want to send a patch to do so?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-22 10:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22  7:18 why were GIO_FONTX/PIO_FONTX dropped? i was using them nick black
2021-06-22 10:40 ` Greg Kroah-Hartman

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).