fix(HDMI): Prevent HDMI CEC from powering on display at boot - #2939
jessica12ryan wants to merge 9 commits into
Conversation
|
Need to have a bit of a deep dive on this before I merge... see the new checkbox in simple video but that only displays in simple media mode not "advanced (full pipewire)"... also need to think about pipewire knock on effect if an hdmi is in the output chain for video or audio does this create any issues |
|
No worries... I did verify that it works as intended on simple. I've not really played around with pipewire advanced so I wasn't sure how to implement it there or if it has a function or variant that performs the same. |
|
Thanks for digging into #2938 — the managed-block code itself is well done, and the leapfrog handling is exactly right. But I think the underlying mechanism needs re-checking before this can go in, and there are a couple of concrete bugs. Details below. 1.
|
|
I think it is wrong on number one, as mentioned. It worked on a RPi Zero 2 W. Pi was turning on display at boot, solved the issue - and turning on and off enabled/disabled the behaviour. In most of the concerns, it mentions Pi5... would there be any difference between a Zero 2 W and Pi5 using this setting? I've fixed the concrete bugs and moved it to settings-system. I'm not sure how else to really proceed with it. I don't have a Pi5 available to test it on, but maybe that should be done. |
|
You're right and I was wrong on point 1 — thanks for pushing back, and apologies for the noise. Retracting it, with the detail below, because the answer to your Pi Zero 2 W vs Pi 5 question turns out to be the useful part. Point 1: withdrawn for Pi 0–4I over-generalised from a Pi 5 to every Pi. My point 2 evidence actually supports your diagnosis rather than undermining it: nothing in FPP userspace claims a CEC logical address, so on a Pi ≤4 the boot-time Point 1, narrowed: it is a genuine no-op on Pi 5To answer your question directly — yes, there's a real difference, and it's checkable. On a Pi 5 the firmware doesn't parse the key at all: (Firmware Practical consequence: with "variants": { "Raspberry Pi": ["!Pi 5"] }@wraslore-hub offered to test on a Pi 5 in #2938 — worth taking them up on it. If a Pi 5 turns out to wake the projector too, that's a separate kernel-side problem and a separate fix; this PR shouldn't try to cover it. Fixed — thanks
Still openThe HDMI audio interaction (my point 4) is the one thing I'd still want tested, and it's now the main risk, because the fix working is what triggers it. If the projector stays in standby through boot and drops HPD, then Most projectors hold HPD asserted in standby, so this may well never fire. The test is small: on your Zero 2 W with the toggle on, set audio output to HDMI, cold boot with the display in standby, then check whether Minor, take or leave: Sorry again for the wrong call on the main point — the Pi 5 gate is the only thing I'd now consider blocking, and it's one line. |
…t is no-op on KMS/RP1)
|
Gate added for Pi 5... It just needs to be tested to ensure audio is preserved at boot when the setting is checked. I'm unable to test... it should probably also be tested on a Pi 3B+ and another Pi (other than the Pi 5 - gated), as it is noted "hdmi_force_hotplug=1 is inside a [pi02] filter in SD/FPP_Install.sh, so a Pi 3B+ doesn't get forced HPD to protect it." |
|
My main concern is the default. This is scoped as a projector fix, but plenty of people drive an ordinary TV off a Pi for a VirtualMatrix or for mp4 playback, and I think defaulting to 1 regresses that case. The way I read it:
That's the same power-outage scenario this PR is motivated by, inverted. Today: power returns, Pi boots, TV comes on, show is visible. With the default flipped: power returns, Pi boots, TV stays dark, and nobody's there to notice. That's a legitimate choice for someone with a projector, but it shouldn't be made silently for everyone else — including FPP 9 upgraders, where fkms sent that broadcast and this has been the behaviour for years. Two things that compound it:
Could we make this "default": 0 / opt-in? That also drops migrateHDMICECDefault(), the setSetting half of upgrade/144, the config.txt pre-seed, and the whole first-boot-reboot question — the PR shrinks to the setting, the managed block, and the PHP case, which is a much smaller thing to land. Two smaller items while you're in there:
Also worth saying in the description/tip that enabling this means a CEC TV will no longer wake or switch inputs when FPP boots — "Prevent HDMI CEC At Boot" reads as harmless housekeeping rather than as giving up display-on-boot. |
|
This is now ready to go with the suggested changes implemented. Changes:
|
fix(HDMI): Prevent HDMI CEC from powering on display at boot
Summary
FPP 10 (Trixie, kernel 6.18
vc4-kms-v3d) wakes CEC-capable projectors/TVs ~5s after power-on, before the web UI is up. The Pi's firmware +vc4-hdmi-cecsends a CECActive Source/Image View Onon every HDMI modeset. Withhdmi_force_hotplug=1(SD/FPP_Install.sh:1176) andgetty@tty1enabled atSD/FPP_Install.sh:1296, a display that was in standby (e.g. Epson L210SF) powers on after any power loss — even though FPP 9.x did not.This PR adds an Advanced-level UI toggle (on by default, opt-out) that suppresses only the initial boot broadcast. The CEC plugin can still power the display on/off on demand. Fresh + upgraded (never-saved) →
1viaupgrade/144+src/boot/FPPINIT_Config.cpp:1000migrateHDMICECDefault(); explicit0stays off.Issue
Root cause
dtoverlay=vc4-kms-v3d,cma-256(SD/FPP_Install.sh:1111) moves Pi fromvc4-fkms-v3dto full KMS.src/framebuffer/KMSFrameBuffer.cpp:183/src/framebuffer/FrameBuffer.cpp:260(KMSFrameBuffer::EnableDisplay()atsrc/framebuffer/KMSFrameBuffer.cpp:767viadrmModeSetCrtc/SetPlane) plus earlygetty@tty1drive HDMI and the kernelvc4-hdmi-cecemitsActive Sourceby default.hdmi_ignore_cec*handling existed (grep 0 hitsacrosssrc/ SD/ scripts/ www/), andSD/FPP_Install.sh:1112intentionally kepthdmi_force_hotplug=1for 6.18 KMS.Changes
Additive only, no breaking changes, no renames/removals. Toggle defaults on → fresh installs get checked (
www/settings.json:1631default:"1"); existing installs with no key get1viaupgrade/144+src/boot/FPPINIT_Config.cpp:1000migrateHDMICECDefault()on nextupgrade_config//fppos_upgradedboot; explicit0stays0(opt-out preserved).www/settings.json:181,1620— New settingDisableHDMICECInitinsimplePipeWireVideogroup:level:1= Advanced UI.default:"1"= on by default.reboot:1prompts reboot via existing UI banner.src/boot/FPPINIT_Config.cpp:1333fallback also1so fresh/missing settings default on;upgrade/144+src/boot/FPPINIT_Config.cpp:1000migrateHDMICECDefault()pins never-saved →1on upgrade/FPPOS, explicit0stays0.www/common/settings.php:437— Newcase 'DisableHDMICECInit'delegating tosudo …/src/fppinit setupHDMICEC(same delegation pattern asDisablePiRTCatwww/common/settings.php:430).src/boot/FPPINIT.h:97— DeclaredsetupHDMICECConfig(bool rebootIfChanged=true).src/boot/FPPINIT_Config.cpp:1268— Managed blockHDMI_CEC_BLOCK_BEGIN/END+applyDisableHDMICECBlock()+setupHDMICECConfig(), mirroringapplyDisablePiRTCBlockatsrc/boot/FPPINIT_Config.cpp:1184(strip every prior copy including truncated, remember first insertion point, insert ahead ofCAPE_VARIANT_BLOCK_BEGINatsrc/boot/FPPINIT_Config.cpp:1170to avoid leapfrog withsetupChannelOutputs()'s DPI block). Desired block when enabled:Uses
hdmi_ignore_cec_init=1(boot-only) nothdmi_ignore_cec=1(would disable all CEC and break plugin).src/boot/FPPINIT.cpp:244,286,479— WiredsetupHDMICECintoteeOutputfacility,startboot path (setupHDMICECConfig()aftersetupPiRTCConfig()atsrc/boot/FPPINIT.cpp:280withrebootIfChanged=true), andsetupHDMICECaction handler withrebootIfChanged=false(UI path never auto-reboots).SD/FPP_Install.sh:1112/1176/1296intentionally untouched — image ships without the line; reconciled on first boot per toggle.Behavior
1viaupgrade/144/src/boot/FPPINIT_Config.cpp:1000) →fppinit setupHDMICECwrites managed block[all]\nhdmi_ignore_cec_init=1on next boot → after reboot firmware skips initialActive Source;cec-ctl --monitorproves (tested on L210SF).0preserved) →fppinit setupHDMICECremoves managed block → UI shows reboot banner (viareboot:1) → wake at boot restored.Testing
php -l www/common/settings.phpclean,python3 -m json.tool www/settings.jsonvalidg++ -DPLATFORM_PI -c src/boot/FPPINIT_Config.cppcompiles; no new warningsapplyDisableHDMICECBlock: fresh→enable, idempotent enable, disable→remove, cape-variant insertion ahead, truncatedBEGINw/oENDstrip, verifieshdmi_ignore_cec_initvshdmi_ignore_cecpolarityRisk
Low. Additive setting, managed block is idempotent, insertion respects
CAPE_VARIANT_BLOCK_BEGINordering to prevent reboot-loop leapfrog noted atsrc/boot/FPPINIT_Config.cpp:1170. No changes tohdmi_force_hotplug,getty@tty1, KMS modeset, or public plugin headers (fpp-pch.h/Plugin.h).Checklist
default:"1",migrateHDMICECDefault),reboot:1, explicit0preservedhdmi_ignore_cec_init(boot-only) preserves CEC pluginScreenshot
Additional Comments
This PR provides a resolution for issue #2938.
After merging, please mark #2938 as "Fix Applied - Testing Required".