poplar/syscall/
get_framebuffer.rsuse super::{
raw,
result::{define_error_type, handle_from_syscall_repr},
SYSCALL_GET_FRAMEBUFFER,
};
use crate::Handle;
define_error_type!(GetFramebufferError {
AccessDenied => 1,
InfoAddressIsInvalid => 2,
NoFramebufferCreated => 3,
});
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[repr(u8)]
pub enum PixelFormat {
Rgb32 = 0,
Bgr32 = 1,
}
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub struct FramebufferInfo {
pub width: u16,
pub height: u16,
pub stride: u16,
pub pixel_format: PixelFormat,
}
pub fn get_framebuffer(info: *mut FramebufferInfo) -> Result<Handle, GetFramebufferError> {
handle_from_syscall_repr(unsafe { raw::syscall1(SYSCALL_GET_FRAMEBUFFER, info as usize) })
}