| 1 |
//! Graphics Output Protocol |
| 2 |
//! |
| 3 |
//! Provides means to configure graphics hardware and get access to |
| 4 |
//! framebuffers. Replaces the old UGA interface from EFI with a |
| 5 |
//! VGA-independent API. |
| 6 |
|
| 7 |
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields( |
| 8 |
0x9042a9de, |
| 9 |
0x23dc, |
| 10 |
0x4a38, |
| 11 |
0x96, |
| 12 |
0xfb, |
| 13 |
&[0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a], |
| 14 |
); |
| 15 |
|
| 16 |
#[repr(C)] |
| 17 |
#[derive(Clone, Copy, Debug)] |
| 18 |
pub struct PixelBitmask { |
| 19 |
pub red_mask: u32, |
| 20 |
pub green_mask: u32, |
| 21 |
pub blue_mask: u32, |
| 22 |
pub reserved_mask: u32, |
| 23 |
} |
| 24 |
|
| 25 |
pub type GraphicsPixelFormat = u32; |
| 26 |
|
| 27 |
pub const PIXEL_RED_GREEN_BLUE_RESERVED_8_BIT_PER_COLOR: GraphicsPixelFormat = 0x00000000; |
| 28 |
pub const PIXEL_BLUE_GREEN_RED_RESERVED_8_BIT_PER_COLOR: GraphicsPixelFormat = 0x00000001; |
| 29 |
pub const PIXEL_BIT_MASK: GraphicsPixelFormat = 0x00000002; |
| 30 |
pub const PIXEL_BLT_ONLY: GraphicsPixelFormat = 0x00000003; |
| 31 |
pub const PIXEL_FORMAT_MAX: GraphicsPixelFormat = 0x00000004; |
| 32 |
|
| 33 |
#[repr(C)] |
| 34 |
#[derive(Clone, Copy, Debug)] |
| 35 |
pub struct ModeInformation { |
| 36 |
pub version: u32, |
| 37 |
pub horizontal_resolution: u32, |
| 38 |
pub vertical_resolution: u32, |
| 39 |
pub pixel_format: GraphicsPixelFormat, |
| 40 |
pub pixel_information: PixelBitmask, |
| 41 |
pub pixels_per_scan_line: u32, |
| 42 |
} |
| 43 |
|
| 44 |
#[repr(C)] |
| 45 |
#[derive(Clone, Copy, Debug)] |
| 46 |
pub struct Mode { |
| 47 |
pub max_mode: u32, |
| 48 |
pub mode: u32, |
| 49 |
pub info: *mut ModeInformation, |
| 50 |
pub size_of_info: usize, |
| 51 |
pub frame_buffer_base: crate::base::PhysicalAddress, |
| 52 |
pub frame_buffer_size: usize, |
| 53 |
} |
| 54 |
|
| 55 |
#[repr(C)] |
| 56 |
#[derive(Clone, Copy, Debug)] |
| 57 |
pub struct BltPixel { |
| 58 |
pub blue: u8, |
| 59 |
pub green: u8, |
| 60 |
pub red: u8, |
| 61 |
pub reserved: u8, |
| 62 |
} |
| 63 |
|
| 64 |
pub type BltOperation = u32; |
| 65 |
|
| 66 |
pub const BLT_VIDEO_FILL: BltOperation = 0x00000000; |
| 67 |
pub const BLT_VIDEO_TO_BLT_BUFFER: BltOperation = 0x00000001; |
| 68 |
pub const BLT_BUFFER_TO_VIDEO: BltOperation = 0x00000002; |
| 69 |
pub const BLT_VIDEO_TO_VIDEO: BltOperation = 0x00000003; |
| 70 |
pub const BLT_OPERATION_MAX: BltOperation = 0x00000004; |
| 71 |
|
| 72 |
pub type ProtocolQueryMode = eficall! {fn( |
| 73 |
*mut Protocol, |
| 74 |
u32, |
| 75 |
*mut usize, |
| 76 |
*mut *mut ModeInformation, |
| 77 |
) -> crate::base::Status}; |
| 78 |
|
| 79 |
pub type ProtocolSetMode = eficall! {fn( |
| 80 |
*mut Protocol, |
| 81 |
u32, |
| 82 |
) -> crate::base::Status}; |
| 83 |
|
| 84 |
pub type ProtocolBlt = eficall! {fn( |
| 85 |
*mut Protocol, |
| 86 |
*mut BltPixel, |
| 87 |
BltOperation, |
| 88 |
usize, |
| 89 |
usize, |
| 90 |
usize, |
| 91 |
usize, |
| 92 |
usize, |
| 93 |
usize, |
| 94 |
usize, |
| 95 |
) -> crate::base::Status}; |
| 96 |
|
| 97 |
#[repr(C)] |
| 98 |
pub struct Protocol { |
| 99 |
pub query_mode: ProtocolQueryMode, |
| 100 |
pub set_mode: ProtocolSetMode, |
| 101 |
pub blt: ProtocolBlt, |
| 102 |
pub mode: *mut Mode, |
| 103 |
} |