The caret blinking forever wastes CPU/power
Categories
(Core :: Layout, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox93 | --- | fixed |
People
(Reporter: florian, Assigned: emilio)
References
(Blocks 1 open bug)
Details
(Keywords: power)
Attachments
(1 file)
Here is a profile of starting Firefox and doing nothing with it. It shows about:home and the caret keeps blinking in the url bar forever: https://share.firefox.dev/3AgOoy5
Each time the caret visibility changes, there's activity in the main thread, the Renderer thread and the Compositor thread: https://share.firefox.dev/3fFblmG
Could this be changed to a compositor animation?
Also, it seems most platforms limit the blinking duration.
On Windows, there's a Computer\HKEY_CURRENT_USER\Control Panel\Desktop\CaretTimeout
registry setting (defaulting to 5000ms) which makes the caret stop blinking after 5s.
On GTK there's a gtk-cursor-blink-timeout
setting (https://docs.gtk.org/gtk3/property.Settings.gtk-cursor-blink-timeout.html) which seems to default to 10, for 10s after which the caret stops blinking.
Bug 1159263 already added support for a pref that makes the caret stop blinking after some time, but it's only enabled on Android.
Maybe we could enable this on desktop too?
Assignee | ||
Comment 1•3 years ago
|
||
Limiting the amount of blinks seems legit.
One way to fix this is changing ui.caretBlinkCount
to be a LookAndFeel::IntID
, and implementing it per platform (returning a 10 on Android). Or making it a timer or such.
gtk-cursor-blink
seems only a boolean to see if the caret should blink at all, and we already honor it, afaict. Did you mean gtk-cursor-blink-timeout
?
I can take this if you don't have the cycles and you think it's important, feel free to ni? me if so.
Implementing the caret blink time as an opacity animation on nsDisplayCaret::CreateWebRenderCommands
might be worth trying. Not sure how easy that is though, might be worth spinning either the blink timeout or that as a separate bug.
Reporter | ||
Comment 2•3 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #1)
gtk-cursor-blink
seems only a boolean to see if the caret should blink at all, and we already honor it, afaict. Did you meangtk-cursor-blink-timeout
?
Yes, sorry. I fixed the previous comment.
I can take this if you don't have the cycles and you think it's important, feel free to ni? me if so.
I will be on PTO for the next 2 weeks, and this is a bit outside my comfort zone, so feel free to take it. About whether I think it's important... I think it's worth fixing, but I don't know if it needs to be a priority. It would be nice to no longer see it in profiles, as that causes lots of markers that can easily hide other things that would be worth investigating for idle power use.
Assignee | ||
Comment 3•3 years ago
|
||
And make sure the caret ends up being visible, rather than not
visible.
This should be implementable on windows as well. It seems macOS doesn't
have a timeout thing.
Updated•3 years ago
|
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/aa696af2feac Make ui.caretBlinkCount a proper widget int, and make it respect GTK settings. r=stransky
Comment 5•3 years ago
|
||
bugherder |
Assignee | ||
Updated•3 years ago
|
Description
•