1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#[repr(C)]
#[derive(Debug, PartialEq, Eq)]
/// Framebuffer structure
pub struct Framebuffer {
    /// The address of the framebuffer
    pub address: *mut u8,
    /// The width of the framebuffer
    pub width: u16,
    /// The height of the framebuffer
    pub height: u16,
    /// The pitch of the framebuffer
    pub pitch: u16,
    /// How many bits are present per pixel
    pub bpp: u16,
    /// The memory model of the framebuffer
    pub memory_model: u8,
    /// The red mask size
    pub red_mask_size: u8,
    /// The red mask shift amount
    pub red_mask_shift: u8,
    /// The green mask size
    pub green_mask_size: u8,
    /// The green mask shift amount
    pub green_mask_shift: u8,
    /// The blue mask size
    pub blue_mask_size: u8,
    /// The blue mask shift amount
    pub blue_mask_shift: u8,
    /// This is unused, you shouldn't even see this.
    unused: u8,
    /// The size of the EDID
    pub edid_size: u64,
    /// A pointer to the EDID
    pub edid: *mut u8,
}

#[cfg(test)]
impl Framebuffer {
    pub fn new_empty() -> Self {
        use core::ptr::null_mut;
        Self {
            address: null_mut(),
            width: 100,
            height: 100,
            pitch: 3,
            bpp: 3,
            memory_model: 0,
            red_mask_size: 0,
            red_mask_shift: 0,
            green_mask_size: 0,
            green_mask_shift: 0,
            blue_mask_size: 0,
            blue_mask_shift: 0,
            unused: 0,
            edid_size: 0,
            edid: null_mut(),
        }
    }
}