From 33a5c486560164510efb3ed5bc940a65302e43ff Mon Sep 17 00:00:00 2001 From: zero Date: Sun, 25 Oct 2026 14:28:58 -0600 Subject: [PATCH] fix(iokitd): name the :0 fallback in the display probe and the log iokitd opens DISPLAY and falls back to :0, but the env-check probe only asked xdpyinfo for DISPLAY. It could warn on a host where iokitd still had a display, or pass on :0 while DISPLAY was broken. The probe now tries :0 when DISPLAY is unset or cannot be opened, and the one-line log names the fallback, so the probe and the guest agree. prepare.py --check-only validates all 31 patch entries with the new hunk; iokitd rebuilds and carries the new message. Signed-off-by: zero --- docs/TROUBLESHOOTING.md | 6 +++--- patches/iokitd.patch | 5 +++-- tools/env-check.sh | 22 ++++++++++++---------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md index d7b0e68..f6a42ab 100644 --- a/docs/TROUBLESHOOTING.md +++ b/docs/TROUBLESHOOTING.md @@ -436,9 +436,9 @@ The installer adds a CarbonCore framework override and the matching absolute Cor ## `iokitd` restarts when the X display is not accessible -`DISPLAY` can name an X server that rejects the connection, which is what an unset or stale `XAUTHORITY` does on a server, over SSH, or in a `sudo` session that dropped the cookie. `iokitd` then has no Xlib display and previously still called into EGL with a null display, so the process faulted and launchd restarted it in a loop while `/tmp/lolsig.log` filled with frames ([#140](https://github.com/lucannez64/darling-lol/issues/140)). +`DISPLAY` can name an X server that rejects the connection, which is what an unset or stale `XAUTHORITY` does on a server, over SSH, or in a `sudo` session that dropped the cookie. `iokitd` opens `DISPLAY` and then falls back to `:0`, so the display is missing only when both fail. Previously it still called into EGL with a null display, so the process faulted and launchd restarted it in a loop while `/tmp/lolsig.log` filled with frames ([#140](https://github.com/lucannez64/darling-lol/issues/140)). -`iokitd` now checks the display before EGL. Without a usable display it prints one line (`iokitd: cannot open X display …; X11 surface acceleration disabled`) and keeps running, so `darling shell` starts instead of crash-looping. Surfaces then fail with `KERN_FAILURE`, which means the guest has no GPU rendering: export a cookie the user running Darling can read and start again, for example: +`iokitd` now checks the display before EGL. When neither `DISPLAY` nor the `:0` fallback can be opened it prints one line (`iokitd: cannot open X display … or its :0 fallback; X11 surface acceleration disabled`) and keeps running, so `darling shell` starts instead of crash-looping. Surfaces then fail with `KERN_FAILURE`, which means the guest has no GPU rendering: export a cookie the user running Darling can read and start again, for example: ```sh export XAUTHORITY=/run/user/$(id -u)/xauth @@ -446,7 +446,7 @@ export XAUTHORITY=/run/user/$(id -u)/xauth XAUTHORITY=$(ls /var/run/sddm/* | head -1) DISPLAY=:0 EGL_PLATFORM=x11 darling shell echo hola ``` -`bash tools/env-check.sh` now probes the display with `xdpyinfo` in the environment Darling inherits and warns when it cannot open it. That check is advisory: without X11/EGL the runtime still boots, but the game cannot render. +`bash tools/env-check.sh` now probes the display with `xdpyinfo` in the environment Darling inherits, tries the `:0` fallback that `iokitd` uses, and warns only when both fail. That check is advisory: without X11/EGL the runtime still boots, but the game cannot render. ## Blocky video or flickering startup logo diff --git a/patches/iokitd.patch b/patches/iokitd.patch index d7f9069..61df020 100644 --- a/patches/iokitd.patch +++ b/patches/iokitd.patch @@ -440,7 +440,7 @@ diff --git a/src/IOSurfaceRoot.mm b/src/IOSurfaceRoot.mm index d7e6fab..f47889f 100644 --- a/src/IOSurfaceRoot.mm +++ b/src/IOSurfaceRoot.mm -@@ -21,13 +21,33 @@ +@@ -21,13 +21,34 @@ #include "iokitd.h" #include "IOSurface.h" #include "IODisplayConnectX11.h" @@ -467,7 +467,8 @@ index d7e6fab..f47889f 100644 + m_display = EGL_NO_DISPLAY; + std::cerr << "iokitd: cannot open X display " + << (std::getenv("DISPLAY") ? std::getenv("DISPLAY") : "(DISPLAY unset)") -+ << "; X11 surface acceleration disabled, set XAUTHORITY to a readable cookie" ++ << " or its :0 fallback; X11 surface acceleration disabled, set XAUTHORITY to a " ++ << "readable cookie" + << std::endl; + return; + } diff --git a/tools/env-check.sh b/tools/env-check.sh index f0e5415..34865be 100755 --- a/tools/env-check.sh +++ b/tools/env-check.sh @@ -22,20 +22,22 @@ ls /dev/dri 2>/dev/null || echo "no /dev/dri (Vulkan render needs GPU or lavapip command -v vulkaninfo >/dev/null && vulkaninfo --summary 2>&1 | head -20 || echo "vulkaninfo absent" echo "== display ==" # DISPLAY is not enough: the X server can reject the connection when the cookie -# is missing or stale, and Darling's iokitd then has no X11/EGL path. Ask the -# server with the environment Darling will inherit. +# is missing or stale. iokitd opens DISPLAY and, if that fails or DISPLAY is +# unset, falls back to :0, so probe both with the environment Darling inherits. if [ -n "${DISPLAY:-}" ]; then echo "DISPLAY=$DISPLAY XAUTHORITY=${XAUTHORITY:-unset}" - if command -v xdpyinfo >/dev/null 2>&1; then - if xdpyinfo >/dev/null 2>&1; then - echo "X display reachable" - else - echo "WARN: cannot open $DISPLAY; export XAUTHORITY with a readable cookie (typical for servers and SSH), otherwise iokitd runs without X11/EGL" - fi +else + echo "DISPLAY unset; iokitd falls back to :0" +fi +if command -v xdpyinfo >/dev/null 2>&1; then + if xdpyinfo >/dev/null 2>&1; then + echo "X display reachable (${DISPLAY:-:0})" + elif xdpyinfo -display :0 >/dev/null 2>&1; then + echo ":0 reachable; iokitd falls back to it when DISPLAY is unset or cannot be opened" else - echo "xdpyinfo not installed; skipping the display probe (install x11-utils)" + echo "WARN: cannot open ${DISPLAY:-:0} or :0; export XAUTHORITY with a readable cookie (typical for servers and SSH), otherwise iokitd has no X11/EGL surface path" fi else - echo "DISPLAY unset; iokitd runs without X11/EGL (expected on a headless host)" + echo "xdpyinfo not installed; skipping the display probe (install x11-utils)" fi [ "$ok" -eq 1 ] && echo "OK" || { echo "FAIL: install missing tools"; exit 1; }