mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:38:11 +00:00
Kernel/SysFS: Add exposing interface for DisplayConnectors
Under normal conditions (when mounting SysFS in /sys), there will be a new directory in the /sys/devices directory called "graphics". For now, under that directory there will be only a sub-directory called "connectors" which will contain all DisplayConnectors' details, each in its own sub-directory too, distinguished in naming with its minor number. Therefore, /sys/devices/graphics/connectors/MINOR_NUMBER/ will contain: - General device attributes such as mutable_mode_setting_capable, double_buffering_capable, flush_support, partial_flush_support and refresh_rate_support. These values are exposed in the ioctl interface of the DisplayConnector class too, but these can be useful later on for command line utilities that want/need to expose these basic settings. - The EDID blob, simply named "edid". This will help userspace to fetch the edid without the need of using the ioctl interface later on.
This commit is contained in:
parent
cb900006b9
commit
da8d18b263
12 changed files with 378 additions and 2 deletions
|
@ -4,6 +4,9 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <Kernel/FileSystem/SysFS/Subsystems/DeviceIdentifiers/CharacterDevicesDirectory.h>
|
||||
#include <Kernel/FileSystem/SysFS/Subsystems/Devices/Graphics/DisplayConnector/DeviceDirectory.h>
|
||||
#include <Kernel/FileSystem/SysFS/Subsystems/Devices/Graphics/DisplayConnector/Directory.h>
|
||||
#include <Kernel/Graphics/DisplayConnector.h>
|
||||
#include <Kernel/Graphics/GraphicsManagement.h>
|
||||
#include <Kernel/Memory/MemoryManager.h>
|
||||
|
@ -57,12 +60,31 @@ ErrorOr<size_t> DisplayConnector::write(OpenFileDescription&, u64, UserOrKernelB
|
|||
void DisplayConnector::will_be_destroyed()
|
||||
{
|
||||
GraphicsManagement::the().detach_display_connector({}, *this);
|
||||
Device::will_be_destroyed();
|
||||
|
||||
VERIFY(m_symlink_sysfs_component);
|
||||
VERIFY(!is_block_device());
|
||||
SysFSCharacterDevicesDirectory::the().m_child_components.with([&](auto& list) -> void {
|
||||
list.remove(*m_symlink_sysfs_component);
|
||||
});
|
||||
m_symlink_sysfs_component.clear();
|
||||
SysFSDisplayConnectorsDirectory::the().unplug({}, *m_sysfs_device_directory);
|
||||
before_will_be_destroyed_remove_from_device_management();
|
||||
}
|
||||
|
||||
void DisplayConnector::after_inserting()
|
||||
{
|
||||
Device::after_inserting();
|
||||
after_inserting_add_to_device_management();
|
||||
auto sysfs_display_connector_device_directory = DisplayConnectorSysFSDirectory::create(SysFSDisplayConnectorsDirectory::the(), *this);
|
||||
m_sysfs_device_directory = sysfs_display_connector_device_directory;
|
||||
SysFSDisplayConnectorsDirectory::the().plug({}, *sysfs_display_connector_device_directory);
|
||||
VERIFY(!m_symlink_sysfs_component);
|
||||
auto sys_fs_component = MUST(SysFSSymbolicLinkDeviceComponent::try_create(SysFSDeviceIdentifiersDirectory::the(), *this, *m_sysfs_device_directory));
|
||||
m_symlink_sysfs_component = sys_fs_component;
|
||||
VERIFY(!is_block_device());
|
||||
SysFSCharacterDevicesDirectory::the().m_child_components.with([&](auto& list) -> void {
|
||||
list.append(*m_symlink_sysfs_component);
|
||||
});
|
||||
|
||||
auto rounded_size = MUST(Memory::page_round_up(m_framebuffer_resource_size));
|
||||
|
||||
if (!m_framebuffer_at_arbitrary_physical_range) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue