mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-28 18:46:18 +00:00
comp: Keep track of nominal display interval and last time
This commit is contained in:
parent
f6c97ec253
commit
8c37377853
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_misc.h"
|
||||
#include "util/u_time.h"
|
||||
|
||||
#include "main/comp_compositor.h"
|
||||
#include "main/comp_client_interface.h"
|
||||
|
@ -79,6 +80,9 @@ compositor_wait_frame(struct xrt_compositor *xc,
|
|||
{
|
||||
struct comp_compositor *c = comp_compositor(xc);
|
||||
COMP_SPEW(c, "WAIT_FRAME");
|
||||
*predicted_display_period = c->settings.nominal_frame_interval_ns;
|
||||
*predicted_display_time =
|
||||
c->last_frame_time_ns + c->settings.nominal_frame_interval_ns;
|
||||
|
||||
//! @todo set *predicted_display_time
|
||||
|
||||
|
@ -121,6 +125,9 @@ compositor_end_frame(struct xrt_compositor *xc,
|
|||
} else {
|
||||
COMP_ERROR(c, "non-stereo rendering not supported");
|
||||
}
|
||||
|
||||
// Record the time of this frame.
|
||||
c->last_frame_time_ns = time_state_get_now(c->timekeeping);
|
||||
}
|
||||
|
||||
|
||||
|
@ -487,6 +494,7 @@ comp_compositor_create(struct xrt_device *xdev,
|
|||
comp_settings_init(&c->settings, xdev);
|
||||
|
||||
c->settings.flip_y = flip_y;
|
||||
c->last_frame_time_ns = time_state_get_now(c->timekeeping);
|
||||
|
||||
// Need to select window backend before creating Vulkan, then
|
||||
// swapchain will initialize the window fully and the swapchain, and
|
||||
|
|
|
@ -118,6 +118,9 @@ struct comp_compositor
|
|||
//! Vulkan bundle of things.
|
||||
struct vk_bundle vk;
|
||||
|
||||
//! Timestamp of last-rendered (immersive) frame.
|
||||
int64_t last_frame_time_ns;
|
||||
|
||||
/*!
|
||||
* The current state we are tracking.
|
||||
*
|
||||
|
|
|
@ -30,6 +30,8 @@ comp_settings_init(struct comp_settings *s, struct xrt_device *xdev)
|
|||
s->distortion_model = xdev->distortion.preferred;
|
||||
s->width = xdev->screens[0].w_pixels;
|
||||
s->height = xdev->screens[0].h_pixels;
|
||||
s->nominal_frame_interval_ns =
|
||||
xdev->screens[0].nominal_frame_interval_ns;
|
||||
s->print_spew = debug_get_bool_option_print_spew();
|
||||
s->print_debug = debug_get_bool_option_print_debug();
|
||||
|
||||
|
|
|
@ -67,6 +67,9 @@ struct comp_settings
|
|||
|
||||
//! Should we flip y axis for compositor buffers (for GL)
|
||||
bool flip_y;
|
||||
|
||||
//! Nominal frame interval
|
||||
uint64_t nominal_frame_interval_ns;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
Loading…
Reference in a new issue