mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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:
parent
eac54183c1
commit
f7448b5d61
9 changed files with 5 additions and 54 deletions
3
Cargo.lock
generated
3
Cargo.lock
generated
|
@ -644,7 +644,6 @@ dependencies = [
|
||||||
"style",
|
"style",
|
||||||
"style_traits",
|
"style_traits",
|
||||||
"surfman",
|
"surfman",
|
||||||
"time 0.1.45",
|
|
||||||
"unicode-script",
|
"unicode-script",
|
||||||
"webrender",
|
"webrender",
|
||||||
"webrender_api",
|
"webrender_api",
|
||||||
|
@ -670,7 +669,6 @@ dependencies = [
|
||||||
"servo_config",
|
"servo_config",
|
||||||
"sparkle",
|
"sparkle",
|
||||||
"style",
|
"style",
|
||||||
"time 0.1.45",
|
|
||||||
"webrender_api",
|
"webrender_api",
|
||||||
"webxr-api",
|
"webxr-api",
|
||||||
]
|
]
|
||||||
|
@ -7382,7 +7380,6 @@ dependencies = [
|
||||||
"ipc-channel",
|
"ipc-channel",
|
||||||
"log",
|
"log",
|
||||||
"serde",
|
"serde",
|
||||||
"time 0.1.45",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -12,7 +12,6 @@ path = "lib.rs"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
webgl_backtrace = ["canvas_traits/webgl_backtrace"]
|
webgl_backtrace = ["canvas_traits/webgl_backtrace"]
|
||||||
xr-profile = ["webxr-api/profile", "time"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
app_units = { workspace = true }
|
app_units = { workspace = true }
|
||||||
|
@ -41,7 +40,6 @@ sparkle = { workspace = true }
|
||||||
style = { workspace = true }
|
style = { workspace = true }
|
||||||
style_traits = { workspace = true }
|
style_traits = { workspace = true }
|
||||||
surfman = { workspace = true }
|
surfman = { workspace = true }
|
||||||
time = { workspace = true, optional = true }
|
|
||||||
unicode-script = { workspace = true }
|
unicode-script = { workspace = true }
|
||||||
webrender = { workspace = true }
|
webrender = { workspace = true }
|
||||||
webrender_api = { workspace = true }
|
webrender_api = { workspace = true }
|
||||||
|
|
|
@ -51,11 +51,6 @@ use webxr_api::{
|
||||||
|
|
||||||
use crate::webgl_limits::GLLimitsDetect;
|
use crate::webgl_limits::GLLimitsDetect;
|
||||||
|
|
||||||
#[cfg(feature = "xr-profile")]
|
|
||||||
fn to_ms(ns: u64) -> f64 {
|
|
||||||
ns as f64 / 1_000_000.
|
|
||||||
}
|
|
||||||
|
|
||||||
struct GLContextData {
|
struct GLContextData {
|
||||||
ctx: Context,
|
ctx: Context,
|
||||||
gl: Rc<Gl>,
|
gl: Rc<Gl>,
|
||||||
|
@ -831,14 +826,6 @@ impl WebGLThread {
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
let mut end_swap = 0;
|
let mut end_swap = 0;
|
||||||
#[cfg(feature = "xr-profile")]
|
|
||||||
{
|
|
||||||
end_swap = time::precise_time_ns();
|
|
||||||
println!(
|
|
||||||
"WEBXR PROFILING [swap buffer]:\t{}ms",
|
|
||||||
to_ms(end_swap - start_swap)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
completed_sender.send(end_swap).unwrap();
|
completed_sender.send(end_swap).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ profilemozjs = ['js/profilemozjs']
|
||||||
webgl_backtrace = ["canvas_traits/webgl_backtrace"]
|
webgl_backtrace = ["canvas_traits/webgl_backtrace"]
|
||||||
js_backtrace = []
|
js_backtrace = []
|
||||||
refcell_backtrace = ["accountable-refcell"]
|
refcell_backtrace = ["accountable-refcell"]
|
||||||
xr-profile = ["webxr-api/profile"]
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
phf_codegen = "0.11"
|
phf_codegen = "0.11"
|
||||||
|
|
|
@ -2912,10 +2912,6 @@ impl Document {
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
let mut time = 0;
|
let mut time = 0;
|
||||||
#[cfg(feature = "xr-profile")]
|
|
||||||
{
|
|
||||||
time = time::precise_time_ns();
|
|
||||||
}
|
|
||||||
let (sender, receiver) = webgl::webgl_channel().unwrap();
|
let (sender, receiver) = webgl::webgl_channel().unwrap();
|
||||||
self.window
|
self.window
|
||||||
.webgl_chan()
|
.webgl_chan()
|
||||||
|
|
|
@ -182,21 +182,12 @@ impl XRSession {
|
||||||
ROUTER.add_route(
|
ROUTER.add_route(
|
||||||
frame_receiver.to_opaque(),
|
frame_receiver.to_opaque(),
|
||||||
Box::new(move |message| {
|
Box::new(move |message| {
|
||||||
#[allow(unused)]
|
let frame: Frame = message.to().unwrap();
|
||||||
let mut frame: Frame = message.to().unwrap();
|
let time = time::precise_time_ns();
|
||||||
#[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 this = this.clone();
|
let this = this.clone();
|
||||||
let _ = task_source.queue_with_canceller(
|
let _ = task_source.queue_with_canceller(
|
||||||
task!(xr_raf_callback: move || {
|
task!(xr_raf_callback: move || {
|
||||||
this.root().raf_callback(frame);
|
this.root().raf_callback(frame, time);
|
||||||
}),
|
}),
|
||||||
&canceller,
|
&canceller,
|
||||||
);
|
);
|
||||||
|
@ -363,15 +354,8 @@ impl XRSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://immersive-web.github.io/webxr/#xr-animation-frame>
|
/// <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);
|
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
|
// 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);
|
mem::swap(&mut *self.raf_callback_list.borrow_mut(), &mut current);
|
||||||
}
|
}
|
||||||
let start = self.global().as_window().get_navigation_start();
|
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);
|
let frame = XRFrame::new(&self.global(), self, frame);
|
||||||
// Step 8-9
|
// Step 8-9
|
||||||
|
@ -454,12 +438,6 @@ impl XRSession {
|
||||||
|
|
||||||
// TODO: how does this fit the webxr spec?
|
// TODO: how does this fit the webxr spec?
|
||||||
self.session.borrow_mut().render_animation_frame();
|
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) {
|
fn update_inline_projection_matrix(&self) {
|
||||||
|
|
|
@ -30,7 +30,6 @@ webgl_backtrace = [
|
||||||
"canvas/webgl_backtrace",
|
"canvas/webgl_backtrace",
|
||||||
"canvas_traits/webgl_backtrace",
|
"canvas_traits/webgl_backtrace",
|
||||||
]
|
]
|
||||||
xr-profile = ["canvas/xr-profile", "canvas_traits/xr-profile", "script/xr-profile", "webxr/profile"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
background_hang_monitor = { path = "../background_hang_monitor" }
|
background_hang_monitor = { path = "../background_hang_monitor" }
|
||||||
|
|
|
@ -12,7 +12,6 @@ path = "lib.rs"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
webgl_backtrace = []
|
webgl_backtrace = []
|
||||||
xr-profile = ["webxr-api/profile", "time"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
base = { workspace = true }
|
base = { workspace = true }
|
||||||
|
@ -28,6 +27,5 @@ serde_bytes = { workspace = true }
|
||||||
servo_config = { path = "../../config" }
|
servo_config = { path = "../../config" }
|
||||||
sparkle = { workspace = true }
|
sparkle = { workspace = true }
|
||||||
style = { workspace = true }
|
style = { workspace = true }
|
||||||
time = { workspace = true, optional = true }
|
|
||||||
webrender_api = { workspace = true }
|
webrender_api = { workspace = true }
|
||||||
webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] }
|
webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] }
|
||||||
|
|
|
@ -50,7 +50,6 @@ profilemozjs = ["libservo/profilemozjs"]
|
||||||
refcell_backtrace = ["libservo/refcell_backtrace"]
|
refcell_backtrace = ["libservo/refcell_backtrace"]
|
||||||
webdriver = ["libservo/webdriver"]
|
webdriver = ["libservo/webdriver"]
|
||||||
webgl_backtrace = ["libservo/webgl_backtrace"]
|
webgl_backtrace = ["libservo/webgl_backtrace"]
|
||||||
xr-profile = ["libservo/xr-profile"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = { workspace = true }
|
libc = { workspace = true }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue