I noticed that when using the framebuffer display with wayland on weston or plasma-mobile, the red and blue colors are swapped.
The problem has been found in the following devices, all sharing the MSM8974 SoC:
oneplus-bacon, reported by @Nimayer
samsung-klte, reported by @minlexx
fairphone-fp2, reported by @z3ntu
Edit: The problem has been solved
Apparently the problem was due to an inverted byte order of the pixel format in the framebuffer driver.
Administratorchanged title from framebuffer: red and blue are swapped on devices using MSM8974AC to framebuffer: red and blue are swapped on devices using MSM8974·
Imported
changed title from framebuffer: red and blue are swapped on devices using MSM8974AC to framebuffer: red and blue are swapped on devices using MSM8974
I figured out the framebuffer color problem and managed to solve it on oneplus-bacon,
and I think the same fix can be applied also to samsung-klte and fairphone-fp2, with a small change.
I will open soon a MR for oneplus-bacon which I tested myself and for other two phones which will need testing.
TL:DR: the bytes of the framebuffer pixel format are in reverse order
Where R,G,B are red, green and blue channels and A is alpha (transparency)
Assuming that instead the oneplus-bacon framebuffer format is RGBA but in reverse order
hardware RGBA: | R | G | B | A |
k. driver RGBA: | A | B | G | R |
We can see that the stock kernel driver provides images where A corresponds to R on hardware (possible source of red screen problem)
The original fix i pushed for oneplus-bacon red screen problem was the first one suggested on display troubleshooting,
which is using the format RGB instead of RGBA.
Which works but with swapped B and G.
hardware RGBA: | R | G | B | A |
k. driver RGB: | B | G | R | |
The RGB solution probably displays correct image because there is padding corresponding to the hardware alpha channel,
but as we can see R and B are swapped in driver w.r.t hardware.
Solution
Apply a patch equivalent to the alternative patch proposed in display troubleshooting which inverts the order of bytes in the framebuffer driver.
Once the order is inverted, oneplus-bacon works fine with RGBA color setting,
while samsung-klte and fairphone-fp2 that did not have the red screen problem,
probably need the patch and ARGB color setting.
samsung-klte example:
hardware ARGB: | A | R | G | B |
k. driver RGBA: | A | B | G | R | |
Which explains why stock kernel results in R and B being swapped.
Merge requests
As I said, I will open MR for oneplus-bacon, samsung-klte and fairphone-fp2