From 521ff05d86983becb841a13e90cff725e563dc60 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Mon, 30 Sep 2024 23:54:25 +0200 Subject: [PATCH] Display CRTC --- src/main.rs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index dbfdc7e..b2a5105 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,7 +17,30 @@ fn main() { println!("Connectors:"); for handle in resource_handles.connectors() { match gpu.get_connector(*handle, false) { - Ok(connector) => println!("\t{} ({:?})", connector.interface().as_str(), connector.state()), + Ok(connector) => { + println!("\t{} ({:?})", connector.interface().as_str(), connector.state()); + + let current_encoder = connector + .current_encoder() + .and_then(|encoder_handle| gpu.get_encoder(encoder_handle).ok()); + + let encoder_info = match current_encoder { + Some(encoder) => { + + let crtc_info = encoder.crtc() + .and_then(|crtc_handle| gpu.get_crtc(crtc_handle).ok()) + .and_then(|crtc| Some(format!("{:?}", crtc))) + .unwrap_or_else(|| format!("No CRTC data")); + + format!("{:?}, {}", encoder.kind(), crtc_info) + } + None => format!("No encoder found") + }; + + println!("\t\tEncoder: {}", encoder_info); + + println!(""); // Add blank line + }, Err(_) => {} } }