mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-29 18:08:29 +00:00
xrt/compositor: use int64_t for timestamps
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2298>
This commit is contained in:
parent
f88705a307
commit
9f6f6c6df7
|
@ -171,9 +171,9 @@ static_assert(std::is_standard_layout<client_d3d11_compositor>::value);
|
|||
struct client_d3d11_swapchain;
|
||||
|
||||
static inline DWORD
|
||||
convertTimeoutToWindowsMilliseconds(uint64_t timeout_ns)
|
||||
convertTimeoutToWindowsMilliseconds(int64_t timeout_ns)
|
||||
{
|
||||
return (timeout_ns == XRT_INFINITE_DURATION) ? INFINITE : (DWORD)(timeout_ns / (uint64_t)U_TIME_1MS_IN_NS);
|
||||
return (timeout_ns == XRT_INFINITE_DURATION) ? INFINITE : (DWORD)(timeout_ns / (int64_t)U_TIME_1MS_IN_NS);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -275,7 +275,7 @@ client_d3d11_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *out_in
|
|||
}
|
||||
|
||||
static xrt_result_t
|
||||
client_d3d11_swapchain_wait_image(struct xrt_swapchain *xsc, uint64_t timeout_ns, uint32_t index)
|
||||
client_d3d11_swapchain_wait_image(struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t index)
|
||||
{
|
||||
struct client_d3d11_swapchain *sc = as_client_d3d11_swapchain(xsc);
|
||||
|
||||
|
@ -516,8 +516,8 @@ client_d3d11_compositor_end_session(struct xrt_compositor *xc)
|
|||
static xrt_result_t
|
||||
client_d3d11_compositor_wait_frame(struct xrt_compositor *xc,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *predicted_display_time,
|
||||
uint64_t *predicted_display_period)
|
||||
int64_t *predicted_display_time,
|
||||
int64_t *predicted_display_period)
|
||||
{
|
||||
struct client_d3d11_compositor *c = as_client_d3d11_compositor(xc);
|
||||
|
||||
|
|
|
@ -163,9 +163,9 @@ static_assert(std::is_standard_layout<client_d3d12_compositor>::value);
|
|||
struct client_d3d12_swapchain;
|
||||
|
||||
static inline DWORD
|
||||
convertTimeoutToWindowsMilliseconds(uint64_t timeout_ns)
|
||||
convertTimeoutToWindowsMilliseconds(int64_t timeout_ns)
|
||||
{
|
||||
return (timeout_ns == XRT_INFINITE_DURATION) ? INFINITE : (DWORD)(timeout_ns / (uint64_t)U_TIME_1MS_IN_NS);
|
||||
return (timeout_ns == XRT_INFINITE_DURATION) ? INFINITE : (DWORD)(timeout_ns / (int64_t)U_TIME_1MS_IN_NS);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
|
@ -377,7 +377,7 @@ client_d3d12_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *out_in
|
|||
}
|
||||
|
||||
static xrt_result_t
|
||||
client_d3d12_swapchain_wait_image(struct xrt_swapchain *xsc, uint64_t timeout_ns, uint32_t index)
|
||||
client_d3d12_swapchain_wait_image(struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t index)
|
||||
{
|
||||
struct client_d3d12_swapchain *sc = as_client_d3d12_swapchain(xsc);
|
||||
|
||||
|
@ -744,8 +744,8 @@ client_d3d12_compositor_end_session(struct xrt_compositor *xc)
|
|||
static xrt_result_t
|
||||
client_d3d12_compositor_wait_frame(struct xrt_compositor *xc,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *predicted_display_time,
|
||||
uint64_t *predicted_display_period)
|
||||
int64_t *predicted_display_time,
|
||||
int64_t *predicted_display_period)
|
||||
{
|
||||
struct client_d3d12_compositor *c = as_client_d3d12_compositor(xc);
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ client_gl_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *out_index
|
|||
}
|
||||
|
||||
static xrt_result_t
|
||||
client_gl_swapchain_wait_image(struct xrt_swapchain *xsc, uint64_t timeout_ns, uint32_t index)
|
||||
client_gl_swapchain_wait_image(struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t index)
|
||||
{
|
||||
// Pipe down call into native swapchain.
|
||||
return xrt_swapchain_wait_image(to_native_swapchain(xsc), timeout_ns, index);
|
||||
|
@ -195,8 +195,8 @@ client_gl_compositor_end_session(struct xrt_compositor *xc)
|
|||
static xrt_result_t
|
||||
client_gl_compositor_wait_frame(struct xrt_compositor *xc,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *predicted_display_time,
|
||||
uint64_t *predicted_display_period)
|
||||
int64_t *predicted_display_time,
|
||||
int64_t *predicted_display_period)
|
||||
{
|
||||
// Pipe down call into native compositor.
|
||||
return xrt_comp_wait_frame( //
|
||||
|
|
|
@ -319,7 +319,7 @@ client_vk_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *out_index
|
|||
}
|
||||
|
||||
static xrt_result_t
|
||||
client_vk_swapchain_wait_image(struct xrt_swapchain *xsc, uint64_t timeout_ns, uint32_t index)
|
||||
client_vk_swapchain_wait_image(struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t index)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
|
@ -438,8 +438,8 @@ client_vk_compositor_end_session(struct xrt_compositor *xc)
|
|||
static xrt_result_t
|
||||
client_vk_compositor_wait_frame(struct xrt_compositor *xc,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *predicted_display_time,
|
||||
uint64_t *predicted_display_period)
|
||||
int64_t *predicted_display_time,
|
||||
int64_t *predicted_display_period)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
|
|
|
@ -174,10 +174,10 @@ compositor_end_session(struct xrt_compositor *xc)
|
|||
static xrt_result_t
|
||||
compositor_predict_frame(struct xrt_compositor *xc,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *out_wake_time_ns,
|
||||
uint64_t *out_predicted_gpu_time_ns,
|
||||
uint64_t *out_predicted_display_time_ns,
|
||||
uint64_t *out_predicted_display_period_ns)
|
||||
int64_t *out_wake_time_ns,
|
||||
int64_t *out_predicted_gpu_time_ns,
|
||||
int64_t *out_predicted_display_time_ns,
|
||||
int64_t *out_predicted_display_period_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
|
@ -186,17 +186,17 @@ compositor_predict_frame(struct xrt_compositor *xc,
|
|||
COMP_SPEW(c, "PREDICT_FRAME");
|
||||
|
||||
// A little bit easier to read.
|
||||
uint64_t interval_ns = (int64_t)c->settings.nominal_frame_interval_ns;
|
||||
int64_t interval_ns = (int64_t)c->settings.nominal_frame_interval_ns;
|
||||
|
||||
comp_target_update_timings(c->target);
|
||||
|
||||
assert(comp_frame_is_invalid_locked(&c->frame.waited));
|
||||
|
||||
int64_t frame_id = -1;
|
||||
uint64_t wake_up_time_ns = 0;
|
||||
uint64_t present_slop_ns = 0;
|
||||
uint64_t desired_present_time_ns = 0;
|
||||
uint64_t predicted_display_time_ns = 0;
|
||||
int64_t wake_up_time_ns = 0;
|
||||
int64_t present_slop_ns = 0;
|
||||
int64_t desired_present_time_ns = 0;
|
||||
int64_t predicted_display_time_ns = 0;
|
||||
comp_target_calc_frame_pacing( //
|
||||
c->target, //
|
||||
&frame_id, //
|
||||
|
@ -223,7 +223,7 @@ static xrt_result_t
|
|||
compositor_mark_frame(struct xrt_compositor *xc,
|
||||
int64_t frame_id,
|
||||
enum xrt_compositor_frame_point point,
|
||||
uint64_t when_ns)
|
||||
int64_t when_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ struct comp_settings
|
|||
bool print_modes;
|
||||
|
||||
//! Nominal frame interval
|
||||
uint64_t nominal_frame_interval_ns;
|
||||
int64_t nominal_frame_interval_ns;
|
||||
|
||||
//! Vulkan physical device selected by comp_settings_check_vulkan_caps
|
||||
//! may be forced by user
|
||||
|
|
|
@ -221,8 +221,8 @@ struct comp_target
|
|||
VkQueue queue,
|
||||
uint32_t index,
|
||||
uint64_t timeline_semaphore_value,
|
||||
uint64_t desired_present_time_ns,
|
||||
uint64_t present_slop_ns);
|
||||
int64_t desired_present_time_ns,
|
||||
int64_t present_slop_ns);
|
||||
|
||||
/*!
|
||||
* Flush any WSI state before rendering.
|
||||
|
@ -242,10 +242,10 @@ struct comp_target
|
|||
*/
|
||||
void (*calc_frame_pacing)(struct comp_target *ct,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *out_wake_up_time_ns,
|
||||
uint64_t *out_desired_present_time_ns,
|
||||
uint64_t *out_present_slop_ns,
|
||||
uint64_t *out_predicted_display_time_ns);
|
||||
int64_t *out_wake_up_time_ns,
|
||||
int64_t *out_desired_present_time_ns,
|
||||
int64_t *out_present_slop_ns,
|
||||
int64_t *out_predicted_display_time_ns);
|
||||
|
||||
/*!
|
||||
* The compositor tells the target a timing information about a single
|
||||
|
@ -254,7 +254,7 @@ struct comp_target
|
|||
void (*mark_timing_point)(struct comp_target *ct,
|
||||
enum comp_target_timing_point point,
|
||||
int64_t frame_id,
|
||||
uint64_t when_ns);
|
||||
int64_t when_ns);
|
||||
|
||||
/*!
|
||||
* Update timing information for this target, this function should be
|
||||
|
@ -279,7 +279,7 @@ struct comp_target
|
|||
* @see @ref frame-pacing.
|
||||
*/
|
||||
void (*info_gpu)(
|
||||
struct comp_target *ct, int64_t frame_id, uint64_t gpu_start_ns, uint64_t gpu_end_ns, uint64_t when_ns);
|
||||
struct comp_target *ct, int64_t frame_id, int64_t gpu_start_ns, int64_t gpu_end_ns, int64_t when_ns);
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -393,8 +393,8 @@ comp_target_present(struct comp_target *ct,
|
|||
VkQueue queue,
|
||||
uint32_t index,
|
||||
uint64_t timeline_semaphore_value,
|
||||
uint64_t desired_present_time_ns,
|
||||
uint64_t present_slop_ns)
|
||||
int64_t desired_present_time_ns,
|
||||
int64_t present_slop_ns)
|
||||
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
@ -431,10 +431,10 @@ comp_target_flush(struct comp_target *ct)
|
|||
static inline void
|
||||
comp_target_calc_frame_pacing(struct comp_target *ct,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *out_wake_up_time_ns,
|
||||
uint64_t *out_desired_present_time_ns,
|
||||
uint64_t *out_present_slop_ns,
|
||||
uint64_t *out_predicted_display_time_ns)
|
||||
int64_t *out_wake_up_time_ns,
|
||||
int64_t *out_desired_present_time_ns,
|
||||
int64_t *out_present_slop_ns,
|
||||
int64_t *out_predicted_display_time_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
|
@ -455,7 +455,7 @@ comp_target_calc_frame_pacing(struct comp_target *ct,
|
|||
* @ingroup comp_main
|
||||
*/
|
||||
static inline void
|
||||
comp_target_mark_wake_up(struct comp_target *ct, int64_t frame_id, uint64_t when_woke_ns)
|
||||
comp_target_mark_wake_up(struct comp_target *ct, int64_t frame_id, int64_t when_woke_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
|
@ -470,7 +470,7 @@ comp_target_mark_wake_up(struct comp_target *ct, int64_t frame_id, uint64_t when
|
|||
* @ingroup comp_main
|
||||
*/
|
||||
static inline void
|
||||
comp_target_mark_begin(struct comp_target *ct, int64_t frame_id, uint64_t when_began_ns)
|
||||
comp_target_mark_begin(struct comp_target *ct, int64_t frame_id, int64_t when_began_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
|
@ -485,7 +485,7 @@ comp_target_mark_begin(struct comp_target *ct, int64_t frame_id, uint64_t when_b
|
|||
* @ingroup comp_main
|
||||
*/
|
||||
static inline void
|
||||
comp_target_mark_submit_begin(struct comp_target *ct, int64_t frame_id, uint64_t when_submit_began_ns)
|
||||
comp_target_mark_submit_begin(struct comp_target *ct, int64_t frame_id, int64_t when_submit_began_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
|
@ -500,7 +500,7 @@ comp_target_mark_submit_begin(struct comp_target *ct, int64_t frame_id, uint64_t
|
|||
* @ingroup comp_main
|
||||
*/
|
||||
static inline void
|
||||
comp_target_mark_submit_end(struct comp_target *ct, int64_t frame_id, uint64_t when_submit_end_ns)
|
||||
comp_target_mark_submit_end(struct comp_target *ct, int64_t frame_id, int64_t when_submit_end_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
|
@ -529,7 +529,7 @@ comp_target_update_timings(struct comp_target *ct)
|
|||
*/
|
||||
static inline void
|
||||
comp_target_info_gpu(
|
||||
struct comp_target *ct, int64_t frame_id, uint64_t gpu_start_ns, uint64_t gpu_end_ns, uint64_t when_ns)
|
||||
struct comp_target *ct, int64_t frame_id, int64_t gpu_start_ns, int64_t gpu_end_ns, int64_t when_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
|
|
|
@ -329,7 +329,7 @@ do_update_timings_google_display_timing(struct comp_target_swapchain *cts)
|
|||
cts->swapchain.handle, //
|
||||
&count, //
|
||||
timings); //
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
u_pc_info(cts->upc, //
|
||||
timings[i].presentID, //
|
||||
|
@ -350,7 +350,7 @@ do_update_timings_vblank_thread(struct comp_target_swapchain *cts)
|
|||
return;
|
||||
}
|
||||
|
||||
uint64_t last_vblank_ns;
|
||||
int64_t last_vblank_ns;
|
||||
|
||||
os_thread_helper_lock(&cts->vblank.event_thread);
|
||||
last_vblank_ns = cts->vblank.last_vblank_ns;
|
||||
|
@ -416,7 +416,7 @@ get_surface_counter_val(struct comp_target *ct)
|
|||
}
|
||||
|
||||
static bool
|
||||
vblank_event_func(struct comp_target *ct, uint64_t *out_timestamp_ns)
|
||||
vblank_event_func(struct comp_target *ct, int64_t *out_timestamp_ns)
|
||||
{
|
||||
struct comp_target_swapchain *cts = (struct comp_target_swapchain *)ct;
|
||||
|
||||
|
@ -449,7 +449,7 @@ vblank_event_func(struct comp_target *ct, uint64_t *out_timestamp_ns)
|
|||
ret = vk->vkWaitForFences(vk->device, 1, &vblank_event_fence, true, time_s_to_ns(1));
|
||||
|
||||
// As quickly as possible after the fence has fired.
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
|
||||
bool valid = false;
|
||||
if (ret == VK_SUCCESS) {
|
||||
|
@ -520,7 +520,7 @@ run_vblank_event_thread(void *ptr)
|
|||
// Unlock while waiting.
|
||||
os_thread_helper_unlock(&cts->vblank.event_thread);
|
||||
|
||||
uint64_t when_ns = 0;
|
||||
int64_t when_ns = 0;
|
||||
bool valid = vblank_event_func(ct, &when_ns);
|
||||
|
||||
// Just keep swimming.
|
||||
|
@ -619,7 +619,7 @@ comp_target_swapchain_create_images(struct comp_target *ct, const struct comp_ta
|
|||
VkBool32 supported;
|
||||
VkResult ret;
|
||||
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
// Some platforms really don't like the pacing_compositor code.
|
||||
bool use_display_timing_if_available = cts->timing_usage == COMP_TARGET_USE_DISPLAY_IF_AVAILABLE;
|
||||
if (cts->upc == NULL && use_display_timing_if_available && vk->has_GOOGLE_display_timing) {
|
||||
|
@ -846,8 +846,8 @@ comp_target_swapchain_present(struct comp_target *ct,
|
|||
VkQueue queue,
|
||||
uint32_t index,
|
||||
uint64_t timeline_semaphore_value,
|
||||
uint64_t desired_present_time_ns,
|
||||
uint64_t present_slop_ns)
|
||||
int64_t desired_present_time_ns,
|
||||
int64_t present_slop_ns)
|
||||
{
|
||||
struct comp_target_swapchain *cts = (struct comp_target_swapchain *)ct;
|
||||
struct vk_bundle *vk = get_vk(cts);
|
||||
|
@ -914,21 +914,21 @@ comp_target_swapchain_check_ready(struct comp_target *ct)
|
|||
static void
|
||||
comp_target_swapchain_calc_frame_pacing(struct comp_target *ct,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *out_wake_up_time_ns,
|
||||
uint64_t *out_desired_present_time_ns,
|
||||
uint64_t *out_present_slop_ns,
|
||||
uint64_t *out_predicted_display_time_ns)
|
||||
int64_t *out_wake_up_time_ns,
|
||||
int64_t *out_desired_present_time_ns,
|
||||
int64_t *out_present_slop_ns,
|
||||
int64_t *out_predicted_display_time_ns)
|
||||
{
|
||||
struct comp_target_swapchain *cts = (struct comp_target_swapchain *)ct;
|
||||
|
||||
int64_t frame_id = -1;
|
||||
uint64_t wake_up_time_ns = 0;
|
||||
uint64_t desired_present_time_ns = 0;
|
||||
uint64_t present_slop_ns = 0;
|
||||
uint64_t predicted_display_time_ns = 0;
|
||||
uint64_t predicted_display_period_ns = 0;
|
||||
uint64_t min_display_period_ns = 0;
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t wake_up_time_ns = 0;
|
||||
int64_t desired_present_time_ns = 0;
|
||||
int64_t present_slop_ns = 0;
|
||||
int64_t predicted_display_time_ns = 0;
|
||||
int64_t predicted_display_period_ns = 0;
|
||||
int64_t min_display_period_ns = 0;
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
|
||||
u_pc_predict(cts->upc, //
|
||||
now_ns, //
|
||||
|
@ -953,7 +953,7 @@ static void
|
|||
comp_target_swapchain_mark_timing_point(struct comp_target *ct,
|
||||
enum comp_target_timing_point point,
|
||||
int64_t frame_id,
|
||||
uint64_t when_ns)
|
||||
int64_t when_ns)
|
||||
{
|
||||
struct comp_target_swapchain *cts = (struct comp_target_swapchain *)ct;
|
||||
assert(frame_id == cts->current_frame_id);
|
||||
|
@ -990,7 +990,7 @@ comp_target_swapchain_update_timings(struct comp_target *ct)
|
|||
|
||||
static void
|
||||
comp_target_swapchain_info_gpu(
|
||||
struct comp_target *ct, int64_t frame_id, uint64_t gpu_start_ns, uint64_t gpu_end_ns, uint64_t when_ns)
|
||||
struct comp_target *ct, int64_t frame_id, int64_t gpu_start_ns, int64_t gpu_end_ns, int64_t when_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ mock_compositor_swapchain_destroy(struct xrt_swapchain *xsc)
|
|||
}
|
||||
|
||||
static xrt_result_t
|
||||
mock_compositor_swapchain_wait_image(struct xrt_swapchain *xsc, uint64_t timeout_ns, uint32_t index)
|
||||
mock_compositor_swapchain_wait_image(struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t index)
|
||||
{
|
||||
struct mock_compositor_swapchain *mcsc = mock_compositor_swapchain(xsc);
|
||||
struct mock_compositor *mc = mcsc->mc;
|
||||
|
|
|
@ -49,7 +49,7 @@ static void
|
|||
slot_clear_locked(struct multi_compositor *mc, struct multi_layer_slot *slot)
|
||||
{
|
||||
if (slot->active) {
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
u_pa_retired(mc->upa, slot->data.frame_id, now_ns);
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ wait_fence(struct xrt_compositor_fence **xcf_ptr)
|
|||
xrt_result_t ret = XRT_SUCCESS;
|
||||
|
||||
// 100ms
|
||||
uint64_t timeout_ns = 100 * U_TIME_1MS_IN_NS;
|
||||
int64_t timeout_ns = 100 * U_TIME_1MS_IN_NS;
|
||||
|
||||
do {
|
||||
ret = xrt_compositor_fence_wait(*xcf_ptr, timeout_ns);
|
||||
|
@ -150,7 +150,7 @@ wait_semaphore(struct xrt_compositor_semaphore **xcsem_ptr, uint64_t value)
|
|||
xrt_result_t ret = XRT_SUCCESS;
|
||||
|
||||
// 100ms
|
||||
uint64_t timeout_ns = 100 * U_TIME_1MS_IN_NS;
|
||||
int64_t timeout_ns = 100 * U_TIME_1MS_IN_NS;
|
||||
|
||||
do {
|
||||
ret = xrt_compositor_semaphore_wait(*xcsem_ptr, value, timeout_ns);
|
||||
|
@ -291,7 +291,7 @@ run_func(void *ptr)
|
|||
}
|
||||
|
||||
// Sample time outside of lock.
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
|
||||
os_mutex_lock(&mc->msc->list_and_timing_lock);
|
||||
u_pa_mark_gpu_done(mc->upa, frame_id, now_ns);
|
||||
|
@ -496,15 +496,15 @@ multi_compositor_end_session(struct xrt_compositor *xc)
|
|||
static xrt_result_t
|
||||
multi_compositor_predict_frame(struct xrt_compositor *xc,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *out_wake_time_ns,
|
||||
uint64_t *out_predicted_gpu_time_ns,
|
||||
uint64_t *out_predicted_display_time_ns,
|
||||
uint64_t *out_predicted_display_period_ns)
|
||||
int64_t *out_wake_time_ns,
|
||||
int64_t *out_predicted_gpu_time_ns,
|
||||
int64_t *out_predicted_display_time_ns,
|
||||
int64_t *out_predicted_display_period_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
struct multi_compositor *mc = multi_compositor(xc);
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
os_mutex_lock(&mc->msc->list_and_timing_lock);
|
||||
|
||||
u_pa_predict( //
|
||||
|
@ -526,13 +526,13 @@ static xrt_result_t
|
|||
multi_compositor_mark_frame(struct xrt_compositor *xc,
|
||||
int64_t frame_id,
|
||||
enum xrt_compositor_frame_point point,
|
||||
uint64_t when_ns)
|
||||
int64_t when_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
struct multi_compositor *mc = multi_compositor(xc);
|
||||
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
|
||||
switch (point) {
|
||||
case XRT_COMPOSITOR_FRAME_POINT_WOKE:
|
||||
|
@ -549,16 +549,16 @@ multi_compositor_mark_frame(struct xrt_compositor *xc,
|
|||
static xrt_result_t
|
||||
multi_compositor_wait_frame(struct xrt_compositor *xc,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *out_predicted_display_time_ns,
|
||||
uint64_t *out_predicted_display_period_ns)
|
||||
int64_t *out_predicted_display_time_ns,
|
||||
int64_t *out_predicted_display_period_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
struct multi_compositor *mc = multi_compositor(xc);
|
||||
|
||||
int64_t frame_id = -1;
|
||||
uint64_t wake_up_time_ns = 0;
|
||||
uint64_t predicted_gpu_time_ns = 0;
|
||||
int64_t wake_up_time_ns = 0;
|
||||
int64_t predicted_gpu_time_ns = 0;
|
||||
|
||||
xrt_comp_predict_frame( //
|
||||
xc, //
|
||||
|
@ -571,7 +571,7 @@ multi_compositor_wait_frame(struct xrt_compositor *xc,
|
|||
// Wait until the given wake up time.
|
||||
u_wait_until(&mc->frame_sleeper, wake_up_time_ns);
|
||||
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
|
||||
// Signal that we woke up.
|
||||
xrt_comp_mark_frame(xc, frame_id, XRT_COMPOSITOR_FRAME_POINT_WOKE, now_ns);
|
||||
|
@ -589,7 +589,7 @@ multi_compositor_begin_frame(struct xrt_compositor *xc, int64_t frame_id)
|
|||
struct multi_compositor *mc = multi_compositor(xc);
|
||||
|
||||
os_mutex_lock(&mc->msc->list_and_timing_lock);
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
u_pa_mark_point(mc->upa, frame_id, U_TIMING_POINT_BEGIN, now_ns);
|
||||
os_mutex_unlock(&mc->msc->list_and_timing_lock);
|
||||
|
||||
|
@ -602,7 +602,7 @@ multi_compositor_discard_frame(struct xrt_compositor *xc, int64_t frame_id)
|
|||
COMP_TRACE_MARKER();
|
||||
|
||||
struct multi_compositor *mc = multi_compositor(xc);
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
|
||||
os_mutex_lock(&mc->msc->list_and_timing_lock);
|
||||
u_pa_mark_discarded(mc->upa, frame_id, now_ns);
|
||||
|
@ -617,7 +617,7 @@ multi_compositor_layer_begin(struct xrt_compositor *xc, const struct xrt_layer_f
|
|||
struct multi_compositor *mc = multi_compositor(xc);
|
||||
|
||||
// As early as possible.
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
os_mutex_lock(&mc->msc->list_and_timing_lock);
|
||||
u_pa_mark_delivered(mc->upa, data->frame_id, now_ns, data->display_time_ns);
|
||||
os_mutex_unlock(&mc->msc->list_and_timing_lock);
|
||||
|
@ -797,7 +797,7 @@ multi_compositor_layer_commit(struct xrt_compositor *xc, xrt_graphics_sync_handl
|
|||
push_fence_to_wait_thread(mc, frame_id, xcf);
|
||||
} else {
|
||||
// Assume that the app side compositor waited.
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
|
||||
os_mutex_lock(&mc->msc->list_and_timing_lock);
|
||||
u_pa_mark_gpu_done(mc->upa, frame_id, now_ns);
|
||||
|
@ -898,7 +898,7 @@ multi_compositor_destroy(struct xrt_compositor *xc)
|
|||
}
|
||||
|
||||
static void
|
||||
log_frame_time_diff(uint64_t frame_time_ns, uint64_t display_time_ns)
|
||||
log_frame_time_diff(int64_t frame_time_ns, int64_t display_time_ns)
|
||||
{
|
||||
int64_t diff_ns = (int64_t)frame_time_ns - (int64_t)display_time_ns;
|
||||
bool late = false;
|
||||
|
@ -911,7 +911,7 @@ log_frame_time_diff(uint64_t frame_time_ns, uint64_t display_time_ns)
|
|||
}
|
||||
|
||||
void
|
||||
multi_compositor_deliver_any_frames(struct multi_compositor *mc, uint64_t display_time_ns)
|
||||
multi_compositor_deliver_any_frames(struct multi_compositor *mc, int64_t display_time_ns)
|
||||
{
|
||||
os_mutex_lock(&mc->slot_lock);
|
||||
|
||||
|
@ -923,7 +923,7 @@ multi_compositor_deliver_any_frames(struct multi_compositor *mc, uint64_t displa
|
|||
if (time_is_greater_then_or_within_half_ms(display_time_ns, mc->scheduled.data.display_time_ns)) {
|
||||
slot_move_and_clear_locked(mc, &mc->delivered, &mc->scheduled);
|
||||
|
||||
uint64_t frame_time_ns = mc->delivered.data.display_time_ns;
|
||||
int64_t frame_time_ns = mc->delivered.data.display_time_ns;
|
||||
if (!time_is_within_half_ms(frame_time_ns, display_time_ns)) {
|
||||
log_frame_time_diff(frame_time_ns, display_time_ns);
|
||||
}
|
||||
|
@ -933,13 +933,13 @@ multi_compositor_deliver_any_frames(struct multi_compositor *mc, uint64_t displa
|
|||
}
|
||||
|
||||
void
|
||||
multi_compositor_latch_frame_locked(struct multi_compositor *mc, uint64_t when_ns, int64_t system_frame_id)
|
||||
multi_compositor_latch_frame_locked(struct multi_compositor *mc, int64_t when_ns, int64_t system_frame_id)
|
||||
{
|
||||
u_pa_latched(mc->upa, mc->delivered.data.frame_id, when_ns, system_frame_id);
|
||||
}
|
||||
|
||||
void
|
||||
multi_compositor_retire_delivered_locked(struct multi_compositor *mc, uint64_t when_ns)
|
||||
multi_compositor_retire_delivered_locked(struct multi_compositor *mc, int64_t when_ns)
|
||||
{
|
||||
slot_clear_locked(mc, &mc->delivered);
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ struct multi_compositor
|
|||
/*!
|
||||
* The next which the next frames to be picked up will be displayed.
|
||||
*/
|
||||
uint64_t slot_next_frame_display;
|
||||
int64_t slot_next_frame_display;
|
||||
|
||||
/*!
|
||||
* Currently being transferred or waited on.
|
||||
|
@ -225,7 +225,7 @@ multi_compositor_push_event(struct multi_compositor *mc, const union xrt_session
|
|||
* @private @memberof multi_compositor
|
||||
*/
|
||||
void
|
||||
multi_compositor_deliver_any_frames(struct multi_compositor *mc, uint64_t display_time_ns);
|
||||
multi_compositor_deliver_any_frames(struct multi_compositor *mc, int64_t display_time_ns);
|
||||
|
||||
/*!
|
||||
* Makes the current delivered frame as latched, called by the render thread.
|
||||
|
@ -235,7 +235,7 @@ multi_compositor_deliver_any_frames(struct multi_compositor *mc, uint64_t displa
|
|||
* @private @memberof multi_compositor
|
||||
*/
|
||||
void
|
||||
multi_compositor_latch_frame_locked(struct multi_compositor *mc, uint64_t when_ns, int64_t system_frame_id);
|
||||
multi_compositor_latch_frame_locked(struct multi_compositor *mc, int64_t when_ns, int64_t system_frame_id);
|
||||
|
||||
/*!
|
||||
* Clears and retires the delivered frame, called by the render thread.
|
||||
|
@ -245,7 +245,7 @@ multi_compositor_latch_frame_locked(struct multi_compositor *mc, uint64_t when_n
|
|||
* @private @memberof multi_compositor
|
||||
*/
|
||||
void
|
||||
multi_compositor_retire_delivered_locked(struct multi_compositor *mc, uint64_t when_ns);
|
||||
multi_compositor_retire_delivered_locked(struct multi_compositor *mc, int64_t when_ns);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -358,9 +358,9 @@ struct multi_system_compositor
|
|||
|
||||
struct
|
||||
{
|
||||
uint64_t predicted_display_time_ns;
|
||||
uint64_t predicted_display_period_ns;
|
||||
uint64_t diff_ns;
|
||||
int64_t predicted_display_time_ns;
|
||||
int64_t predicted_display_period_ns;
|
||||
int64_t diff_ns;
|
||||
} last_timings;
|
||||
|
||||
//! List of active clients.
|
||||
|
|
|
@ -251,7 +251,7 @@ find_active_blend_mode(struct multi_compositor **overlay_sorted_clients, size_t
|
|||
}
|
||||
|
||||
static void
|
||||
transfer_layers_locked(struct multi_system_compositor *msc, uint64_t display_time_ns, int64_t system_frame_id)
|
||||
transfer_layers_locked(struct multi_system_compositor *msc, int64_t display_time_ns, int64_t system_frame_id)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
|
@ -260,7 +260,7 @@ transfer_layers_locked(struct multi_system_compositor *msc, uint64_t display_tim
|
|||
struct multi_compositor *array[MULTI_MAX_CLIENTS] = {0};
|
||||
|
||||
// To mark latching.
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
|
||||
size_t count = 0;
|
||||
for (size_t k = 0; k < ARRAY_SIZE(array); k++) {
|
||||
|
@ -337,7 +337,7 @@ transfer_layers_locked(struct multi_system_compositor *msc, uint64_t display_tim
|
|||
}
|
||||
|
||||
static void
|
||||
broadcast_timings_to_clients(struct multi_system_compositor *msc, uint64_t predicted_display_time_ns)
|
||||
broadcast_timings_to_clients(struct multi_system_compositor *msc, int64_t predicted_display_time_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
|
@ -359,9 +359,9 @@ broadcast_timings_to_clients(struct multi_system_compositor *msc, uint64_t predi
|
|||
|
||||
static void
|
||||
broadcast_timings_to_pacers(struct multi_system_compositor *msc,
|
||||
uint64_t predicted_display_time_ns,
|
||||
uint64_t predicted_display_period_ns,
|
||||
uint64_t diff_ns)
|
||||
int64_t predicted_display_time_ns,
|
||||
int64_t predicted_display_period_ns,
|
||||
int64_t diff_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
|
@ -392,14 +392,14 @@ broadcast_timings_to_pacers(struct multi_system_compositor *msc,
|
|||
}
|
||||
|
||||
static void
|
||||
wait_frame(struct os_precise_sleeper *sleeper, struct xrt_compositor *xc, int64_t frame_id, uint64_t wake_up_time_ns)
|
||||
wait_frame(struct os_precise_sleeper *sleeper, struct xrt_compositor *xc, int64_t frame_id, int64_t wake_up_time_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
// Wait until the given wake up time.
|
||||
u_wait_until(sleeper, wake_up_time_ns);
|
||||
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
|
||||
// Signal that we woke up.
|
||||
xrt_comp_mark_frame(xc, frame_id, XRT_COMPOSITOR_FRAME_POINT_WOKE, now_ns);
|
||||
|
@ -507,10 +507,10 @@ multi_main_loop(struct multi_system_compositor *msc)
|
|||
os_thread_helper_unlock(&msc->oth);
|
||||
|
||||
int64_t frame_id = -1;
|
||||
uint64_t wake_up_time_ns = 0;
|
||||
uint64_t predicted_gpu_time_ns = 0;
|
||||
uint64_t predicted_display_time_ns = 0;
|
||||
uint64_t predicted_display_period_ns = 0;
|
||||
int64_t wake_up_time_ns = 0;
|
||||
int64_t predicted_gpu_time_ns = 0;
|
||||
int64_t predicted_display_time_ns = 0;
|
||||
int64_t predicted_display_period_ns = 0;
|
||||
|
||||
// Get the information for the next frame.
|
||||
xrt_comp_predict_frame( //
|
||||
|
@ -527,8 +527,8 @@ multi_main_loop(struct multi_system_compositor *msc)
|
|||
// Now we can wait.
|
||||
wait_frame(&sleeper, xc, frame_id, wake_up_time_ns);
|
||||
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
uint64_t diff_ns = predicted_display_time_ns - now_ns;
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t diff_ns = predicted_display_time_ns - now_ns;
|
||||
|
||||
// Now we know the diff, broadcast to pacers.
|
||||
broadcast_timings_to_pacers(msc, predicted_display_time_ns, predicted_display_period_ns, diff_ns);
|
||||
|
@ -630,7 +630,7 @@ system_compositor_set_main_app_visibility(struct xrt_system_compositor *xsc, str
|
|||
static xrt_result_t
|
||||
system_compositor_notify_loss_pending(struct xrt_system_compositor *xsc,
|
||||
struct xrt_compositor *xc,
|
||||
uint64_t loss_time_ns)
|
||||
int64_t loss_time_ns)
|
||||
{
|
||||
struct multi_system_compositor *msc = multi_system_compositor(xsc);
|
||||
struct multi_compositor *mc = multi_compositor(xc);
|
||||
|
|
|
@ -341,20 +341,20 @@ null_compositor_end_session(struct xrt_compositor *xc)
|
|||
static xrt_result_t
|
||||
null_compositor_predict_frame(struct xrt_compositor *xc,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *out_wake_time_ns,
|
||||
uint64_t *out_predicted_gpu_time_ns,
|
||||
uint64_t *out_predicted_display_time_ns,
|
||||
uint64_t *out_predicted_display_period_ns)
|
||||
int64_t *out_wake_time_ns,
|
||||
int64_t *out_predicted_gpu_time_ns,
|
||||
int64_t *out_predicted_display_time_ns,
|
||||
int64_t *out_predicted_display_period_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
struct null_compositor *c = null_compositor(xc);
|
||||
NULL_TRACE(c, "PREDICT_FRAME");
|
||||
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
uint64_t null_desired_present_time_ns = 0;
|
||||
uint64_t null_present_slop_ns = 0;
|
||||
uint64_t null_min_display_period_ns = 0;
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t null_desired_present_time_ns = 0;
|
||||
int64_t null_present_slop_ns = 0;
|
||||
int64_t null_min_display_period_ns = 0;
|
||||
|
||||
u_pc_predict( //
|
||||
c->upc, // upc
|
||||
|
@ -374,7 +374,7 @@ static xrt_result_t
|
|||
null_compositor_mark_frame(struct xrt_compositor *xc,
|
||||
int64_t frame_id,
|
||||
enum xrt_compositor_frame_point point,
|
||||
uint64_t when_ns)
|
||||
int64_t when_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
|
@ -442,13 +442,13 @@ null_compositor_layer_commit(struct xrt_compositor *xc, xrt_graphics_sync_handle
|
|||
|
||||
// When we begin rendering.
|
||||
{
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
u_pc_mark_point(c->upc, U_TIMING_POINT_BEGIN, frame_id, now_ns);
|
||||
}
|
||||
|
||||
// When we are submitting to the GPU.
|
||||
{
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
u_pc_mark_point(c->upc, U_TIMING_POINT_SUBMIT_BEGIN, frame_id, now_ns);
|
||||
|
||||
now_ns = os_monotonic_get_ns();
|
||||
|
|
|
@ -207,16 +207,16 @@ base_layer_equirect2(struct xrt_compositor *xc,
|
|||
static xrt_result_t
|
||||
base_wait_frame(struct xrt_compositor *xc,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *out_predicted_display_time_ns,
|
||||
uint64_t *out_predicted_display_period_ns)
|
||||
int64_t *out_predicted_display_time_ns,
|
||||
int64_t *out_predicted_display_period_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
struct comp_base *cb = comp_base(xc);
|
||||
|
||||
int64_t frame_id = -1;
|
||||
uint64_t wake_up_time_ns = 0;
|
||||
uint64_t predicted_gpu_time_ns = 0;
|
||||
int64_t wake_up_time_ns = 0;
|
||||
int64_t predicted_gpu_time_ns = 0;
|
||||
|
||||
xrt_comp_predict_frame( //
|
||||
xc, //
|
||||
|
@ -229,7 +229,7 @@ base_wait_frame(struct xrt_compositor *xc,
|
|||
// Wait until the given wake up time.
|
||||
u_wait_until(&cb->sleeper, wake_up_time_ns);
|
||||
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
|
||||
// Signal that we woke up.
|
||||
xrt_comp_mark_frame(xc, frame_id, XRT_COMPOSITOR_FRAME_POINT_WOKE, now_ns);
|
||||
|
|
|
@ -106,7 +106,7 @@ swapchain_dec_image_use(struct xrt_swapchain *xsc, uint32_t index)
|
|||
}
|
||||
|
||||
static xrt_result_t
|
||||
swapchain_wait_image(struct xrt_swapchain *xsc, uint64_t timeout_ns, uint32_t index)
|
||||
swapchain_wait_image(struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t index)
|
||||
{
|
||||
struct comp_swapchain *sc = comp_swapchain(xsc);
|
||||
|
||||
|
@ -124,12 +124,12 @@ swapchain_wait_image(struct xrt_swapchain *xsc, uint64_t timeout_ns, uint32_t in
|
|||
}
|
||||
|
||||
// on windows pthread_cond_timedwait can not be used with monotonic time
|
||||
uint64_t start_wait_rt = os_realtime_get_ns();
|
||||
int64_t start_wait_rt = os_realtime_get_ns();
|
||||
|
||||
uint64_t end_wait_rt;
|
||||
int64_t end_wait_rt;
|
||||
// don't wrap on big or indefinite timeout
|
||||
if (start_wait_rt > UINT64_MAX - timeout_ns) {
|
||||
end_wait_rt = UINT64_MAX;
|
||||
if (start_wait_rt > INT64_MAX - timeout_ns) {
|
||||
end_wait_rt = INT64_MAX;
|
||||
} else {
|
||||
end_wait_rt = start_wait_rt + timeout_ns;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ swapchain_wait_image(struct xrt_swapchain *xsc, uint64_t timeout_ns, uint32_t in
|
|||
// use pthread_cond_timedwait to implement timeout behavior
|
||||
ret = pthread_cond_timedwait(&sc->images[index].use_cond, &sc->images[index].use_mutex.mutex, &spec);
|
||||
|
||||
uint64_t now_rt = os_realtime_get_ns();
|
||||
int64_t now_rt = os_realtime_get_ns();
|
||||
double diff = time_ns_to_ms_f(now_rt - start_wait_rt);
|
||||
|
||||
if (ret == 0) {
|
||||
|
|
|
@ -589,7 +589,7 @@ struct xrt_swapchain
|
|||
* @param timeout_ns Timeout in nanoseconds,
|
||||
* @param index Image index to wait for.
|
||||
*/
|
||||
xrt_result_t (*wait_image)(struct xrt_swapchain *xsc, uint64_t timeout_ns, uint32_t index);
|
||||
xrt_result_t (*wait_image)(struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t index);
|
||||
|
||||
/*!
|
||||
* Do any barrier transitions to and from the application.
|
||||
|
@ -686,7 +686,7 @@ xrt_swapchain_dec_image_use(struct xrt_swapchain *xsc, uint32_t index)
|
|||
* @public @memberof xrt_swapchain
|
||||
*/
|
||||
static inline xrt_result_t
|
||||
xrt_swapchain_wait_image(struct xrt_swapchain *xsc, uint64_t timeout_ns, uint32_t index)
|
||||
xrt_swapchain_wait_image(struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t index)
|
||||
{
|
||||
return xsc->wait_image(xsc, timeout_ns, index);
|
||||
}
|
||||
|
@ -725,7 +725,7 @@ xrt_swapchain_release_image(struct xrt_swapchain *xsc, uint32_t index)
|
|||
*/
|
||||
|
||||
/*!
|
||||
* Compositor fence used for syncornization.
|
||||
* Compositor fence used for synchronization.
|
||||
*/
|
||||
struct xrt_compositor_fence
|
||||
{
|
||||
|
@ -1104,10 +1104,10 @@ struct xrt_compositor
|
|||
*/
|
||||
xrt_result_t (*predict_frame)(struct xrt_compositor *xc,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *out_wake_time_ns,
|
||||
uint64_t *out_predicted_gpu_time_ns,
|
||||
uint64_t *out_predicted_display_time_ns,
|
||||
uint64_t *out_predicted_display_period_ns);
|
||||
int64_t *out_wake_time_ns,
|
||||
int64_t *out_predicted_gpu_time_ns,
|
||||
int64_t *out_predicted_display_time_ns,
|
||||
int64_t *out_predicted_display_period_ns);
|
||||
|
||||
/*!
|
||||
* This function and @ref predict_frame function calls are a alternative to
|
||||
|
@ -1124,7 +1124,7 @@ struct xrt_compositor
|
|||
xrt_result_t (*mark_frame)(struct xrt_compositor *xc,
|
||||
int64_t frame_id,
|
||||
enum xrt_compositor_frame_point point,
|
||||
uint64_t when_ns);
|
||||
int64_t when_ns);
|
||||
|
||||
/*!
|
||||
* See xrWaitFrame.
|
||||
|
@ -1147,8 +1147,8 @@ struct xrt_compositor
|
|||
*/
|
||||
xrt_result_t (*wait_frame)(struct xrt_compositor *xc,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *out_predicted_display_time,
|
||||
uint64_t *out_predicted_display_period);
|
||||
int64_t *out_predicted_display_time,
|
||||
int64_t *out_predicted_display_period);
|
||||
|
||||
/*!
|
||||
* See xrBeginFrame.
|
||||
|
@ -1588,10 +1588,10 @@ xrt_comp_end_session(struct xrt_compositor *xc)
|
|||
static inline xrt_result_t
|
||||
xrt_comp_predict_frame(struct xrt_compositor *xc,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *out_wake_time_ns,
|
||||
uint64_t *out_predicted_gpu_time_ns,
|
||||
uint64_t *out_predicted_display_time_ns,
|
||||
uint64_t *out_predicted_display_period_ns)
|
||||
int64_t *out_wake_time_ns,
|
||||
int64_t *out_predicted_gpu_time_ns,
|
||||
int64_t *out_predicted_display_time_ns,
|
||||
int64_t *out_predicted_display_period_ns)
|
||||
{
|
||||
return xc->predict_frame( //
|
||||
xc, //
|
||||
|
@ -1610,10 +1610,7 @@ xrt_comp_predict_frame(struct xrt_compositor *xc,
|
|||
* @public @memberof xrt_compositor
|
||||
*/
|
||||
static inline xrt_result_t
|
||||
xrt_comp_mark_frame(struct xrt_compositor *xc,
|
||||
int64_t frame_id,
|
||||
enum xrt_compositor_frame_point point,
|
||||
uint64_t when_ns)
|
||||
xrt_comp_mark_frame(struct xrt_compositor *xc, int64_t frame_id, enum xrt_compositor_frame_point point, int64_t when_ns)
|
||||
{
|
||||
return xc->mark_frame(xc, frame_id, point, when_ns);
|
||||
}
|
||||
|
@ -1628,8 +1625,8 @@ xrt_comp_mark_frame(struct xrt_compositor *xc,
|
|||
static inline xrt_result_t
|
||||
xrt_comp_wait_frame(struct xrt_compositor *xc,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *out_predicted_display_time,
|
||||
uint64_t *out_predicted_display_period)
|
||||
int64_t *out_predicted_display_time,
|
||||
int64_t *out_predicted_display_period)
|
||||
{
|
||||
return xc->wait_frame(xc, out_frame_id, out_predicted_display_time, out_predicted_display_period);
|
||||
}
|
||||
|
@ -2380,7 +2377,7 @@ struct xrt_multi_compositor_control
|
|||
*/
|
||||
xrt_result_t (*notify_loss_pending)(struct xrt_system_compositor *xsc,
|
||||
struct xrt_compositor *xc,
|
||||
uint64_t loss_time_ns);
|
||||
int64_t loss_time_ns);
|
||||
|
||||
/*!
|
||||
* Notify this client/session if the compositor lost the ability of rendering.
|
||||
|
@ -2517,7 +2514,7 @@ xrt_syscomp_set_main_app_visibility(struct xrt_system_compositor *xsc, struct xr
|
|||
* @public @memberof xrt_system_compositor
|
||||
*/
|
||||
static inline xrt_result_t
|
||||
xrt_syscomp_notify_loss_pending(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, uint64_t loss_time_ns)
|
||||
xrt_syscomp_notify_loss_pending(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, int64_t loss_time_ns)
|
||||
{
|
||||
if (xsc->xmcc == NULL) {
|
||||
return XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED;
|
||||
|
|
|
@ -183,7 +183,7 @@ ipc_compositor_swapchain_destroy(struct xrt_swapchain *xsc)
|
|||
}
|
||||
|
||||
static xrt_result_t
|
||||
ipc_compositor_swapchain_wait_image(struct xrt_swapchain *xsc, uint64_t timeout_ns, uint32_t index)
|
||||
ipc_compositor_swapchain_wait_image(struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t index)
|
||||
{
|
||||
struct ipc_client_swapchain *ics = ipc_client_swapchain(xsc);
|
||||
struct ipc_client_compositor *icc = ics->icc;
|
||||
|
@ -522,17 +522,17 @@ ipc_compositor_end_session(struct xrt_compositor *xc)
|
|||
static xrt_result_t
|
||||
ipc_compositor_wait_frame(struct xrt_compositor *xc,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *out_predicted_display_time,
|
||||
uint64_t *out_predicted_display_period)
|
||||
int64_t *out_predicted_display_time,
|
||||
int64_t *out_predicted_display_period)
|
||||
{
|
||||
IPC_TRACE_MARKER();
|
||||
struct ipc_client_compositor *icc = ipc_client_compositor(xc);
|
||||
xrt_result_t xret;
|
||||
|
||||
int64_t frame_id = -1;
|
||||
uint64_t wake_up_time_ns = 0;
|
||||
uint64_t predicted_display_time = 0;
|
||||
uint64_t predicted_display_period = 0;
|
||||
int64_t wake_up_time_ns = 0;
|
||||
int64_t predicted_display_time = 0;
|
||||
int64_t predicted_display_period = 0;
|
||||
|
||||
xret = ipc_call_compositor_predict_frame( //
|
||||
icc->ipc_c, // Connection
|
||||
|
|
|
@ -861,9 +861,9 @@ ipc_handle_compositor_get_info(volatile struct ipc_client_state *ics, struct xrt
|
|||
xrt_result_t
|
||||
ipc_handle_compositor_predict_frame(volatile struct ipc_client_state *ics,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *out_wake_up_time_ns,
|
||||
uint64_t *out_predicted_display_time_ns,
|
||||
uint64_t *out_predicted_display_period_ns)
|
||||
int64_t *out_wake_up_time_ns,
|
||||
int64_t *out_predicted_display_time_ns,
|
||||
int64_t *out_predicted_display_period_ns)
|
||||
{
|
||||
IPC_TRACE_MARKER();
|
||||
|
||||
|
@ -877,7 +877,7 @@ ipc_handle_compositor_predict_frame(volatile struct ipc_client_state *ics,
|
|||
*/
|
||||
ipc_server_activate_session(ics);
|
||||
|
||||
uint64_t gpu_time_ns = 0;
|
||||
int64_t gpu_time_ns = 0;
|
||||
return xrt_comp_predict_frame( //
|
||||
ics->xc, //
|
||||
out_frame_id, //
|
||||
|
@ -1656,7 +1656,7 @@ ipc_handle_swapchain_import(volatile struct ipc_client_state *ics,
|
|||
}
|
||||
|
||||
xrt_result_t
|
||||
ipc_handle_swapchain_wait_image(volatile struct ipc_client_state *ics, uint32_t id, uint64_t timeout_ns, uint32_t index)
|
||||
ipc_handle_swapchain_wait_image(volatile struct ipc_client_state *ics, uint32_t id, int64_t timeout_ns, uint32_t index)
|
||||
{
|
||||
if (ics->xc == NULL) {
|
||||
return XRT_ERROR_IPC_SESSION_NOT_CREATED;
|
||||
|
|
|
@ -215,9 +215,9 @@
|
|||
"compositor_predict_frame": {
|
||||
"out": [
|
||||
{"name": "frame_id", "type": "int64_t"},
|
||||
{"name": "wake_up_time", "type": "uint64_t"},
|
||||
{"name": "predicted_display_time", "type": "uint64_t"},
|
||||
{"name": "predicted_display_period", "type": "uint64_t"}
|
||||
{"name": "wake_up_time", "type": "int64_t"},
|
||||
{"name": "predicted_display_time", "type": "int64_t"},
|
||||
{"name": "predicted_display_period", "type": "int64_t"}
|
||||
]
|
||||
},
|
||||
|
||||
|
@ -345,7 +345,7 @@
|
|||
"swapchain_wait_image": {
|
||||
"in": [
|
||||
{"name": "id", "type": "uint32_t"},
|
||||
{"name": "timeout_ns", "type": "uint64_t"},
|
||||
{"name": "timeout_ns", "type": "int64_t"},
|
||||
{"name": "index", "type": "uint32_t"}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -695,15 +695,15 @@ static XrResult
|
|||
do_wait_frame_and_checks(struct oxr_logger *log,
|
||||
struct oxr_session *sess,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *out_predicted_display_time,
|
||||
uint64_t *out_predicted_display_period,
|
||||
int64_t *out_predicted_display_time,
|
||||
int64_t *out_predicted_display_period,
|
||||
XrTime *out_converted_time)
|
||||
{
|
||||
assert(sess->compositor != NULL);
|
||||
|
||||
int64_t frame_id = -1;
|
||||
uint64_t predicted_display_time = 0;
|
||||
uint64_t predicted_display_period = 0;
|
||||
int64_t predicted_display_time = 0;
|
||||
int64_t predicted_display_period = 0;
|
||||
|
||||
xrt_result_t xret = xrt_comp_wait_frame( //
|
||||
sess->compositor, // compositor
|
||||
|
@ -765,8 +765,8 @@ oxr_session_frame_wait(struct oxr_logger *log, struct oxr_session *sess, XrFrame
|
|||
}
|
||||
|
||||
int64_t frame_id = -1;
|
||||
uint64_t predicted_display_time = 0;
|
||||
uint64_t predicted_display_period = 0;
|
||||
int64_t predicted_display_time = 0;
|
||||
int64_t predicted_display_period = 0;
|
||||
XrTime converted_time = 0;
|
||||
|
||||
XrResult ret = do_wait_frame_and_checks( //
|
||||
|
@ -811,7 +811,7 @@ oxr_session_frame_wait(struct oxr_logger *log, struct oxr_session *sess, XrFrame
|
|||
}
|
||||
|
||||
if (sess->frame_timing_wait_sleep_ms > 0) {
|
||||
uint64_t sleep_ns = U_TIME_1MS_IN_NS * sess->frame_timing_wait_sleep_ms;
|
||||
int64_t sleep_ns = U_TIME_1MS_IN_NS * sess->frame_timing_wait_sleep_ms;
|
||||
os_precise_sleeper_nanosleep(&sess->sleeper, sleep_ns);
|
||||
}
|
||||
|
||||
|
|
|
@ -347,10 +347,10 @@ sdl_compositor_end_session(struct xrt_compositor *xc)
|
|||
static xrt_result_t
|
||||
sdl_compositor_predict_frame(struct xrt_compositor *xc,
|
||||
int64_t *out_frame_id,
|
||||
uint64_t *out_wake_time_ns,
|
||||
uint64_t *out_predicted_gpu_time_ns,
|
||||
uint64_t *out_predicted_display_time_ns,
|
||||
uint64_t *out_predicted_display_period_ns)
|
||||
int64_t *out_wake_time_ns,
|
||||
int64_t *out_predicted_gpu_time_ns,
|
||||
int64_t *out_predicted_display_time_ns,
|
||||
int64_t *out_predicted_display_period_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
|
@ -358,10 +358,10 @@ sdl_compositor_predict_frame(struct xrt_compositor *xc,
|
|||
|
||||
SC_TRACE(c, "PREDICT_FRAME");
|
||||
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
uint64_t null_desired_present_time_ns = 0;
|
||||
uint64_t null_present_slop_ns = 0;
|
||||
uint64_t null_min_display_period_ns = 0;
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t null_desired_present_time_ns = 0;
|
||||
int64_t null_present_slop_ns = 0;
|
||||
int64_t null_min_display_period_ns = 0;
|
||||
|
||||
u_pc_predict( //
|
||||
c->upc, // upc
|
||||
|
@ -381,7 +381,7 @@ static xrt_result_t
|
|||
sdl_compositor_mark_frame(struct xrt_compositor *xc,
|
||||
int64_t frame_id,
|
||||
enum xrt_compositor_frame_point point,
|
||||
uint64_t when_ns)
|
||||
int64_t when_ns)
|
||||
{
|
||||
COMP_TRACE_MARKER();
|
||||
|
||||
|
@ -452,7 +452,7 @@ sdl_compositor_layer_commit(struct xrt_compositor *xc, xrt_graphics_sync_handle_
|
|||
|
||||
// When we begin rendering.
|
||||
{
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
u_pc_mark_point(c->upc, U_TIMING_POINT_BEGIN, frame_id, now_ns);
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ sdl_compositor_layer_commit(struct xrt_compositor *xc, xrt_graphics_sync_handle_
|
|||
|
||||
// When we are submitting to the GPU.
|
||||
{
|
||||
uint64_t now_ns = os_monotonic_get_ns();
|
||||
int64_t now_ns = os_monotonic_get_ns();
|
||||
u_pc_mark_point(c->upc, U_TIMING_POINT_SUBMIT_BEGIN, frame_id, now_ns);
|
||||
|
||||
now_ns = os_monotonic_get_ns();
|
||||
|
|
Loading…
Reference in a new issue