aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-09-14 09:19:20 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-09-14 09:19:20 +0400
commitef11975ec53005b10786e2bfe6f31ba88ff81a34 (patch)
treea28ddf1878c2503544b64c69719bc7c5ac9db633
parent46403bd84a8e7a35fa7bcbdc1c7b95639613888c (diff)
downloadniri-ef11975ec53005b10786e2bfe6f31ba88ff81a34.tar.gz
niri-ef11975ec53005b10786e2bfe6f31ba88ff81a34.tar.bz2
niri-ef11975ec53005b10786e2bfe6f31ba88ff81a34.zip
tty: Plot vblank dispatch offsets
-rw-r--r--src/backend/tty.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs
index 343da54e..475a007d 100644
--- a/src/backend/tty.rs
+++ b/src/backend/tty.rs
@@ -80,8 +80,10 @@ struct Surface {
dmabuf_feedback: DmabufFeedback,
/// Tracy frame that goes from vblank to vblank.
vblank_frame: Option<tracy_client::Frame>,
- /// Frame name for the VBlank frame that unfortunately has to be leaked.
+ /// Frame name for the VBlank frame.
vblank_frame_name: tracy_client::FrameName,
+ /// Plot name for the VBlank dispatch offset plot.
+ vblank_plot_name: tracy_client::PlotName,
}
impl Tty {
@@ -314,9 +316,15 @@ impl Tty {
format!("vblank on {name}, presentation time unknown")
} else if presentation_time > now {
let diff = presentation_time - now;
+ tracy_client::Client::running()
+ .unwrap()
+ .plot(surface.vblank_plot_name, -diff.as_secs_f64() * 1000.);
format!("vblank on {name}, presentation is {diff:?} later")
} else {
let diff = now - presentation_time;
+ tracy_client::Client::running()
+ .unwrap()
+ .plot(surface.vblank_plot_name, diff.as_secs_f64() * 1000.);
format!("vblank on {name}, presentation was {diff:?} ago")
};
tracy_client::Client::running()
@@ -551,6 +559,11 @@ impl Tty {
let vblank_frame_name = unsafe {
tracy_client::internal::create_frame_name(format!("vblank on {output_name}\0").leak())
};
+ let vblank_plot_name = unsafe {
+ tracy_client::internal::create_plot(
+ format!("{output_name} vblank dispatch offset, ms\0").leak(),
+ )
+ };
self.connectors
.lock()
@@ -563,6 +576,7 @@ impl Tty {
dmabuf_feedback,
vblank_frame: None,
vblank_frame_name,
+ vblank_plot_name,
};
let res = device.surfaces.insert(crtc, surface);
assert!(res.is_none(), "crtc must not have already existed");