From: Thomas Zimmermann <tzimmermann@suse.de>
To: "René Rebe" <rene@exactco.de>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: Dave Airlie <airlied@redhat.com>
Subject: Re: [PATCH V3] drm/mgag200: Fix big-endian support
Date: Mon, 8 Dec 2025 14:21:05 +0100 [thread overview]
Message-ID: <d81983aa-05ae-43d6-82c8-d1b80cdff0a6@suse.de> (raw)
In-Reply-To: <20251208.141827.965103015954471168.rene@exactco.de>
Hi
Am 08.12.25 um 14:18 schrieb René Rebe:
> 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
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Thanks again for the patch. I'll get it into upstream ASAP
Best regards
Thomas
> ---
> V3: move to func, mask prev reg content
> V2: move to atomic_update
> V3 was only compile tested, while V1/2 were tested on IBM 43p w/ T2/Linux.
> ---
> drivers/gpu/drm/mgag200/mgag200_mode.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
> index 951d715dea30..191037ce1029 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_mode.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
> @@ -161,6 +161,29 @@ static void mgag200_set_startadd(struct mga_device *mdev,
> WREG_ECRT(0x00, crtcext0);
> }
>
> +/*
> + * Set the opmode for the hardware swapper for Big-Endian processor
> + * support for the frame buffer aperture and DMAWIN space.
> + */
> +static void mgag200_set_datasiz(struct mga_device *mdev, u32 format)
> +{
> +#if __BIG_ENDIAN
> + u32 opmode = RREG32(MGAREG_OPMODE);
> + opmode &= ~(GENMASK(17, 16) | GENMASK(9, 8) | GENMASK(3, 2));
> +
> + /* Big-endian byte-swapping */
> + switch (format) {
> + case DRM_FORMAT_RGB565:
> + opmode |= 0x10100;
> + break;
> + case DRM_FORMAT_XRGB8888:
> + opmode |= 0x20200;
> + break;
> + }
> + WREG32(MGAREG_OPMODE, opmode);
> +#endif
> +}
> +
> void mgag200_init_registers(struct mga_device *mdev)
> {
> u8 crtc11, misc;
> @@ -496,6 +519,7 @@ void mgag200_primary_plane_helper_atomic_update(struct drm_plane *plane,
> struct drm_atomic_helper_damage_iter iter;
> struct drm_rect damage;
>
> + mgag200_set_datasiz(mdev, fb->format->format);
> 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);
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
prev parent reply other threads:[~2025-12-08 13:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-08 13:18 René Rebe
2025-12-08 13:21 ` Thomas Zimmermann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d81983aa-05ae-43d6-82c8-d1b80cdff0a6@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rene@exactco.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®