summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-07-13 20:07:33 +0300
committerLinus Groh <mail@linusgroh.de>2022-07-13 19:15:17 +0100
commit97a769d2a91020bfae5cb8b15f5c8e1f5a5c8983 (patch)
treea32c94c60c7478bd6896dc4e69bc7d973cb57657
parent3f93aec7207b646cf7b125a86451a028fc8e766a (diff)
downloadserenity-97a769d2a91020bfae5cb8b15f5c8e1f5a5c8983.zip
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.
-rw-r--r--Kernel/CMakeLists.txt1
-rw-r--r--Kernel/Graphics/Console/TextModeConsole.cpp3
-rw-r--r--Kernel/Graphics/Console/TextModeConsole.h5
-rw-r--r--Kernel/Graphics/Console/VGAConsole.cpp19
-rw-r--r--Kernel/Graphics/Console/VGAConsole.h38
5 files changed, 5 insertions, 61 deletions
diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt
index 5e4aaa6dfe..428859b933 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 811fc477ab..dc9cd1635e 100644
--- a/Kernel/Graphics/Console/TextModeConsole.cpp
+++ b/Kernel/Graphics/Console/TextModeConsole.cpp
@@ -17,7 +17,8 @@ UNMAP_AFTER_INIT NonnullRefPtr<TextModeConsole> 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 1b4947653e..25d947f24d 100644
--- a/Kernel/Graphics/Console/TextModeConsole.h
+++ b/Kernel/Graphics/Console/TextModeConsole.h
@@ -8,11 +8,11 @@
#include <AK/RefCounted.h>
#include <AK/Types.h>
-#include <Kernel/Graphics/Console/VGAConsole.h>
+#include <Kernel/Graphics/Console/Console.h>
#include <Kernel/Locking/Spinlock.h>
namespace Kernel::Graphics {
-class TextModeConsole final : public VGAConsole {
+class TextModeConsole final : public Console {
public:
static NonnullRefPtr<TextModeConsole> initialize();
virtual size_t chars_per_line() const override { return width(); };
@@ -40,6 +40,7 @@ private:
mutable Spinlock m_vga_lock;
+ NonnullOwnPtr<Memory::Region> 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 c60a1be493..0000000000
--- a/Kernel/Graphics/Console/VGAConsole.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include <Kernel/Graphics/Console/VGAConsole.h>
-#include <Kernel/Sections.h>
-
-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 5a15e89626..0000000000
--- a/Kernel/Graphics/Console/VGAConsole.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <AK/RefCounted.h>
-#include <AK/Types.h>
-#include <Kernel/Graphics/Console/Console.h>
-
-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<VGAConsole> 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<Memory::Region> m_vga_region;
- const Mode m_mode;
-};
-}