mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:37:44 +00:00
Kernel/Graphics + SystemServer: Support text mode properly
As we removed the support of VBE modesetting that was done by GRUB early on boot, we need to determine if we can modeset the resolution with our drivers, and if not, we should enable text mode and ensure that SystemServer knows about it too. Also, SystemServer should first check if there's a framebuffer device node, which is an indication that text mode was not even if it was requested. Then, if it doesn't find it, it should check what boot_mode argument the user specified (in case it's self-test). This way if we try to use bochs-display device (which is not VGA compatible) and request a text mode, it will not honor the request and will continue with graphical mode. Also try to print critical messages with mininum memory allocations possible. In LibVT, We make the implementation flexible for kernel-specific methods that are implemented in ConsoleImpl class.
This commit is contained in:
parent
dac129e10b
commit
20743e8aed
41 changed files with 1832 additions and 321 deletions
|
@ -12,9 +12,18 @@
|
|||
#include <AK/Vector.h>
|
||||
#include <Kernel/API/KeyCode.h>
|
||||
#include <LibVT/EscapeSequenceParser.h>
|
||||
#include <LibVT/Line.h>
|
||||
#include <LibVT/Position.h>
|
||||
|
||||
#ifndef KERNEL
|
||||
# include <LibVT/Attribute.h>
|
||||
# include <LibVT/Line.h>
|
||||
#else
|
||||
namespace Kernel {
|
||||
class VirtualConsole;
|
||||
}
|
||||
# include <LibVT/Attribute.h>
|
||||
#endif
|
||||
|
||||
namespace VT {
|
||||
|
||||
class TerminalClient {
|
||||
|
@ -31,24 +40,52 @@ public:
|
|||
|
||||
class Terminal : public EscapeSequenceExecutor {
|
||||
public:
|
||||
#ifndef KERNEL
|
||||
explicit Terminal(TerminalClient&);
|
||||
~Terminal();
|
||||
#else
|
||||
explicit Terminal(Kernel::VirtualConsole&);
|
||||
#endif
|
||||
|
||||
virtual ~Terminal()
|
||||
{
|
||||
}
|
||||
|
||||
bool m_need_full_flush { false };
|
||||
|
||||
#ifndef KERNEL
|
||||
void invalidate_cursor();
|
||||
#else
|
||||
virtual void invalidate_cursor() = 0;
|
||||
#endif
|
||||
|
||||
void on_input(u8);
|
||||
|
||||
void set_cursor(unsigned row, unsigned column);
|
||||
|
||||
#ifndef KERNEL
|
||||
void clear();
|
||||
void clear_including_history();
|
||||
#else
|
||||
virtual void clear() = 0;
|
||||
virtual void clear_including_history() = 0;
|
||||
#endif
|
||||
|
||||
#ifndef KERNEL
|
||||
void set_size(u16 columns, u16 rows);
|
||||
u16 columns() const { return m_columns; }
|
||||
#else
|
||||
virtual void set_size(u16 columns, u16 rows) = 0;
|
||||
#endif
|
||||
|
||||
u16 columns() const
|
||||
{
|
||||
return m_columns;
|
||||
}
|
||||
u16 rows() const { return m_rows; }
|
||||
|
||||
u16 cursor_column() const { return m_cursor_column; }
|
||||
u16 cursor_row() const { return m_cursor_row; }
|
||||
|
||||
#ifndef KERNEL
|
||||
size_t line_count() const
|
||||
{
|
||||
return m_history.size() + m_lines.size();
|
||||
|
@ -100,13 +137,16 @@ public:
|
|||
m_max_history_lines = value;
|
||||
}
|
||||
size_t history_size() const { return m_history.size(); }
|
||||
#endif
|
||||
|
||||
void inject_string(const StringView&);
|
||||
void handle_key_press(KeyCode, u32, u8 flags);
|
||||
|
||||
#ifndef KERNEL
|
||||
Attribute attribute_at(const Position&) const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
protected:
|
||||
// ^EscapeSequenceExecutor
|
||||
virtual void emit_code_point(u32) override;
|
||||
virtual void execute_control_code(u8) override;
|
||||
|
@ -117,14 +157,20 @@ private:
|
|||
virtual void receive_dcs_char(u8 byte) override;
|
||||
virtual void execute_dcs_sequence() override;
|
||||
|
||||
void carriage_return();
|
||||
#ifndef KERNEL
|
||||
void scroll_up();
|
||||
void scroll_down();
|
||||
void newline();
|
||||
void carriage_return();
|
||||
|
||||
void set_cursor(unsigned row, unsigned column);
|
||||
void put_character_at(unsigned row, unsigned column, u32 ch);
|
||||
void set_window_title(const String&);
|
||||
#else
|
||||
virtual void scroll_up() = 0;
|
||||
virtual void scroll_down() = 0;
|
||||
virtual void newline() = 0;
|
||||
virtual void put_character_at(unsigned row, unsigned column, u32 ch) = 0;
|
||||
virtual void set_window_title(const String&) = 0;
|
||||
#endif
|
||||
|
||||
void unimplemented_control_code(u8);
|
||||
void unimplemented_escape_sequence(Intermediates, u8 last_byte);
|
||||
|
@ -192,8 +238,12 @@ private:
|
|||
// DSR - Device Status Reports
|
||||
void DSR(Parameters);
|
||||
|
||||
#ifndef KERNEL
|
||||
// ICH - Insert Character
|
||||
void ICH(Parameters);
|
||||
#else
|
||||
virtual void ICH(Parameters) = 0;
|
||||
#endif
|
||||
|
||||
// SU - Scroll Up (called "Pan Down" in VT510)
|
||||
void SU(Parameters);
|
||||
|
@ -201,14 +251,18 @@ private:
|
|||
// SD - Scroll Down (called "Pan Up" in VT510)
|
||||
void SD(Parameters);
|
||||
|
||||
#ifndef KERNEL
|
||||
// IL - Insert Line
|
||||
void IL(Parameters);
|
||||
|
||||
// DCH - Delete Character
|
||||
void DCH(Parameters);
|
||||
|
||||
// DL - Delete Line
|
||||
void DL(Parameters);
|
||||
#else
|
||||
virtual void IL(Parameters) = 0;
|
||||
virtual void DCH(Parameters) = 0;
|
||||
virtual void DL(Parameters) = 0;
|
||||
#endif
|
||||
|
||||
// CHA - Cursor Horizontal Absolute
|
||||
void CHA(Parameters);
|
||||
|
@ -225,10 +279,14 @@ private:
|
|||
// FIXME: Find the right names for these.
|
||||
void XTERM_WM(Parameters);
|
||||
|
||||
#ifndef KERNEL
|
||||
TerminalClient& m_client;
|
||||
#else
|
||||
Kernel::VirtualConsole& m_client;
|
||||
#endif
|
||||
|
||||
EscapeSequenceParser m_parser;
|
||||
|
||||
#ifndef KERNEL
|
||||
size_t m_history_start = 0;
|
||||
NonnullOwnPtrVector<Line> m_history;
|
||||
void add_line_to_history(NonnullOwnPtr<Line>&& line)
|
||||
|
@ -246,6 +304,7 @@ private:
|
|||
}
|
||||
|
||||
NonnullOwnPtrVector<Line> m_lines;
|
||||
#endif
|
||||
|
||||
size_t m_scroll_region_top { 0 };
|
||||
size_t m_scroll_region_bottom { 0 };
|
||||
|
@ -263,7 +322,9 @@ private:
|
|||
Attribute m_current_attribute;
|
||||
Attribute m_saved_attribute;
|
||||
|
||||
#ifndef KERNEL
|
||||
u32 m_next_href_id { 0 };
|
||||
#endif
|
||||
|
||||
Vector<bool> m_horizontal_tabs;
|
||||
u32 m_last_code_point { 0 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue