pub struct Framebuffer {
info: FramebufferInfo,
pub canvas: CanvasBuffer,
double_buffer: Option<*mut u8>,
use_double_buffer: bool,
fb_size: usize,
console_defer_present: bool,
zero_copy_backing: bool,
}Expand description
Main framebuffer structure
Fields§
§info: FramebufferInfo§canvas: CanvasBufferShared double-buffered canvas (dirty tracking, present throttling, SIMD ops)
double_buffer: Option<*mut u8>Raw double buffer for VirtIO GPU (physically contiguous)
use_double_buffer: boolWhether the raw double buffer should be used
fb_size: usizeTotal framebuffer size in bytes
console_defer_present: boolWhether console deferred present is active
zero_copy_backing: boolTrue when the VirtIO backing IS our double buffer (zero-copy present)
Implementations§
Source§impl Framebuffer
impl Framebuffer
fn request_present(&mut self)
fn present_if_due(&mut self, force: bool)
Sourcepub fn init_bootloader(
addr: u64,
width: u32,
height: u32,
stride: u32,
format: PixelFormat,
) -> Result<(), &'static str>
pub fn init_bootloader( addr: u64, width: u32, height: u32, stride: u32, format: PixelFormat, ) -> Result<(), &'static str>
Initialize framebuffer with bootloader-provided buffer
Sourcepub fn init_virtio_gpu() -> Result<(), &'static str>
pub fn init_virtio_gpu() -> Result<(), &'static str>
Initialize framebuffer with VirtIO GPU
G3: the double buffer is allocated FIRST and attached as the scanout resource backing itself, so draws land directly in what TRANSFER_TO_HOST_2D reads : presentation becomes zero-copy.
Sourcepub fn init_amd_gpu() -> Result<(), &'static str>
pub fn init_amd_gpu() -> Result<(), &'static str>
Initialize framebuffer with AMDGPU
Sourcepub fn info() -> Option<FramebufferInfo>
pub fn info() -> Option<FramebufferInfo>
Get framebuffer info (lockless: reads the init-time snapshot)
Sourcepub fn is_available() -> bool
pub fn is_available() -> bool
Check if framebuffer is initialized
Sourcepub fn source() -> FramebufferSource
pub fn source() -> FramebufferSource
Get framebuffer source (lockless)
pub fn render_stats() -> Option<FramebufferRenderStats>
Sourcepub fn set_pixel(x: u32, y: u32, r: u8, g: u8, b: u8)
pub fn set_pixel(x: u32, y: u32, r: u8, g: u8, b: u8)
Set a pixel at (x, y) with RGB color.
Delegates to CanvasBuffer::write_pixel (S6: single implementation
of target selection). Takes the framebuffer lock for a single pixel:
fine for sparse dots, but batched drawing MUST go through
Self::blit_rect instead.
Sourcepub fn fill_rect(x: u32, y: u32, width: u32, height: u32, r: u8, g: u8, b: u8)
pub fn fill_rect(x: u32, y: u32, width: u32, height: u32, r: u8, g: u8, b: u8)
Fill rectangle with color.
Delegates to CanvasBuffer::fill_rect (S6: one implementation of
clipping, SIMD dispatch, target selection and dirty marking). Takes
the framebuffer lock once for the whole rectangle. Does NOT present;
call swap_buffers() after a batch of draw operations.
Sourcepub fn blit_rect(src: &[u8], x: u32, y: u32, w: u32, h: u32)
pub fn blit_rect(src: &[u8], x: u32, y: u32, w: u32, h: u32)
Blit a packed 32bpp XRGB rectangle into the current draw target (double buffer when enabled, else the hardware framebuffer).
This is the batch primitive: the framebuffer lock is taken exactly
once and a single dirty rectangle is marked, whatever the size.
src holds h rows of w pixels with a tight row stride of w*4
bytes; the rect is clipped against screen bounds.
Sourcepub fn swap_buffers()
pub fn swap_buffers()
Swap buffers (for double buffering)
Sourcepub fn set_double_buffering(enable: bool)
pub fn set_double_buffering(enable: bool)
Enable/disable double buffering
Trait Implementations§
impl Send for Framebuffer
impl Sync for Framebuffer
Auto Trait Implementations§
impl Freeze for Framebuffer
impl RefUnwindSafe for Framebuffer
impl Unpin for Framebuffer
impl UnsafeUnpin for Framebuffer
impl UnwindSafe for Framebuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more