mirror of
https://github.com/RGBCube/serenity
synced 2025-05-24 05:45:07 +00:00

If we tried to change the resolution before of this patch, we triggered a kernel crash due to mmaping the framebuffer device again. Therefore, on mmaping of the framebuffer device, we create an entire new set of VMObjects and Regions for the new settings. Then, when we change the resolution, the framebuffersconsole needs to be updated with the new resolution and also to be refreshed with the new settings. To ensure we handle both shrinking of the resolution and growth of it, we only copy the right amount of available data from the cells Region.
45 lines
997 B
C++
45 lines
997 B
C++
/*
|
|
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/NonnullRefPtr.h>
|
|
#include <AK/NonnullRefPtrVector.h>
|
|
#include <AK/Types.h>
|
|
#include <Kernel/TTY/VirtualConsole.h>
|
|
|
|
namespace Kernel {
|
|
|
|
class ConsoleManagement {
|
|
AK_MAKE_ETERNAL;
|
|
friend class VirtualConsole;
|
|
|
|
public:
|
|
ConsoleManagement();
|
|
|
|
static bool is_initialized();
|
|
static ConsoleManagement& the();
|
|
|
|
void switch_to(unsigned);
|
|
void initialize();
|
|
|
|
void resolution_was_changed();
|
|
|
|
void switch_to_debug() { switch_to(1); }
|
|
|
|
NonnullRefPtr<VirtualConsole> first_tty() const { return m_consoles[0]; }
|
|
NonnullRefPtr<VirtualConsole> debug_tty() const { return m_consoles[1]; }
|
|
|
|
RecursiveSpinLock& tty_write_lock() { return m_tty_write_lock; }
|
|
|
|
private:
|
|
NonnullRefPtrVector<VirtualConsole> m_consoles;
|
|
RefPtr<VirtualConsole> m_active_console;
|
|
SpinLock<u8> m_lock;
|
|
RecursiveSpinLock m_tty_write_lock;
|
|
};
|
|
|
|
};
|