pub struct FramebufferInfo {
    pub virt_addr: Option<VirtualAddress>,
    pub phys_addr: PhysicalAddress,
    pub total_size_in_bytes: u64,
    pub width: u32,
    pub height: u32,
    pub bits_per_pixel: u8,
    pub stride: u32,
    pub format: FramebufferFormat,
}
Expand description

Information about a framebuffer’s layout in memory.

Fields§

§virt_addr: Option<VirtualAddress>

The virtual address of the start of the framebuffer, if it has been mapped for us by the bootloader.

§phys_addr: PhysicalAddress

The physical address of the start of the framebuffer.

§total_size_in_bytes: u64

The total size of the framebuffer memory in bytes.

§width: u32

The width in pixels (number of columns) of the framebuffer. If this is a text framebuffer, this is in units of characters.

§height: u32

The height in pixels (number of rows) of the framebuffer. If this is a text framebuffer, this is in units of characters.

§bits_per_pixel: u8

The number of bits that each pixel occupies in memory. If this is a text framebuffer, this is the number of bits that each character occupies in memory.

§stride: u32

The number of pixels between the start of one line (row) and the start of the next line (row).

This is sometimes referred to as pixels per scan line.

This is required because some framebuffer implementations may have padding (empty space) at the end of each line, i.e., each line is not contiguous in memory. For such framebuffers, you must skip those padding pixels in order to get to the start of the next line in memory.

  • If stride is equal to width, there are no padding pixels.
  • If stride is greater than width, the number of padding pixels after the end of each line is stride - width.
  • The value of stride itself is NOT the number of padding pixels.

If this is a text framebuffer, this value represents the number of characters instead of pixels, but it is typically always 0.

§format: FramebufferFormat

The format of the framebuffer and its pixels or characters.

Implementations§

source§

impl FramebufferInfo

source

pub fn is_mapped(&self) -> bool

Returns true if the bootloader mapped the framebuffer and can provide its virtual address.

Returns false if the bootloader did not map the framebuffer and can only provide its physical address.

Trait Implementations§

source§

impl Debug for FramebufferInfo

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.