Remove the WebXR dependency on ancient time@0.1 crate (#32862)

`webxr` depends on a very old verison of `time`, which allowed serializing
monotonic clock output. This isn't possible on all platforms, so newer
versions of `time` do not allow this. In order to stop using the old
0.1 versions of `time` we have to stop relying on times passed from `webxr`
to Servo. This change does that, at the cost of removing the XR
profiling feature. It has to be rewritten in another way in the `webxr`
crate.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2024-07-26 15:53:34 +02:00 committed by GitHub
parent eac54183c1
commit f7448b5d61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 5 additions and 54 deletions

View file

@ -18,7 +18,6 @@ profilemozjs = ['js/profilemozjs']
webgl_backtrace = ["canvas_traits/webgl_backtrace"]
js_backtrace = []
refcell_backtrace = ["accountable-refcell"]
xr-profile = ["webxr-api/profile"]
[build-dependencies]
phf_codegen = "0.11"

View file

@ -2912,10 +2912,6 @@ impl Document {
#[allow(unused)]
let mut time = 0;
#[cfg(feature = "xr-profile")]
{
time = time::precise_time_ns();
}
let (sender, receiver) = webgl::webgl_channel().unwrap();
self.window
.webgl_chan()

View file

@ -182,21 +182,12 @@ impl XRSession {
ROUTER.add_route(
frame_receiver.to_opaque(),
Box::new(move |message| {
#[allow(unused)]
let mut frame: Frame = message.to().unwrap();
#[cfg(feature = "xr-profile")]
{
let received = time::precise_time_ns();
println!(
"WEBXR PROFILING [raf receive]:\t{}ms",
(received - frame.sent_time) as f64 / 1_000_000.
);
frame.sent_time = received;
}
let frame: Frame = message.to().unwrap();
let time = time::precise_time_ns();
let this = this.clone();
let _ = task_source.queue_with_canceller(
task!(xr_raf_callback: move || {
this.root().raf_callback(frame);
this.root().raf_callback(frame, time);
}),
&canceller,
);
@ -363,15 +354,8 @@ impl XRSession {
}
/// <https://immersive-web.github.io/webxr/#xr-animation-frame>
fn raf_callback(&self, mut frame: Frame) {
fn raf_callback(&self, mut frame: Frame, time: u64) {
debug!("WebXR RAF callback {:?}", frame);
#[cfg(feature = "xr-profile")]
let raf_start = time::precise_time_ns();
#[cfg(feature = "xr-profile")]
println!(
"WEBXR PROFILING [raf queued]:\t{}ms",
(raf_start - frame.sent_time) as f64 / 1_000_000.
);
// Step 1-2 happen in the xebxr device thread
@ -421,7 +405,7 @@ impl XRSession {
mem::swap(&mut *self.raf_callback_list.borrow_mut(), &mut current);
}
let start = self.global().as_window().get_navigation_start();
let time = reduce_timing_resolution((frame.time_ns - start).to_ms());
let time = reduce_timing_resolution((time - start).to_ms());
let frame = XRFrame::new(&self.global(), self, frame);
// Step 8-9
@ -454,12 +438,6 @@ impl XRSession {
// TODO: how does this fit the webxr spec?
self.session.borrow_mut().render_animation_frame();
#[cfg(feature = "xr-profile")]
println!(
"WEBXR PROFILING [raf execute]:\t{}ms",
(time::precise_time_ns() - raf_start) as f64 / 1_000_000.
);
}
fn update_inline_projection_matrix(&self) {