From bf8d72f5a4ecf56a32df1e348e16eab63d324576 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 18 Jul 2019 10:36:26 +0200 Subject: [PATCH] Kernel: Remove unnecessary use of LibDraw. BXVGADevice was using a Size object for its framebuffer size. We shouldn't be pulling in userspace code in the kernel like this, even if it's just headers. :^) --- Kernel/Devices/BXVGADevice.cpp | 7 ++++--- Kernel/Devices/BXVGADevice.h | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Kernel/Devices/BXVGADevice.cpp b/Kernel/Devices/BXVGADevice.cpp index 14416fff52f..9e689258b78 100644 --- a/Kernel/Devices/BXVGADevice.cpp +++ b/Kernel/Devices/BXVGADevice.cpp @@ -51,7 +51,8 @@ void BXVGADevice::set_register(u16 index, u16 data) void BXVGADevice::set_resolution(int width, int height) { - m_framebuffer_size = { width, height }; + m_framebuffer_width = width; + m_framebuffer_height = height; set_register(VBE_DISPI_INDEX_ENABLE, VBE_DISPI_DISABLED); set_register(VBE_DISPI_INDEX_XRES, (u16)width); @@ -65,7 +66,7 @@ void BXVGADevice::set_resolution(int width, int height) void BXVGADevice::set_y_offset(int offset) { - ASSERT(offset <= m_framebuffer_size.height()); + ASSERT(offset <= m_framebuffer_height); set_register(VBE_DISPI_INDEX_Y_OFFSET, (u16)offset); } @@ -107,7 +108,7 @@ int BXVGADevice::ioctl(FileDescription&, unsigned request, unsigned arg) { switch (request) { case BXVGA_DEV_IOCTL_SET_Y_OFFSET: - if (arg > (unsigned)m_framebuffer_size.height() * 2) + if (arg > (unsigned)m_framebuffer_height * 2) return -EINVAL; set_y_offset((int)arg); return 0; diff --git a/Kernel/Devices/BXVGADevice.h b/Kernel/Devices/BXVGADevice.h index 18d35f6fbf4..6a3c040789b 100644 --- a/Kernel/Devices/BXVGADevice.h +++ b/Kernel/Devices/BXVGADevice.h @@ -4,7 +4,6 @@ #include #include #include -#include class BXVGADevice final : public BlockDevice { AK_MAKE_ETERNAL @@ -20,8 +19,9 @@ public: virtual int ioctl(FileDescription&, unsigned request, unsigned arg) override; virtual KResultOr mmap(Process&, FileDescription&, VirtualAddress preferred_vaddr, size_t offset, size_t, int prot) override; - size_t framebuffer_size_in_bytes() const { return m_framebuffer_size.area() * sizeof(u32) * 2; } - Size framebuffer_size() const { return m_framebuffer_size; } + size_t framebuffer_size_in_bytes() const { return m_framebuffer_width * m_framebuffer_height * sizeof(u32) * 2; } + int framebuffer_width() const { return m_framebuffer_width; } + int framebuffer_height() const { return m_framebuffer_height; } private: virtual const char* class_name() const override { return "BXVGA"; } @@ -34,5 +34,6 @@ private: u32 find_framebuffer_address(); PhysicalAddress m_framebuffer_address; - Size m_framebuffer_size; + int m_framebuffer_width { 0 }; + int m_framebuffer_height { 0 }; };