Refactor format crtc
This commit is contained in:
parent
4319a48063
commit
f479143eba
2 changed files with 11 additions and 7 deletions
12
src/main.rs
12
src/main.rs
|
@ -27,10 +27,7 @@ fn main() {
|
|||
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"));
|
||||
let crtc_info = format_crtc(&gpu, encoder.crtc());
|
||||
|
||||
format!("{:?}, {}", encoder.kind(), crtc_info)
|
||||
}
|
||||
|
@ -45,3 +42,10 @@ fn main() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn format_crtc(gpu: &card::Card, crtc_handle: Option<drm::control::crtc::Handle>) -> String {
|
||||
match crtc_handle.and_then(|handle| Some(gpu.get_crtc(handle))) {
|
||||
Some(crtc) => format!("{:?}", crtc),
|
||||
None => format!("No CRTC data")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue