Unlike the original deleted Matrox mga driver, the new mgag200 driver
has the frame-buffer RGBX swapped on big-endian RISC systems. Fix by
enabling byte swapping "PowerPC" OPMODE for any __BIG_ENDIAN config.
Fixes: 414c45310625 ("mgag200: initial g200se driver (v2)")
Signed-off-by: René Rebe <[email protected]>
---
Tested on IBM 43p Model 150 (7043-150) running T2/Linux.
---
drivers/gpu/drm/mgag200/mgag200_mode.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c
b/drivers/gpu/drm/mgag200/mgag200_mode.c
index 951d715dea30..9073063f6473 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -655,6 +655,20 @@ void mgag200_crtc_helper_atomic_enable(struct drm_crtc
*crtc, struct drm_atomic_
else
mgag200_crtc_fill_gamma(mdev, format);
+#ifdef __BIG_ENDIAN
+ /* Big-endian byte-swapping */
+ switch (format->format) {
+ case DRM_FORMAT_RGB565:
+ WREG32(MGAREG_OPMODE, 1 << 16);
+ break;
+ case DRM_FORMAT_XRGB8888:
+ WREG32(MGAREG_OPMODE, 2 << 16);
+ break;
+ default:
+ break;
+ }
+#endif
+
mgag200_enable_display(mdev);
}
--
2.46.0
--
René Rebe, ExactCODE GmbH, Berlin, Germany
https://exactco.de • https://t2linux.com • https://patreon.com/renerebe