Replies: 3 comments 3 replies
-
The important thing for me would be that we don't regress performance wise if we are using a solid color (or vertical gradient with #2686). If the user decides to use either of the gradients and is aware of their specific implications on extremely low-end hardware in increased memory->GPU bandwidth + CPU utilization everything is fine in my book. The difference to the vertical gradients would likely be:
@cillian64 feel free to chime in and correct me if I got something wrong here (for SOCs in general, not just the latest rpi5). |
Beta Was this translation helpful? Give feedback.
-
@cillian64 - thanks for testing. I've actually got a Pi1B in the drawer but have not booted it for a long time so you spared me the effort! It feels to me like we should go for the horizontal gradients because:
Having more code paths (e.g. treat horizontal gradients as special case) does not seem like a sensible option - not that anyone suggested it, but just saying 😄 So, is the way ahead:
Cc: @jlindgren90 (not sure you've seen this thread) |
Beta Was this translation helpful? Give feedback.
-
I am not too happy about losing subpixel antialiasing of the title text. If we are going to render the whole titlebar into an image buffer, can we just render the text into that same buffer to continue supporting subpixel antialiasing (assuming the buffer is opaque)? |
Beta Was this translation helpful? Give feedback.
-
My implementation for horizontal gradients in the titlebar
#2686 implements vertical gradients for titlebar. However, its design is fundamentally limited for vertical gradients. For example:
So as an alternate approach, I made a dirty prototype of horizontal gradients support for titlebar: https://github.com/tokyo4j/labwc/tree/scaled-titlebar-buffer that rotates vertical gradients in #2686 by 90 degrees. In short, my implementation adds
scaled_titlebar_buffer
that renders the whole titlebar every time the window is resized, rather than expanding 1px-wide buffer. I think this approach is more flexible than #2686 and easily expandable for other complex patterns like borders.Performance/memory overhead
But of course, this comes with costs of performance and memory. So I did a quick benchmark to evaluate the performance overhead of my implementation. In this benchmark, I opened an
xterm
window and used my simple uinput program to resize the window continuously. Here's the result:As you can see, my approach shows more CPU usage than #2686 or labwc master by 2-3%, but less than openbox by 2-3%.
And as for memory consumption, my approach will consume approximately 4B * 20 * 1920 = 154KB if the window covers an entire FHD monitor.
Gray vs subpixel anti-aliasing
Another drawback in my approach is that it always falls back to gray anti-aliasing instead of subpixels if the background color is not solid. This will make the fonts slightly more blurry.
Question
I'd like to define our scope for gradient support. I think we can either:
I don't really have a strong preference on this. Either way, I will keep using solid titlebar color and my laptop is performant enough to handle the overhead.
Also, as I said in #2686 (comment), we can merge #2686 for now and we can apply my approach on top of it.
Beta Was this translation helpful? Give feedback.
All reactions