From 93ec50fe9db639d518903b1cf741a10c78c60dac Mon Sep 17 00:00:00 2001 From: rope Date: Sat, 25 Jul 2026 09:10:36 +0100 Subject: [PATCH] macbook: aquamarine immediate legacy cursor moves (patch file) --- hosts/hardware/FredOS-Macbook.nix | 16 +++++++--------- patches/aquamarine-legacy-cursor.patch | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 patches/aquamarine-legacy-cursor.patch diff --git a/hosts/hardware/FredOS-Macbook.nix b/hosts/hardware/FredOS-Macbook.nix index c1cc68c..dd96f07 100644 --- a/hosts/hardware/FredOS-Macbook.nix +++ b/hosts/hardware/FredOS-Macbook.nix @@ -54,17 +54,15 @@ # wait_prepare/wait_finish were removed from struct vb2_ops in Linux 6.8 nixpkgs.overlays = [ - # Legacy DRM iface (AQ_NO_ATOMIC): every commit without cursor flags - # hits the else-branch and nulls the cursor plane → cursor vanishes - # whenever it isn't moving (vfr=false commits every frame). Only null - # it when the cursor is actually meant to be hidden. Bug present - # upstream as of aquamarine 0.11.0 / main (July 2026). + # Legacy DRM iface (AQ_NO_ATOMIC) cursor fixes, see patch: + # 1. moveCursor only scheduled a frame — cursor still waited for vblank. + # Issue the immediate drmModeMoveCursor ioctl like wlroots did. + # 2. Commits without cursor flags nulled the cursor plane → cursor + # vanished while idle. Only null when actually hidden. + # Both present upstream as of aquamarine 0.11.0 / main (July 2026). (final: prev: { aquamarine = prev.aquamarine.overrideAttrs (old: { - postPatch = (old.postPatch or "") + '' - sed -i 's|} else if (drmModeSetCursor(|} else if (!connector->output->cursorVisible \&\& drmModeSetCursor(|' \ - src/backend/drm/impl/Legacy.cpp - ''; + patches = (old.patches or [ ]) ++ [ ../../patches/aquamarine-legacy-cursor.patch ]; }); }) (final: prev: { diff --git a/patches/aquamarine-legacy-cursor.patch b/patches/aquamarine-legacy-cursor.patch new file mode 100644 index 0000000..9064303 --- /dev/null +++ b/patches/aquamarine-legacy-cursor.patch @@ -0,0 +1,22 @@ +--- a/src/backend/drm/impl/Legacy.cpp ++++ b/src/backend/drm/impl/Legacy.cpp +@@ -18,6 +18,10 @@ + if (!connector->output->cursorVisible || !connector->output->state->state().enabled || !connector->crtc || !connector->crtc->cursor) + return true; + ++ // move the cursor plane immediately via the legacy ioctl instead of ++ // waiting for the next vblank-bound commit ++ drmModeMoveCursor(connector->backend->gpu->fd, connector->crtc->id, (int)connector->output->cursorPos.x, (int)connector->output->cursorPos.y); ++ + if (!skipSchedule) + connector->output->scheduleFrame(IOutput::AQ_SCHEDULE_CURSOR_MOVE); + +@@ -123,7 +127,7 @@ + connector->backend->backend->log(AQ_LOG_ERROR, std::format("legacy drm: cursor drmIoctl failed: {}", strerror(errno))); + return false; + } +- } else if (drmModeSetCursor(connector->backend->gpu->fd, connector->crtc->id, 0, 0, 0)) ++ } else if (!connector->output->cursorVisible && drmModeSetCursor(connector->backend->gpu->fd, connector->crtc->id, 0, 0, 0)) + connector->backend->backend->log(AQ_LOG_ERROR, "legacy drm: cursor null failed"); + + if (!enable)