Display CRTC

This commit is contained in:
Florian RICHER 2024-09-30 23:54:25 +02:00
parent 30ca46d2b7
commit 521ff05d86

View file

@ -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(_) => {}
}
}