forge
Explore
Log in

Don't you dare go Hollow

tty: Plot vblank dispatch offsets

Browse files at this commit

ef11975ec53005b10786e2bfe6f31ba88ff81a34Ivan MolodetskikhParent: 46403bd
src/backend/tty.rsmodified+15 -1
@@ -80,8 +80,10 @@ struct Surface {
80 dmabuf_feedback: DmabufFeedback,80 dmabuf_feedback: DmabufFeedback,
81 /// Tracy frame that goes from vblank to vblank.81 /// Tracy frame that goes from vblank to vblank.
82 vblank_frame: Option<tracy_client::Frame>,82 vblank_frame: Option<tracy_client::Frame>,
83- /// Frame name for the VBlank frame that unfortunately has to be leaked.83+ /// Frame name for the VBlank frame.
84 vblank_frame_name: tracy_client::FrameName,84 vblank_frame_name: tracy_client::FrameName,
85+ /// Plot name for the VBlank dispatch offset plot.
86+ vblank_plot_name: tracy_client::PlotName,
85 }87 }
86 88
87 impl Tty {89 impl Tty {
@@ -314,9 +316,15 @@ impl Tty {
314 format!("vblank on {name}, presentation time unknown")316 format!("vblank on {name}, presentation time unknown")
315 } else if presentation_time > now {317 } else if presentation_time > now {
316 let diff = presentation_time - now;318 let diff = presentation_time - now;
319+ tracy_client::Client::running()
320+ .unwrap()
321+ .plot(surface.vblank_plot_name, -diff.as_secs_f64() * 1000.);
317 format!("vblank on {name}, presentation is {diff:?} later")322 format!("vblank on {name}, presentation is {diff:?} later")
318 } else {323 } else {
319 let diff = now - presentation_time;324 let diff = now - presentation_time;
325+ tracy_client::Client::running()
326+ .unwrap()
327+ .plot(surface.vblank_plot_name, diff.as_secs_f64() * 1000.);
320 format!("vblank on {name}, presentation was {diff:?} ago")328 format!("vblank on {name}, presentation was {diff:?} ago")
321 };329 };
322 tracy_client::Client::running()330 tracy_client::Client::running()
@@ -551,6 +559,11 @@ impl Tty {
551 let vblank_frame_name = unsafe {559 let vblank_frame_name = unsafe {
552 tracy_client::internal::create_frame_name(format!("vblank on {output_name}\0").leak())560 tracy_client::internal::create_frame_name(format!("vblank on {output_name}\0").leak())
553 };561 };
562+ let vblank_plot_name = unsafe {
563+ tracy_client::internal::create_plot(
564+ format!("{output_name} vblank dispatch offset, ms\0").leak(),
565+ )
566+ };
554 567
555 self.connectors568 self.connectors
556 .lock()569 .lock()
@@ -563,6 +576,7 @@ impl Tty {
563 dmabuf_feedback,576 dmabuf_feedback,
564 vblank_frame: None,577 vblank_frame: None,
565 vblank_frame_name,578 vblank_frame_name,
579+ vblank_plot_name,
566 };580 };
567 let res = device.surfaces.insert(crtc, surface);581 let res = device.surfaces.insert(crtc, surface);
568 assert!(res.is_none(), "crtc must not have already existed");582 assert!(res.is_none(), "crtc must not have already existed");