Display flickering on Pocket Reform (related to Mesa 25.0.0?)

I’ve been experiencing inconsistent (but sometimes constant) flickering and small visual glitches on my Pocket Reform on a311d over the last few days. Looking at my apt logs I think it might be related to upgrading on 2/23, when a bunch of Mesa-related packages upgraded to 25.0.0-1 from 24.3.4-3:

  • libglx-mesa0
  • libgbm1
  • mesa-libgallium
  • libgl1-mesa-dri
  • libegl1-mesa-dev
  • libegl-mesa0

It doesn’t happen on the virtual terminal on Pocket Reform, and does happen on external displays, so I do think it’s a software issue.

Does anyone have advice to confirm whether this is related to that upgrade? I’m not sure if there’s a good way to downgrade a handful of specific packages on Debian unstable, or how I would narrow search terms down enough to search for related bugs.

1 Like

I agree that this sounds like mesa. I can come up with two reasonable ways to make sure that it is indeed mesa:

  1. downgrade the mesa packages. This might be a bit tricky because you have to downgrade all packages at the same time as they all depend on each other. But the old version is still in testing, so it’s relatively easy to acquire the old version safely. Also, the involved library packages do not have maintainer scripts (except for libgl1-mesa-dri with an rm_conffile one-liner) so it should not break things to try such a downgrade.
  2. download the a311d system image from six days ago which should still contain the old version of mesa. Confirm that the flickering issues are not there and then only upgrade mesa. If it starts flickering then it’s mesa.

I do not have any specific advice and I do not see any existing bugs.

Do you have some way to reliably trigger it? I just upgraded the five mesa packages from 24.3.4-3 to 25.0.0-1 and cannot immediately see the effect. A reliable reproducer would also be really important when bisecting mesa to find the offending commit.

Can you explain how to try this? I naively tried

sudo apt-get install mesa-libgallium=24.3.4-3
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package mesa-libgallium is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Version '24.3.4-3' for 'mesa-libgallium' was not found

It always shows up within a minute or so during normal usage. It seems to be more frequent when playing video, either in Firefox or VLC, although interestingly is less frequent when watching video in fullscreen.

This seems easy enough, thank you!

You have to make version 24.3.4-3 available to apt. When you run this:

apt-cache policy mesa-libgallium

Then you probably only will see version 25.0.0-1. This means that apt cannot install version 24.3.4-3 at all.

This is another indicator for what I said above. To make the old version available, you have to add repositories to your sources.list which contain the package version you want. In this case, Debian testing still has the working version. To add testing you can create a that is for example called /etc/apt/sources.list.d/debian-testing.sources with the following contents:

Types: deb
URIs: http://deb.debian.org/debian/
Suites: testing
Components: main
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Then you run sudo apt update and then you should be able to downgrade using this command line:

sudo apt install libegl-mesa0=24.3.4-3 libgbm1=24.3.4-3 libgl1-mesa-dri=24.3.4-3 libglx-mesa0=24.3.4-3 mesa-libgallium=24.3.4-3

Thank you! This is really helpful, I haven’t used debian much outside of the pocket reform so my mental model for how these channels (releases?) work is a little wrong. I added the testing source and ran
sudo apt install libglx-mesa0=24.3.4-3 libgbm1=24.3.4-3 mesa-libgallium=24.3.4-3 libgl1-mesa-dri=24.3.4-3 libegl1-mesa-dev=24.3.4-3 libegl-mesa0=24.3.4-3 and yes, the flickering is gone.

1 Like

Nice, then this is indeed mesa. It would be great if you could come up with a way to more reliably trigger this flickering effect. If you have some time, maybe make a video showing how it looks like? If you want, I can submit a bug report to Debian mesa for you. I can also do the investigation myself but only after Thursday (I have an important deadline to meet until then).

@deianara and @josch thank you, I was having the same issue. I could reproduce with firefox in sway. Downgrading fixed the issue.

I’ll try and get to it but I’m sort of busy this week too – maybe someone who’s currently experiencing this can get a video in the meantime, or I’ll get to it in the coming weeks.

I opened a bug here to maybe prevent transition of broken mesa to testing: #1099032 - Flickering on BananaPI CM4 with Arm Mali-G52 - Debian Bug report logs

2 Likes

@deianara @Savasten I am investigating this issue today. How sure are you that the flickering is really gone after downgrading? I am on an otherwise upgraded system and am using mesa packages 24.3.4-3 from testing but am still observing occasional flicker when watching youtube in firefox. Maybe my test setup is wrong, so I’d like to have confirmation that after downgrading mesa the problem is really permanently gone for you?

It was extremely noticeable, even distracting, on 25.0.0-1, and I haven’t noticed it at all after using it pretty extensively today. I think I might have been understating how frequent and annoying it was before — it was very frequent and very annoying.

(Of course there might be other confounding factors, idk!)

I just followed these downgrade instructions on a Pocket Reform at the MNT office and it successfully fixed the display stuttering! The stuttering was most noticeable if the screen was displaying a lot of white space at full brightness. And always stuttered when running wev and moving the cursor around.

2 Likes

I upgraded back to 25.0.0-1 ( sudo apt install libglx-mesa0=25.0.0-1 libgbm1=25.0.0-1 mesa-libgallium=25.0.0-1 libgl1-mesa-dri=25.0.0-1 libegl1-mesa-dev=25.0.0-1 lib egl-mesa0=25.0.0-1) and restarted and immediately started experiencing the flickering again. Here’s a short video:

https://imgur.com/a/iHmbML2

Focusing on the screen correctly was difficult (and I think the image host re-encoding it has made it less dramatic?) but you can clearly see the flicker at several points in this video. It happens often with playing videos, on both firefox and vlc. Moving the mouse seems to trigger it as well, as @wakest says. I watched this video several times and it flickered often every time.

Downgrading back to 24.3.4-3 (sudo apt install libglx-mesa0=24.3.4-3 libgbm1=24.3.4-3 mesa-libgallium=24.3.4-3 libgl1-mesa-dri=24.3.4-3 libegl1-mesa-dev=24.3.4-3 libegl-mesa0=24.3.4-3) again and restarting totally eliminated the flicker. I carefully watched the video again and didn’t see it once, and I haven’t noticed it at all in my normal usage on 24.3.4-3.

Thank you for filing a bug, @josch!

1 Like

Okay, I see the flickering effect too but only very seldom. I have to pay a lot of attention and it happens maybe once or twice per minute when watching a video on youtube without having it in fullscreen mode. This makes the issue very hard to track down.

Maybe somebody with a more reliable flicker effect can do the bisection? Essentially, you clone upstream mesa git, build it like this:

$ meson setup build
$ ninja -C build/

And then you run sway with the libs you built like this:

$ meson devenv -C build/ sway

I essenitally spent the whole day making this work but I barely get any flickering on classic reform…

EDIT: okay, i get about one flicker per minute… maybe that’s enough to track this down. I just started the second bisection step. 11 more to go… each build takes 2 hours…

2 Likes

I will try to find some time to take a stab at it. You’re on a full sized reform yeah? I wonder if something about the pocket reform display, like the odd refresh rate, makes it more flicker prone with this bug…

Yes. Other names are “big reform” or “original reform” but lukas calls it “classic reform” so that’s what I was using as well in my post above.

Tell me how your bisecting goes. I have the impression that the effect is more noticable after a fresh reboot. I now reboot on every bisection step just to make sure…

1 Like

Ended up with free time today :slightly_smiling_face: git bisect says it’s e0f48568c7f2a638213dee317fde03c23775556f. I’m not totally confident in my work so here’s my git bisect log:

# bad: [4fa244fddfebb21378042556862e197284ef65ac] VERSION: bump for 25.0.0
# good: [769e51468b49b2a42f0a0eaf71cf9eed5ff4e5de] VERSION: bump for 24.3.4
git bisect start 'mesa-25.0.0' 'mesa-24.3.4'
# good: [879ec4270d07b51d14ab20fa0b72816b7dd664a3] panvk: fix dummy sampler handle for vs
git bisect good 879ec4270d07b51d14ab20fa0b72816b7dd664a3
# bad: [419879ee6292506c79a3f1342161663cac77b33c] ir3,freedreno: remove binning outputs after vs ucp lowering
git bisect bad 419879ee6292506c79a3f1342161663cac77b33c
# bad: [f3272f0044c67fb1caf41c07d884d9d9910cf1ea] radv: add new start/stop sqtt helpers for capturing with SQTT
git bisect bad f3272f0044c67fb1caf41c07d884d9d9910cf1ea
# good: [6bd21e4a062e796361c8585a6cd7c68ffa4bedea] frontends/va: Check if target buffer is supported in EndPicture
git bisect good 6bd21e4a062e796361c8585a6cd7c68ffa4bedea
# good: [4c8ff06449397685a3e7f084cb4e3693ccf82300] ci/pipeline_message: add unit tests for tool
git bisect good 4c8ff06449397685a3e7f084cb4e3693ccf82300
# bad: [0ae8e69810ed0449ada45c8288cb0395e989b439] pan/cs: Add cs_exception_handler_ctx
git bisect bad 0ae8e69810ed0449ada45c8288cb0395e989b439
# good: [4af57952b126bf399c1063e83dbe305b3d4db013] panfrost: Add support for AFBC(split)
git bisect good 4af57952b126bf399c1063e83dbe305b3d4db013
# bad: [dcf380d1b6d57e84c67b9d94872cea2e1e0e2f0b] docs: update GL_OES_shader_image_atomic support
git bisect bad dcf380d1b6d57e84c67b9d94872cea2e1e0e2f0b
# bad: [9838024547b355d6abb05e4415106925881a5a94] r300: always transform sin/cos input for fs
git bisect bad 9838024547b355d6abb05e4415106925881a5a94
# bad: [5de990f5a94f357f6efd6950f166c2742b4442e8] aco: add SSA repair pass
git bisect bad 5de990f5a94f357f6efd6950f166c2742b4442e8
# bad: [5c3a757ba6fe05d3db7536cbce020d0e6b62573f] radv: add a pipeline helper to skip shaders cache
git bisect bad 5c3a757ba6fe05d3db7536cbce020d0e6b62573f
# bad: [3f646d43dd21809e95a9f862ebe17733fbece72a] radv: fix dumping debug/perftest options when there are holes
git bisect bad 3f646d43dd21809e95a9f862ebe17733fbece72a
# bad: [e0f48568c7f2a638213dee317fde03c23775556f] panfrost: Advertise support for AFBC(32x8,sparse,split)
git bisect bad e0f48568c7f2a638213dee317fde03c23775556f
# first bad commit: [e0f48568c7f2a638213dee317fde03c23775556f] panfrost: Advertise support for AFBC(32x8,sparse,split)

(I did not reboot at any point here but did see clear differences between good and bad commits).

Edit: double-checked my work: e0f485 does indeed flicker, and its parent, 4af579 does not.

4 Likes

Awesome work, thank you! Can you try if reverting that commit on top of 25.0.0 leaves the display fixed? This might be the correct revert: Debian Pastezone

If yes, then we can patch mesa in the MNT repos until this issue is fixed.

Thank you!! :heart:

1 Like