comp: Update nominal frame interval to match chosen mode in direct mdoe

This value is used in xrWaitFrame() to throttle the application's rendering
down to the refresh rate of the HMD.
This commit is contained in:
Christoph Haag 2020-02-15 02:35:37 +01:00 committed by Lubosz Sarnecki
parent 36d6b71e8a
commit 6b8103f31b

View file

@ -468,6 +468,20 @@ comp_window_direct_get_primary_display_mode(struct comp_window_direct *w,
props.parameters.visibleRegion.height,
(float)props.parameters.refreshRate / 1000.);
int64_t new_frame_interval =
1000. * 1000. * 1000. * 1000. / props.parameters.refreshRate;
COMP_DEBUG(w->base.c,
"Updating compositor settings nominal frame interval from "
"%lu (%f Hz) to %lu (%f Hz)",
w->base.c->settings.nominal_frame_interval_ns,
1000. * 1000. * 1000. /
(float)w->base.c->settings.nominal_frame_interval_ns,
new_frame_interval,
(float)props.parameters.refreshRate / 1000.);
w->base.c->settings.nominal_frame_interval_ns = new_frame_interval;
delete[] mode_properties;
return props.displayMode;