mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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_traits",
|
||||
"surfman",
|
||||
"time 0.1.45",
|
||||
"unicode-script",
|
||||
"webrender",
|
||||
"webrender_api",
|
||||
|
@ -670,7 +669,6 @@ dependencies = [
|
|||
"servo_config",
|
||||
"sparkle",
|
||||
"style",
|
||||
"time 0.1.45",
|
||||
"webrender_api",
|
||||
"webxr-api",
|
||||
]
|
||||
|
@ -7382,7 +7380,6 @@ dependencies = [
|
|||
"ipc-channel",
|
||||
"log",
|
||||
"serde",
|
||||
"time 0.1.45",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -12,7 +12,6 @@ path = "lib.rs"
|
|||
|
||||
[features]
|
||||
webgl_backtrace = ["canvas_traits/webgl_backtrace"]
|
||||
xr-profile = ["webxr-api/profile", "time"]
|
||||
|
||||
[dependencies]
|
||||
app_units = { workspace = true }
|
||||
|
@ -41,7 +40,6 @@ sparkle = { workspace = true }
|
|||
style = { workspace = true }
|
||||
style_traits = { workspace = true }
|
||||
surfman = { workspace = true }
|
||||
time = { workspace = true, optional = true }
|
||||
unicode-script = { workspace = true }
|
||||
webrender = { workspace = true }
|
||||
webrender_api = { workspace = true }
|
||||
|
|
|
@ -51,11 +51,6 @@ use webxr_api::{
|
|||
|
||||
use crate::webgl_limits::GLLimitsDetect;
|
||||
|
||||
#[cfg(feature = "xr-profile")]
|
||||
fn to_ms(ns: u64) -> f64 {
|
||||
ns as f64 / 1_000_000.
|
||||
}
|
||||
|
||||
struct GLContextData {
|
||||
ctx: Context,
|
||||
gl: Rc<Gl>,
|
||||
|
@ -831,14 +826,6 @@ impl WebGLThread {
|
|||
|
||||
#[allow(unused)]
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -30,7 +30,6 @@ webgl_backtrace = [
|
|||
"canvas/webgl_backtrace",
|
||||
"canvas_traits/webgl_backtrace",
|
||||
]
|
||||
xr-profile = ["canvas/xr-profile", "canvas_traits/xr-profile", "script/xr-profile", "webxr/profile"]
|
||||
|
||||
[dependencies]
|
||||
background_hang_monitor = { path = "../background_hang_monitor" }
|
||||
|
|
|
@ -12,7 +12,6 @@ path = "lib.rs"
|
|||
|
||||
[features]
|
||||
webgl_backtrace = []
|
||||
xr-profile = ["webxr-api/profile", "time"]
|
||||
|
||||
[dependencies]
|
||||
base = { workspace = true }
|
||||
|
@ -28,6 +27,5 @@ serde_bytes = { workspace = true }
|
|||
servo_config = { path = "../../config" }
|
||||
sparkle = { workspace = true }
|
||||
style = { workspace = true }
|
||||
time = { workspace = true, optional = true }
|
||||
webrender_api = { workspace = true }
|
||||
webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] }
|
||||
|
|
|
@ -50,7 +50,6 @@ profilemozjs = ["libservo/profilemozjs"]
|
|||
refcell_backtrace = ["libservo/refcell_backtrace"]
|
||||
webdriver = ["libservo/webdriver"]
|
||||
webgl_backtrace = ["libservo/webgl_backtrace"]
|
||||
xr-profile = ["libservo/xr-profile"]
|
||||
|
||||
[dependencies]
|
||||
libc = { workspace = true }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue