forge
Explore
Log in

Don't you dare go Hollow

Add vrr_supported/enabled to output IPC

Browse files at this commit

c40de5364d5ff560c53a1faa00e138001efa6726Ivan MolodetskikhParent: 69f723d
niri-ipc/src/lib.rsmodified+4 -0
@@ -252,6 +252,10 @@ pub struct Output {
252 ///252 ///
253 /// `None` if the output is disabled.253 /// `None` if the output is disabled.
254 pub current_mode: Option<usize>,254 pub current_mode: Option<usize>,
255+ /// Whether the output supports variable refresh rate.
256+ pub vrr_supported: bool,
257+ /// Whether variable refresh rate is enabled on the output.
258+ pub vrr_enabled: bool,
255 /// Logical output information.259 /// Logical output information.
256 ///260 ///
257 /// `None` if the output is not mapped to any logical output (for example, if it is disabled).261 /// `None` if the output is not mapped to any logical output (for example, if it is disabled).
src/backend/tty.rsmodified+5 -0
@@ -1451,6 +1451,9 @@ impl Tty {
1451 }1451 }
1452 }1452 }
1453 1453
1454+ let vrr_supported = is_vrr_capable(&device.drm, connector.handle()) == Some(true);
1455+ let vrr_enabled = surface.map_or(false, |surface| surface.vrr_enabled);
1456+
1454 let logical = niri1457 let logical = niri
1455 .global_space1458 .global_space
1456 .outputs()1459 .outputs()
@@ -1467,6 +1470,8 @@ impl Tty {
1467 physical_size,1470 physical_size,
1468 modes,1471 modes,
1469 current_mode,1472 current_mode,
1473+ vrr_supported,
1474+ vrr_enabled,
1470 logical,1475 logical,
1471 };1476 };
1472 1477
src/backend/winit.rsmodified+2 -0
@@ -73,6 +73,8 @@ impl Winit {
73 is_preferred: true,73 is_preferred: true,
74 }],74 }],
75 current_mode: Some(0),75 current_mode: Some(0),
76+ vrr_supported: false,
77+ vrr_enabled: false,
76 logical: Some(logical_output(&output)),78 logical: Some(logical_output(&output)),
77 },79 },
78 )])));80 )])));
src/ipc/client.rsmodified+9 -0
@@ -72,6 +72,8 @@ pub fn handle_msg(msg: Msg, json: bool) -> anyhow::Result<()> {
72 physical_size,72 physical_size,
73 modes,73 modes,
74 current_mode,74 current_mode,
75+ vrr_supported,
76+ vrr_enabled,
75 logical,77 logical,
76 } = output;78 } = output;
77 79
@@ -94,6 +96,13 @@ pub fn handle_msg(msg: Msg, json: bool) -> anyhow::Result<()> {
94 println!(" Disabled");96 println!(" Disabled");
95 }97 }
96 98
99+ if vrr_supported {
100+ let enabled = if vrr_enabled { "enabled" } else { "disabled" };
101+ println!(" Variable refresh rate: supported, {enabled}");
102+ } else {
103+ println!(" Variable refresh rate: not supported");
104+ }
105+
97 if let Some((width, height)) = physical_size {106 if let Some((width, height)) = physical_size {
98 println!(" Physical size: {width}x{height} mm");107 println!(" Physical size: {width}x{height} mm");
99 } else {108 } else {