#embedded-graphics #uefi #graphics

no-std uefi-graphics2

An embedded-graphics display driver for UEFI environments

14 unstable releases (3 breaking)

0.4.4 Oct 24, 2024
0.4.2 Aug 21, 2024
0.3.0 Jul 24, 2024

#485 in Embedded development

Download history 188/week @ 2024-07-22 118/week @ 2024-07-29 15/week @ 2024-08-05 328/week @ 2024-08-19 1/week @ 2024-08-26 133/week @ 2024-09-09 35/week @ 2024-09-16 27/week @ 2024-09-23 67/week @ 2024-09-30 109/week @ 2024-10-21 14/week @ 2024-10-28

124 downloads per month

Apache-2.0

12KB
132 lines

uefi-graphics2

Crates.io Version Crates.io Total Downloads Crates.io License

A fast embedded-graphics display driver for UEFI environments, using the embedded-graphics crate as its base.

Supports:

  • Double buffering
  • Display resizing
  • An extensive draw/render library using the embedded-graphics crate

Why are there 2 other crates for this job?

uefi-graphics and uefi-graphics-driver are 2 crates providing similar purpose, sadly both seem to either lack functionality or are unmaintained

Example

Here is a simple example with using the uefi crate on version 0.30.0:

#![no_main]
#![no_std]

extern crate alloc;

use uefi::prelude::*;
use uefi::proto::console::gop::GraphicsOutput;

use uefi_graphics2::embedded_graphics::pixelcolor::{Rgb888, RgbColor};
use uefi_graphics2::UefiDisplay;

#[entry]
fn main(_image_handle: Handle, mut boot_system_table: SystemTable<Boot>) -> Status {
    uefi::helpers::init(&mut boot_system_table).unwrap();

    // Disable the watchdog timer
    boot_system_table
        .boot_services()
        .set_watchdog_timer(0, 0x10000, None)
        .unwrap();

    let boot_services = boot_system_table.boot_services();

    // Get gop
    let gop_handle = boot_services.get_handle_for_protocol::<GraphicsOutput>().unwrap();
    let mut gop = boot_services.open_protocol_exclusive::<GraphicsOutput>(gop_handle).unwrap();

    // Create UefiDisplay
    let mode = gop.current_mode_info();
    let mut display = UefiDisplay::new(gop.frame_buffer(), mode);

    // Tint the entire screen cyan
    display.fill_entire(Rgb888::CYAN).unwrap();

    // Draw everything
    display.flush();

    // wait 10000000 microseconds (10 seconds)
    boot_services.stall(10_000_000);

    Status::SUCCESS
}

More example can be found in the example directory uefi-graphics2/examples.

Contributing and Updating

If any dependencies are outdated, bugs occur or features are requested, please notify me and create an issue.

Contributing is appreciated as well, feel free to create a pull request.

If you like this project dont forget to leave a star on github!

Star History

Star History Chart

Dependencies

~5.5MB
~77K SLoC