-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
FR: With -B
, display the unblurred screenshot while waiting for the blurring process to finish
#239
Comments
I've gotten several bug reports about it lagging, so I think this is worth a shot. We could show the unblurred screenshot, with a warning text saying |
It actually goes beyond just simply displaying the un-blurred screenshot, it is not displaying anything at all, what you see is not a screenshot, it's your system at work, and if you're fast enough you could kill the i3lock process to prevent it from locking! it'd be awesome if there was an option to specify an image that appears while blurring, or if it just displayed the wallpaper, or even a simple black screen, anything is better than what we have now! |
Interesting. What's the behaviour when you specify both an image AND the blur option? |
It ignores the blur option and displays the image, I presume that's because of some if-else behavior in the code and the |
Interesting. I can probably enable some kind of overloading to display the image before blurring it. Or I think a better option would be to blur with a tiny radius first, draw and lock, then reblur with the desired radius. I'll take a look at this over Christmas break, and hopefully get the couple open PRs merged as well. |
@Raymo111 For now I solved the issue by not using the Example
It looks exactly the same but without the annoying (and insecure?) delay. But this fix only makes sense if you're already using a compositor that supports blur. |
@SafwanLjd Why does picom blur faster than i3lock-color? |
@Raymo111 I'm not sure, but probably because i3lock-color takes a screenshot, edits it (probably using ImageMagick), and only then sets it as a background, while picom is actually displaying the actual windows and is just adding a blur effect on top |
Exactly, i3-lock takes an screenshot and blurs the image by traveling every pixel of the image. However, this blur process is slow, and gets slower over time. A few months ago, I tried to overcome this problem by showing the image on screen and refreshing it when the blur it's done. But, for some reason, drawing the image on screen affected the information being used on the blur process, which made it never blur or "segmentation fault". Perhaps, these solutions could be done:
|
Some people might want a fixed blurred screenshot, so it's not necessarily better, it's more a different option. |
I guess you're right, but it's still a better option speed-wise anyway Anyway, I hope you guys figure it out! I would've contributed myself if I knew a little bit more C... Maybe someday |
Always an option to learn on the job (aka while contributing code to fix this) :) |
Having just started using i3lock-color today and having the same confusion as to why it was so slow a generating a blurred screenshot, I noticed the that compile logs show debug is enabled by default in the configure.ac and -O0 is appended after any user CFLAGS meaning no optimisation. Rebuilt with ./configure --disable-debug and it now takes fraction of a second. Debug should be disabled by default! |
@alanswanson I'm not able to see a difference between the two, is there anything else you're doing? |
I actually see a big difference without debug enabled: $ time i3lock -B20 --no-verify # Default i3lock-color
i3lock -B20 --no-verify 25.32s user 0.08s system 98% cpu 25.714 total
$ time ./i3lock -B20 --no-verify # Compiled with `./configure --disable-debug`
./i3lock -B20 --no-verify 3.25s user 0.04s system 97% cpu 3.377 total |
No, that was the only change I made to make a previously 4s pause on a 2560x1440 screen less than 0.3s for a blur radius of 5. My CFLAGS are "-O2 -march=znver1 -ftree-vectorize -fvect-cost-model=cheap" so vectorisation might additionally help but gcc12 should pass __SSE2__ define for the blur_simd.c usage but didn't check that. |
Where are you setting CFLAGS? I'm on a 3840x2160 screen and I have this:
|
Through a Gentoo ebuild but would be just the same as passing in the env. |
I have a similar setup for CFLAGS (Arch makepkg config) and I'm still getting the same thing. Not sure what the difference is. |
Do you use clang? With GCC if multiple -On options are defined then it uses the last one but it's not clear what Clang does - maybe uses the highest optimisation defined? Otherwise no idea (except that debug should still be disabled by default regardless). |
No, I use GCC. I'm fine with disabling debug by default, it just doesn't solve this issue for me. |
Done in 37eecf2. |
When locking screen, first open the window with a color (specified with `--color`) as background, then, if blurring is requested, do that and redraw window. Relates to Raymo111#239
When locking screen, first open the window with a color (specified with `--color`) as background, then, if blurring is requested, do that and redraw window. Relates to Raymo111#239
When locking screen, first open the window with a color (specified with `--color`) as background, then, if blurring is requested, do that and redraw window. Relates to Raymo111#239
This issue is a....
Current Behavior
With
-B
,i3lock
takes a screenshot, blurs it, and then shows the blurred image. This creates a noticeable delay, which can be exaggerated further for testing by setting the parameter to a high value.Desired Behavior
Option for
i3lock
to initially render with the original, unblurred screenshot. Blur the image in another thread, and switch to the blurred image when complete.My use case: I'm abusing
i3lock --no-verify
(with yubikey-touch-detector) to show a full-screen prompt when I need to touch the button on my Yubikey; thus,i3lock
's slow start can be jarring while I am actively using the machine (though the current behaviour does not actually slow down my workflow, since the workflow is waiting on me to interact with the Yubikey at that point anyway).Perhaps more common use case: if someone returns to their machine after
xautolock
or similar has launchedi3lock
, but beforei3lock
has actually rendered, they could encounter a very frustrating lock-after-started-typing situation; reducing the time between "lock screen triggered" and "lock screen rendered" means less frequent violation of user expectations.Reproduction Instructions
Environment
Output of
i3lock --version
:Where'd you get i3lock-color from?
The text was updated successfully, but these errors were encountered: