From: Guillaume La Roque <glaroque@baylibre.com>
To: Neil Armstrong <neil.armstrong@linaro.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>,
Kevin Hilman <khilman@baylibre.com>,
Jerome Brunet <jbrunet@baylibre.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: dri-devel@lists.freedesktop.org,
linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
Simona Vetter <simona.vetter@ffwll.ch>,
Guillaume La Roque <glaroque@baylibre.com>
Subject: [PATCH 4/8] drm/meson: parameterize the G12A OSD color matrix setup
Date: Mon, 30 Nov 2026 22:57:53 +0100 [thread overview]
Message-ID: <20261130-meson-g12a-osd2-v1-4-aa982300c20e@baylibre.com> (raw)
In-Reply-To: <20261130-meson-g12a-osd2-v1-0-aa982300c20e@baylibre.com>
The OSD wrap matrices have the same register layout at different bases.
Select the base by OSD index so both RGB planes can share the CSC setup.
Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
---
drivers/gpu/drm/meson/meson_viu.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/meson/meson_viu.c b/drivers/gpu/drm/meson/meson_viu.c
index 2716d970fe8c..eb6a6f44cb2d 100644
--- a/drivers/gpu/drm/meson/meson_viu.c
+++ b/drivers/gpu/drm/meson/meson_viu.c
@@ -78,32 +78,33 @@ static int eotf_bypass_coeff[EOTF_COEFF_SIZE] = {
EOTF_COEFF_RIGHTSHIFT /* right shift */
};
-static void meson_viu_set_g12a_osd1_matrix(struct meson_drm *priv,
- int *m, bool csc_on)
+static void meson_viu_set_g12a_osd_matrix(struct meson_drm *priv,
+ unsigned int index, int *m)
{
- /* VPP WRAP OSD1 matrix */
+ u32 offset = index * (VPP_WRAP_OSD2_MATRIX_COEF00_01 -
+ VPP_WRAP_OSD1_MATRIX_COEF00_01);
writel(((m[0] & 0xfff) << 16) | (m[1] & 0xfff),
- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_PRE_OFFSET0_1));
+ priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_PRE_OFFSET0_1 + offset));
writel(m[2] & 0xfff,
- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_PRE_OFFSET2));
+ priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_PRE_OFFSET2 + offset));
writel(((m[3] & 0x1fff) << 16) | (m[4] & 0x1fff),
- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF00_01));
+ priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF00_01 + offset));
writel(((m[5] & 0x1fff) << 16) | (m[6] & 0x1fff),
- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF02_10));
+ priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF02_10 + offset));
writel(((m[7] & 0x1fff) << 16) | (m[8] & 0x1fff),
- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF11_12));
+ priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF11_12 + offset));
writel(((m[9] & 0x1fff) << 16) | (m[10] & 0x1fff),
- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF20_21));
+ priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF20_21 + offset));
writel((m[11] & 0x1fff),
- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF22));
+ priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF22 + offset));
writel(((m[18] & 0xfff) << 16) | (m[19] & 0xfff),
- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_OFFSET0_1));
+ priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_OFFSET0_1 + offset));
writel(m[20] & 0xfff,
- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_OFFSET2));
+ priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_OFFSET2 + offset));
- writel_bits_relaxed(BIT(0), csc_on ? BIT(0) : 0,
- priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_EN_CTRL));
+ writel_bits_relaxed(BIT(0), BIT(0),
+ priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_EN_CTRL + offset));
}
static void meson_viu_set_osd_matrix(struct meson_drm *priv,
@@ -426,8 +427,7 @@ void meson_viu_init(struct meson_drm *priv)
meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXL))
meson_viu_load_matrix(priv);
else if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) {
- meson_viu_set_g12a_osd1_matrix(priv, RGB709_to_YUV709l_coeff,
- true);
+ meson_viu_set_g12a_osd_matrix(priv, 0, RGB709_to_YUV709l_coeff);
/* fix green/pink color distortion from vendor u-boot */
writel_bits_relaxed(OSD1_HDR2_CTRL_REG_ONLY_MAT |
OSD1_HDR2_CTRL_VDIN0_HDR2_TOP_EN, 0,
--
2.34.1
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2026-11-30 21:59 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 21:57 [PATCH 0/8] drm/meson: add a second RGB plane on G12A Guillaume La Roque
2026-11-30 21:57 ` [PATCH 1/8] drm/meson: honor framebuffer offsets for the primary plane Guillaume La Roque
2026-12-01 8:21 ` Neil Armstrong
2026-12-02 11:55 ` Guillaume La Roque
2026-11-30 21:57 ` [PATCH 2/8] drm/meson: isolate primary plane scaler setup Guillaume La Roque
2026-11-30 21:57 ` [PATCH 3/8] drm/meson: keep RGB scanout state per OSD Guillaume La Roque
2026-11-30 21:57 ` Guillaume La Roque [this message]
2026-12-01 8:28 ` [PATCH 4/8] drm/meson: parameterize the G12A OSD color matrix setup Neil Armstrong
2026-12-02 11:56 ` Guillaume La Roque
2026-11-30 21:57 ` [PATCH 5/8] drm/meson: handle primary plane zpos allocation failure Guillaume La Roque
2026-12-01 8:26 ` Neil Armstrong
2026-11-30 21:57 ` [PATCH 6/8] drm/meson: select RGB plane registers by OSD index Guillaume La Roque
2026-12-01 8:32 ` Neil Armstrong
2026-12-02 11:57 ` Guillaume La Roque
2026-11-30 21:57 ` [PATCH 7/8] drm/meson: serialize OSD state updates with the IRQ Guillaume La Roque
2026-11-30 22:14 ` sashiko-bot
2026-11-30 21:57 ` [PATCH 8/8] drm/meson: add a linear RGB overlay on G12A OSD2 Guillaume La Roque
2026-11-30 22:16 ` sashiko-bot
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=20261130-meson-g12a-osd2-v1-4-aa982300c20e@baylibre.com \
--to=glaroque@baylibre.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jbrunet@baylibre.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=martin.blumenstingl@googlemail.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=simona.vetter@ffwll.ch \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.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®