fix mmap for framebuffer

master
PanQL 6 years ago
parent f8c88baeea
commit a6f211cef5

@ -19,7 +19,7 @@ pub fn probe_fb_info(width : u32, height : u32, depth : u32) -> FramebufferResul
yoffset: 0,
depth: 24,
pitch: 1024, // TOKNOW
bus_addr: 0xf000_0000,
bus_addr: 0xfd00_0000,
screen_size: 1024 * 768 * 3,
};
Ok((fb_info, fb::ColorConfig::BGRA8888, KERNEL_OFFSET + 0xf000_0000))

@ -172,6 +172,11 @@ impl Framebuffer {
unsafe { self.buf.base_addr }
}
#[inline]
pub fn bus_addr(&self) -> usize {
self.fb_info.bus_addr as usize
}
/// Read pixel at `(x, y)`.
#[inline]
pub fn read(&self, x: u32, y: u32) -> u32 {

@ -58,16 +58,19 @@ impl Syscall<'_> {
info!("mmap path is {} ", &*file.path);
match &*file.path {
"/dev/fb0" => {
self.vm().push(
addr,
addr + len,
prot.to_attr(),
Linear::new(
( 0xfd00_0000 - addr ) as isize,
),
"mmap_file",
);
info!("mmap for /dev/fb0");
use crate::arch::board::fb::FRAME_BUFFER;
if let Some(fb) = FRAME_BUFFER.lock().as_mut() {
self.vm().push(
addr,
addr + len,
prot.to_attr(),
Linear::new(
( fb.bus_addr() - addr ) as isize,
),
"mmap_file",
);
info!("mmap for /dev/fb0");
}
return Ok(addr);
},
_ => {

Loading…
Cancel
Save