Hacker News new | ask | show | jobs
by mbf1 2318 days ago
It's a nice looking display, and it's running at a nice 60FPS. However, operating systems don't generally run in full GPU mode all the time -- it's a huge amount of power to be re-drawing the screen that often, and that scales to poor battery life on mobile and expensive power costs in servers.

So that's one of many reasons practical OSes don't do their UIs with GPU shaders when they can otherwise get away with less.

6 comments

Your phrasing of this is a bit unclear. I think you mean that no "real" UI redraws when nothing has changed.

But otherwise most operating systems do run in full GPU mode all the time. The true-mobile ones, so iOS & Android, are almost always using dedicated hardware to handle composition without spinning up the GPU (although both use the GPU to render, so whenever something does change it's immediately back on the GPU), but "desktop" ones are generally always doing GPU composition as long as the display is on. With some hand-wavy exceptions to that primarily for video layers in select circumstances with proper hardware support.

Windows is actually pretty good about doing incremental present, only writing the composited regions that have actually changed. But macOS is bad at this, so people have to fake it in ugly ways to reduce power consumption. It's especially bad when all you want to do is blink a cursor.

Whether apps make use of these capabilities are another question. It's pretty easy to get lazy and blat out the whole window every time, when you know the GPU can handle the pixel bandwidth, and things like imgui explicitly make this tradeoff to keep logic simple.

TIL hardware planes (the "dedicated hardware" you refer to?) != the GPU.

I presume these are inside the GPU die, though? Probably near the display controller logic?

Whether or not it's inside the GPU die would depend on if the display controller is part of the GPU die or not. On a mobile SoC everything tends to be on the one die anyway so... sure. On a discreet desktop GPU I have absolutely no idea. They might not even bother having one at all?

The mobile ones though are pretty good, though. They can do like ~6 composition layers with alpha blending, cropping, rotation, and apply a color matrix for display calibration. All in the dedicated HWC silicon, GPU can be powered off (or doing something else like rendering a game)

This is not true. OS's generally blit their entire UI with GPU shaders, for power efficiency as much as for performance. This may be mixed with scanout compositing, depending on the system.
There are now projects such as Dear ImGui / Nuklear - Immediate Mode Graphical User interface that are just that: GPU accelerated UI.

Here is something I am coding with Dear ImGui:

https://www.youtube.com/watch?v=vbZsE7ACXrw

Even on an old MacBook, it keeps running at 60 FPS.

- Redrawing the entire screen on every frame is indeed disastrous

- Redrawing entire application windows every time something gets moved around a bit and something gets a paint event is also higher load than necessary

- Drawing things that won't change every frame into textures (not shaders), and then compositing those textures together on every frame, is by far the most efficient approach today, on all platforms

I am genuinely interested to hear the definition of "less" that you refer to. It's possible some piece of assumed context is being lost in translation.

> Drawing things that won't change every frame into textures (not shaders), and then compositing those textures together on every frame, is by far the most efficient approach today, on all platforms

Not really true. It's a lot more efficient to draw quite a few things from scratch than it is to use a cache texture. Texture composition requires a lot of memory bandwidth, which tends to be a rather constrained resource. It is very effective to do things like put each window in its own texture, yes. Within a given window using caching textures tends to be a net-loss, though.

OSX and iOS would probably disagree
How does wayland work?