From fb7d9186b24b967058495337aa0bcf7acb0cf739 Mon Sep 17 00:00:00 2001 From: Liav A Date: Fri, 6 May 2022 01:05:43 +0300 Subject: [PATCH] SystemServer: Boot to text mode if there are no device nodes at /dev/gpu Otherwise, WindowServer will simply crash and fail due to no hardware to utilize. --- Userland/Services/SystemServer/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Userland/Services/SystemServer/main.cpp b/Userland/Services/SystemServer/main.cpp index d0498cac0e..36f1c161f1 100644 --- a/Userland/Services/SystemServer/main.cpp +++ b/Userland/Services/SystemServer/main.cpp @@ -72,6 +72,14 @@ static ErrorOr determine_system_mode() g_system_mode = system_mode; dbgln("Read system_mode: {}", g_system_mode); + + struct stat file_state; + int rc = lstat("/dev/gpu/connector0", &file_state); + if (rc != 0 && g_system_mode == "graphical") { + dbgln("WARNING: No device nodes at /dev/gpu/ directory. This is probably a sign of disabled graphics functionality."); + dbgln("To cope with this, I'll turn off graphical mode."); + g_system_mode = "text"; + } return {}; }