1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:47:45 +00:00

Kernel: Don't remap BochsGraphicsAdapter MMIO registers on every access

We were creating a new memory mapping every time WindowServer performed
a buffer flip. This was very visible in whole-system profiles, as the
mapping and unmapping of MMIO registers caused quite a bit of kmalloc()
and kfree() churn.

Avoid this problem by simply keeping the MMIO registers mapped.
This commit is contained in:
Andreas Kling 2021-07-06 11:47:12 +02:00
parent eda5ab2d0f
commit 7e4bc04057
2 changed files with 18 additions and 19 deletions

View file

@ -13,11 +13,14 @@
#include <Kernel/Graphics/FramebufferDevice.h>
#include <Kernel/Graphics/GraphicsDevice.h>
#include <Kernel/PhysicalAddress.h>
#include <Kernel/VM/TypedMapping.h>
namespace Kernel {
class BochsFramebufferDevice;
class GraphicsManagement;
struct BochsDisplayMMIORegisters;
class BochsGraphicsAdapter final : public GraphicsDevice
, public PCI::DeviceController {
AK_MAKE_ETERNAL
@ -56,6 +59,7 @@ private:
void set_y_offset(size_t);
PhysicalAddress m_mmio_registers;
TypedMapping<BochsDisplayMMIORegisters volatile> m_registers;
RefPtr<FramebufferDevice> m_framebuffer_device;
RefPtr<Graphics::GenericFramebufferConsole> m_framebuffer_console;
SpinLock<u8> m_console_mode_switch_lock;