aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-09-04 08:02:24 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-09-04 08:02:24 +0400
commitacb9376d05b389ae045b6eeeafbcd06dc586430c (patch)
treed44ab82d77221b9d7f80870ac0c67ca06250958c /src/backend
parentacf3016bce426dd45bbc2c299373a3cfd6a7eba4 (diff)
downloadniri-acb9376d05b389ae045b6eeeafbcd06dc586430c.tar.gz
niri-acb9376d05b389ae045b6eeeafbcd06dc586430c.tar.bz2
niri-acb9376d05b389ae045b6eeeafbcd06dc586430c.zip
tty: Add name and presentation to vblank mark
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/tty.rs26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs
index 27f8d8ad..d49c7762 100644
--- a/src/backend/tty.rs
+++ b/src/backend/tty.rs
@@ -33,6 +33,7 @@ use smithay_drm_extras::drm_scanner::{DrmScanEvent, DrmScanner};
use smithay_drm_extras::edid::EdidInfo;
use crate::niri::OutputRenderElements;
+use crate::utils::get_monotonic_time;
use crate::{LoopData, Niri};
const BACKGROUND_COLOR: [f32; 4] = [0.1, 0.1, 0.1, 1.];
@@ -275,14 +276,12 @@ impl Tty {
let tty = data.state.backend.tty();
match event {
DrmEvent::VBlank(crtc) => {
- tracy_client::Client::running()
- .unwrap()
- .message("vblank", 0);
- trace!("vblank {metadata:?}");
+ let now = get_monotonic_time();
let device = tty.output_device.as_mut().unwrap();
- let drm_compositor =
- &mut device.surfaces.get_mut(&crtc).unwrap().compositor;
+ let surface = device.surfaces.get_mut(&crtc).unwrap();
+ let name = &surface.name;
+ trace!("vblank on {name} {metadata:?}");
let presentation_time = match metadata.as_mut().unwrap().time {
DrmEventTime::Monotonic(time) => time,
@@ -294,8 +293,21 @@ impl Tty {
}
};
+ let message = if presentation_time.is_zero() {
+ format!("vblank on {name}, presentation time unknown")
+ } else if presentation_time > now {
+ let diff = presentation_time - now;
+ format!("vblank on {name}, presentation is {diff:?} later")
+ } else {
+ let diff = now - presentation_time;
+ format!("vblank on {name}, presentation was {diff:?} ago")
+ };
+ tracy_client::Client::running()
+ .unwrap()
+ .message(&message, 0);
+
// Mark the last frame as submitted.
- match drm_compositor.frame_submitted() {
+ match surface.compositor.frame_submitted() {
Ok(Some(mut feedback)) => {
let refresh =
feedback.output().unwrap().current_mode().unwrap().refresh