use nix::ioctl_read_bad;
#[repr(C)]
#[derive(Clone, Default, Debug)]
pub struct fb_bitfield {
pub offset: u32,
pub length: u32,
pub msb_right: u32,
}
#[repr(C)]
#[derive(Clone, Default, Debug)]
pub struct fb_var_screeninfo {
pub xres: u32,
pub yres: u32,
pub xres_virtual: u32,
pub yres_virtual: u32,
pub xoffset: u32,
pub yoffset: u32,
pub bits_per_pixel: u32,
pub grayscale: u32,
pub red: fb_bitfield,
pub green: fb_bitfield,
pub blue: fb_bitfield,
pub transp: fb_bitfield,
pub nonstd: u32,
pub activate: u32,
pub height: u32,
pub width: u32,
pub accel_flags: u32,
pub pixclock: u32,
pub left_margin: u32,
pub right_margin: u32,
pub upper_margin: u32,
pub lower_margin: u32,
pub hsync_len: u32,
pub vsync_len: u32,
pub sync: u32,
pub vmode: u32,
pub rotate: u32,
pub colorspace: u32,
pub reserved: [u32; 4],
}
impl fb_var_screeninfo {
pub fn overall_size(&self) -> usize {
(self.xres * self.yres * self.bits_per_pixel / 8) as usize
}
}
ioctl_read_bad! {
get_var_screeninfo, 0x4600, fb_var_screeninfo
}