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. :^)
This commit is contained in:
Andreas Kling 2019-07-18 10:36:26 +02:00
parent 1c0669f010
commit bf8d72f5a4
Notes: sideshowbarker 2024-07-19 13:11:17 +09:00
2 changed files with 9 additions and 7 deletions

View File

@ -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;

View File

@ -4,7 +4,6 @@
#include <AK/Types.h>
#include <Kernel/Devices/BlockDevice.h>
#include <Kernel/VM/PhysicalAddress.h>
#include <LibDraw/Size.h>
class BXVGADevice final : public BlockDevice {
AK_MAKE_ETERNAL
@ -20,8 +19,9 @@ public:
virtual int ioctl(FileDescription&, unsigned request, unsigned arg) override;
virtual KResultOr<Region*> 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 };
};