Closed Bug 587887 Opened 15 years ago Closed 15 years ago

Refresh driver timer should be 60Hz and TIMER_REPEATING_PRECISE

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: roc, Assigned: roc)

Details

Attachments

(2 files, 1 obsolete file)

Comments on my blog suggest that 60Hz is a better guess for the refresh rate, and being higher than 50 it's slightly more "conservative" if we guessed wrong. I also think that the timer should be TIMER_REPEATING_PRECISE for a steadier frame rate. Is there a problem with starvation there? I would hope that under load timer events don't get any special priority.
Attached patch fix (obsolete) — Splinter Review
Patch is trivial, if this is the right thing to do
Assignee: nobody → roc
Attachment #466506 - Flags: review?(dbaron)
If refreshes are expensive, it seems better to leave some processing time to other things; that was why I originally chose TYPE_REPEATING_SLACK rather than TYPE_REPEATING_PRECISE. That said, I think we should actually experiment with how things behave under heavy load to see what works better. I think we should probably experiment with the refresh rate at some point as well. (It might be worth have a boolean and an integer pref to allow people to experiment, though we might want to clamp the integer to be at least 10.) That said, I'm fine with trying this.
Actually I think having prefs is a fine idea. A pref for the rate actually might be useful to someone. I'll do that.
Attached patch Add prefsSplinter Review
Attachment #466506 - Attachment is obsolete: true
Attachment #466534 - Flags: review?(dbaron)
That patch also changes the default rate to 60Hz, but doesn't flip the "precise" pref, because that change is somewhat more risky.
Comment on attachment 466534 [details] [diff] [review] Add prefs r=dbaron
Attachment #466534 - Flags: review?(dbaron) → review+
Comment on attachment 466535 [details] [diff] [review] Flip "precise" pref on r=dbaron
Attachment #466535 - Flags: review?(dbaron) → review+
Whiteboard: [needs landing]
Whiteboard: [needs landing] → [needs approval]
What happens if a particular frame takes more than 1/60 of a second? Does the timer then skip a frame, or do they back up? Is there a test to make sure we don't starve?
mTimeout always advances by mDelay every time the timer fires, so if firings take longer than mDelay for a while, mTimeout will fall behind "now" arbitrarily far and events will be fired constantly. However, we shouldn't starve during this time because we're just posting events to the main thread and events are still processed in FIFO order. But from looking at the code, later if we can process firings quickly again, we'll keep firing events as fast as possible until mTimeout "catches up" to "now". That seems pretty broken, so I won't flip the precise pref for now.
Comment on attachment 466534 [details] [diff] [review] Add prefs ok. It sounds like we want some kind of "precise-skipping" timer.
Attachment #466534 - Flags: approval2.0? → approval2.0+
Whiteboard: [needs approval] → [needs landing]
For what it's worth, using a pref cache instead of calling the getter every time might be better, esp. in the e10s world. But that can be a followup bug...
I sincerely hope in the e10s world each process gets at least a read-only copy of the prefs so every pref read isn't IPC...
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: [needs landing]
This is probably responsible for a small Dromaeo DOM regression. When mozilla-central is not too busy, I'll try temporarily checking in a patch to lower the refresh rate to 50Hz again to check if the change in refresh rate is the cause of the regression.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: