1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:17:45 +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

@ -12,6 +12,7 @@
#include <AK/Types.h>
#include <Kernel/Bus/PCI/Definitions.h>
#include <Kernel/Graphics/Console/Console.h>
#include <Kernel/Graphics/DisplayConnector.h>
#include <Kernel/Graphics/GenericGraphicsAdapter.h>
#include <Kernel/Graphics/VGACompatibleAdapter.h>
#include <Kernel/Graphics/VirtIOGPU/GraphicsAdapter.h>
@ -29,6 +30,9 @@ public:
unsigned allocate_minor_device_number() { return m_current_minor_number++; };
GraphicsManagement();
void attach_new_display_connector(Badge<DisplayConnector>, DisplayConnector&);
void detach_display_connector(Badge<DisplayConnector>, DisplayConnector&);
bool framebuffer_devices_console_only() const;
bool framebuffer_devices_use_bootloader_framebuffer() const;
bool framebuffer_devices_exist() const;
@ -55,6 +59,8 @@ private:
RefPtr<VGACompatibleAdapter> m_vga_adapter;
unsigned m_current_minor_number { 0 };
IntrusiveList<&DisplayConnector::m_list_node> m_display_connector_nodes;
RecursiveSpinlock m_main_vga_lock;
bool m_vga_access_is_disabled { false };
};