From 51ffd9e0114f1ffa48c6773035ee3448bf4e86cc Mon Sep 17 00:00:00 2001 From: Beyley Cardellio Date: Wed, 5 Nov 2025 18:50:14 -0800 Subject: [PATCH] xrt: Switch scannout duration to int64_t Part-of: --- src/xrt/compositor/main/comp_renderer.c | 2 +- src/xrt/drivers/steamvr_lh/device.cpp | 4 ++-- src/xrt/drivers/steamvr_lh/device.hpp | 2 +- src/xrt/include/xrt/xrt_device.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/xrt/compositor/main/comp_renderer.c b/src/xrt/compositor/main/comp_renderer.c index 2c83d865d..6cbb17813 100644 --- a/src/xrt/compositor/main/comp_renderer.c +++ b/src/xrt/compositor/main/comp_renderer.c @@ -259,7 +259,7 @@ calc_pose_data(struct comp_renderer *r, struct xrt_fov xdev_fovs[XRT_MAX_VIEWS] = XRT_STRUCT_INIT; struct xrt_pose xdev_poses[2][XRT_MAX_VIEWS] = XRT_STRUCT_INIT; - uint64_t scanout_time_ns = 0; + int64_t scanout_time_ns = 0; if (r->c->xdev->hmd->screens[0].scanout_direction == XRT_SCANOUT_DIRECTION_TOP_TO_BOTTOM) { scanout_time_ns = r->c->xdev->hmd->screens[0].scanout_time_ns; } else if (r->c->xdev->hmd->screens[0].scanout_direction != XRT_SCANOUT_DIRECTION_NONE) { diff --git a/src/xrt/drivers/steamvr_lh/device.cpp b/src/xrt/drivers/steamvr_lh/device.cpp index 4585e13c7..cf2c496ae 100644 --- a/src/xrt/drivers/steamvr_lh/device.cpp +++ b/src/xrt/drivers/steamvr_lh/device.cpp @@ -868,7 +868,7 @@ HmdDevice::set_nominal_frame_interval(uint64_t interval_ns) } void -HmdDevice::set_scanout_type(xrt_scanout_direction direction, uint64_t time_ns) +HmdDevice::set_scanout_type(xrt_scanout_direction direction, int64_t time_ns) { auto set = [this, direction, time_ns] { hmd_parts->base.screens[0].scanout_direction = direction; @@ -1047,7 +1047,7 @@ HmdDevice::handle_property_write(const vr::PropertyWrite_t &prop) case vr::Prop_DisplayFrequency_Float: { assert(prop.unBufferSize == sizeof(float)); float freq = *static_cast(prop.pvBuffer); - uint64_t interval_ns = (1.f / freq) * 1e9f; + int64_t interval_ns = (1.f / freq) * 1e9f; set_nominal_frame_interval(interval_ns); if (variant == VIVE_VARIANT_PRO) { set_scanout_type(XRT_SCANOUT_DIRECTION_TOP_TO_BOTTOM, interval_ns * 1600.0 / 1624.0); diff --git a/src/xrt/drivers/steamvr_lh/device.hpp b/src/xrt/drivers/steamvr_lh/device.hpp index 75f3a21d5..ad15e226e 100644 --- a/src/xrt/drivers/steamvr_lh/device.hpp +++ b/src/xrt/drivers/steamvr_lh/device.hpp @@ -211,7 +211,7 @@ private: set_nominal_frame_interval(uint64_t interval_ns); void - set_scanout_type(enum xrt_scanout_direction direction, uint64_t time_ns); + set_scanout_type(enum xrt_scanout_direction direction, int64_t time_ns); std::condition_variable hmd_parts_cv; std::mutex hmd_parts_mut; diff --git a/src/xrt/include/xrt/xrt_device.h b/src/xrt/include/xrt/xrt_device.h index 47d9ce487..d4e6bfcc1 100644 --- a/src/xrt/include/xrt/xrt_device.h +++ b/src/xrt/include/xrt/xrt_device.h @@ -103,7 +103,7 @@ struct xrt_hmd_parts //! Nominal frame interval uint64_t nominal_frame_interval_ns; enum xrt_scanout_direction scanout_direction; - uint64_t scanout_time_ns; + int64_t scanout_time_ns; } screens[1]; /*!