-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance improvements, and (fractional) DPI scaling #53
Conversation
8dd29cf
to
2940dcf
Compare
08e6ac6
to
74e9aa6
Compare
Performance seems good with |
01f87b4
to
4a9e921
Compare
I think it should be possible to improve the performance of all three scaling modes, with I guess cosmic-bg still needs to properly handling DPI scaling (#51). I guess it should bind the fractional scale protocol... |
I think the fractional scaling implementation I've added is correct. Though there are still a few details to improve here. |
Oh, and I guess I should note that I'm testing with a 6000x4000 (24 megapixel) image from my DSLR. So if I wanted it to be faster I could probably scale that down a bit before cosmic-bg accesses the file. But if performance is good with that, it should handle most reasonable desktop background images. (And I guess scaling multiple times would results in somewhat worse visual quality, in principle.) |
6e53e5d
to
cf424d0
Compare
src/wallpaper.rs
Outdated
img.width() != layer.width || img.height() != layer.height | ||
}) { | ||
let CosmicBgLayer { width, height, .. } = *layer; | ||
let fractional_scale = layer.fractional_scale.unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we require the fractional-scale protocol now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming cosmic-bg isn't really targeting compositors other than cosmic-comp, so there's no harm in depending on protocols cosmic-comp provides. (Especially if it's a standard protocol other current compositors should support.)
We could definitely not require it, but it makes this a bit more complicated, particularly if we still want to support integer scaling without the protocol.
Anchoring to all edges will do that automatically, and should adjust if the resolution changes.
We don't draw until we get an initial configure, so there's no need to have the size before then. `first_configure` was never set to `true`, so the logic there wasn't right. And I was seeing more draws than needed with multiple monitors, slowing things down. Instead have a `needs_redraw` field that is set when a surface should be drawn, due to a new configure. This is at least better than how this was behaving.
Now requires viewporter and fractional scale Wayland protocols.
`fast_image_resize` provides a range of scaling algorithms, but much better optimized than those in `image::imageops`, including SIMD optimization. This noticeably improves startup time.
8421dc4
to
a1f0033
Compare
Apparently it was 69c7b5f that previously removed the use of Not sure if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I've noticed cosmic-bg is somewhat slow to start, particularly with a couple monitors.
I see it's noticeably better changing a couple things:
tiny_skia
for scaling;image::imageops
seems pretty inefficient in comparison.RUST_LOG=debug cargo run --release
shows much better wallpaper draw times.It also is drawing 6 times, for just 3 outputs, also adding to run time. It seems
first_configure
is never set to anything other thanfalse
? Presumably some change should be made there.tiny-skia
only handles RGBA8. So I guess we may need to fallback toimageops
for HDR source images, if anyone is using those. I also have only tried updating thezoom
scaler, but the others can probably be done more efficiently with tiny-skia as well.