2019-02-06 10:17:26 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Types.h>
|
|
|
|
#include <AK/AKString.h>
|
2019-02-16 09:57:42 +01:00
|
|
|
#include <SharedGraphics/Size.h>
|
2019-04-06 14:29:29 +02:00
|
|
|
#include <Kernel/PhysicalAddress.h>
|
2019-04-03 12:36:40 +02:00
|
|
|
#include <Kernel/Devices/BlockDevice.h>
|
2019-02-06 10:17:26 +01:00
|
|
|
|
2019-02-17 08:40:30 +01:00
|
|
|
class BXVGADevice final : public BlockDevice {
|
2019-02-06 10:17:26 +01:00
|
|
|
AK_MAKE_ETERNAL
|
|
|
|
public:
|
2019-02-17 08:40:30 +01:00
|
|
|
static BXVGADevice& the();
|
2019-02-06 10:17:26 +01:00
|
|
|
|
2019-02-17 08:40:30 +01:00
|
|
|
BXVGADevice();
|
2019-02-06 10:17:26 +01:00
|
|
|
|
|
|
|
PhysicalAddress framebuffer_address() const { return m_framebuffer_address; }
|
|
|
|
void set_resolution(int width, int height);
|
2019-02-07 08:53:57 +01:00
|
|
|
void set_y_offset(int);
|
2019-02-06 10:17:26 +01:00
|
|
|
|
2019-02-16 10:24:55 +01:00
|
|
|
virtual int ioctl(Process&, unsigned request, unsigned arg) override;
|
2019-02-16 09:57:42 +01:00
|
|
|
virtual Region* mmap(Process&, LinearAddress preferred_laddr, size_t offset, size_t) override;
|
|
|
|
|
|
|
|
size_t framebuffer_size_in_bytes() const { return m_framebuffer_size.area() * sizeof(dword) * 2; }
|
|
|
|
Size framebuffer_size() const { return m_framebuffer_size; }
|
|
|
|
|
2019-02-06 10:17:26 +01:00
|
|
|
private:
|
2019-02-17 08:40:30 +01:00
|
|
|
virtual const char* class_name() const override { return "BXVGA"; }
|
2019-02-16 09:57:42 +01:00
|
|
|
virtual bool can_read(Process&) const override;
|
|
|
|
virtual bool can_write(Process&) const override;
|
2019-02-25 21:19:57 +01:00
|
|
|
virtual ssize_t read(Process&, byte*, ssize_t) override;
|
|
|
|
virtual ssize_t write(Process&, const byte*, ssize_t) override;
|
2019-02-16 09:57:42 +01:00
|
|
|
|
2019-02-06 10:17:26 +01:00
|
|
|
void set_register(word index, word value);
|
|
|
|
dword find_framebuffer_address();
|
|
|
|
|
|
|
|
PhysicalAddress m_framebuffer_address;
|
2019-02-16 09:57:42 +01:00
|
|
|
Size m_framebuffer_size;
|
2019-02-06 10:17:26 +01:00
|
|
|
};
|