5 ms·
Raw graphics output in Linux: Part 2
- Jasper_ 11y agoInstead of using the deprecated /dev/fb interface, you should be using DRM/KMS instead, which has support for modesetting, page flipping, cursors, overlays/planes (including YUV planes), and plenty more. I have a simple toy app that shows how to use the API here: https://github.com/magcius/drmdemo https://github.com/magcius/drmdemo
- voltagex_ 11y agois KMS going to work in VirtualBox without the extensions?
- Jasper_ 11y agoIn VirtualBox without the extensions, I believe we will currently fall back to either VESA or EFI GOP modesetting, neither of which indeed have KMS support yet. There was a patchset to support KMS for simple fb fallbacks, but it hasn't been merged yet. http://cgit.freedesktop.org/~dvdhrm/linux/log/?h=simpledrm http://cgit.freedesktop.org/~dvdhrm/linux/log/?h=simpledrm However, I definitely wouldn't throw out KMS just to support VESA / GOP. They don't support page flipping, so you get lots of tearing. With the extensions, vboxdrv supplies a KMS driver. https://www.virtualbox.org/svn/vbox/trunk/src/VBox/Additions/linux/drm/vboxvideo_drm.c https://www.virtualbox.org/svn/vbox/trunk/src/VBox/Additions...
- stonogo 11y agoI think we have different understandings of "raw video." I have too much hardware unsupported by KMS to regard it as a solution. I have zero hardware that does not support VESA output.
- voltagex_ 11y agoPart 1 is at http://orangejuiceliberationfront.com/raw-graphics-output-on-linux-part-1/ http://orangejuiceliberationfront.com/raw-graphics-output-on... but mostly covers setting up a VM.
- nitrogen 11y agoI'd like to see a trend toward increasing use of raw framebuffers along with the embedded mini-PCs like the RPi, CHIP, Beagle*, etc. At one point in time I worked almost exclusively through the framebuffer console while developing a long-abandoned library to simplify framebuffer development. There are image viewers, PDF viewers, and web browsers that can use the raw framebuffer. I even wrote a basic framebuffer driver for an old HDTV tuner card. There's something very satisfying about building up one's digital reality pixel by pixel, working with graphics as raw arrays of pixels, learning Bresenham's line drawing algorithm, etc. I highly recommend it.
- voltagex_ 11y agoHold on, was the framebuffer for the tuner used for input or output? I'm also very interested in being able to push pixels to the screen "manually".
- nitrogen 11y agoOutput. The tuner was from the era when PCs and GPUs didn't have the horsepower to decode 1080i MPEG-2, so the tuner had to have its own MPEG-2 decoder chip and display driver, with 16MB of RAM. It supported a basic OSD (sort of like hardware sprites) and arbitrary output resolutions, so IIRC I set up the OSD to stretch one of the OSD overlays to the full screen size, and pointed the framebuffer driver at the section of the card's memory assigned to that overlay. Here's an old demo: https://www.youtube.com/watch?v=cDWH7d8pbH0 https://www.youtube.com/watch?v=cDWH7d8pbH0 I never finished getting video input to work, and eventually my reference card was stolen so I never will. Working with the framebuffer is almost as easy as calling mmap() on /dev/fb0 and just writing data. There are ioctls for switching resolutions on drivers that supported it. But it sounds like DRM/KMS is the way to go these days if you aren't running a proprietary GPU driver.