Consolidating limine graphics

This commit is contained in:
Able 2022-12-02 08:51:21 -06:00
parent d94e50be39
commit 78a52f7102
4 changed files with 28 additions and 5 deletions

View file

@ -0,0 +1,24 @@
// TODO: Reorganize and make part of this into a limine agnostic API for general purpose graphics
use crate::kmain::FRAMEBUFFER;
pub fn clear_screen() {
{
// TODO: setup a proper framebuffer handler
let fb_response = FRAMEBUFFER.get_response().get().unwrap();
for fb in fb_response.framebuffers().unwrap() {
trace!("Framebuffer {}x{}", fb.width, fb.height);
trace!("{}", fb.memory_model);
trace!("{}", fb.bpp);
let mut count = 0;
let total = fb.width * fb.height * 3;
while count != total {
unsafe {
let fb_ptr = fb.address.as_mut_ptr().unwrap();
*fb_ptr.offset((count).try_into().unwrap()) = 0x00;
*fb_ptr.offset((count + 1).try_into().unwrap()) = 0x00;
*fb_ptr.offset((count + 2).try_into().unwrap()) = 0x00;
}
count += 3;
}
}
}
}

View file

@ -14,7 +14,7 @@ use crate::devices::pci;
use crate::relib::network::socket::{SimpleSock, Socket};
use crate::{boot_conf::KernelConfig, scratchpad, systeminfo::RELEASE_TYPE};
// use crate::{boot_conf::KernelConfig, scratchpad, systeminfo::RELEASE_TYPE, TERM};
use crate::{filesystem, hardware};
use crate::{filesystem, graphics_limine, hardware};
use kernel::KERNEL_VERSION;
use limine::LimineSmpInfo;
use limine::{LimineFramebufferRequest, LimineSmpRequest};
@ -131,6 +131,8 @@ pub fn kernel_main(
// }
// }
graphics_limine::clear_screen();
scratchpad();
sloop()
}

View file

@ -81,6 +81,7 @@ pub mod wasm_jumploader;
pub mod allocator;
// pub use allocator as aalloc;
pub mod graphics_limine;
pub mod handle;
pub mod hardware;
pub mod ipc;

View file

@ -1,4 +0,0 @@
Hi there :>$RED$
hi
$GREEN$
hi 3