aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-03-01 07:49:10 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-03-01 07:54:58 +0400
commit92d9c7ff4fda3b8e10d92e86e5803b0b40886766 (patch)
treede6821277a2c6be830f2e6267f8ff84cbf79d472
parent28977d1d3fd7883a7f757a1ba4e636bdacf9d0be (diff)
downloadniri-92d9c7ff4fda3b8e10d92e86e5803b0b40886766.tar.gz
niri-92d9c7ff4fda3b8e10d92e86e5803b0b40886766.tar.bz2
niri-92d9c7ff4fda3b8e10d92e86e5803b0b40886766.zip
Add emulate-zero-presentation-time debug flag
-rw-r--r--niri-config/src/lib.rs2
-rw-r--r--resources/default-config.kdl5
-rw-r--r--src/backend/tty.rs5
3 files changed, 12 insertions, 0 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs
index 59a4813c..c2a4dfbe 100644
--- a/niri-config/src/lib.rs
+++ b/niri-config/src/lib.rs
@@ -810,6 +810,8 @@ pub struct DebugConfig {
pub disable_cursor_plane: bool,
#[knuffel(child, unwrap(argument))]
pub render_drm_device: Option<PathBuf>,
+ #[knuffel(child)]
+ pub emulate_zero_presentation_time: bool,
}
impl Config {
diff --git a/resources/default-config.kdl b/resources/default-config.kdl
index 35a04ca7..616cd48f 100644
--- a/resources/default-config.kdl
+++ b/resources/default-config.kdl
@@ -557,4 +557,9 @@ debug {
// Enable the color-transformations capability of the Smithay renderer.
// May cause a slight decrease in rendering performance.
// enable-color-transformations-capability
+
+ // Emulate zero (unknown) presentation time returned from DRM.
+ // This is a thing on NVIDIA proprietary drivers, so this flag can be
+ // used to test that we don't break too hard on those systems.
+ // emulate-zero-presentation-time
}
diff --git a/src/backend/tty.rs b/src/backend/tty.rs
index 1f0cdb16..c60dc4a0 100644
--- a/src/backend/tty.rs
+++ b/src/backend/tty.rs
@@ -902,6 +902,11 @@ impl Tty {
Duration::ZERO
}
};
+ let presentation_time = if niri.config.borrow().debug.emulate_zero_presentation_time {
+ Duration::ZERO
+ } else {
+ presentation_time
+ };
let message = if presentation_time.is_zero() {
format!("vblank on {name}, presentation time unknown")