From 97a769d2a91020bfae5cb8b15f5c8e1f5a5c8983 Mon Sep 17 00:00:00 2001 From: Liav A Date: Wed, 13 Jul 2022 20:07:33 +0300 Subject: [PATCH] Kernel/Graphics: Remove unnecessary VGAConsole class abstraction The original intention was to support other types of consoles based on standard VGA modes, but it never came to an implementation, nor we need such feature at all. Therefore, this class is not needed and can be removed. --- Kernel/CMakeLists.txt | 1 - Kernel/Graphics/Console/TextModeConsole.cpp | 3 +- Kernel/Graphics/Console/TextModeConsole.h | 5 +-- Kernel/Graphics/Console/VGAConsole.cpp | 19 ----------- Kernel/Graphics/Console/VGAConsole.h | 38 --------------------- 5 files changed, 5 insertions(+), 61 deletions(-) delete mode 100644 Kernel/Graphics/Console/VGAConsole.cpp delete mode 100644 Kernel/Graphics/Console/VGAConsole.h diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt index 5e4aaa6dfec..428859b933b 100644 --- a/Kernel/CMakeLists.txt +++ b/Kernel/CMakeLists.txt @@ -79,7 +79,6 @@ set(KERNEL_SOURCES Graphics/Console/GenericFramebufferConsole.cpp Graphics/Console/ContiguousFramebufferConsole.cpp Graphics/Console/TextModeConsole.cpp - Graphics/Console/VGAConsole.cpp Graphics/DisplayConnector.cpp Graphics/Generic/DisplayConnector.cpp Graphics/GraphicsManagement.cpp diff --git a/Kernel/Graphics/Console/TextModeConsole.cpp b/Kernel/Graphics/Console/TextModeConsole.cpp index 811fc477abf..dc9cd1635ec 100644 --- a/Kernel/Graphics/Console/TextModeConsole.cpp +++ b/Kernel/Graphics/Console/TextModeConsole.cpp @@ -17,7 +17,8 @@ UNMAP_AFTER_INIT NonnullRefPtr TextModeConsole::initialize() } UNMAP_AFTER_INIT TextModeConsole::TextModeConsole() - : VGAConsole(VGAConsole::Mode::TextMode, 80, 25) + : Console(80, 25) + , m_vga_region(MM.allocate_kernel_region(PhysicalAddress(0xa0000), Memory::page_round_up(0xc0000 - 0xa0000).release_value_but_fixme_should_propagate_errors(), "VGA Display"sv, Memory::Region::Access::ReadWrite).release_value()) , m_current_vga_window(m_vga_region->vaddr().offset(0x18000).as_ptr()) { for (size_t index = 0; index < height(); index++) { diff --git a/Kernel/Graphics/Console/TextModeConsole.h b/Kernel/Graphics/Console/TextModeConsole.h index 1b4947653ed..25d947f24d2 100644 --- a/Kernel/Graphics/Console/TextModeConsole.h +++ b/Kernel/Graphics/Console/TextModeConsole.h @@ -8,11 +8,11 @@ #include #include -#include +#include #include namespace Kernel::Graphics { -class TextModeConsole final : public VGAConsole { +class TextModeConsole final : public Console { public: static NonnullRefPtr initialize(); virtual size_t chars_per_line() const override { return width(); }; @@ -40,6 +40,7 @@ private: mutable Spinlock m_vga_lock; + NonnullOwnPtr m_vga_region; VirtualAddress m_current_vga_window; }; diff --git a/Kernel/Graphics/Console/VGAConsole.cpp b/Kernel/Graphics/Console/VGAConsole.cpp deleted file mode 100644 index c60a1be4939..00000000000 --- a/Kernel/Graphics/Console/VGAConsole.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2021, Liav A. - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include -#include - -namespace Kernel::Graphics { - -UNMAP_AFTER_INIT VGAConsole::VGAConsole(Mode mode, size_t width, size_t height) - : Console(width, height) - , m_vga_region(MM.allocate_kernel_region(PhysicalAddress(0xa0000), Memory::page_round_up(0xc0000 - 0xa0000).release_value_but_fixme_should_propagate_errors(), "VGA Display"sv, Memory::Region::Access::ReadWrite).release_value()) - , m_mode(mode) -{ -} - -} diff --git a/Kernel/Graphics/Console/VGAConsole.h b/Kernel/Graphics/Console/VGAConsole.h deleted file mode 100644 index 5a15e896260..00000000000 --- a/Kernel/Graphics/Console/VGAConsole.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2021, Liav A. - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include -#include -#include - -namespace Kernel::Graphics { -class VGAConsole : public Console { -public: - // Note: these are the modes we will support and only these - enum class Mode { - TextMode = 1, // Text Mode - Colored256, // 320x200 256 color mode - Colored16, // 640x480 16 color mode - }; - -public: - static NonnullRefPtr initialize(Mode, size_t width, size_t height); - - virtual bool is_hardware_paged_capable() const override { return false; } - virtual bool has_hardware_cursor() const override { return false; } - virtual void flush(size_t, size_t, size_t, size_t) override { } - - virtual ~VGAConsole() = default; - -protected: - VGAConsole(Mode, size_t width, size_t height); - - NonnullOwnPtr m_vga_region; - const Mode m_mode; -}; -}