aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-04-15 22:29:25 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-04-15 22:29:25 +0400
commitc40de5364d5ff560c53a1faa00e138001efa6726 (patch)
tree55180e7ef980c120d01382e17812dfd4d9b0387c
parent69f723d68aa28698488618e00688ef3a84e40819 (diff)
downloadniri-c40de5364d5ff560c53a1faa00e138001efa6726.tar.gz
niri-c40de5364d5ff560c53a1faa00e138001efa6726.tar.bz2
niri-c40de5364d5ff560c53a1faa00e138001efa6726.zip
Add vrr_supported/enabled to output IPC
-rw-r--r--niri-ipc/src/lib.rs4
-rw-r--r--src/backend/tty.rs5
-rw-r--r--src/backend/winit.rs2
-rw-r--r--src/ipc/client.rs9
4 files changed, 20 insertions, 0 deletions
diff --git a/niri-ipc/src/lib.rs b/niri-ipc/src/lib.rs
index fb515e5d..33d25f2d 100644
--- a/niri-ipc/src/lib.rs
+++ b/niri-ipc/src/lib.rs
@@ -252,6 +252,10 @@ pub struct Output {
///
/// `None` if the output is disabled.
pub current_mode: Option<usize>,
+ /// Whether the output supports variable refresh rate.
+ pub vrr_supported: bool,
+ /// Whether variable refresh rate is enabled on the output.
+ pub vrr_enabled: bool,
/// Logical output information.
///
/// `None` if the output is not mapped to any logical output (for example, if it is disabled).
diff --git a/src/backend/tty.rs b/src/backend/tty.rs
index abeec237..fd6cf0d6 100644
--- a/src/backend/tty.rs
+++ b/src/backend/tty.rs
@@ -1451,6 +1451,9 @@ impl Tty {
}
}
+ let vrr_supported = is_vrr_capable(&device.drm, connector.handle()) == Some(true);
+ let vrr_enabled = surface.map_or(false, |surface| surface.vrr_enabled);
+
let logical = niri
.global_space
.outputs()
@@ -1467,6 +1470,8 @@ impl Tty {
physical_size,
modes,
current_mode,
+ vrr_supported,
+ vrr_enabled,
logical,
};
diff --git a/src/backend/winit.rs b/src/backend/winit.rs
index acf16481..177dab85 100644
--- a/src/backend/winit.rs
+++ b/src/backend/winit.rs
@@ -73,6 +73,8 @@ impl Winit {
is_preferred: true,
}],
current_mode: Some(0),
+ vrr_supported: false,
+ vrr_enabled: false,
logical: Some(logical_output(&output)),
},
)])));
diff --git a/src/ipc/client.rs b/src/ipc/client.rs
index 97413d0b..36fb2d37 100644
--- a/src/ipc/client.rs
+++ b/src/ipc/client.rs
@@ -72,6 +72,8 @@ pub fn handle_msg(msg: Msg, json: bool) -> anyhow::Result<()> {
physical_size,
modes,
current_mode,
+ vrr_supported,
+ vrr_enabled,
logical,
} = output;
@@ -94,6 +96,13 @@ pub fn handle_msg(msg: Msg, json: bool) -> anyhow::Result<()> {
println!(" Disabled");
}
+ if vrr_supported {
+ let enabled = if vrr_enabled { "enabled" } else { "disabled" };
+ println!(" Variable refresh rate: supported, {enabled}");
+ } else {
+ println!(" Variable refresh rate: not supported");
+ }
+
if let Some((width, height)) = physical_size {
println!(" Physical size: {width}x{height} mm");
} else {