Skip to content

Ignore DDC buses of displays ddcutil reports as invalid - #14397

Open
myblu-admin wants to merge 2 commits into
omacom:quattrofrom
myblu-admin:fix/ddc-skip-invalid-display
Open

myblu-admin wants to merge 2 commits into
omacom:quattrofrom
myblu-admin:fix/ddc-skip-invalid-display

Conversation

@myblu-admin

Copy link
Copy Markdown

Problem

omarchy-brightness-display-ddc takes ~21s per call on a monitor that has an I2C bus but does not speak DDC/CI (here: an LG TV on DVI-D-1). Because omarchy-monitor-state calls it on every refresh, the Display panel's DISPLAYS list stays stale for ~20s after enabling or disabling a monitor, and the panel's 5s poll keeps ddcutil busy the whole time it is open (766 ddcutil EIO lines in the journal in 15 minutes).

Why

ddcutil --skip-ddc-checks detect --brief lists such a monitor as Invalid display but still prints its I2C bus:

Invalid display
   I2C bus:          /dev/i2c-2
   DRM connector:    card1-DVI-D-1
   drm_connector_id: 0
   Monitor:          GSM:LG TV:

detect_bus does not look at the block header, so it harvests bus 2. read_vcp on that bus then fails after ~6s of EIO retries, and the failure path deletes the cache file (deliberately, so transient failures are retried), so the next call repeats the ~9s detect as well.

Measured on Omarchy 4.0.4-1, Hyprland 0.56.2, ddcutil 2.2.7, i9-9900K + RTX 2060 SUPER:

1st call 2nd call
current 21.5s 21.5s
this PR 15.5s (one detect) 0.00s (unavailable cache)

Fix

Only a block headed Display N yields a bus. Blocks headed Invalid display (or Phantom display) fall through to the existing 60s unavailable cache, the same path as a monitor ddcutil does not list at all. The transient-read-failure behaviour for valid displays is unchanged.

Test

test/shell.d/brightness-display-test.sh gains a case where the ddcutil mock emits an Invalid display block ahead of the valid one. It checks that the invalid monitor gets no backend, that its bus is never probed with getvcp, and that the result is cached (one detect across two calls). The case fails on quattro and passes with this change; the rest of the file and ./test/cli pass.

🤖 Generated with Claude Code

ddcutil detect lists monitors it could not talk to over DDC as "Invalid
display" and still prints their I2C bus. omarchy-brightness-display-ddc
harvested that bus, so every brightness read on such a monitor (e.g. an LG
TV on DVI) ran a VCP read that failed only after ~6s of EIO retries, and
the failure path deleted the cache, so the next read repeated the ~9s
detect as well. omarchy-monitor-state, which the Display panel runs on
every refresh, took ~21s per call as a result.

Only a block headed "Display N" now yields a bus; invalid displays fall
through to the existing 60s unavailable cache.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Filters invalid DDC buses from display detection.

The PR appears safe to merge.

Summary

The PR ignores buses from invalid or phantom display blocks and uses the existing 60-second unavailable cache.

  • Valid display blocks still provide a bus.
  • New tests cover both orders of valid and invalid blocks with fresh caches.
  • The previous coverage finding is fully addressed. No new actionable issues were found.

Reviews (2) · Last reviewed commit: "Cover both orders of valid and invalid D..." · Reviewed by Greptile

Comment thread test/shell.d/brightness-display-test.sh Resolved
The first test listed the invalid display ahead of the valid one, which
passes even if the parser never resets "usable" on a non-Display header.
Add the reverse order, and check that a valid display listed after an
invalid one is still usable.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@omarchybot omarchybot added bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Oct 16, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed, nothing found to change.

What was checked: ddcutil's own report code (ddc_display_ref_reports.c) prints Invalid display, Phantom display, Busy display, Removed display and DDC_disabled as unindented block headers, with the I2C bus: and DRM connector: fields indented beneath them. So the new ^Display [0-9]+ / ^[^[:space:]] rules in detect_bus accept a usable display's bus and drop every other block's, in either order. A valid display after an invalid one still resolves, and an invalid one after a valid one doesn't inherit usable.

Where it ran: on a disposable Omarchy worker, against this head merged with current quattro. test/shell.d/brightness-display-test.sh passes (17/17), and with only the bin/omarchy-brightness-display-ddc change reverted it fails on "invalid DDC display has no brightness backend". ./test/cli and the other brightness and monitor-state tests pass. Your timings weren't reproduced, since that needs the monitor itself.

Second opinion: Codex Medium reviewed the diff and found no defects. Independence isn't guaranteed, because it can read this session's notes. It pointed out one limit that's worth stating rather than fixing here: --skip-ddc-checks marks communication as working, so a monitor that doesn't answer VCP but is still listed as Display N isn't covered by this change. That case is what #14525 handles.

Related: #14525 caches a failed getvcp read instead of deleting the cache. The two are complementary, neither makes the other redundant, and they merge without a textual conflict.

This is now waiting on the maintainer.

@omarchybot

Copy link
Copy Markdown
Collaborator

Checked again now that #14525 has merged, and this is still needed.

Why it still matters: #14525 caches a failed getvcp read, but detect_bus on quattro still takes the I2C bus from an Invalid display block. So a monitor like your LG TV still gets one detect plus a slow failed getvcp on its bus every 60 seconds while the Display panel is open. With this change, that block yields no bus, the monitor goes straight to the unavailable cache after detect, and getvcp is never sent to it. The two changes touch different functions and merge cleanly.

Where it ran: on a disposable Omarchy worker, against this head merged with current quattro (dfdf0b0e, which includes #14525). test/shell.d/brightness-display-test.sh passes (20/20). With only bin/omarchy-brightness-display-ddc reverted to quattro, it fails on "invalid DDC display has no brightness backend". ./test/cli and the other brightness and monitor-state tests pass.

Second opinion: Codex Medium and muse-wonder (pi, thinking high) were each asked whether #14525 makes this redundant. Both found it is not and found no defect in the change against current quattro. They agreed with reasoning I had already written down, and their independence isn't guaranteed.

Nothing was pushed. This is waiting on 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 ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants