-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
6.10.0
-
None
-
Debian sid
On a big-endian ppc64 host with llvmpipe providing OpenGL software rendering support, all Qt applications show incorrect colors (see attached). Note that only Qt applications are affected; all other applications tested (including mesa test applications such as glxgears and the OpenGL xscreensavers) operate normally.
This appears to be the result of a clarification at some point to the OpenGL specification for 8888 formats [1], which now states the format is host endian agnostic. Qt on the other hand tries to swap the channels, causing the problem.
Changing QImage::rgbSwapped_inplace() from
*p = ((c << 16) & 0xff000000) | ((c >> 16) & 0xff00) | (c & 0x00ff00ff);
to
*p = ((c << 24) & 0xff000000) | ((c >> 8) & 0x00ff0000) | ((c >> 8) & 0x0000ff00) | ((c >> 8) & 0x000000ff);
resolves the color issue entirely. This effectively treats the outgoing OpenGL buffer as ARGB instead of BGRA, per the updated OpenGL format specifications.
Note this only affects OpenGL visuals; passing a standard X11 visual to the Qt application or disabling the X11 glx extension results in normal colors both with and without this patch.