741f144c79
- Add full VirtIO GPU driver with command submission, resource management, VirtQueue implementation, and transport layer; includes diagnostic probes for resource_create_2d ERR_INVALID_RESOURCE_ID investigation - Expand libdrm Redox support with DRM ioctl wrappers (ADDFB, RMFB, CREATE_DUMB, MAP_DUMB, DESTROY_DUMB, GET_RESOURCES, GET_CONNECTOR, GET_CRTC, SET_CRTC, MODE_OBJ_GET_PROPERTIES, etc.) and xf86drm_redox.h - Add redox-drm scheme handlers for VirtIO GPU-specific DRM ioctls (VIRTGPU_RESOURCE_CREATE, VIRTGPU_MAP, VIRTGPU_WAIT, VIRTGPU_INFO, etc.) - Add display stack recipes: freetype2, lcms2, libdisplay-info, libepoxy, libxcvt - Fix KWin build (recipe.toml expanded, kf6-ksvg added) - Fix KF6 CMakeLists for cross-compilation (attica, kcmutils, kcolorscheme, kcompletion, kconfigwidgets, kdeclarative, kiconthemes, kitemmodels, kitemviews, kjobwidgets, ktextwidgets, kwayland, kxmlgui, kpty, solid) - Add Qt6 futex support patch - Add relibc patches: P3 strtold, P3 ld-so search path, P5 DRM ioctl removal - Add base P4 pcid config scheme patch - Update driver-manager hotplug/config, PCI config in redox-driver-sys - Update greeter compositor and KDE session scripts - Update AGENTS.md with zero-tolerance stubs policy and project knowledge
104 lines
4.0 KiB
Bash
Executable File
104 lines
4.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
# NOTE: Neither WAYLAND_DISPLAY nor DISPLAY may be exported when starting
|
|
# KWin. KWin uses their presence (even as empty strings) to select the
|
|
# nested Wayland or X11 backend instead of the bare-metal DRM/KMS backend.
|
|
# Clients (the greeter UI, KDE session apps) receive WAYLAND_DISPLAY from
|
|
# redbear-session-launch instead.
|
|
unset DISPLAY
|
|
unset WAYLAND_DISPLAY
|
|
export XDG_SESSION_TYPE=wayland
|
|
export LIBSEAT_BACKEND=seatd
|
|
export SEATD_SOCK=/run/seatd.sock
|
|
export QT_PLUGIN_PATH="${QT_PLUGIN_PATH:-/usr/plugins}"
|
|
export QT_QPA_PLATFORM_PLUGIN_PATH="${QT_QPA_PLATFORM_PLUGIN_PATH:-/usr/plugins/platforms}"
|
|
export QML2_IMPORT_PATH="${QML2_IMPORT_PATH:-/usr/qml}"
|
|
export QT_WAYLAND_SHELL_INTEGRATION="${QT_WAYLAND_SHELL_INTEGRATION:-xdg-shell}"
|
|
export XCURSOR_THEME="${XCURSOR_THEME:-Pop}"
|
|
export XKB_CONFIG_ROOT="${XKB_CONFIG_ROOT:-/usr/share/X11/xkb}"
|
|
export KWIN_COMPOSE="${KWIN_COMPOSE:-O2}"
|
|
export QT_DEBUG_PLUGINS=1
|
|
export QT_LOGGING_RULES="${QT_LOGGING_RULES:-*.debug=true}"
|
|
export MESA_LOADER_DRIVER_OVERRIDE="${MESA_LOADER_DRIVER_OVERRIDE:-virtio_gpu}"
|
|
|
|
if [ -z "${XDG_RUNTIME_DIR:-}" ]; then
|
|
export XDG_RUNTIME_DIR="/tmp/run/redbear-greeter"
|
|
fi
|
|
|
|
mkdir -p "$XDG_RUNTIME_DIR"
|
|
|
|
drm_scheme_ready() {
|
|
# Try to open /scheme/drm/card0 via read (head -c 1).
|
|
# On Redox, stat and test -e are unreliable for scheme paths,
|
|
# but opening the scheme file descriptor works.
|
|
( head -c 1 "/scheme/drm/card0" ) >/dev/null 2>&1
|
|
}
|
|
|
|
wait_for_drm_scheme() {
|
|
local wait_seconds="${REDBEAR_DRM_WAIT_SECONDS:-10}"
|
|
local attempts=0
|
|
|
|
if drm_scheme_ready; then
|
|
return 0
|
|
fi
|
|
|
|
echo "redbear-greeter-compositor: waiting up to ${wait_seconds}s for DRM device(s): /scheme/drm:/scheme/drm/card0" >&2
|
|
|
|
attempts=$((wait_seconds * 2))
|
|
|
|
while [ "$attempts" -gt 0 ]; do
|
|
if drm_scheme_ready; then
|
|
return 0
|
|
fi
|
|
|
|
sleep 0.5
|
|
attempts=$((attempts - 1))
|
|
done
|
|
|
|
drm_scheme_ready
|
|
}
|
|
|
|
# Prefer kwin_wayland (real KWin compositor). Fall back to redbear-compositor only if
|
|
# KWin is not installed (e.g. text-only target accidentally includes greeter).
|
|
COMPOSITOR=""
|
|
if command -v kwin_wayland >/dev/null 2>&1; then
|
|
COMPOSITOR="kwin_wayland"
|
|
elif command -v /usr/bin/kwin_wayland >/dev/null 2>&1; then
|
|
COMPOSITOR="/usr/bin/kwin_wayland"
|
|
elif command -v redbear-compositor >/dev/null 2>&1; then
|
|
COMPOSITOR="redbear-compositor"
|
|
echo "redbear-greeter-compositor: kwin_wayland not found, falling back to redbear-compositor" >&2
|
|
else
|
|
echo "redbear-greeter-compositor: no compositor found (need kwin_wayland or redbear-compositor)" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# pcid-spawner is intentionally async in Red Bear OS, so service ordering only guarantees that
|
|
# spawning has started. Wait for the DRM scheme to appear.
|
|
if wait_for_drm_scheme; then
|
|
export KWIN_DRM_DEVICES="${KWIN_DRM_DEVICES:-/scheme/drm/card0}"
|
|
echo "redbear-greeter-compositor: using DRM compositor backend (KWIN_DRM_DEVICES=${KWIN_DRM_DEVICES})" >&2
|
|
|
|
# NOTE: QDBusConnection::sessionBus() blocks on Redox when attempting Unix socket
|
|
# connect(), even when dbus-daemon is running. All KWin sessionBus() calls in the
|
|
# startup path have been bypassed in the KWin source. We do NOT set
|
|
# DBUS_SESSION_BUS_ADDRESS so that remaining sessionBus() calls with env-var guards
|
|
# skip gracefully. If a future change re-enables D-Bus session bus, the Qt/Redox
|
|
# Unix socket connect() issue must be resolved first.
|
|
|
|
echo "redbear-greeter-compositor: env DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS:-unset} DBUS_SYSTEM_BUS_ADDRESS=${DBUS_SYSTEM_BUS_ADDRESS:-unset}" >&2
|
|
echo "redbear-greeter-compositor: launching $COMPOSITOR" >&2
|
|
QT_QPA_PLATFORM=offscreen "$COMPOSITOR"
|
|
EXIT_CODE=$?
|
|
echo "redbear-greeter-compositor: compositor exited with code $EXIT_CODE" >&2
|
|
exit $EXIT_CODE
|
|
fi
|
|
|
|
# No DRM at all — fall back to virtual backend.
|
|
unset KWIN_DRM_DEVICES
|
|
echo "redbear-greeter-compositor: no DRM device found, using virtual compositor backend" >&2
|
|
"$COMPOSITOR"
|
|
exit $?
|