1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:47:35 +00:00

Kernel: Enable additional VirtIO displays only on first resolution set

Also, only allocate the amount of memory we actually need for the given
resolution.
This commit is contained in:
Tom 2021-06-26 20:05:37 -06:00 committed by Andreas Kling
parent 8749235046
commit 56cd0f929e
5 changed files with 52 additions and 40 deletions

View file

@ -24,9 +24,6 @@ public:
bool try_to_set_resolution(size_t width, size_t height);
void clear_to_black();
VMObject& vm_object() { return m_framebuffer->vmobject(); }
Region& region() { return *m_framebuffer; }
size_t width() const { return display_info().rect.width; }
size_t height() const { return display_info().rect.height; }
size_t pitch() const { return display_info().rect.width * 4; }
@ -43,12 +40,16 @@ public:
void draw_ntsc_test_pattern();
u8* framebuffer_data();
private:
virtual const char* class_name() const override { return "VirtIOFrameBuffer"; }
VirtIOGPURespDisplayInfo::VirtIOGPUDisplayOne const& display_info() const;
VirtIOGPURespDisplayInfo::VirtIOGPUDisplayOne& display_info();
void create_framebuffer();
virtual int ioctl(FileDescription&, unsigned request, FlatPtr arg) override;
virtual KResultOr<Region*> mmap(Process&, FileDescription&, const Range&, u64 offset, int prot, bool shared) override;
virtual bool can_read(const FileDescription&, size_t) const override { return true; }