Repository navigation
Description
Is this the right place for my bug report?
I'm not 100% certain that it is, but it's my best-effort-guess so far.
If the nature of the problem/workaround appears more relevant to the forum audience then please accept my apologies. I'm slightly reluctant to register for another online account to report a single problem (even one that can often be resolved easily), but can do if that would be preferable.
Describe the bug
Visual speckling can occur on an HDMI output when using one -- but only one -- of the two microHDMI ports on the RPi 400.
Workaround / solution
The workaround/fix -- when possible! -- is to connect the HDMI cable to the other microHDMI port, the one closer to the USB-C power supply.
To reproduce
- Connect the display output to the microHDMI output closest to the RPi 400 keyboard status LEDs (capslock, numlock, power).
- Boot into a desktop Linux environment (I'm using Debian Linux with LXDE, so nearish-to-but-admittedly-different-from RPiOS).
- Move the mouse cursor, particularly through the lower 40-ish or so pixels of the display.
Expected behaviour
No unexpected visual output should occur, and the display should continue to refresh as usual.
Actual behaviour
Visual speckling in dark blue and green occurs within the lower half of the output while the cursor is in motion.
System
- Which model of Raspberry Pi? RPi 400
- Which OS and version? Debian Linux (bookworm)
- Which firmware version? Is repeatable for both Debian's
1.20220830+ds-1and this repository's1.20230405 - Which kernel version?
6.1.0-8
Logs
Available on request.
Additional context
-
The system is running Linux kernel 6.1.0-8 from Debian's
linux-image-arm64version 6.1.25-1 package. -
The problem is also replicable using the latest '*.{elf,dat,bin}' files from this repository's version
1.20230405release. -
The devicetree 'compatible' entry for the gpu is:
$ cat /proc/device-tree/gpu/compatible
brcm,bcm2711-vc5
-
The vc4 video driver appears to initialize fine according to dmesg (I don't see any errors).
-
The vc4 driver is in use as a framebuffer device, I think.
$ dmesg --notime | grep -i vc4 | tail -n 2
[drm] Initialized vc4 0.0.0 20140616 for gpu on minor 1
vc4-drm gpu: [drm] fb0: vc4drmfb frame buffer device
-
I've attempted to use the 'config_hdmi_boost'[1] setting from the documentation to resolve the problem, since it mentions speckling (in fact, it's where I learned the term 'speckling') specifically, but this has not had any effect. The documentation there does mention that the option is ignored on RPi4, and it seems possible that that may also apply to RPi400.
-
Reducing the resolution of the desktop does not reduce or eliminate the speckling.
Thank you for any help.
Also reported to Debian at: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1035878
[1] - https://www.raspberrypi.com/documentation/computers/config_txt.html#config_hdmi_boost
Edit: add missing documentation footnote
Activity
pelwell commentedon May 10, 2023
[ Moved to our Linux repo, where I think it belongs if anywhere ]
Can you reproduce this on a current RPiOS image? https://www.raspberrypi.com/software/operating-systems/
pelwell commentedon May 10, 2023
Information about your monitor resolution might also be useful.
6by9 commentedon May 10, 2023
That sounds like the issue addressed with 013f247
You've said you've reproduced it with firmware from both Debian and our repo. Have you tested with kernels from both repos?
jayaddison commentedon May 10, 2023
Thanks @pelwell, @6by9!
In reply to the RPiOS repro question and also this one:
Not yet, no - but I will try that soon.
This was replicable at 1920x, 1280x, 720x and 640x resolutions, and with both 60hz and 59.xhz frequencies, with the static effect covering approximately the lower half of the display in each case.
popcornmix commentedon May 10, 2023
If it's not fixed with an updated RPiOS kernel, then a photo/video of the effect may be helpful.
jayaddison commentedon May 10, 2023
Good news: the issue is resolved when using kernel version 6.1.21-v8+ from the 2023-05-03 release. No more visual noise of this kind occurs when moving the mouse cursor around on any part of the screen.
Thank you all for the swift response! I'll close the GitHub issue, but let me know if any other details/follow-up would help.
6by9 commentedon May 10, 2023
The patch has been submitted upstream (https://patchwork.freedesktop.org/patch/520709/?series=113424&rev=1), but not merged.
@mripard would know for certain, but I seem to recall him saying that the upstream folk didn't like it as it implied something else wrong with the resource allocation/vblank handling in the driver.
mripard commentedon May 11, 2023
Hi,
So I talked with @danvet again about this today since I couldn't find the previous discussion we had.
There's two issues related to that bug, and the patch you mentioned above:
The legacy cursor API doesn't wait for vblank completion, and it doesn't work for us at all. A patch has been posted here, but hasn't been merged yet. We carried it downstream for a while now, and it's the one (mostly) fixing the bug you've discussed here.
We've have some similar issues with Kodi even with that patch, that eventually ended up with @popcornmix (re)merging the patch @6by9 just linked to in that PR. The bugs descriptions are in the PR.
This one is a bit more troublesome, since the hardware shouldn't use the KMS state by the time it's freed, and thus that last patch shouldn't make a difference. Yet, it does.
It can hint at multiple things, from the vc4 driver signaling vblank too early to the core losing track of something and getting vblank completion wrong eventually.
Discussing it further, it looks like we could try to detect if and what goes wrong by:
complete_all(&commit->flip_done)indrm_atomic_helper_setup_commitThis should be able to detect cases of freeing the state while it's active.
We can further refine this by adding:
programmed?) tovc4_crtc_statethat reports when the state has been programmed (set invc4_crtc_atomic_flush(probably?))checked?) tovc4_crtc_statethat reports that the dlist not being active anymore has been checked (set in the function we implemented above)vc4_crtc_destroy_statethat ifprogrammedis set,checkedis set as well. If not, then we complain too.That part will allow us to see if we're getting refcounting wrong and freeing the state before we're supposed to.
jayaddison commentedon Jun 9, 2023
@mripard possibly a silly question, but: is the fact that this only affects one of the two output ports on the device understandable and/or a clue about the cause?
mripard commentedon Jun 9, 2023
There's a couple of causes I can think of:
It's all theories, of course :)
jayaddison commentedon Jun 9, 2023
Ok, the puzzle continues, but good ideas. Thank you!
mripard commentedon Jun 9, 2023
Is it still a puzzle though? The underlying cause seems identified to me, and we have a couple of solutions to fix it?
jayaddison commentedon Jun 9, 2023
I think the problematic effects can be solved (for example, by the upgrade to one of the RPiOS kernels), but that doesn't necessarily mean that the cause was identified (and I took your message to mean that we have some theories but are not certain).
Sometimes I think that real challenge in software engineering is to make sure both are addressed, because otherwise we repeatedly/fractally iterate on fixes without reducing the size of the problem-space, but that's getting into philosophy probably.
mripard commentedon Jun 13, 2023
Wait, which kernel are we talking about here?
The cause of the corruption is pretty much identified, see the commit log of 013f247
All the code path that trigger that might not be, but we definitely know what's going on at the hardware level.
jayaddison commentedon Jun 13, 2023
Upgrading to kernel 6.1.21-v8+ from the
raspberrypi-kernel_1.20230405-1_arm64.debpackage resolved the speckling problem on my RPi 400.In more detail: I think that was distributed from raspberrypi/firmware@eb18fe0 , which references this repository's commit dbcb823 ... and that does include the fix from 013f247.
Ok, thanks. I should check the firmware settings on the device to confirm whether overscan is configured differently for each of the two HDMI ports. I haven't intentionally adjusted any settings, but it's possible that I did.
jayaddison commentedon Apr 29, 2025
For the record: I eventually found time to apply the fix from 013f247 in isolation against a recent Debian Linux 6.12.22 kernel source; only minimal conflict-resolution was required to rebase it.
I tested two builds of that kernel - one without the patch applied, and then one with it applied -- and confirmed that the speckling behaviour on the affected mini-HDMI port no longer occurred after the patch was applied.
With that testing complete, I've updated the Debian bugthread and provided the updated copy of the patch that I used there.