bga/edid.rs
2024-09-09 09:44:51 -05:00

58 lines
1.8 KiB
Rust

//let mut edid = [0; 1024];
//
//let edid_vol = unsafe {
// VolatilePtr::new(NonNull::slice_from_raw_parts(
// NonNull::new(reg_base).unwrap(),
// 1024,
// ))
//};
//
//edid_vol.copy_into_slice(&mut edid);
//
//rhexdump!(&edid);
//
//if edid[35] & 0xC0 > 0 {
// println!("Established timing 720x400");
//}
//if edid[35] & 0x3C > 0 {
// println!("Established timing 640x480");
//}
//if (edid[35] & 0x3 > 0) | (edid[36] & 0xC0 > 0) {
// println!("Established timing 800x600");
//}
//if edid[36] & 0x20 > 0 {
// println!("Established timing 832x624");
//}
//if edid[36] & 0x1E > 0 {
// println!("Established timing 1024x768");
//}
//if edid[36] & 0x1 > 0 {
// println!("Established timing 1280x1024");
//}
//if edid[37] & 0x80 > 0 {
// println!("Established timing 1152x870");
//}
//
//for i in 0..7 {
// let offset = 38 + 2 * i;
// let xres = ((edid[offset] as u32) + 31) * 8;
// let aspect = (edid[offset] & 0xC0) >> 6;
// let yres = match aspect {
// 0 => (xres / 16) * 10,
// 1 => (xres / 4) * 3,
// 2 => (xres / 5) * 4,
// 3 => (xres / 16) * 9,
// _ => panic!("Invalid aspect!"),
// };
// println!("Standard res {i}: {xres}x{yres}");
//}
//
//for (i, offset) in [0x36, 0x48, 0x5A, 0x6C].iter().enumerate() {
// let xres = edid[offset + 2] as u32 | ((edid[offset + 4] as u32 & 0xF0) << 4);
// if xres == 0 {
// continue;
// }
// let yres = edid[offset + 5] as u32 | ((edid[offset + 7] as u32 & 0xF0) << 4);
// println!("Detailed res {i}: {xres}x{yres}");
//}