Kernel: Add method to clean up remapping region loops

In the VMObject code there are multiple examples of loops over
the VMObject's regions (using for_each_region()) that call remap()
on each region.

To clean up usage of this pattern, this patch adds a method in
VMObject that does this remapping loop. VMObject code that needs
to remap its regions call the new method.
This commit is contained in:
brody-qq
2024-06-02 01:51:14 +01:00
committed by Tim Ledbetter
parent 0608f15e25
commit a4ca757db9
5 changed files with 18 additions and 21 deletions

View File

@@ -79,17 +79,13 @@ void SharedFramebufferVMObject::switch_to_fake_sink_framebuffer_writes(Badge<Ker
{
SpinlockLocker locker(m_writes_state_lock);
m_writes_are_faked = true;
for_each_region([](Region& region) {
region.remap();
});
remap_regions();
}
void SharedFramebufferVMObject::switch_to_real_framebuffer_writes(Badge<Kernel::DisplayConnector>)
{
SpinlockLocker locker(m_writes_state_lock);
m_writes_are_faked = false;
for_each_region([](Region& region) {
region.remap();
});
remap_regions();
}
ReadonlySpan<RefPtr<PhysicalRAMPage>> SharedFramebufferVMObject::physical_pages() const