diff --git a/graphics/vesad/src/framebuffer.rs b/graphics/vesad/src/framebuffer.rs index 74d5b1be89..7eeab2fe4d 100644 --- a/graphics/vesad/src/framebuffer.rs +++ b/graphics/vesad/src/framebuffer.rs @@ -1,7 +1,5 @@ use std::ptr; -use syscall::PAGE_SIZE; - pub struct FrameBuffer { pub onscreen: *mut [u32], pub phys: usize, @@ -58,36 +56,4 @@ impl FrameBuffer { let stride = parse_number(parts.next()?)?; Some(Self::new(phys, width, height, stride)) } - - pub unsafe fn resize(&mut self, width: usize, height: usize, stride: usize) { - // Unmap old onscreen - unsafe { - let slice = self.onscreen; - libredox::call::munmap(slice.cast(), (slice.len() * 4).next_multiple_of(PAGE_SIZE)) - .expect("vesad: failed to unmap framebuffer"); - } - - // Map new onscreen - self.onscreen = unsafe { - let size = stride * height; - let onscreen_ptr = common::physmap( - self.phys, - size * 4, - common::Prot { - read: true, - write: true, - }, - common::MemoryType::WriteCombining, - ) - .expect("vesad: failed to map framebuffer") as *mut u32; - ptr::write_bytes(onscreen_ptr, 0, size); - - ptr::slice_from_raw_parts_mut(onscreen_ptr, size) - }; - - // Update size - self.width = width; - self.height = height; - self.stride = stride; - } } diff --git a/graphics/vesad/src/screen.rs b/graphics/vesad/src/screen.rs index 71b99f7b51..3523f24a83 100644 --- a/graphics/vesad/src/screen.rs +++ b/graphics/vesad/src/screen.rs @@ -1,5 +1,5 @@ use std::convert::TryInto; -use std::{cmp, ptr}; +use std::ptr; use driver_graphics::Resource; use inputd::Damage; @@ -34,51 +34,6 @@ impl Resource for GraphicScreen { } impl GraphicScreen { - pub fn resize(&mut self, width: usize, height: usize) { - //TODO: Fix issue with mapped screens - - if width != self.width || height != self.height { - println!("Resize display to {}, {}", width, height); - - let size = width * height; - let mut offscreen = OffscreenBuffer::new(size); - - let mut old_ptr = self.offscreen.as_ptr(); - let mut new_ptr = offscreen.as_mut_ptr(); - - for _y in 0..cmp::min(height, self.height) { - unsafe { - ptr::copy(old_ptr, new_ptr, cmp::min(width, self.width)); - if width > self.width { - ptr::write_bytes( - new_ptr.offset(self.width as isize), - 0, - width - self.width, - ); - } - old_ptr = old_ptr.offset(self.width as isize); - new_ptr = new_ptr.offset(width as isize); - } - } - - if height > self.height { - for _y in self.height..height { - unsafe { - ptr::write_bytes(new_ptr, 0, width); - new_ptr = new_ptr.offset(width as isize); - } - } - } - - self.width = width; - self.height = height; - - self.offscreen = offscreen; - } else { - println!("Display is already {}, {}", width, height); - }; - } - pub fn sync(&self, framebuffer: &mut FrameBuffer, sync_rects: &[Damage]) { for sync_rect in sync_rects { let sync_rect = sync_rect.clip(