Writing to the Framebuffer
seenaburns.com
seenaburns.com
[0] https://github.com/torvalds/linux/blob/master/drivers/gpu/dr...
For instance one thing I have been working on is a library that allows writing to and partially refreshing an EInk display with low latency enabling this[0].
I am curious what would happen if I got xorg working on this and used an additional application to call the `refresh` ioctl so that the changes get displayed on the screen.
The GitHub project: https://www.github.com/canselcik/libremarkable
Would be a great work machine outside during summer time.
Post it until it gets to the front page, waiting a couple of days or more between each time you post it.
For example, echo "foo" | sudo tee /path/to/file
or any of the other ways listed here: https://stackoverflow.com/questions/82256/how-do-i-use-sudo-...
EDIT: it says so in TFA. Oops!
You can (and should if you are writing software not only for yourself) ask the kernel about the framebuffer layout using FBIOGET_FSCREENINFO and FBIOGET_VSCREENINFO ioctls.
GPUs can actually scan to a display from multiple overlapping framebuffers in different resolutions and color formats in the same time. Alpha blending and rotations are often supported as well.
A bit like a very large mouse cursor. In a way, mouse cursors are also framebuffers. Or like hardware video layers in the nineties.
We like abstractions.
This is also how early SLI worked: each GPU has a framebuffer, one holding the "even" scanlines and one holding the "odd" scanlines. Each GPU does its own rendering work to its own framebuffer, each rendering a vertically-squashed scene, with one scene offset by one pixel vertically. The master GPU then interleaves the two framebuffers together (pulling data from the slave GPU's framebuffer over the SLI link) when outputting a field.
If you ever wondered why some old Youtube video looked like crap and has lines that don't match up, interleaving was why.
Not sure if it's still the case but back in the ICS days your status bar, wallpaper and launcher/app were all separate surfaces that were scanned out from different frame buffers.
If you want a really fast framebuffer system, get something like an old Nvidia 7600GT and use 'nvidiafb'; while this won't work with X at the same time, it's blazingly fast and gives brilliant console text output (modern GPUs are super-slow by comparison).
[0] https://www.kernel.org/doc/Documentation/fb/framebuffer.txt
I was not using Compiz or something like this so it cannot be explained with the lack of 3D acceleration.
Also, with generic VGA driver you cannot have 100Hz frame rate on high resolutions.
Maybe it's just me but I have the impression that drawing arbitrary things on screen has become harder since then.
Is it possible to get the GPU to copy kernel / system memory to the framebuffer, then read that back with user space app? I.e. can we convince the GPU or framebuffer to give us the contents of protected system memory?
Otherwise, it simply depends on system hardware architecture and drivers.
If the GPU is in a position to read and write physical memory (bus master DMA), and there's no hardware level protection like IOMMU or it's not properly configured, operating system has very little say in the matter, be it Linux or anything else.
See how chvt does it.