mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:07:44 +00:00
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:
parent
1c0669f010
commit
bf8d72f5a4
2 changed files with 9 additions and 7 deletions
|
@ -51,7 +51,8 @@ void BXVGADevice::set_register(u16 index, u16 data)
|
||||||
|
|
||||||
void BXVGADevice::set_resolution(int width, int height)
|
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_ENABLE, VBE_DISPI_DISABLED);
|
||||||
set_register(VBE_DISPI_INDEX_XRES, (u16)width);
|
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)
|
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);
|
set_register(VBE_DISPI_INDEX_Y_OFFSET, (u16)offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +108,7 @@ int BXVGADevice::ioctl(FileDescription&, unsigned request, unsigned arg)
|
||||||
{
|
{
|
||||||
switch (request) {
|
switch (request) {
|
||||||
case BXVGA_DEV_IOCTL_SET_Y_OFFSET:
|
case BXVGA_DEV_IOCTL_SET_Y_OFFSET:
|
||||||
if (arg > (unsigned)m_framebuffer_size.height() * 2)
|
if (arg > (unsigned)m_framebuffer_height * 2)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
set_y_offset((int)arg);
|
set_y_offset((int)arg);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
#include <Kernel/Devices/BlockDevice.h>
|
#include <Kernel/Devices/BlockDevice.h>
|
||||||
#include <Kernel/VM/PhysicalAddress.h>
|
#include <Kernel/VM/PhysicalAddress.h>
|
||||||
#include <LibDraw/Size.h>
|
|
||||||
|
|
||||||
class BXVGADevice final : public BlockDevice {
|
class BXVGADevice final : public BlockDevice {
|
||||||
AK_MAKE_ETERNAL
|
AK_MAKE_ETERNAL
|
||||||
|
@ -20,8 +19,9 @@ public:
|
||||||
virtual int ioctl(FileDescription&, unsigned request, unsigned arg) override;
|
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;
|
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_t framebuffer_size_in_bytes() const { return m_framebuffer_width * m_framebuffer_height * sizeof(u32) * 2; }
|
||||||
Size framebuffer_size() const { return m_framebuffer_size; }
|
int framebuffer_width() const { return m_framebuffer_width; }
|
||||||
|
int framebuffer_height() const { return m_framebuffer_height; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual const char* class_name() const override { return "BXVGA"; }
|
virtual const char* class_name() const override { return "BXVGA"; }
|
||||||
|
@ -34,5 +34,6 @@ private:
|
||||||
u32 find_framebuffer_address();
|
u32 find_framebuffer_address();
|
||||||
|
|
||||||
PhysicalAddress m_framebuffer_address;
|
PhysicalAddress m_framebuffer_address;
|
||||||
Size m_framebuffer_size;
|
int m_framebuffer_width { 0 };
|
||||||
|
int m_framebuffer_height { 0 };
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue