diff options
author | Liav A <liavalb@gmail.com> | 2022-06-10 13:54:36 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-07-23 10:42:08 +0100 |
commit | b5e5b299c4b9979bd7ac56ba09a800c1709c7ce5 (patch) | |
tree | 8d0437f987b0379e838df5c64cd0bac2714d277e | |
parent | b7d0b5d745a5bf5cd36a3ac39946ad73b4537611 (diff) | |
download | serenity-b5e5b299c4b9979bd7ac56ba09a800c1709c7ce5.zip |
Userland: Remove stale remainders of old framebuffer devices
-rw-r--r-- | Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibEDID/EDID.cpp | 16 | ||||
-rw-r--r-- | Userland/Libraries/LibEDID/EDID.h | 4 | ||||
-rw-r--r-- | Userland/Services/SystemServer/main.cpp | 9 | ||||
-rw-r--r-- | Userland/Services/WindowServer/HardwareScreenBackend.cpp | 26 | ||||
-rw-r--r-- | Userland/Services/WindowServer/HardwareScreenBackend.h | 2 | ||||
-rw-r--r-- | Userland/Services/WindowServer/main.cpp | 6 |
7 files changed, 29 insertions, 36 deletions
diff --git a/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp b/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp index 5bdf07ec9e..cb21dd1a3e 100644 --- a/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp @@ -153,7 +153,7 @@ void MonitorSettingsWidget::load_current_settings() for (size_t i = 0; i < m_screen_layout.screens.size(); i++) { String screen_display_name; if (m_screen_layout.screens[i].mode == WindowServer::ScreenLayout::Screen::Mode::Device) { - if (auto edid = EDID::Parser::from_framebuffer_device(m_screen_layout.screens[i].device.value(), 0); !edid.is_error()) { // TODO: multihead + if (auto edid = EDID::Parser::from_display_connector_device(m_screen_layout.screens[i].device.value(), 0); !edid.is_error()) { // TODO: multihead screen_display_name = display_name_from_edid(edid.value()); m_screen_edids.append(edid.release_value()); } else { diff --git a/Userland/Libraries/LibEDID/EDID.cpp b/Userland/Libraries/LibEDID/EDID.cpp index 16e10ca730..be8e2b6963 100644 --- a/Userland/Libraries/LibEDID/EDID.cpp +++ b/Userland/Libraries/LibEDID/EDID.cpp @@ -201,20 +201,20 @@ ErrorOr<Parser> Parser::from_bytes(ByteBuffer&& bytes) } #ifndef KERNEL -ErrorOr<Parser> Parser::from_framebuffer_device(int framebuffer_fd, size_t head) +ErrorOr<Parser> Parser::from_display_connector_device(int display_connector_fd, size_t head) { RawBytes edid_bytes; GraphicsHeadEDID edid_info {}; edid_info.head_index = head; edid_info.bytes = &edid_bytes[0]; edid_info.bytes_size = sizeof(edid_bytes); - if (graphics_connector_get_head_edid(framebuffer_fd, &edid_info) < 0) { + if (graphics_connector_get_head_edid(display_connector_fd, &edid_info) < 0) { int err = errno; if (err == EOVERFLOW) { // We need a bigger buffer with at least bytes_size bytes auto edid_byte_buffer = TRY(ByteBuffer::create_zeroed(edid_info.bytes_size)); edid_info.bytes = edid_byte_buffer.data(); - if (graphics_connector_get_head_edid(framebuffer_fd, &edid_info) < 0) { + if (graphics_connector_get_head_edid(display_connector_fd, &edid_info) < 0) { err = errno; return Error::from_errno(err); } @@ -229,17 +229,17 @@ ErrorOr<Parser> Parser::from_framebuffer_device(int framebuffer_fd, size_t head) return from_bytes(move(edid_byte_buffer)); } -ErrorOr<Parser> Parser::from_framebuffer_device(String const& framebuffer_device, size_t head) +ErrorOr<Parser> Parser::from_display_connector_device(String const& display_connector_device, size_t head) { - int framebuffer_fd = open(framebuffer_device.characters(), O_RDWR | O_CLOEXEC); - if (framebuffer_fd < 0) { + int display_connector_fd = open(display_connector_device.characters(), O_RDWR | O_CLOEXEC); + if (display_connector_fd < 0) { int err = errno; return Error::from_errno(err); } ScopeGuard fd_guard([&] { - close(framebuffer_fd); + close(display_connector_fd); }); - return from_framebuffer_device(framebuffer_fd, head); + return from_display_connector_device(display_connector_fd, head); } #endif diff --git a/Userland/Libraries/LibEDID/EDID.h b/Userland/Libraries/LibEDID/EDID.h index 6ccfc23aa0..3c7bdaf0fa 100644 --- a/Userland/Libraries/LibEDID/EDID.h +++ b/Userland/Libraries/LibEDID/EDID.h @@ -85,8 +85,8 @@ public: static ErrorOr<Parser> from_bytes(ByteBuffer&&); #ifndef KERNEL - static ErrorOr<Parser> from_framebuffer_device(int, size_t); - static ErrorOr<Parser> from_framebuffer_device(String const&, size_t); + static ErrorOr<Parser> from_display_connector_device(int, size_t); + static ErrorOr<Parser> from_display_connector_device(String const&, size_t); #endif StringView legacy_manufacturer_id() const; diff --git a/Userland/Services/SystemServer/main.cpp b/Userland/Services/SystemServer/main.cpp index 8f78d72691..085c1b8cd3 100644 --- a/Userland/Services/SystemServer/main.cpp +++ b/Userland/Services/SystemServer/main.cpp @@ -208,13 +208,6 @@ static void populate_devtmpfs_devices_based_on_devctl() create_devtmpfs_char_device(String::formatted("/dev/gpu/connector{}", minor_number), 0666, 226, minor_number); break; } - case 29: { - if (is_block_device) { - create_devtmpfs_block_device(String::formatted("/dev/fb{}", minor_number), 0666, 29, minor_number); - break; - } - break; - } case 229: { if (!is_block_device) { create_devtmpfs_char_device(String::formatted("/dev/hvc0p{}", minor_number), 0666, major_number, minor_number); @@ -401,7 +394,7 @@ static ErrorOr<void> prepare_synthetic_filesystems() auto phys_group = TRY(Core::System::getgrnam("phys"sv)); VERIFY(phys_group.has_value()); - // FIXME: Try to find a way to not hardcode the major number of framebuffer device nodes. + // FIXME: Try to find a way to not hardcode the major number of display connector device nodes. TRY(chown_all_matching_device_nodes(phys_group.value(), 29)); auto const filter_chown_ENOENT = [](ErrorOr<void> result) -> ErrorOr<void> { diff --git a/Userland/Services/WindowServer/HardwareScreenBackend.cpp b/Userland/Services/WindowServer/HardwareScreenBackend.cpp index 6263868d13..85388385dc 100644 --- a/Userland/Services/WindowServer/HardwareScreenBackend.cpp +++ b/Userland/Services/WindowServer/HardwareScreenBackend.cpp @@ -24,10 +24,10 @@ HardwareScreenBackend::HardwareScreenBackend(String device) ErrorOr<void> HardwareScreenBackend::open() { - m_framebuffer_fd = TRY(Core::System::open(m_device, O_RDWR | O_CLOEXEC)); + m_display_connector_fd = TRY(Core::System::open(m_device, O_RDWR | O_CLOEXEC)); GraphicsConnectorProperties properties; - if (graphics_connector_get_properties(m_framebuffer_fd, &properties) < 0) + if (graphics_connector_get_properties(m_display_connector_fd, &properties) < 0) return Error::from_syscall(String::formatted("failed to ioctl {}", m_device), errno); m_can_device_flush_buffers = (properties.partial_flushing_support != 0); @@ -38,9 +38,9 @@ ErrorOr<void> HardwareScreenBackend::open() HardwareScreenBackend::~HardwareScreenBackend() { - if (m_framebuffer_fd >= 0) { - close(m_framebuffer_fd); - m_framebuffer_fd = -1; + if (m_display_connector_fd >= 0) { + close(m_display_connector_fd); + m_display_connector_fd = -1; } if (m_framebuffer) { MUST(Core::System::munmap(m_framebuffer, m_size_in_bytes)); @@ -54,10 +54,10 @@ ErrorOr<void> HardwareScreenBackend::set_head_mode_setting(GraphicsHeadModeSetti { GraphicsHeadModeSetting requested_mode_setting = mode_setting; - auto rc = graphics_connector_set_head_mode_setting(m_framebuffer_fd, &requested_mode_setting); + auto rc = graphics_connector_set_head_mode_setting(m_display_connector_fd, &requested_mode_setting); if (rc != 0) { dbgln("Failed to set backend mode setting: falling back to safe resolution"); - rc = graphics_connector_set_safe_head_mode_setting(m_framebuffer_fd); + rc = graphics_connector_set_safe_head_mode_setting(m_display_connector_fd); if (rc != 0) { dbgln("Failed to set backend safe mode setting: aborting"); return Error::from_syscall("graphics_connector_set_safe_head_mode_setting"sv, rc); @@ -81,12 +81,12 @@ ErrorOr<void> HardwareScreenBackend::map_framebuffer() { GraphicsHeadModeSetting mode_setting {}; memset(&mode_setting, 0, sizeof(GraphicsHeadModeSetting)); - int rc = graphics_connector_get_head_mode_setting(m_framebuffer_fd, &mode_setting); + int rc = graphics_connector_get_head_mode_setting(m_display_connector_fd, &mode_setting); if (rc != 0) { return Error::from_syscall("graphics_connector_get_head_mode_setting"sv, rc); } m_size_in_bytes = mode_setting.horizontal_stride * mode_setting.vertical_active * 2; - m_framebuffer = (Gfx::ARGB32*)TRY(Core::System::mmap(nullptr, m_size_in_bytes, PROT_READ | PROT_WRITE, MAP_SHARED, m_framebuffer_fd, 0)); + m_framebuffer = (Gfx::ARGB32*)TRY(Core::System::mmap(nullptr, m_size_in_bytes, PROT_READ | PROT_WRITE, MAP_SHARED, m_display_connector_fd, 0)); if (m_can_set_head_buffer) { // Note: fall back to assuming the second buffer starts right after the last line of the first @@ -106,7 +106,7 @@ ErrorOr<GraphicsHeadModeSetting> HardwareScreenBackend::get_head_mode_setting() { GraphicsHeadModeSetting mode_setting {}; memset(&mode_setting, 0, sizeof(GraphicsHeadModeSetting)); - int rc = graphics_connector_get_head_mode_setting(m_framebuffer_fd, &mode_setting); + int rc = graphics_connector_get_head_mode_setting(m_display_connector_fd, &mode_setting); if (rc != 0) { return Error::from_syscall("graphics_connector_get_head_mode_setting"sv, rc); } @@ -121,13 +121,13 @@ void HardwareScreenBackend::set_head_buffer(int head_index) GraphicsHeadVerticalOffset offset { 0, 0 }; if (head_index == 1) offset.offsetted = 1; - int rc = fb_set_head_vertical_offset_buffer(m_framebuffer_fd, &offset); + int rc = fb_set_head_vertical_offset_buffer(m_display_connector_fd, &offset); VERIFY(rc == 0); } ErrorOr<void> HardwareScreenBackend::flush_framebuffer_rects(int buffer_index, Span<FBRect const> flush_rects) { - int rc = fb_flush_buffers(m_framebuffer_fd, buffer_index, flush_rects.data(), (unsigned)flush_rects.size()); + int rc = fb_flush_buffers(m_display_connector_fd, buffer_index, flush_rects.data(), (unsigned)flush_rects.size()); if (rc == -ENOTSUP) m_can_device_flush_buffers = false; else if (rc != 0) @@ -137,7 +137,7 @@ ErrorOr<void> HardwareScreenBackend::flush_framebuffer_rects(int buffer_index, S ErrorOr<void> HardwareScreenBackend::flush_framebuffer() { - int rc = fb_flush_head(m_framebuffer_fd); + int rc = fb_flush_head(m_display_connector_fd); if (rc == -ENOTSUP) m_can_device_flush_entire_framebuffer = false; else if (rc != 0) diff --git a/Userland/Services/WindowServer/HardwareScreenBackend.h b/Userland/Services/WindowServer/HardwareScreenBackend.h index 8af2642084..35b2786d17 100644 --- a/Userland/Services/WindowServer/HardwareScreenBackend.h +++ b/Userland/Services/WindowServer/HardwareScreenBackend.h @@ -35,7 +35,7 @@ public: virtual ErrorOr<GraphicsHeadModeSetting> get_head_mode_setting() override; String m_device {}; - int m_framebuffer_fd { -1 }; + int m_display_connector_fd { -1 }; Gfx::ARGB32* scanline(int buffer_index, int y) const { diff --git a/Userland/Services/WindowServer/main.cpp b/Userland/Services/WindowServer/main.cpp index f11106f816..a5d6339a90 100644 --- a/Userland/Services/WindowServer/main.cpp +++ b/Userland/Services/WindowServer/main.cpp @@ -69,7 +69,7 @@ ErrorOr<int> serenity_main(Main::Arguments) String error_msg; auto add_unconfigured_display_connector_devices = [&]() { - // Enumerate the /dev/fbX devices and try to set up any ones we find that we haven't already used + // Enumerate the /dev/gpu/connectorX devices and try to set up any ones we find that we haven't already used Core::DirIterator di("/dev/gpu", Core::DirIterator::SkipParentAndBaseDir); while (di.has_next()) { auto path = di.next_path(); @@ -81,7 +81,7 @@ ErrorOr<int> serenity_main(Main::Arguments) if (fb_devices_configured.find(full_path) != fb_devices_configured.end()) continue; if (!screen_layout.try_auto_add_display_connector(full_path)) - dbgln("Could not auto-add framebuffer device {} to screen layout", full_path); + dbgln("Could not auto-add display connector device {} to screen layout", full_path); } }; @@ -130,7 +130,7 @@ ErrorOr<int> serenity_main(Main::Arguments) TRY(Core::System::unveil("/tmp", "")); - // NOTE: Because we dynamically need to be able to open new /dev/fb* + // NOTE: Because we dynamically need to be able to open new /dev/gpu/connector* // devices we can't really unveil all of /dev unless we have some // other mechanism that can hand us file descriptors for these. |