From nobody Wed Dec 17 04:21:18 2025 Received: from exactco.de (exactco.de [176.9.10.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A61A359FB3 for ; Fri, 5 Dec 2025 17:24:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=176.9.10.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764955448; cv=none; b=CLJwPEW5luZAvuJv9iDQaSdbqQEtxBkmZSsGbEo4Ysu7aKsSHhiXbSKSxe0bkt06rz/Fh9f0efV56K9evz9s6EoG708vh2SMU2dxh7U38ZOMqKPNGrl3ftZ/bGx802GlRRhUCcW15wPubx4aWNwEDr0QbvHU33xQRGiG1yfQlmA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764955448; c=relaxed/simple; bh=cXz+lX9gkTv1tgG+ZgQvCyasEOGwariL2OLS2uafaJo=; h=Date:Message-Id:To:Cc:Subject:From:Mime-Version:Content-Type; b=LO08/wARS+AH1LZjAYnK/zeb4axaATrypNqRjwykHdO/XDW8SpR4DLlDSST/t+h7xRH8TPGnwbnrJ+AKyAlbPQcMDSiY/pflv9XB18sP5Stcla5BuTI0lT6ezCJGNROmamy6nsFXedttdMIKuZWc1B6z4cgZoLjZZ+QvOJ1eL44= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=exactco.de; spf=pass smtp.mailfrom=exactco.de; dkim=pass (2048-bit key) header.d=exactco.de header.i=@exactco.de header.b=n7RwLtDg; arc=none smtp.client-ip=176.9.10.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=exactco.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=exactco.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=exactco.de header.i=@exactco.de header.b="n7RwLtDg" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=exactco.de; s=x; h=Content-Transfer-Encoding:Content-Type:Mime-Version:From:Subject:Cc:To :Message-Id:Date:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=Zwc3elfcrN1cbQtiss8FPA3Ap7/mji/PJcXvgIZpJWA=; b=n 7RwLtDgmiyPu1/bH07DQg1bC/24RpULJXJ2zMFrj4XFXQP9zYFgeuWwv+kRw9bfjT8hGHwUUv0WYO qC4fI879gwqdPe2KUtmb3AMsRbt25mCukLd8+1TDKxldmqhUHHqR1TFgqI1DXjEnQRiY/EFa7rn4i rPx+ZytBS81eCfziNVzCXVS37/EqW8qElWczuhO5vfA3DahuSNu0YOfVhZZy497vz2l/GEfaCPOCc dwZhNiaFsRn8JldsDzdSSVFi4li3Y4ZrcXBL3LBT4HEsjY85vGNh217HRfY/6W6xsRzOZlbST20At qMTmKUvW2ISX5J+e+vlYgLbK1K+g3+JEQ==; Date: Fri, 05 Dec 2025 18:24:05 +0100 (CET) Message-Id: <20251205.182405.876575799174263183.rene@exactco.de> To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Dave Airlie , Thomas Zimmermann Subject: [PATCH V2] drm/mgag200: Fix big-endian support From: =?iso-8859-1?Q?Ren=E9?= Rebe X-Mailer: Mew version 6.10 on Emacs 30.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=C3=A9 Rebe 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/mgag2= 00/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; =20 +#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); --=20 2.52.0 --=20 Ren=C3=A9 Rebe, ExactCODE GmbH, Berlin, Germany https://exactco.de =E2=80=A2 https://t2linux.com =E2=80=A2 https://patreon.= com/renerebe