1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-17 15:35:06 +00:00
serenity/Kernel/Graphics/VirtIOGPU/Console.h
Liav A 883b0f1390 Kernel/Graphics: Restore VirtIO GPU framebuffer console functionality
This has been done in multiple ways:
- Each time we modeset the resolution via the VirtIOGPU DisplayConnector
  we ensure that the framebuffer is updated with the new resolution.
- Each time the cursor is updated we ensure that the framebuffer console
  is marked dirty so the IO Work Queue task which is scheduled to check
  if it is dirty, will flush the surface.
- We only initialize a framebuffer console after we ensure that at the
  very least a DisplayConnector has being set with a known resolution.
- We only call GenericFramebufferConsole::enable() when enabling the
  console after the important variables of the console (m_width, m_pitch
  and m_height) have been set.
2022-12-31 05:13:21 -07:00

37 lines
1.1 KiB
C++

/*
* Copyright (c) 2021, Sahan Fernando <sahan.h.fernando@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <Kernel/Graphics/Console/GenericFramebufferConsole.h>
#include <Kernel/Graphics/VirtIOGPU/DisplayConnector.h>
#include <Kernel/TimerQueue.h>
namespace Kernel::Graphics::VirtIOGPU {
class Console final : public GenericFramebufferConsole {
public:
static NonnullLockRefPtr<Console> initialize(VirtIODisplayConnector& parent_display_connector);
virtual void set_resolution(size_t width, size_t height, size_t pitch) override;
virtual void flush(size_t x, size_t y, size_t width, size_t height) override;
virtual void enable() override;
virtual void set_cursor(size_t x, size_t y) override;
private:
void enqueue_refresh_timer();
virtual u8* framebuffer_data() override;
virtual void hide_cursor() override;
virtual void show_cursor() override;
Console(VirtIODisplayConnector const& parent_display_connector, DisplayConnector::ModeSetting current_resolution);
NonnullLockRefPtr<VirtIODisplayConnector> m_parent_display_connector;
bool m_dirty { false };
};
}