Add vrr_supported/enabled to output IPC

This commit is contained in:
Ivan Molodetskikh
2024-04-15 22:29:25 +04:00
parent 69f723d68a
commit c40de5364d
4 changed files with 20 additions and 0 deletions
+4
View File
@@ -252,6 +252,10 @@ pub struct Output {
/// ///
/// `None` if the output is disabled. /// `None` if the output is disabled.
pub current_mode: Option<usize>, 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. /// Logical output information.
/// ///
/// `None` if the output is not mapped to any logical output (for example, if it is disabled). /// `None` if the output is not mapped to any logical output (for example, if it is disabled).
+5
View File
@@ -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 let logical = niri
.global_space .global_space
.outputs() .outputs()
@@ -1467,6 +1470,8 @@ impl Tty {
physical_size, physical_size,
modes, modes,
current_mode, current_mode,
vrr_supported,
vrr_enabled,
logical, logical,
}; };
+2
View File
@@ -73,6 +73,8 @@ impl Winit {
is_preferred: true, is_preferred: true,
}], }],
current_mode: Some(0), current_mode: Some(0),
vrr_supported: false,
vrr_enabled: false,
logical: Some(logical_output(&output)), logical: Some(logical_output(&output)),
}, },
)]))); )])));
+9
View File
@@ -72,6 +72,8 @@ pub fn handle_msg(msg: Msg, json: bool) -> anyhow::Result<()> {
physical_size, physical_size,
modes, modes,
current_mode, current_mode,
vrr_supported,
vrr_enabled,
logical, logical,
} = output; } = output;
@@ -94,6 +96,13 @@ pub fn handle_msg(msg: Msg, json: bool) -> anyhow::Result<()> {
println!(" Disabled"); 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 { if let Some((width, height)) = physical_size {
println!(" Physical size: {width}x{height} mm"); println!(" Physical size: {width}x{height} mm");
} else { } else {