Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X11 present #989

Merged
merged 13 commits into from
Jun 30, 2020
Prev Previous commit
Next Next commit
Track missed presents.
  • Loading branch information
jneem committed Jun 21, 2020
commit 582a7e462e4c40df14e110bcd601af658a3df495
24 changes: 24 additions & 0 deletions druid-shell/src/platform/x11/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ impl WindowBuilder {
region: region_id,
waiting_on: None,
needs_present: false,
last_msc: None,
last_ust: None,
})
} else {
Err(anyhow!("no present opcode"))
Expand Down Expand Up @@ -438,6 +440,12 @@ struct PresentData {
waiting_on: Option<u32>,
/// We need to render another frame as soon as the current one is done presenting.
needs_present: bool,
/// The last MSC that was completed. This can be used to diagnose latency problems, because MSC
/// is a frame counter: we should be presenting on every frame, and storing the last completed
/// MSC lets us know if we missed one.
last_msc: Option<u64>,
/// The time at which the last frame was completed.
last_ust: Option<u64>,
jneem marked this conversation as resolved.
Show resolved Hide resolved
}

impl Window {
Expand Down Expand Up @@ -844,6 +852,22 @@ impl Window {
);
}

// Check whether we missed presenting on any frames.
if let Some(last_msc) = present.last_msc {
if last_msc.wrapping_add(1) != event.msc {
log::warn!(
"missed a present: msc went from {} to {}",
last_msc,
event.msc
);
if let Some(last_ust) = present.last_ust {
log::warn!("ust went from {} to {}", last_ust, event.ust);
}
}
}

present.last_msc = Some(event.msc);
present.last_ust = Some(event.ust);
present.waiting_on = None;
}

Expand Down