mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:18:12 +00:00
Kernel: Fix framebuffer resolution modesetting after boot
If we tried to change the resolution before of this patch, we triggered a kernel crash due to mmaping the framebuffer device again. Therefore, on mmaping of the framebuffer device, we create an entire new set of VMObjects and Regions for the new settings. Then, when we change the resolution, the framebuffersconsole needs to be updated with the new resolution and also to be refreshed with the new settings. To ensure we handle both shrinking of the resolution and growth of it, we only copy the right amount of available data from the cells Region.
This commit is contained in:
parent
5f718c6b05
commit
87f8f892d8
9 changed files with 88 additions and 13 deletions
|
@ -30,16 +30,16 @@ KResultOr<Region*> FramebufferDevice::mmap(Process& process, FileDescription&, c
|
|||
if (range.size() != page_round_up(framebuffer_size_in_bytes()))
|
||||
return EOVERFLOW;
|
||||
|
||||
// FIXME: We rely on the fact that only the WindowServer will mmap the framebuffer
|
||||
// and only once when starting to work with it. If other program wants to do so, we need to fix this.
|
||||
VERIFY(!m_userspace_framebuffer_region);
|
||||
VERIFY(!m_userspace_real_framebuffer_vmobject);
|
||||
|
||||
auto vmobject = AnonymousVMObject::create_for_physical_range(m_framebuffer_address, page_round_up(framebuffer_size_in_bytes()));
|
||||
if (!vmobject)
|
||||
return ENOMEM;
|
||||
m_userspace_real_framebuffer_vmobject = vmobject;
|
||||
|
||||
m_real_framebuffer_vmobject = AnonymousVMObject::create_for_physical_range(m_framebuffer_address, page_round_up(framebuffer_size_in_bytes()));
|
||||
m_swapped_framebuffer_vmobject = AnonymousVMObject::create_with_size(page_round_up(framebuffer_size_in_bytes()), AllocationStrategy::AllocateNow);
|
||||
m_real_framebuffer_region = MM.allocate_kernel_region_with_vmobject(*m_real_framebuffer_vmobject, page_round_up(framebuffer_size_in_bytes()), "Framebuffer", Region::Access::Read | Region::Access::Write);
|
||||
m_swapped_framebuffer_region = MM.allocate_kernel_region_with_vmobject(*m_swapped_framebuffer_vmobject, page_round_up(framebuffer_size_in_bytes()), "Framebuffer Swap (Blank)", Region::Access::Read | Region::Access::Write);
|
||||
|
||||
auto result = process.space().allocate_region_with_vmobject(
|
||||
range,
|
||||
vmobject.release_nonnull(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue