mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:57:43 +00:00
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.
This commit is contained in:
parent
658f9eec6a
commit
883b0f1390
5 changed files with 50 additions and 7 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <Kernel/Graphics/VirtIOGPU/Console.h>
|
||||
#include <Kernel/TTY/ConsoleManagement.h>
|
||||
#include <Kernel/WorkQueue.h>
|
||||
|
||||
namespace Kernel::Graphics::VirtIOGPU {
|
||||
|
@ -21,12 +22,42 @@ Console::Console(VirtIODisplayConnector const& parent_display_connector, Display
|
|||
: GenericFramebufferConsole(current_resolution.horizontal_active, current_resolution.vertical_active, current_resolution.horizontal_stride)
|
||||
, m_parent_display_connector(parent_display_connector)
|
||||
{
|
||||
// NOTE: Clear the framebuffer, in case it's left with some garbage.
|
||||
memset(framebuffer_data(), 0, current_resolution.horizontal_stride * current_resolution.vertical_active);
|
||||
enqueue_refresh_timer();
|
||||
}
|
||||
|
||||
void Console::set_resolution(size_t, size_t, size_t)
|
||||
void Console::set_resolution(size_t width, size_t height, size_t pitch)
|
||||
{
|
||||
// FIXME: Update some values here?
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
m_pitch = pitch;
|
||||
|
||||
// Just to start cleanly, we clean the entire framebuffer
|
||||
memset(framebuffer_data(), 0, pitch * height);
|
||||
|
||||
ConsoleManagement::the().resolution_was_changed();
|
||||
}
|
||||
|
||||
void Console::set_cursor(size_t x, size_t y)
|
||||
{
|
||||
GenericFramebufferConsole::hide_cursor();
|
||||
m_x = x;
|
||||
m_y = y;
|
||||
GenericFramebufferConsole::show_cursor();
|
||||
m_dirty = true;
|
||||
}
|
||||
|
||||
void Console::hide_cursor()
|
||||
{
|
||||
GenericFramebufferConsole::hide_cursor();
|
||||
m_dirty = true;
|
||||
}
|
||||
|
||||
void Console::show_cursor()
|
||||
{
|
||||
GenericFramebufferConsole::show_cursor();
|
||||
m_dirty = true;
|
||||
}
|
||||
|
||||
void Console::flush(size_t, size_t, size_t, size_t)
|
||||
|
@ -54,11 +85,13 @@ void Console::enqueue_refresh_timer()
|
|||
|
||||
void Console::enable()
|
||||
{
|
||||
// FIXME: Do we need some locking here to ensure the resolution doesn't change
|
||||
// while we enable the console?
|
||||
auto current_resolution = m_parent_display_connector->current_mode_setting();
|
||||
GenericFramebufferConsole::enable();
|
||||
m_width = current_resolution.horizontal_active;
|
||||
m_height = current_resolution.vertical_active;
|
||||
m_pitch = current_resolution.horizontal_stride;
|
||||
GenericFramebufferConsole::enable();
|
||||
m_dirty = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue