Imx8mp with custom image: display output is wrong until i start and stop sway

i am installing gentoo. with the reform kernel patchset build from the great buildscript from Niklaus Hofer / Mnt Reform Gentoo Overlay · GitLab

I have the official mnt image on eMMC, and my own install is on microSD, so i can switch between them easy. I have tried the pocket imx8mp dtb built from the above patchset, and also the appropriately-versioned dtb from the official mnt image, copied onto mine. Since we are on the same kernel version.

mostly working so far, except, when I boot up, what should be the top of the screen is in the middle of the screen. and then it wraps around so the bottom of the screen comes at the top.

Because this panel is rotated sideways, it is easier to think about it like this: basically however it is scanning out the pixels, it is scanning out the data offset slightly from where it should be starting from.

this offset also is making the pixels be shifted a color channel over. Red → Green. Green → Blue. Blue → Red.

A picture will make this easier to understand:

here is htop. see how the bottom hotkey list is above the top of the htop window. see how the things which should be teal, instead are pink. the thing which should be green, instead is blue.

It stays like this, until I

  • start sway (sway is broken like this too)
  • stop sway

When I start sway it is still broken. But when I exit, the console is fixed! And sway will work right too if i start it a second time.

It is not broken like this on the official image. If i reboot into that image everything works fine. reboot into mine and it’s like this again.

Here is what I know from kernel so far:

There is a message

panel-mnt-pocket-reform 32e60000.dsi.0: [display] init in enable...

On the official image what happens is

  • this message prints out early in boot
  • couple seconds later it prints out again

On my busted image, instead

  • this message prints out once in boot
  • it never prints out again, UNTIL after i CLOSE sway. I checked, it is not print it while sway is running the first time, only after I close it

So it seems like when transitioning from sway back to the console, something is causing the dsi output to re-initialize a second time, and this is fixing things

But what I don’t understand is why on the official image, it does the second initialization automatically during boot.

from linux/patches6.12/imx8mp-mnt-pocket-reform/pocket-panel/0001-v5-add-multi-display-panel-driver.patch

that pretty clearly explains why the colors are wrapped/shifted, and why i see two inits. but it still doesnt explain why this hack is successfully forcing immediate re-init on mnt’s build, but not my own…

the kernel is different in some way, it’s true. mine is fedora base + gentoo config (doesnt change much from fedora) + mnt patches & config. official is based on the debian kernel (unsure if debian maintain their own config or are downstream from anyone)

i suppose the quick and dirty fix for my machine specifically would be to add another patch to this patch that removes this hack, also removes the dcs register read, and hard codes the panel version (or maybe makes it a device tree config).

You could try using the mnt kernel with your image, just to see if the kernel triggers it, or if userspace also interferes.