Slashdot Mirror


Kmscon Project Seeks To Replace Linux Virtual Terminal

An anonymous reader writes "Phoronix reports on the progress of kmscon, David Herrmann's virtual console project that aims to supersede the Linux kernel's virtual terminal. kmscon takes advantage of modern Linux features such as kernel mode setting, direct rendering, and udev to provide hardware-accelerated rendering, full internationalization, monitor hot-plugging, and proper multi-seat support. A recent blog post by Herrmann addresses some of his frequently heard questions and criticisms about the kmscon project."

47 of 182 comments (clear)

  1. is any of this needed? by Anonymous Coward · · Score: 3, Interesting

    Hardware accelerated rendering for simple text? Why is any of that needed?

    1. Re:is any of this needed? by FranTaylor · · Score: 4, Insightful

      you're aware that the BIOS and the linux boot screen are currently using HARDWARE ACCELERATED RENDERING for SIMPLE TEXT?

      They call it "text mode"

    2. Re:is any of this needed? by JabberWokky · · Score: 4, Informative

      Because monitors aren't VGA anymore. We now have small laptops with 2880x1880 screens built in that are plugged into multiple monitors. If you want to drive that at a snappy response, or if you want to select a primary monitor and switch between them, you should take advantage of the hardware.

      Heck, a simple one: I have a laptop with a dead built-in monitor. I use an external monitor, which works fine with X, but the console is on the internal screen.

      --
      "$30 for the One True Ring. $10 each additional ring!" -- JRR "Bob" Tolkien
    3. Re:is any of this needed? by broken_chaos · · Score: 4, Interesting

      Framebuffer consoles are (or were), in some cases, surprisingly slow. Huge amounts of output at least used to overwhelm them, only catching up if you swapped back and forth between VTs -- this didn't happen in non-framebuffer consoles or in terminal emulators in X.

      I think it has improved significantly over the past few years, but that's probably partly from already working some hardware-accelerated rendering into some of the framebuffer console drivers. Though I'm not sure why they're not just working on improving the framebuffer drivers further -- the project seems to aim to put every damn piece into userspace, which seems like a terrible idea for something so essential as the basic console. If you break one of the things it depends on (such as xkb -- yes, really, a piece of X11 for a console system), then you lose any ability to interact with your system, or even view the boot output.

      I'm really not sure who it's aimed at. If you break your install and you don't have an old kernel-based VT fallback, you're screwed. If you don't break it and it works fine, what benefit is it? You'll more than likely just be starting up X11 momentarily anyway.

    4. Re:is any of this needed? by FranTaylor · · Score: 4, Informative

      no it is worse

      text mode performance is unimportant to graphics vendors, they do the bare minimum to make it work, they don't lift a finger to make it faster.

      nursing the dynamic data flow to potentially slow I/O devices (like USB displays) is a job for user space. Data is queued to be sent to the device for display but it might be modified while in the queue by graphics events. You don't want to put this stuff in the kernel.

      you are actually making good arguments to remove this functionality from the kernel

      you don't lose the ability to interact with your system or view the boot output, if you have SSH enabled, or if you dump the log messages to the serial port.

      embedded people have been working on screenless systems for years, they are not necessary for interacting with the computer. There are plenty of other ways.

    5. Re:is any of this needed? by h4rr4r · · Score: 3, Insightful

      That is why real operating systems all have a serial console. Be glad for that.

    6. Re:is any of this needed? by gman003 · · Score: 5, Insightful

      If you read the article (or was it the blog post?), you'll find answers.

      First, kmscon has only one dependency - libudev. It can be compiled to use Pango for font rendering, or EGL for hardware-accelerated rendering, but those are optional. X11 is never used.

      Second, the rationale for putting this in userspace was mainly for internationalization. In particular, some character tables (for Asian languages, especially) can be rather large. If it was in the kernel, that memory could not be swapped out. In userspace, you can.

      Third, this seems aimed at regular console users, not primarily-X-users-that-use-a-terminal. There are plenty of good X11 terminal emulators (and just as many bad ones). This is aimed at people who don't need (or at least, don't want) X, but still want to use all the features of modern hardware. It also claims to interact well with both the kernel VT system, and with X - you can keep an X session on one virtual screen, keep the kernel terminal on another (for those few cases where it is needed, like kernel error messages), and put kmscon on the rest.

      I will probably try this out, because I at least used to fit into that group of regular console users. I have on several occasions run out of virtual terminals. I'm not so much of one anymore, but maybe this will get me back into it.

    7. Re:is any of this needed? by jellomizer · · Score: 3, Interesting

      I remember a while back, (Like a decade or so) I did some simple benchmark tests.
      In essence display all the numbers from 1 to 1,000,000
      And depending on the video Card, this program would run faster in X-Windows or just in Text Mode.

      Most new video cards have the performance in the GUI stuff, and not much work in making text mode faster. So I would expect with hardeare acceleration rendering for simple text you may be able to see a major speed improvement noticeable in application that blurt out data to the screen (Such application that blurt are normally meant to be piped to an other app for better detail, But sometime we just let it run... That I/O is slowing down the application running speed.

      That said what I would really like to see out of a Frame Buffer Text Mode is better support for other terminal types. No longer restricted to the BIOS text rules. We can emulate other formats such as the higher number VT that allows for different font sizes on the same screen (well wide, narrow, and normal). Form based Terminal Emulation such at 3270.

      I am not dissing the command line, I really like it, but PC Text mode is an ancient fossil now that need to be gone.

      --
      If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    8. Re:is any of this needed? by Nimey · · Score: 3, Informative

      Hah. Going straight to BIOS was actually faster than using the DOS API. What you'd do for speed was use something like ANSI.SYS (or NNANSI.COM) or just write your own video driver, but that last wasn't exactly being a good neighbor.

      --
      Hail Eris, full of mischief...

      E pluribus sanguinem
    9. Re:is any of this needed? by FranTaylor · · Score: 3, Informative

      compatibility issues are you kidding

      your video card boots up in EGA text mode

      every video card has done the same for decades now

    10. Re:is any of this needed? by snemarch · · Score: 2

      ...at very limited resolutions (yes, there's the extended VGA text modes, but those are still limited and look horrible), with limited character sets, and either display cloned across all connected monitors, or limited to a single monitor output.

      80x50 textmode is perfectly fine for me, but other people might have different needs... and the unaccelerated framebuffer modes are definitely horribly slow.

      --
      Coffee-driven development.
    11. Re:is any of this needed? by TheCarp · · Score: 4, Interesting

      Totally unrelated... except to show how relative a term "slow" can be.

      This reminds me of reading the docs for a Perl DNS module once when I was writting an internal app that needed to do a lot of DNS lookups. The docs said it was "pure perl" and "slow". So, if the docs said it was slow....I figured I would use the system resolver instead.

      I wrote my app, came to test it.... and DOSd my own system as my program began trying to slam the system resolver with 6 parallel workers (batch resolving IPs based on logs)...each of which had to open several files (nsswitch.conf, hosts, hosts.allow, resolv.conf.....and I think a few others if memory servers) for EACH LOOKUP.... my poor system was no match for it (this was back in the single core days)

      I switched to the "slow" dns module, and maybe it was slow by some standards, but compared to the system resolver...it was lightweight and fast.

      "Slow" is always a relative term.

      --
      "I opened my eyes, and everything went dark again"
    12. Re:is any of this needed? by VortexCortex · · Score: 2

      That said what I would really like to see out of a Frame Buffer Text Mode is better support for other terminal types. No longer restricted to the BIOS text rules. We can emulate other formats such as the higher number VT that allows for different font sizes on the same screen (well wide, narrow, and normal). Form based Terminal Emulation such at 3270.

      So, basically you want GUI features without having a GUI system. Graphical changes: Wide, Narrow, Normal. My video game has a terminal emulator that's fully hardware accelerated -- It can even use 3D "glyphs". What we really need is just OpenGL without X11. Gimme that at boot: standardised API to low level GPU stuff. That's all we really need. Canonical is going in that direction... Textmode is essentially a fallback mode for when shit hits the fan. If you're using a server, connect via SSH or serial on another machine. If you're using it as a desktop machine, then use a damn desktop rendering system. If that's too heavyweight, the answer isn't to make a special purpose low level textmode rendering system, the answer is to make the rendering pipeline lightweight.

      I can give you a multi font hardware accelerated terminal emulator with full Unicode support, but what I need is a way to throw textures and polygons on the screen -- NOT YET ANOTHER TEXT API.

    13. Re:is any of this needed? by snemarch · · Score: 2

      "wasn't exactly being a good neighbor"? That's the way you did stuff under DOS, and it was just fine in those days. It was a single-tasking environment, and writing directly to the 0xB800 segment when you needed fast textmode operations was just fine. ANSI.SYS was slow as hell compared to handling ANSI escape sequences yourself - even if you resorted to BIOS character output routines and not doing direct 0xB800 access... But since redirecting ANSI escape codes to files often didn't make sense, it made more sense doing direct access. Not everybody had the luxury of affording one of those insanely fast 80386 processors ;)

      --
      Coffee-driven development.
    14. Re:is any of this needed? by Barefoot+Monkey · · Score: 2

      Triggering a separate interrupt for individual characters was the slow way of rendering text. There's the overhead of the IRQ jump itself, handling cursor movement, window wrapping, scrolling - all that is OK if done once for a batch of characters but too much work when repeated for each character. Most programs used DOS or BIOS calls to print out strings of text at a time. Those occasional programs that had need to twiddle random characters on the screen would edit segment $B800 directly. Whether using BIOS, DOS or the text buffer, you're still using text mode. And believe me - it was much faster just setting the byte for a character and letting the hardware figure it out than plotting the pixels for the text in software. That's what text mode was - hardware-accelerated graphics that increased speed and reduced memory usage at the expense of limiting you to a set of pre-defined characters always arranged in a grid. There weren't compatibility issues because the protocol (the location and format of the text buffer in segment $B800) was kept sufficiently consistent from CGA to EGA to VGA.

    15. Re:is any of this needed? by broken_chaos · · Score: 3, Interesting

      First, kmscon has only one dependency - libudev. It can be compiled to use Pango for font rendering, or EGL for hardware-accelerated rendering, but those are optional. X11 is never used.

      Looking into the source briefly suggests it actually doesn't have a hard dependency on udev, but has optional dependencies on: systemd, udev, dbus, libdrm, gbm, egl (mesa), glesv2 (mesa), xkbcommon (a part of X11), freetype2, and pango. This means if you don't intentionally build it with the minimal of requirements (presumably making it no richer in features than the default VT system), it would be linked against all those and break if any of them broke during an upgrade or for any other reason.

      This is aimed at people who don't need (or at least, don't want) X, but still want to use all the features of modern hardware.

      This seems like a niche-of-a-niche market, so to speak. I greatly prefer terminal applications, but I always run them under X (using a minimal window manager, etc.) so that I have access to more complex things like PDF viewing or web browsing (beyond links) when needed.

      It also claims to interact well with both the kernel VT system, and with X - you can keep an X session on one virtual screen, keep the kernel terminal on another (for those few cases where it is needed, like kernel error messages), and put kmscon on the rest.

      Ah, I guess the Slashdot, Phoronix, and author's blog posts are a bit sensationalist, then -- all three of them make repeated references to completely replacing the standard kernel VT system, including the author recommending disabling CONFIG_VT entirely.

    16. Re:is any of this needed? by Nimey · · Score: 2

      It was, but if you had a TSR, device driver, or possibly a memory manager that expected things to be a certain way then you could cause trouble by not going through the proper channels.

      IIRC one of the reasons why WordPerfect was so popular was its speed, and it got this way by getting keyboard input straight from the 8042 keyboard controller. If you had too many programs in memory (EMM386, maybe one or two other types) that also read keyboard input directly and then passed it through, you'd get random characters in your WP document. Other word processors that went through DOS or BIOS didn't have that problem, but weren't as fast.

      --
      Hail Eris, full of mischief...

      E pluribus sanguinem
    17. Re:is any of this needed? by Miamicanes · · Score: 4, Informative

      > and how many real laptops have serial ports these days?

      Don't remind me. Two weeks ago, I spent the better part of a day troubleshooting a nonexistent bug in an embedded hardware project that was caused by a malfunctioning USB virtual fucking serial port on the computer I was using to view the debugging info I was outputting to the MCU's serial port.

      Now I know why so many guys have built their own serial terminals with a 4x20 LCD and a microcontroller. It's the only way left to reliably and infallably render serial input straight to a display without risking stupid errors caused by Windows or its USB subsystem.

      When you're dealing with bare metal embedded hardware, USB anywhere along the signal chain really sucks.

    18. Re:is any of this needed? by raster · · Score: 4, Insightful

      this has nothing to do with gfx vendors by is piss-poor text mode EMULATION inside the kernel. your "text mode" console is actually graphics mode and emulated to be text by the kernel splatting out pixels that look like text chars - just like x does (and x apps).

      it's piss-poor at this because it's poor unoptimized code that does some royally stupid things.

      1. "blit" (copy region) to scroll 1 line at a time... and this ends up being almost always done by your cpu.
      2. this blit will be done by cpu to/from video memory which often is on a discrete video card across a pcie bus or such
      3. writes across this bus are fast, but reads can be in the order of just 10mb/sec. it's piss-poor at reads.
      4. the kernel text console doesn't try and play catch-up and scroll multiple lines at a time. it scrolls 1 line at a time thus making the overhead of copying enforced per line scrolled, as opposed to internally skipping a bunch of lines and drawing 2, 5, 20 new lines and copying up only those that are not new.

      it's entirely poorly performing because of poor kernel code. how poorly performing? well.

      i recently decided to write a terminal emulator (for x). of course i went and used a toolkit i knew to help, and it so happens this toolkit can automatically work in the linux framebuffer just like it does in x11. it can use opengl, but doesn't need it and works fine on a dumb fbcon text console. so i now have the EXACT same terminal in bot x11 and fbcon. hell it even manages to provide me a mouse pointer in fbcon as it detects it's in fb and the toolkit emulates one itself. it looks the same pixel-for-pixel too. so i did some performance comparisons of it in fbcon vs kernel text console. it clocks in at being 55 TIMES faster than the kernel. 55 TIMES. that's how poor the kernel is. going through scads of toolkit layers and abstractions, code to alpha blend the text on top of backgrounds, blend and scale lighting overlays and more... and its still clocking in at 55 TIMES faster. (it happens to run at about the same speed in x11 - on the same machine).

      it's not fast because it's amazing code or i'm a genius at all - it's fast because it just is NOT being royally stupid, which is what the kernel text console emulation is.

      personally i was quite happy to know my terminal works both in x and in fb.. so if'm i'm ever stuck there.. i can use it and not be 100% grumpy that my text console is piss-slow anymore.

      --
      --------------- Codito, ergo sum - "I code, therefore I am" --------------------
    19. Re:is any of this needed? by epyT-R · · Score: 2

      Real text mode is quite fast because all the kernel has to do is push bytes at an IO port and the video card takes care of the rest. The framebuffer is slow because there is no way to accelerate blitting without interfering with the X11 driver. There are drivers in the kernel that offer partial acceleration, but because of this limitation they aren't used much. It might be possible to alleviate some of this with sse-enhanced routines, but in the end, spamming the console in framebuffer mode would still seriously impact performance of the rest of the machine, say during a software build or 'tail -f' on a fast moving log.

    20. Re:is any of this needed? by Zontar+The+Mindless · · Score: 2

      and how many real laptops have serial ports these days?

      Mine does, and it's less than 4 months old. (It also has USB and HDMI.)

      --
      Il n'y a pas de Planet B.
    21. Re:is any of this needed? by galanom · · Score: 2

      The fastest way to print text in DOS is to write directly to the VGA video memory at B800:0000

  2. Attention Distros by Anonymous Coward · · Score: 2, Interesting

    Please don't take this as an excuse to default the console to anything other than 80x24. Not only is it annoying, but when arch went to this default, I struggled for days trying to figure out how to undo it. I finally did, but a month later it somehow reverted.

    Please don't do that. Thanks.

    1. Re:Attention Distros by the_B0fh · · Score: 4, Insightful

      OTOH, please make it configurable to have a default of other than 80x24. Back in the days of 9" terminals, 80x24 is great. Today, when I have a 20" monitor attached, capable of displaying 1600x1280, please let me display more lines and columns.

    2. Re:Attention Distros by ciggieposeur · · Score: 3, Insightful

      Don't you mean 80x25?

      80x24 is vt100, xterm, and friends.

      80x25 is CGA/EGA/VGA.

    3. Re:Attention Distros by Nimey · · Score: 4, Interesting

      Have you ever used 80x24 on a 22" monitor with 1680x1050 native res? The letters are so huge as to be unreadable. Ubuntu et al handle it correctly by letting the X driver do KMS to the native res, which carries over to the console.

      I'd be happy with defaulting to whatever the video hardware can handle and then having an easy way to configure it for other resolutions.

      --
      Hail Eris, full of mischief...

      E pluribus sanguinem
    4. Re:Attention Distros by WaywardGeek · · Score: 2

      Also, please don't take away the consoles as they work now without making sure there's a compatible screen reader available that will read the console boot messages in real time. There are a number of blind sys admins who would be out of a job if they could not hear boot messages during boot. A user space console could be a good thing, but if it harms this small tech community, overall it would be a very bad thing.

      --
      Celebrate failure, and then learn from it - Nolan Bushnell
    5. Re:Attention Distros by the_B0fh · · Score: 2

      If you want anything more than 9600 baud, go back to the 1980s.

    6. Re:Attention Distros by randomencounter · · Score: 2

      Sometimes you have a need for a minimal terminal interface.

      For me it's usually because I managed to break X playing with new drivers (again!) and I need something to fix it in.

      So I should be crippled to 80x24 while I do that when better could be available?

      --
      Forget diamonds, copyright is forever.
    7. Re:Attention Distros by snemarch · · Score: 3, Informative

      You're right - the default textmode when booting an x86 system "since pretty much forever" is 80x25, BIOS video mode 3.. A lot of distros are evil and change to other textmodes, or framebuffer modes, without asking you, though.

      --
      Coffee-driven development.
    8. Re:Attention Distros by epyT-R · · Score: 2

      in character mode, the kernel command line 'vga' can alter the mode. to get a list of available modes use vga=?
      0 is 80x25
      1 is 80x50 which is what I use..
      the rest of the list will depend on what modes your card supports. I've been doing this since the 1990s, so it's been around a long time.

      Alternatively, you can use setfont alt-8x8 (or some other 8x8 font) to get a similar effect. This also works in framebuffer consoles.

  3. Re:What's proper multi-seat support? by Anonymous Coward · · Score: 5, Informative

    Dumb question, but what do they mean by proper multi-seat support?

    http://www.x.org/wiki/Development/Documentation/Multiseat

    > Multiseat is a model of computing that supports multiple local users using their sessions in a totally independent way. This looks quite similar to the old mainframe computer model, but with the "terminals" connected directly to single PC box. There's a lot of people that use and sell multiseat Linux systems due its low cost which qualifies it as a wonderful "techno-social" model of computing.

  4. Re:What's proper multi-seat support? by fuzzyfuzzyfungus · · Score: 2

    A 'multiseat' setup(in the contemporary sense) takes advantage of the fact that putting a decent number of video outs on a single computer is cheaper than ever, and the number of USB HID and/or sound devices you can support is pretty large, and puts multiple independent monitor/keyboard/mouse users on a single host system.

    I haven't had the... pleasure... of testing this myself; but I assume that non-X display scenarios, including virtual terminals, are painfully graceless under such a scheme. Certainly, all the multi-head systems I've used do something brutally ugly during the BIOS display, something slightly less ugly(generally at least mirroring) on GRUB, and don't actually start working properly until X is up and going.

  5. Kernel Mode Setting by andydread · · Score: 3, Insightful

    Does this mean that when KMS is broken on "insert graphics card of the month here" I won't be able to get to the console? ooo nooo...

    1. Re:Kernel Mode Setting by gman003 · · Score: 2

      Then just don't use it. Nobody is trying to make this replace the Linux kernel console, much in the same way nobody is trying to make Emacs replace ed.

    2. Re:Kernel Mode Setting by Eravnrekaree · · Score: 2

      You make a good point, users absolutely should be able to use the consoles as they are now, without all of this KMS, DRI junk that is dependant on specific video card. As has been said, one of the great uses of the consoles has been able to get a command prompt without a video card driver loaded and if the video card drivers are not working properly. The console is meant to provide a text based interface, and all you need for that is to call some VGA BIOS calls, no need for all of these complex video drivers. If you want graphics, fonts and all of that, load X. This kmscon is not going to save you much RAM considering that X itself uses only a few megabytes and you can use a lightweight window manager that uses a few MB. What we see going on here is a terrible idea. This project should NOT be be placed into the standard linux kernel. It makes it harder to get to a BIOS video fallback if the video card drivers are not working, and needlessly duplicates functionality already provided by X.

      There is no need for this project and its really amazing people are wasting time on this.

  6. Dear god no by sl4shd0rk · · Score: 3, Insightful

    I switched to Ubuntu a number of years ago and could never forgive them for trying to hide all the startup info from the console. It's become even more egregious with grub2 parameters/configuration, kernel video modes, even the old faithful boot command "linux single" no longer works to get to a console screen to fix something.

    I don't know how many other distros have adopted this "windows mania" to run everything from gui but for the love of god, leave the console alone. It's the only thing that works anymore when nothing else (emergency sync, boot, etc).

    --
    Join the Slashcott! Feb 10 thru Feb 17!
    1. Re:Dear god no by gstoddart · · Score: 2

      Why would I need one? The virtual console and safe mode have always given me this ability.

      Having a serial terminal laying around to work on your Linux box in case something goes wrong seems like a giant leap backwards ... unless you have some fetish for old TTY devices. :-P

      Sometimes, you need the lowest possible denominator in order to be able to do these things.

      --
      Lost at C:>. Found at C.
    2. Re:Dear god no by h4rr4r · · Score: 2

      Not even the Universal Serial Bus type?

      I thought those were pretty Universal.

    3. Re:Dear god no by skids · · Score: 2

      USB serial dongles make horrible debug ports when trying to debug, for example, udev problems, or capture early messages from the kernel (the USB system takes a very long time to come up, and though you can cache debug message these days, there's no guarantee the kernel will make it all the way to the point of spitting them out before it abends.) The whole reason serial debug ports are effective is because you turn them on at kernel boot and they just sit there running at the kernel level. If you have to plug it in and hope that it gets properly initialized after the fact, you are only going to succeed with that part of the time. If you further need materials from userspace to initialize your console, the odds decrease substantially.

      With rs232 ports disappearing from laptops, that basically leaves good old vgacon/fbcon as the most reliable way to deal with early boot problems. Which means it will pretty much always have to be compiled into the kernel when you have video hardware, unless you are an end user who wouldn't know what oriface to put a debug log into in the first place.

  7. A Real console by stox · · Score: 3, Insightful

    is a Teletype ASR-33 hanging off the serial port.

    --
    "To those who are overly cautious, everything is impossible. "
    1. Re:A Real console by FranTaylor · · Score: 2

      you're wrong

      just put the serial params on the boot command line

      every linux I've tried works fine with a serial console

      you will need to pxe boot or burn your own boot media to get the params there in the first place

  8. Re:What's proper multi-seat support? by FranTaylor · · Score: 4, Informative

    In principle, or in fact?

    I've had a multi-seat linux system for many years

    Fedora 17 documentation:

    For the first time Fedora 17 provides completely automatic multi-seat configuration.
    To use this feature, simply plug in a USB dock such as the Plugable Docking Station, with a monitor, mouse and keyboard, and a new desktop appears.

    I would be delirious with joy.

    well I guess I just made your day

  9. RTFM by FranTaylor · · Score: 3, Informative

    edit the boot parameters, remove "quiet" and replace with "nosplash debug"

    is it really THAT hard???

  10. Re:Userspace? by Lussarn · · Score: 4, Funny

    Thats already possible..

    cat image.jpg

    I don't even see the code. All I see is blonde, brunette, redhead..

  11. Finally! by ilsaloving · · Score: 3, Funny

    I can't wait to see vi rendered in 32-bit photorealistic glory!

  12. That application is easier by dbIII · · Score: 2

    You don't need full multiseat for that since you're only using one mouse+keyboard at a time. Just plug everything in and set the screens to be independant instead of twinview or xinerama. If you use panels or whatever put them on both screens. If you sit down at one screen and the mouse pointer is on the other one, no problem, just move the mouse pointer until you can see it. I use that sort of setup with a bluetooth keyboard+mouse in front of the TV across the hall, with the TV working as a monitor by HDMI.
    With a nvidia card and their nvidia-settings GUI tool it took less than ten seconds in total to configure the screens.