clutter/stage-cogl: Protect against extremely high refresh rates

After 4faeb127, the maximum time allowed for an update to happen
is calculated as:

  max_render_time_allowed = refresh_interval - 1000 * sync_delay;

However, extremely small refresh intervals -- that come as consequence
to extremely high refresh rates -- may fall into an odd numerical range
when refresh_interval < 1000 * sync_delay. That would give us a negative

To be extra cautious about it, add another sanity check for this case.

Change suggested by Jasper St. Pierre.

parent e415cc53
Pipeline #86951 passed with stages
in 4 minutes and 7 seconds
......@@ -199,6 +199,17 @@ clutter_stage_cogl_schedule_update (ClutterStageWindow *stage_window,
min_render_time_allowed = refresh_interval / 2;
max_render_time_allowed = refresh_interval - 1000 * sync_delay;
/* Be robust in the case of incredibly bogus refresh rate */
if (max_render_time_allowed <= 0)
g_warning ("Unsupported monitor refresh rate detected. "
"(Refresh rate: %.3f, refresh interval: %ld)",
stage_cogl->update_time = now;
if (min_render_time_allowed > max_render_time_allowed)
min_render_time_allowed = max_render_time_allowed;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment