Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux removed {GIO,PIO}_FONTX ioctls #1726

Closed
dankamongmen opened this issue Jun 6, 2021 · 9 comments · Fixed by #1809
Closed

linux removed {GIO,PIO}_FONTX ioctls #1726

dankamongmen opened this issue Jun 6, 2021 · 9 comments · Fixed by #1809
Assignees
Labels
bug Something isn't working
Milestone

Comments

@dankamongmen
Copy link
Owner

Somehow my Linux console got reconfigured using a 16-color, 256-glyph mode. Under this setup, the linuxconsole PoC ceased working. Furthermore, linuxconjammer isn't working in either 256- or 512-glyph mode, drawing an ENOTTY despite having opened /dev/tty directly. Hrmmm.

Despite this, caps-rendered thinks we have quadrant support (i don't even think we have halfblock support), and thus we default to quadblitter, which looks pretty shitty without reprogramming the font.

@dankamongmen dankamongmen added the bug Something isn't working label Jun 6, 2021
@dankamongmen dankamongmen added this to the 3.0.0 milestone Jun 6, 2021
@dankamongmen dankamongmen self-assigned this Jun 6, 2021
@dankamongmen
Copy link
Owner Author

That ENOTTY is coming from the GIO_FONTX ioctl (see console_ioctl(2))

@dankamongmen
Copy link
Owner Author

It looks like GIO_FONTX and PIO_FONTX are no longer present in the 5.12.11 kernel, what the fuck?

[schwarzgerat](0) $ grep -r FONTX linux-5.4.127 linux-5.12.11
linux-5.4.127/drivers/tty/vt/vt_ioctl.c:	case PIO_FONTX:
linux-5.4.127/drivers/tty/vt/vt_ioctl.c:	case GIO_FONTX:
linux-5.4.127/drivers/tty/vt/vt_ioctl.c:	case PIO_FONTX:
linux-5.4.127/drivers/tty/vt/vt_ioctl.c:	case GIO_FONTX:
linux-5.4.127/drivers/tty/vt/vt_ioctl.c:	case PIO_FONTX:
linux-5.4.127/drivers/tty/vt/vt_ioctl.c:	case GIO_FONTX:
linux-5.4.127/drivers/tty/vt/vt_ioctl.c:	case PIO_FONTX:
linux-5.4.127/drivers/tty/vt/vt_ioctl.c:	case GIO_FONTX:
linux-5.4.127/include/uapi/linux/kd.h:#define GIO_FONTX	0x4B6B	/* get font using struct consolefontdesc */
linux-5.4.127/include/uapi/linux/kd.h:#define PIO_FONTX	0x4B6C	/* set font using struct consolefontdesc */
linux-5.12.11/include/uapi/linux/kd.h:#define GIO_FONTX	0x4B6B	/* get font using struct consolefontdesc */
linux-5.12.11/include/uapi/linux/kd.h:#define PIO_FONTX	0x4B6C	/* set font using struct consolefontdesc */
[schwarzgerat](0) $ 

like they're still defined, but no longer present in the implementation....[frown] ANGRY HONK

@dankamongmen
Copy link
Owner Author

son of a bitch!!!

commit ff2047fb755d4415ec3c70ac799889371151796d
Author: Jiri Slaby jirislaby@kernel.org
Date: Tue Jan 5 13:02:35 2021 +0100

vt: drop old FONT ioctls

Drop support for these ioctls:
* PIO_FONT, PIO_FONTX
* GIO_FONT, GIO_FONTX
* PIO_FONTRESET

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

Note that PIO_FONTRESET is defunct on most systems as VGA_CONSOLE is set
on them for ages. That turns on BROKEN_GRAPHICS_PROGRAMS which makes
PIO_FONTRESET just return an error.

We are removing KD_FONT_FLAG_OLD here as it was used only by these
removed ioctls. kd.h header exists both in kernel and uapi headers, so
we can remove the kernel one completely. Everyone includeing kd.h will
now automatically get the uapi one.

There are now unused definitions of the ioctl numbers and "struct
consolefontdesc" in kd.h, but as it is a uapi header, I am not touching
these.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210105120239.28031-8-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

@dankamongmen
Copy link
Owner Author

@dankamongmen dankamongmen changed the title linux console fonts don't get reprogrammed in 256-char mode linux removed {GIO,PIO_FONTX ioctls Jun 22, 2021
@dankamongmen dankamongmen changed the title linux removed {GIO,PIO_FONTX ioctls linux removed {GIO,PIO}_FONTX ioctls Jun 22, 2021
@dankamongmen
Copy link
Owner Author

we're getting data back (and sending quads in) with KDFONTOP now. we need rewrite all the shim_*() functions in linux.c to work with variable widths (they assumed 8), but it's pretty close.

@dankamongmen
Copy link
Owner Author

while we're working on this, we really ought replace all those distinct shim functions with one that works on a 4-bit input

@dankamongmen
Copy link
Owner Author

done, rewrote them all with shim_quad_block().

@dankamongmen
Copy link
Owner Author

ok, this is just about working once more. the one shortcoming i see is that it looks like our plot is going to something much less fine than NCBLIT_8x1, which we now have support for (i restored our lower eighth glyphs). tested with both 256 and 512-entry glyph maps.

@dankamongmen
Copy link
Owner Author

we're now getting the kernel version via uname(2) for termversion. tested, works.

it might be nice to save the original KD_FONT_OP_GET results so we can restore the glyphs on exit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant