-
Notifications
You must be signed in to change notification settings - Fork 144
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
magnifier: fix high power consumption even with magnifier disabled #1833
Conversation
Link: #1832 |
As I mentioned in #1822, it does fix the increased power draw I was seeing. |
I think this is correct. When enabling the magnifier (either via |
I was also pondering whether we need the last_mag, all we really care about is |
As a side note, while looking at scene-helper I saw the fixme comment, and that MR was done 10 months ago, Do we need to look at this?
|
Magnification seems to work fine without |
Only relevant once we start to track wlroots 0.18.x. That wlroots MR didn't make it into 0.17. |
Sorry, I thought they had backported it. |
b3981fd
to
ea0d64e
Compare
I removed I also found removing EDIT: |
For software cursors that should indeed not make a difference as we don't early out as the damage region is not empty. Note while testing this: movement of the cursor on top of some wayland surface or SSD button may / will cause damage by the application / SSD and thus it may look as if its actually working properly while it isn't. Moving the cursor on top of the empty desktop area should not cause any application / SSD damage or change the cursor shape and thus is a better test here. Another note while testing: once the magnifier is shown, the area of the magnifier will be added to the damage region for the next frame so from that point on we will never early out until the magnification is disabled again. |
Not sure if wants_magnification is necessary, but it does call is_magnify_on, and returns true/false on that. Edit to add: wants_magnification, calls output_wants_magnification, which returns false for either ETA2: in output_wants_magnification, it checks for cursor not having moved, do we really care about that. |
ea0d64e
to
4d8473a
Compare
OK. I'm not sure removing
I think this is correct, given that the early return never happens when the magnifier is shown. I replaced However, I'm feeling the current situation where the screen is always redrawn when the magnifier is shown is not optimal. |
cripes, what a convoluted mess. This is about output_wants_magnification ie. wants_magnification It's set to return false for !is_magnify_on This would allow the early bail if the cursor hasn't moved I'm not sure how to solve this though. maybe the original patch was for the best and leave everything else alone (as long as everything works)
|
Agree.
We somehow need to mark the magnifier region damaged but maybe we could do so before the early out check based on moved cursor || non-empty damage ring rather than always after modifying the buffer. That should then theoretically allow us to use the early out branch. What complicates this is that the whole function is called with different outputs so we can't just make the
Then we would update a output without cursor when the magnifier is shown on another monitor.
No, it would not return early because the damage region is not empty due to us adding the damage after modifying the output buffer. See above. Edit: |
Consolatis, then we do want wants_magnification for its checks on flags, movement and output. The extra rendering with mag disabled is easy, (the original patch worked) OR just check !is_magnify_on() and ignore last_mag. Not sure how the performance of mag on would be, but as you mention it's a lower priority |
b51795e
to
6c5ae1c
Compare
Agree. I feel fixing this problem is out of my reach. We can just leave this issue open and revisit later. I updated the PR to simply remove |
6c5ae1c
to
bcc3092
Compare
Fixes the high CPU usage issue reported by @droc12345. Changing `last_mag != is_magnify_on()` to `last_mag == is_magnify_on()` works fine, but this check isn't needed in the first place because magnifier state changes call `wlr_output_schedule_frame()`, which sets `wlr_output->needs_frame`. Also added a FIXME comment regarding the performance issue when the magnifier is enabled.
bcc3092
to
b4fc29f
Compare
Thanks for taking care of this regression. |
Ok, added mag stuff to my config, and with the latest changes, it seems to work alright. |
Really? In my test, |
You're right, I did re-check, and the power usage does go up, but it's only for the time the magnification is in effect. With the fix, without mag, the power usage is a before. So bottom line, IMO, it's good enough for general usage, if you're going to use magnification, expect it to Edit to add: the power usage I mention it true watts being used to drive the system. |
Fixes the high power consumption issue reported by @droc12345.
My fix is based on my understanding that the output state should be committed when the cursor has been moved or magnifier on/off state is changed.
I confirmed the CPU consumption reduced from around 5% to lower than 1% with this fix.