by samwillis · 4y ago · 0 comments
I don’t do much low level graphics stuff, but a terminal seems fairly simple graphically, you are just drawing glyphs at xy cords. Would love it if someone had a good explanation.
Obviously there are some terminal applications that could be redrawing very quickly, but that seems like a solved problem.
You might not notice the difference until you accidentally unleash a lot of output at once - then you'll see the difference. Some terminals start to update infrequently to save themselves, some hang completely while burning the CPU.
Psychologically I feel more in control of my computer, more confident to try things out if I can see my typing updating instantly than 10s or 100s of milliseconds later.
e.g. Firefox is already good at doing that on the GPU. WezTerm isn't yet, but We're Working On It™ (i.e. someday it will be done), follow https://github.com/wez/wezterm/issues/1134
The only time this happens, is when I do something wrong, like `cat`-ing the 12MB binary instead of the config.json, or `tail -f` into the output device of the core logging endpoint and forget to pipe into `grep`.
If that happens, I usually terminate the process anyway.
Does anyone have a benchmark of the differences? Is it like a 2-3x improvement or only much smaller? What is the actual latency?
Does anyone have any links to a low level explanation?
(ofc the differences might not be something you ever notice or care about)
When do I actually need to DISPLAY megabytes worth of output as lag-free as possible on a terminal?
There is no way for the intended recipient of displayed information (aka. the user) to process any of it, so what's the point of eliminating lag?
I'm not sure speed benchmarks mean much for terminals though, there's going to be a lot of personal preference involved.
Even processes that you wouldn't think would be impacted by a terminal can be hurt relaly bad by your terminal's performance: your compiler's logs, etc. The GPU rendering part merely guarantees that your terminal sticks at 60FPS (or, whatever your refresh rate is) if the processing behind is efficient.
Generally if you are barfing meg's of data to screen you're prolly doing something wrong... (You prolly wanna be using less?)
And of course your next keystroke is not zero copy. It needs to be sent to the GPU and the texture needs to be updated. GPU terminals seem to do this kinda slowly last I checked
No textures need to be updated. The texture stays in VRAM across each frame, just need to change which texture the character cell points to. That is zero-copy.
If you were to do this with a software rendered terminal, at minimum the software would tell the windowing system which region of the window changed and then copy that region to VRAM. That’s only if the window system supports region updates, if not you’d need to copy the entire window to VRAM each frame. Much slower than just twiddling a pointer to a texture.
Why? Many commands I've run have produced a lot of log output in my day.
If you're looking for something in the stream then maybe you should grep for it?
I'm not saying you never ever should barf to screen - but as far as I can see, you kinda have to strain yourself to concoct a "valid" usecase
I don't know if they actually have to do this (It might be necessary for seamless scrolling?), but building some partial rendering might be more complicated than GPU acceleration as well.
I'd be interested if someone knows more about this.
I cannot process it with my human eyes, so what does it matter if the CPU rendering can keep up or not?
cat 1_gb_of.txt | less
Is what I want to do, and this is easily rendered even on older hardware.80s computers also used lots of special hardware for graphics output, they didn't software render everything ;)
I haven't found any. Seems like it's just a fashion accessory for $THIS_YEAR.
Also building a GPU accelerated terminal emulator is probably a brilliant project to learn loads of low level skills.