Skip to content

Enable amdgpu HDMI HPD debounce so displays that drop HPD in power save stop relighting the locked screen - #13129

Open
davidguilherme wants to merge 4 commits into
omacom:quattrofrom
davidguilherme:fix/amdgpu-hdmi-hpd-debounce
Open

davidguilherme wants to merge 4 commits into
omacom:quattrofrom
davidguilherme:fix/amdgpu-hdmi-hpd-debounce

Conversation

@davidguilherme

@davidguilherme davidguilherme commented Sep 24, 2026 •

Copy link
Copy Markdown

Summary

Fixes a class of lock-screen blank/wake loops on AMD HDMI systems: displays that drop HDMI hotplug-detect (HPD) when blanked re-light a locked screen over and over. Related: #11330, #8580, #10778, #8863.

Problem

When a DPMS-off output enters power save, many HDMI monitors de-assert HPD and then re-assert it as an input-source "autoscan" ~15s later. Linux has no HDMI HPD filter, so the kernel sees a disconnect→reconnect with an identical EDID (~0.75s apart) and raises a hotplug event: the output is removed and re-added with DPMS back on. Locked, that blank→wake→blank cycle repeats indefinitely (drm: HDMI-A-x is not connected, clearing stale crtc), measured at thousands of cycles per night on real installs.

Root cause

Userspace re-blank debounces (#8896, #10130) treat the symptom — the removal happens in amdgpu before userspace ever sees it. amdgpu's Display Manager now ships the right tool: an HDMI HPD filter (upstream "drm/amd/display: Add an HPD filter for HDMI", a driver parameter disabled by default). When enabled, an HDMI disconnect schedules a delayed re-detect instead of being processed immediately; if the same EDID returns within the window, the hotplug event is skipped and the output is never removed. Only HDMI is filtered; DisplayPort is unaffected.

Change

  1. etc/modprobe.d/amdgpu.conf — arms the filter at 1500ms (AMD's chosen default; covers a typical ~0.75s HPD drop) on every Omarchy machine. The options line is inert when amdgpu is not loaded, so non-AMD hardware is untouched.
  2. migrations/1790200214.sh — existing installs need a one-time initramfs rebuild: amdgpu loads out of the initramfs (kms + modconf hooks) and the parameter is read once at module load, so a plain package update stays inert until a later kernel rebuild. The migration rebuilds only on machines with an AMD display controller, records a machine-wide marker so it runs once, and flags a reboot so the fix actually applies.
  3. test/shell.d/amdgpu-hpd-debounce-migration-test.sh — covers AMD/Intel scoping, idempotency, retry-after-failure, and the reboot flag.

Verification

On this AMD (Radeon) + HDMI box: amdgpu.hdmi_hpd_debounce_delay_ms=1500 set → DPMS-off after lock no longer drops the output. During a 42s watch the connector stayed connected with zero disconnect at the ~15s mark (pre-fix it disconnected and relit every cycle).

Testing

  • bash test/shell.d/amdgpu-hpd-debounce-migration-test.sh — 8/8 pass
  • ./test/shell — new test passes; the suite's 6 failures are pre-existing environment gaps (missing omarchy-pkgs checkout, omasnap, live compositor), unrelated

Fixes #11330 · Fixes #8580 · Fixes #10778 · Fixes #8863

…MS power save

Monitors that deassert hotplug-detect when the link enters DPMS power save
and then re-assert it as an input autoscan are seen by the kernel as a real
disconnect->reconnect with an identical EDID. That raises a hotplug event,
which removes a DPMS-off output and re-adds it with DPMS back on (the
lock-screen relight loop reported across several issues).

amdgpu's HDMI HPD filter schedules a delayed re-detect and drops the
duplicate hotplug when the same EDID returns within the window. It is
disabled by default upstream; enabling it here at 1500ms fixes the class of
lock-screen blank/wake loops on AMD HDMI without affecting DisplayPort or
non-amdgpu hardware.
…ounce

The amdgpu contrib lands /etc/modprobe.d/amdgpu.conf through the settings
package, but the param is read once at module load and amdgpu loads out of the
initramfs (kms + modconf hooks) -- so an existing install that only gets the
file sits inert until a later kernel rebuild happens to bake it in. Rebuild
the initramfs once on machines that can benefit (an AMD display controller is
present and the packaged conf has landed), flag a reboot so the fix applies,
and record a machine-wide marker so other users' runs no-op. Mirrors the
NVIDIA kms-hook initramfs migration (1786605598).
@Chulii

Chulii commented Sep 24, 2026

Copy link
Copy Markdown

Verified on my machine (dual AMD display controllers, HDMI-A-1 attached, Limine UKI boot):

  • Rebuilt initramfs via limine-mkinitcpio, rebooted.
  • /sys/module/amdgpu/parameters/hdmi_hpd_debounce_delay_ms now reads 1500 (was 0 before).
  • Locked + DPMS power save + suspend/resume cycle: the HDMI output stays connected, no blank→relight loop.

Works as described, thanks.

omarchybot and others added 2 commits October 3, 2026 03:31
/etc/modprobe.d/amdgpu.conf is the name the Arch wiki and most guides tell people to put their own amdgpu options in (si_support, cik_support, ppfeaturemask). omarchy-settings owning that path means pacman refuses the update on any machine that already has one, and omarchy update's conflict handler then moves the administrator's file to /var/lib/omarchy/replaced and installs ours in its place, so their options silently stop applying at the next boot. Name it like the other Omarchy drop-in beside it, and pin that in the test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
The machine-wide marker was written before the reboot flag, so a run that failed between them left the initramfs rebuilt, the migration complete, and no reboot prompt: every later run exits at the marker, and the debounce never applies until the user happens to reboot. Flag first, as the kernel migration beside it does, so a failure there stays pending and retries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed by Claude Opus 5.5, with Codex Medium as a second opinion. The approach is sound: amdgpu's hdmi_hpd_debounce_delay_ms is in the current kernel (modinfo amdgpu lists it, "1500 is common"), modconf puts every /etc/modprobe.d/*.conf in the initramfs, and the migration only rebuilds on machines with an AMD display controller.

I pushed two fixes to your branch:

  • The drop-in is now etc/modprobe.d/omarchy-amdgpu-hdmi-hpd.conf (3d112a5). /etc/modprobe.d/amdgpu.conf is where the Arch wiki tells people to put their own amdgpu options (si_support, cik_support, ppfeaturemask). Once omarchy-settings owns that path, pacman refuses the update on any machine that already has the file. I reproduced that on a worker with a probe package: /etc/modprobe.d/amdgpu.conf exists in filesystem. omarchy update's conflict handler then moves the user's file to /var/lib/omarchy/replaced/ and installs ours in its place, so their options stop applying at the next boot. The new name matches omarchy-usb-autosuspend.conf beside it, and the test now pins it.
  • The reboot is flagged before completion is recorded (b2331c4). Before, a run that failed between writing the marker and setting reboot-required left the migration complete with no reboot prompt. Codex raised this one.

What ran: on a disposable Omarchy worker, test/shell.d/amdgpu-hpd-debounce-migration-test.sh passes 10/10 at b2331c4. Each new check fails when its fix is reverted. ./test/cli stops at vscode generated theme references current theme file, which fails the same way on quattro and has nothing to do with this change. Codex's second round on the new head found nothing; it had already seen my reasoning, so that agreement isn't independent.

What this can't prove: a worker has neither an amdgpu nor an HDMI monitor that drops HPD, so the fix itself is unverified until someone who has the problem confirms it. @blueedgesolutions-tom (#11330) and @bmcswee (#8580), could you test commit b2331c425a56bcef095232bc531bb2afd219d5d6?

curl -fsSL https://raw.githubusercontent.com/davidguilherme/omarchy/b2331c425a56bcef095232bc531bb2afd219d5d6/etc/modprobe.d/omarchy-amdgpu-hdmi-hpd.conf | sudo tee /etc/modprobe.d/omarchy-amdgpu-hdmi-hpd.conf
sudo limine-mkinitcpio
# reboot, then this should print 1500:
cat /sys/module/amdgpu/parameters/hdmi_hpd_debounce_delay_ms

Then lock, leave it for a few minutes, and say whether the display stays dark. To undo it, delete the file and run sudo limine-mkinitcpio again.

For the maintainer:

This is waiting on a reporter's confirmation, then on the maintainer.

@greptile-apps

greptile-apps Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 3/5

[High risk] Kernel module configuration and initramfs rebuild on system boot.

Fix the migration's completion checks before merging so users do not permanently skip the required rebuild.

Findings

  1. P1 Skipped builds look complete ▶
  2. P1 Missing config never retries ▶

Summary

Enables a 1500 ms AMD HDMI hotplug filter and adds a one-time boot image rebuild for existing AMD installs. Adds shell tests for hardware scoping, completion markers, failures, and reboot requests.

  • Completion needs a check that the rebuilt image actually contains the config.
  • A missing config currently marks the migration complete instead of leaving it pending.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Run migration] --> B{Command and config present?}
  B -- No --> C[Exit successfully]
  B -- Yes --> D{Machine marker exists?}
  D -- Yes --> C
  D -- No --> E{AMD display controller?}
  E -- No --> C
  E -- Yes --> F[Rebuild boot images]
  F -- Successful return --> G[Set reboot flag]
  G --> H[Write machine marker]
  H --> C
  C --> I[Runner writes user completion marker]
Loading

Reviews (1) · Last reviewed commit: "Flag the reboot before recording the reb..."

Comment thread migrations/1790200214.sh
Comment on lines +37 to +39
sudo limine-mkinitcpio
omarchy-state set reboot-required
sudo install -Dm644 /dev/null "$rebuild_marker" No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Skipped builds look complete

limine-mkinitcpio can return zero after skipping a failed build, as the existing kernel migration documents and checks. This migration immediately writes the completion marker instead. If the AMD boot image build is skipped, the old image remains, the screen-wake fix stays inactive, and future runs skip the repair.

Check that the rebuilt image contains the new drop-in before writing the marker, and add a test for a skipped build that returns zero.

Comment thread migrations/1790200214.sh

omarchy-cmd-present limine-mkinitcpio || exit 0
conf="${OMARCHY_AMDGPU_HPD_CONF:-/etc/modprobe.d/omarchy-amdgpu-hdmi-hpd.conf}"
[[ -f $conf ]] || exit 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Missing config never retries

If a dev checkout receives this migration before the settings package receives the drop-in, this exit 0 makes omarchy-migrate record it as complete for that user. Installing the config later will not retry the rebuild, so the fix can remain inactive.

Return a failure when this temporary prerequisite is missing. Test the retry through omarchy-migrate; checking only the machine-wide marker does not show that the migration stays pending.

@omarchybot

Copy link
Copy Markdown
Collaborator

Greptile's two findings on migrations/1790200214.sh are accurate as descriptions, but neither needs a change. I checked both against the source, Claude Opus 5.5 and Codex Medium. Codex, asked without my conclusion, reached the same one; it can read this session's notes, so that agreement isn't fully independent.

  • A silently skipped rebuild still writes the marker (line 39). It's true that limine-mkinitcpio can return 0 after a build it skipped. If that happens, this migration won't run again, but the drop-in is still in /etc/modprobe.d, and modconf adds it to the next image that builds. Kernel, firmware and mkinitcpio updates all rebuild the initramfs through the pacman hook. The sibling rebuild migrations, 1786482992.sh and 1786605598.sh, also accept the exit status as it comes. 1789325478.sh checks a boot entry, but only because a missing entry for a new kernel can leave the machine unbootable. A missed debounce is not in that class.
  • A missing drop-in exits 0 and is recorded as done (line 14). That is true for the user running it. But omarchy-update installs packages before it runs migrations, so the file is there on a normal update. If it isn't, the same next rebuild picks it up. Making the migration fail would block every migration after it over an optional mitigation. 1786482992.sh and 1786605598.sh use the same guard.

Still waiting on the hardware test requested above, at b2331c425a56bcef095232bc531bb2afd219d5d6. @Chulii confirmed the same option line working on an AMD + HDMI machine at the earlier head, under the old file name. A confirmation at this commit is what would let it be marked verified. After that it goes to the maintainer.

@davidguilherme

Copy link
Copy Markdown
Author

Confirmed at b2331c42 on AMD + HDMI hardware of my own (tested with the very problem class from #11330/#8580):

  • Applied the drop-in under its new Omarchy-owned name (/etc/modprobe.d/omarchy-amdgpu-hdmi-hpd.conf), removed the old amdgpu.conf, ran limine-mkinitcpio, rebooted.
  • /sys/module/amdgpu/parameters/hdmi_hpd_debounce_delay_ms reads 1500 after boot.
  • Behavioral check: DPMS-off with output in power save, watched the HDMI connector for 45s — it stayed connected with no disconnect/re-add at the ~15s mark and no relight. This is the exact loop the migration is meant to prevent.

The fix at this head works as described.

@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for testing at b2331c42, @davidguilherme. The readback of 1500 and an HDMI connector that stayed connected through the ~15s mark are what the fix should produce. For hardware a worker can't run, though, the verified label needs a confirmation from someone who opened one of the issues this fixes, or from a maintainer, and never from the pull request's own author. Your result is useful evidence for the maintainer, but it can't stand in for that confirmation.

I checked this against the PR and the four linked issues, Claude Opus 5.5 with Codex Medium as a second opinion. Codex independently reached the same reading of the rule. It couldn't reach GitHub during its run, so the activity check is mine alone. The head hasn't moved since the last review, so the earlier findings stand: the worker suite result, the Greptile notes, and the two maintainer questions (whether the debounce should be on by default, and whether #10778 and #8863 should be "Refs" rather than "Fixes").

This still waits on @blueedgesolutions-tom (#11330) or @bmcswee (#8580) testing b2331c425a56bcef095232bc531bb2afd219d5d6 with the steps above, or on the maintainer deciding without it.

@arnoudja

Copy link
Copy Markdown

Verified on AMD + HDMI hardware (Radeon RX 470/480/570-class, ASUS XG32UCG on HDMI-A-1, Limine/limine-mkinitcpio).

Applied the drop-in at b2331c42 under /etc/modprobe.d/omarchy-amdgpu-hdmi-hpd.conf, rebuilt initramfs, rebooted. Local userspace DPMS workaround was disabled for a clean test (stock omarchy-hyprland-monitor-watch only).

  • /sys/module/amdgpu/parameters/hdmi_hpd_debounce_delay_ms reads 1500 after boot (was 0 before).
  • Lock + DPMS blank: HDMI-A-1 stayed connected for the full watch (~2.5 min); no disconnect/reconnect at the ~15s mark, no DRM HPD/hotplug journal noise.
  • Screen stayed dark until woken intentionally — no blank→relight loop.

Matches the intended fix. Thanks.

@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for testing, @arnoudja. That's a second AMD + HDMI machine, and the first from someone other than the author, where the parameter reads 1500 after boot and the connector stays connected through DPMS blanking with no relight. I'll pass it to the maintainer as corroboration.

It doesn't change the verified label. For hardware a worker can't run, that needs a confirmation from someone who opened one of the linked issues, or from a maintainer, naming the full head commit. Claude Opus 5.5 checked this against the rule, and Codex Medium, given the rule and your comment, came to the same answer. It can read this session's notes, so that agreement isn't fully independent.

The head hasn't moved, so the earlier review stands. This still waits on @blueedgesolutions-tom (#11330), @bmcswee (#8580), @kellylipke (#10778) or @pablo-io (#8863) testing b2331c425a56bcef095232bc531bb2afd219d5d6 with the steps above, or on the maintainer deciding without it.

@kstaikov

Copy link
Copy Markdown

I tested this approach on an AMD box over the last few days and want to flag one serious outcome before it ships to every AMD user by default: with the debounce on, amdgpu deadlocked once, with the compositor stuck in D state until a forced reboot.

Setup: Omarchy 4.0.6, kernel 7.2.8-9-omarchy, Hyprland 0.56.2, Ryzen 9 9950X with the integrated Radeon 610M (Granite Ridge, DCN 3.1.5), MSI MAG B850M Mortar WiFi (HDMI is the board's only output), Dell U3224KB at 6144x3456@60 over HDMI 2.1 FRL. Debounce set to 4000 ms via /etc/modprobe.d plus limine-mkinitcpio, exactly as this PR does with 1500 ms.

What worked: the debounce does what the PR says. With it set, the locked session stopped removing and re-adding the output every ~40 s; the Hyprland log went from hundreds of Connector HDMI-A-1 disconnected lines per day to zero.

What went wrong:

  1. Wake got much slower. Before the debounce, the relight loop was keeping the monitor's HDMI input warm, so wake was instant. With the output genuinely off for a few minutes, the first wake needs HDMI 2.1 link training, which fails on this sink (amdgpu: enabling link 0 failed: 19) and the monitor does not answer on DDC for ~40 s. The kernel does not retry; only further key presses from the user trigger new attempts. This is AMD issue https://gitlab.freedesktop.org/drm/amd/-/issues/5709, and on this box it took 35–50 s per wake. It will not affect monitors that train quickly, but the PR description's "stays connected through DPMS blanking" testing would not surface it unless the tester waits several minutes before waking.

  2. Deadlock. During one of those failed wakes I unplugged and re-plugged the HDMI cable. The next atomic commit from Hyprland never returned:

    task:Hyprland  state:D
     cancel_delayed_work_sync
     amdgpu_dm_atomic_commit_tail [amdgpu]
     drm_atomic_helper_commit
     drm_mode_atomic_ioctl
    Workqueue: events hdmi_hpd_debounce_work [amdgpu]   -> blocked on a mutex owned by Hyprland
    Workqueue: events_highpri dm_irq_work_func [amdgpu] -> blocked on a mutex owned by the debounce work
    Workqueue: hdmi_frl_status_polling_work [amdgpu]    -> blocked on a mutex owned by Hyprland
    

    The commit holds dc_lock and waits for the debounce work to cancel; the debounce work holds the connector's hpd_lock and waits for dc_lock. The monitor's own input scan can produce the same HPD pulse without anyone touching the cable. Filed upstream as https://gitlab.freedesktop.org/drm/amd/-/issues/6030; AMD's https://gitlab.freedesktop.org/drm/amd/-/issues/5902 already describes the same debounce + same-sink HPD pulse combination on FRL sinks.

This is kernel 7.2's brand new HDMI FRL code interacting with the debounce, so it may not reproduce on older GPUs or non-FRL (HDMI 2.0) monitors. But Omarchy ships 7.2 and FRL is on by default in it (dcfeaturemask includes DC_FRL_MASK), so the combination is the default for anyone with an HDMI 2.1 monitor on a current AMD GPU.

Suggestions:

  • Do not enable this by default until the AMD side is fixed, or at least gate it behind an opt-in (omarchy toggle …) with the risk documented.
  • If it does go in, 1500 ms will filter fewer drops than it looks: this Dell takes 1–4 s to reassert HPD after a DPMS off, so I needed 4000 ms for the loop to stop at all.

For what it is worth, the approach that has worked for me without touching the driver is to not DPMS the affected monitor at all and put it to sleep over DDC/CI instead (ddcutil setvcp D6 04 / 01), which keeps the HDMI link trained: no HPD drop, no loop, instant wake, 6K@60 preserved across a 7-hour lock. I have written that up on #13812 and would be happy to turn it into a PR against omarchy-brightness-display if there is interest.

Prepared with the help of Claude (Anthropic's AI assistant) from this machine's logs; reviewed and posted by me.

@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for the long test and the traces, @kstaikov. I checked the deadlock against the amdgpu sources. The cycle in your trace runs through HDMI FRL status polling, not through the debounce. amdgpu_dm_commit_streams takes dc_lock and, when no FRL stream is left, calls cancel_delayed_work_sync(&dm->hdmi_frl_status_polling_work) while still holding it. In 7.2 and 7.3-rc6, hdmi_frl_status_polling_work takes dc_lock with a blocking mutex_lock before it retrains, so a poll that starts retraining just as the FRL stream goes away deadlocks against the commit. hdmi_hpd_debounce_work (holding hpd_lock, waiting for dc_lock) and dm_irq_work_func (waiting for hpd_lock) are stuck behind it, but neither is part of the cycle. AMD fixed it in drm-next with 3e6272b40c8f ("Serialize HDMI FRL status polling against link detect"), which makes the poll take the lock with mutex_trylock. That commit is not in 7.3-rc6. So the hang can happen on any FRL sink that loses its stream while a retrain is pending. The debounce may make that timing more likely on your monitor, but it doesn't create the lock cycle. The slow wake is a separate problem: AMD's 5709 is about FRL link training, and this pull request doesn't touch training. Your report still matters for the default. On an HDMI 2.1 monitor that needs 1–4 s to bring HPD back, 1500 ms doesn't stop the loop, and keeping the output really off is what exposes the slow first wake.

#16457 fixes the same loop a different way: an opt-in toggle that sleeps the monitor over DDC/CI so the link never drops. That makes them competing fixes, and choosing between them is the maintainer's call. Codex, asked which should win without my answer, picked #16457 because of the 1500 ms window and the wake. I'd weigh it differently. #16457 is off by default and needs DDC/CI enabled on the monitor, so on its own it changes nothing for anyone who doesn't find the toggle, while this one applies to every AMD install with no setup. Both views are with the maintainer.

Nothing else changed: the head is still b2331c425a56bcef095232bc531bb2afd219d5d6, and the earlier findings still stand. Claude Opus 5.5 read the kernel sources (master, v7.3-rc6 and 3e6272b40c8f). Codex Medium, given the same files and not my conclusion, traced the same lock cycle and cited the lines; it can read this session's notes, so its independence is not guaranteed. This waits on the maintainer: whether the debounce should be on by default given this report, which of this and #16457 to take, and still a confirmation at that head from @blueedgesolutions-tom (#11330), @bmcswee (#8580), or the maintainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working compatibility Make Omarchy work better on everything!

Projects

None yet

5 participants