mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 13:43:45 +03:00
b957c61e6f
This implements a very basic VGA device using the information provided to us by the bootloader in the multiboot header. This allows Serenity to boot to the desktop on basically any halfway modern system.
32 lines
1.1 KiB
C++
32 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <AK/AKString.h>
|
|
#include <AK/Types.h>
|
|
#include <Kernel/Devices/BlockDevice.h>
|
|
#include <Kernel/VM/PhysicalAddress.h>
|
|
|
|
class MBVGADevice final : public BlockDevice {
|
|
AK_MAKE_ETERNAL
|
|
public:
|
|
static MBVGADevice& the();
|
|
|
|
MBVGADevice(PhysicalAddress addr, int pitch, int width, int height);
|
|
|
|
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;
|
|
|
|
private:
|
|
virtual const char* class_name() const override { return "MBVGA"; }
|
|
virtual bool can_read(FileDescription&) const override;
|
|
virtual bool can_write(FileDescription&) const override;
|
|
virtual ssize_t read(FileDescription&, u8*, ssize_t) override;
|
|
virtual ssize_t write(FileDescription&, const u8*, ssize_t) override;
|
|
|
|
size_t framebuffer_size_in_bytes() const { return m_framebuffer_pitch * m_framebuffer_height; }
|
|
|
|
PhysicalAddress m_framebuffer_address;
|
|
int m_framebuffer_pitch { 0 };
|
|
int m_framebuffer_width { 0 };
|
|
int m_framebuffer_height { 0 };
|
|
};
|