mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH V2] drm/mgag200: Fix big-endian support
@ 2025-12-05 17:24 René Rebe
  2025-12-08  8:29 ` Thomas Zimmermann
  0 siblings, 1 reply; 3+ messages in thread
From: René Rebe @ 2025-12-05 17:24 UTC (permalink / raw)
  To: dri-devel, linux-kernel; +Cc: Dave Airlie, Thomas Zimmermann

Unlike the original, deleted Matrox mga driver, the new mgag200 driver
has the XRGB frame-buffer byte 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 <rene@exactco.de>
Cc: stable@kernel.org
---
V2: move to atomic_update
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..d40434ec68ab 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -496,6 +496,20 @@ void mgag200_primary_plane_helper_atomic_update(struct drm_plane *plane,
 	struct drm_atomic_helper_damage_iter iter;
 	struct drm_rect damage;
 
+#ifdef __BIG_ENDIAN
+	/* Big-endian byte-swapping */
+	switch (fb->format->format) {
+	case DRM_FORMAT_RGB565:
+		WREG32(MGAREG_OPMODE, 0x10100);
+		break;
+	case DRM_FORMAT_XRGB8888:
+		WREG32(MGAREG_OPMODE, 0x20200);
+		break;
+	default:
+		break;
+	}
+#endif
+
 	drm_atomic_helper_damage_iter_init(&iter, old_plane_state, plane_state);
 	drm_atomic_for_each_plane_damage(&iter, &damage) {
 		mgag200_handle_damage(mdev, shadow_plane_state->data, fb, &damage);
-- 
2.52.0

-- 
René Rebe, ExactCODE GmbH, Berlin, Germany
https://exactco.dehttps://t2linux.comhttps://patreon.com/renerebe

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-12-08 12:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-05 17:24 [PATCH V2] drm/mgag200: Fix big-endian support René Rebe
2025-12-08  8:29 ` Thomas Zimmermann
2025-12-08 12:39   ` René Rebe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®