1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

Kernel/Graphics: Introduce the DisplayConnector class

The DisplayConnector class is meant to replace the FramebufferDevice
class. The advantage of this class over the FramebufferDevice class is:
1. It removes the mmap interface entirely. This interface is unsafe, as
multiple processes could try to use it, and when switching to and from
text console mode, there's no "good" way to revoke a memory mapping from
this interface, let alone when there are multiple processes that call
this interface. Therefore, in the DisplayConnector class there's no
implementation for this method at all.
2. The class uses a new real-world structure called ModeSetting, which
takes into account the fact that real hardware requires more than width,
height and pitch settings to mode-set the display resolution.
3. The class assumes all instances should supply some sort of EDID,
so it facilitates such mechanism to do so. Even if a given driver does
not know what is the actual EDID, it will ask to create default-generic
EDID blob.
3. This class shifts the responsibilies of switching between console
mode and graphical mode from a GraphicsAdapter to the DisplayConnector
class, so when doing the switch, the GraphicsManagement code actually
asks each DisplayConnector object to do the switch and doesn't rely on
the GraphicsAdapter objects at all.
This commit is contained in:
Liav A 2022-04-29 12:44:46 +03:00 committed by Andreas Kling
parent ebf7225728
commit 912b8ab965
6 changed files with 522 additions and 0 deletions

View file

@ -95,15 +95,34 @@ void GraphicsManagement::set_vga_text_mode_cursor(size_t console_width, size_t x
void GraphicsManagement::deactivate_graphical_mode()
{
// FIXME: Remove this once we don't support Framebuffer devices anymore.
for (auto& graphics_device : m_graphics_devices) {
graphics_device.enable_consoles();
}
for (auto& connector : m_display_connector_nodes) {
connector.set_display_mode({}, DisplayConnector::DisplayMode::Console);
}
}
void GraphicsManagement::activate_graphical_mode()
{
// FIXME: Remove this once we don't support Framebuffer devices anymore.
for (auto& graphics_device : m_graphics_devices) {
graphics_device.disable_consoles();
}
for (auto& connector : m_display_connector_nodes) {
connector.set_display_mode({}, DisplayConnector::DisplayMode::Graphical);
}
}
void GraphicsManagement::attach_new_display_connector(Badge<DisplayConnector>, DisplayConnector& connector)
{
m_display_connector_nodes.append(connector);
}
void GraphicsManagement::detach_display_connector(Badge<DisplayConnector>, DisplayConnector& connector)
{
m_display_connector_nodes.remove(connector);
}
static inline bool is_vga_compatible_pci_device(PCI::DeviceIdentifier const& device_identifier)