* [PATCH v3 1/8] drm/rockchip: vop2: Take the UV plane address from the second GEM object
2026-11-13 16:39 [PATCH v3 0/8] drm/rockchip: vop2: RK3588 clocking, sync polarity and window fixes Arun Iyengar via B4 Relay
@ 2026-11-13 16:39 ` Arun Iyengar via B4 Relay
2026-11-13 16:39 ` [PATCH v3 2/8] drm/rockchip: vop2: Don't use uninitialised dividers on RK3588 Arun Iyengar via B4 Relay
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-13 16:39 UTC (permalink / raw)
To: Sandy Huang, Heiko Stübner, Andy Yan, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Sascha Hauer
Cc: Piotr Zalewski, Chaoyi Chen, Damon Ding, dri-devel,
linux-rockchip, linux-arm-kernel, linux-kernel, Arun Iyengar,
stable
From: Arun Iyengar <aiyengar1990@gmail.com>
vop2_plane_atomic_update() takes the chroma plane address from
fb->obj[0]. The planes of a framebuffer can be in different GEM objects
(ADDFB2 with two handles, e.g. NV12M from a V4L2 decoder), and the
window then fetches the chroma plane from the luma buffer.
Use fb->obj[1] for formats with more than one plane.
Fixes: 604be85547ce ("drm/rockchip: Add VOP2 driver")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/sashiko-outbox-206550@kernel.org/
Cc: stable@vger.kernel.org
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index 76d151b8bc52..e8ef83d6924b 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -1369,7 +1369,8 @@ static void vop2_plane_atomic_update(struct drm_plane *plane,
if ((pstate->rotation & DRM_MODE_REFLECT_Y) && !afbc_en)
offset += fb->pitches[1] * ((pstate->src_h >> 16) - 2) / vsub;
- rk_obj = to_rockchip_obj(fb->obj[0]);
+ if (fb->format->num_planes > 1)
+ rk_obj = to_rockchip_obj(fb->obj[1]);
uv_mst = rk_obj->dma_addr + offset + fb->offsets[1];
}
--
2.55.0
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v3 2/8] drm/rockchip: vop2: Don't use uninitialised dividers on RK3588
2026-11-13 16:39 [PATCH v3 0/8] drm/rockchip: vop2: RK3588 clocking, sync polarity and window fixes Arun Iyengar via B4 Relay
2026-11-13 16:39 ` [PATCH v3 1/8] drm/rockchip: vop2: Take the UV plane address from the second GEM object Arun Iyengar via B4 Relay
@ 2026-11-13 16:39 ` Arun Iyengar via B4 Relay
2026-11-13 16:39 ` [PATCH v3 3/8] drm/rockchip: vop2: Fix the HDMI sync polarity " Arun Iyengar via B4 Relay
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-13 16:39 UTC (permalink / raw)
To: Sandy Huang, Heiko Stübner, Andy Yan, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Sascha Hauer
Cc: Piotr Zalewski, Chaoyi Chen, Damon Ding, dri-devel,
linux-rockchip, linux-arm-kernel, linux-kernel, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
rk3588_calc_cru_cfg() converts all four dividers with ilog2(), but every
interface only sets the ones it uses: dclk_out_div is left uninitialised
for HDMI, eDP and DPI, if_dclk_div for DP, MIPI and DPI, and
if_pixclk_div for DP and DPI. For HDMI and eDP the uninitialised
dclk_out_div is then written to RK3588_VP_CLK_CTRL.
Set the dividers an interface doesn't use to 1.
Fixes: 5a028e8f062f ("drm/rockchip: vop2: Add support for rk3588")
Suggested-by: Damon Ding <damon.ding@rock-chips.com>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
index c44648e1bc0d..f340aba5bfd1 100644
--- a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
+++ b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
@@ -1597,6 +1597,7 @@ static unsigned long rk3588_calc_cru_cfg(struct vop2_video_port *vp, int id,
*/
*if_pixclk_div = 2;
*if_dclk_div = 4;
+ *dclk_out_div = 1;
} else if (vop2_output_if_is_edp(id)) {
/*
* edp_pixclk = edp_dclk > dclk_core
@@ -1609,6 +1610,7 @@ static unsigned long rk3588_calc_cru_cfg(struct vop2_video_port *vp, int id,
*/
*if_pixclk_div = K;
*if_dclk_div = K;
+ *dclk_out_div = 1;
} else if (vop2_output_if_is_dp(id)) {
if (output_mode == ROCKCHIP_OUT_MODE_YUV420)
dclk_out_rate = v_pixclk >> 3;
@@ -1622,6 +1624,8 @@ static unsigned long rk3588_calc_cru_cfg(struct vop2_video_port *vp, int id,
return 0;
}
*dclk_out_div = dclk_rate / dclk_out_rate;
+ *if_pixclk_div = 1;
+ *if_dclk_div = 1;
} else if (vop2_output_if_is_mipi(id)) {
if_pixclk_rate = dclk_core_rate / K;
/*
@@ -1643,8 +1647,12 @@ static unsigned long rk3588_calc_cru_cfg(struct vop2_video_port *vp, int id,
* mipi pixclk == dclk_out
*/
*if_pixclk_div = 1;
+ *if_dclk_div = 1;
} else if (vop2_output_if_is_dpi(id)) {
dclk_rate = v_pixclk;
+ *dclk_out_div = 1;
+ *if_pixclk_div = 1;
+ *if_dclk_div = 1;
}
*dclk_core_div = dclk_rate / dclk_core_rate;
--
2.55.0
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v3 3/8] drm/rockchip: vop2: Fix the HDMI sync polarity on RK3588
2026-11-13 16:39 [PATCH v3 0/8] drm/rockchip: vop2: RK3588 clocking, sync polarity and window fixes Arun Iyengar via B4 Relay
2026-11-13 16:39 ` [PATCH v3 1/8] drm/rockchip: vop2: Take the UV plane address from the second GEM object Arun Iyengar via B4 Relay
2026-11-13 16:39 ` [PATCH v3 2/8] drm/rockchip: vop2: Don't use uninitialised dividers on RK3588 Arun Iyengar via B4 Relay
@ 2026-11-13 16:39 ` Arun Iyengar via B4 Relay
2026-11-13 16:39 ` [PATCH v3 4/8] drm/rockchip: vop2: Fix the HDMI sync polarity bit order " Arun Iyengar via B4 Relay
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-13 16:39 UTC (permalink / raw)
To: Sandy Huang, Heiko Stübner, Andy Yan, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Sascha Hauer
Cc: Piotr Zalewski, Chaoyi Chen, Damon Ding, dri-devel,
linux-rockchip, linux-arm-kernel, linux-kernel, Arun Iyengar,
Cristian Ciocaltea
From: Arun Iyengar <aiyengar1990@gmail.com>
rk3588_get_hdmi_pol() is passed the POLFLAG bits of the mode but tests
them as DRM mode flags, so the HDMI sync polarity bits in GRF_VO1_CON0
come out wrong: +HSync/+VSync modes get one of them set and
-HSync/-VSync modes none.
The bits are set for a negative sync. Test the POLFLAG bits instead.
Fixes: 5a028e8f062f ("drm/rockchip: vop2: Add support for rk3588")
Reviewed-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
Reviewed-by: Damon Ding <damon.ding@rock-chips.com>
Cc: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
index f340aba5bfd1..3e654cb99ddf 100644
--- a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
+++ b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
@@ -1683,12 +1683,13 @@ static u32 rk3588_get_mipi_port_mux(int vp_id)
return 0;
}
-static u32 rk3588_get_hdmi_pol(u32 flags)
+/* The sync polarity bits in GRF_VO1_CON0 are set for a negative sync */
+static u32 rk3588_get_hdmi_pol(u32 polflags)
{
u32 val;
- val = (flags & DRM_MODE_FLAG_NHSYNC) ? BIT(HSYNC_POSITIVE) : 0;
- val |= (flags & DRM_MODE_FLAG_NVSYNC) ? BIT(VSYNC_POSITIVE) : 0;
+ val = (polflags & BIT(HSYNC_POSITIVE)) ? 0 : BIT(HSYNC_POSITIVE);
+ val |= (polflags & BIT(VSYNC_POSITIVE)) ? 0 : BIT(VSYNC_POSITIVE);
return val;
}
--
2.55.0
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v3 4/8] drm/rockchip: vop2: Fix the HDMI sync polarity bit order on RK3588
2026-11-13 16:39 [PATCH v3 0/8] drm/rockchip: vop2: RK3588 clocking, sync polarity and window fixes Arun Iyengar via B4 Relay
` (2 preceding siblings ...)
2026-11-13 16:39 ` [PATCH v3 3/8] drm/rockchip: vop2: Fix the HDMI sync polarity " Arun Iyengar via B4 Relay
@ 2026-11-13 16:39 ` Arun Iyengar via B4 Relay
2026-11-13 16:39 ` [PATCH v3 5/8] drm/rockchip: vop2: Only accept AFBC YTR for 8 bit RGB " Arun Iyengar via B4 Relay
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-13 16:39 UTC (permalink / raw)
To: Sandy Huang, Heiko Stübner, Andy Yan, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Sascha Hauer
Cc: Piotr Zalewski, Chaoyi Chen, Damon Ding, dri-devel,
linux-rockchip, linux-arm-kernel, linux-kernel, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
In GRF_VO1_CON0 the HDMI vsync polarity bit comes before the hsync one
(bits 5 and 6 for HDMI0, 7 and 8 for HDMI1), but rk3588_get_hdmi_pol()
puts hsync first. Modes with mixed sync polarities go out with both
syncs inverted: the HDMI controller sees 1920x1080@144 +HSync -VSync
as -HSync +VSync in VIDEO_INTERFACE_STATUS0.
Fixes: 5a028e8f062f ("drm/rockchip: vop2: Add support for rk3588")
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
index 3e654cb99ddf..6d08988d7007 100644
--- a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
+++ b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
@@ -1683,13 +1683,13 @@ static u32 rk3588_get_mipi_port_mux(int vp_id)
return 0;
}
-/* The sync polarity bits in GRF_VO1_CON0 are set for a negative sync */
+/* GRF_VO1_CON0: vsync bit below the hsync bit, each set for a negative sync */
static u32 rk3588_get_hdmi_pol(u32 polflags)
{
u32 val;
- val = (polflags & BIT(HSYNC_POSITIVE)) ? 0 : BIT(HSYNC_POSITIVE);
- val |= (polflags & BIT(VSYNC_POSITIVE)) ? 0 : BIT(VSYNC_POSITIVE);
+ val = (polflags & BIT(VSYNC_POSITIVE)) ? 0 : BIT(0);
+ val |= (polflags & BIT(HSYNC_POSITIVE)) ? 0 : BIT(1);
return val;
}
--
2.55.0
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v3 5/8] drm/rockchip: vop2: Only accept AFBC YTR for 8 bit RGB on RK3588
2026-11-13 16:39 [PATCH v3 0/8] drm/rockchip: vop2: RK3588 clocking, sync polarity and window fixes Arun Iyengar via B4 Relay
` (3 preceding siblings ...)
2026-11-13 16:39 ` [PATCH v3 4/8] drm/rockchip: vop2: Fix the HDMI sync polarity bit order " Arun Iyengar via B4 Relay
@ 2026-11-13 16:39 ` Arun Iyengar via B4 Relay
2026-11-13 16:39 ` [PATCH v3 6/8] drm/rockchip: vop2: Find the first mixer of a video port with Esmart3 too Arun Iyengar via B4 Relay
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-13 16:39 UTC (permalink / raw)
To: Sandy Huang, Heiko Stübner, Andy Yan, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Sascha Hauer
Cc: Piotr Zalewski, Chaoyi Chen, Damon Ding, dri-devel,
linux-rockchip, linux-arm-kernel, linux-kernel, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
According to the TRM, the AFBC decoder of the RK3588 Cluster windows
supports the lossless colour transform (YTR) only for the 8 bit RGB
formats. An RGB565 buffer with YTR gives a black picture and
POST_BUF_EMPTY, while the same buffer without YTR displays fine.
Don't accept YTR for any other format on RK3588.
Fixes: 5a028e8f062f ("drm/rockchip: vop2: Add support for rk3588")
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index e8ef83d6924b..de3da292b05a 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -404,6 +404,11 @@ static bool rockchip_vop2_mod_supported(struct drm_plane *plane, u32 format,
if (vop2_convert_afbc_format(format) == VOP2_AFBC_FMT_INVALID)
return false;
+ if (vop2->version == VOP_VERSION_RK3588 && (modifier & AFBC_FORMAT_MOD_YTR) &&
+ vop2_convert_afbc_format(format) != VOP2_AFBC_FMT_ARGB8888 &&
+ vop2_convert_afbc_format(format) != VOP2_AFBC_FMT_RGB888)
+ return false;
+
/* Different windows have different format/modifier support */
for (i = 0; i < plane->modifier_count; i++) {
if (plane->modifiers[i] == modifier)
--
2.55.0
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v3 6/8] drm/rockchip: vop2: Find the first mixer of a video port with Esmart3 too
2026-11-13 16:39 [PATCH v3 0/8] drm/rockchip: vop2: RK3588 clocking, sync polarity and window fixes Arun Iyengar via B4 Relay
` (4 preceding siblings ...)
2026-11-13 16:39 ` [PATCH v3 5/8] drm/rockchip: vop2: Only accept AFBC YTR for 8 bit RGB " Arun Iyengar via B4 Relay
@ 2026-11-13 16:39 ` Arun Iyengar via B4 Relay
2026-11-13 16:39 ` [PATCH v3 7/8] drm/rockchip: vop2: Keep the other LUT_PORT_SEL fields on gamma LUT updates Arun Iyengar via B4 Relay
2026-11-13 16:39 ` [PATCH v3 8/8] drm/rockchip: vop2: Fix the AFBC offsets of a source that starts inside a superblock Arun Iyengar via B4 Relay
7 siblings, 0 replies; 9+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-13 16:39 UTC (permalink / raw)
To: Sandy Huang, Heiko Stübner, Andy Yan, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Sascha Hauer
Cc: Piotr Zalewski, Chaoyi Chen, Damon Ding, dri-devel,
linux-rockchip, linux-arm-kernel, linux-kernel, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
vop2_find_start_mixer_id_for_vp() passes ROCKCHIP_VOP2_ESMART3, the
highest window id, as the bit count to for_each_set_bit(), so Esmart3
is never found and a video port whose bottom layer is Esmart3 programs
the mixers of other video ports.
Add ROCKCHIP_VOP2_MAX_LAYER_ID after the last window id and search up to
it.
Fixes: d3fe9aa49585 ("drm/rockchip: vop2: Use OVL_LAYER_SEL configuration instead of use win_mask calculate used layers")
Reviewed-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
Reviewed-by: Damon Ding <damon.ding@rock-chips.com>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/gpu/drm/rockchip/rockchip_drm_vop2.h | 1 +
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h
index 1c2d7d97a6c2..87982fba7d45 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h
@@ -805,6 +805,7 @@ enum vop2_layer_phy_id {
ROCKCHIP_VOP2_CLUSTER3,
ROCKCHIP_VOP2_ESMART2,
ROCKCHIP_VOP2_ESMART3,
+ ROCKCHIP_VOP2_MAX_LAYER_ID,
ROCKCHIP_VOP2_PHY_ID_INVALID = -1,
};
diff --git a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
index 6d08988d7007..55e5dc8b02d8 100644
--- a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
+++ b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
@@ -1882,7 +1882,7 @@ static int vop2_find_start_mixer_id_for_vp(struct vop2_video_port *vp)
for (i = 0; i < 31; i += 4) {
match = false;
- for_each_set_bit(phys_id, &win_mask, ROCKCHIP_VOP2_ESMART3) {
+ for_each_set_bit(phys_id, &win_mask, ROCKCHIP_VOP2_MAX_LAYER_ID) {
win = vop2_find_win_by_phys_id(vop2, phys_id);
if (win->data->layer_sel_id[vp->id] == ((layer_sel >> i) & 0xf)) {
match = true;
--
2.55.0
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v3 7/8] drm/rockchip: vop2: Keep the other LUT_PORT_SEL fields on gamma LUT updates
2026-11-13 16:39 [PATCH v3 0/8] drm/rockchip: vop2: RK3588 clocking, sync polarity and window fixes Arun Iyengar via B4 Relay
` (5 preceding siblings ...)
2026-11-13 16:39 ` [PATCH v3 6/8] drm/rockchip: vop2: Find the first mixer of a video port with Esmart3 too Arun Iyengar via B4 Relay
@ 2026-11-13 16:39 ` Arun Iyengar via B4 Relay
2026-11-13 16:39 ` [PATCH v3 8/8] drm/rockchip: vop2: Fix the AFBC offsets of a source that starts inside a superblock Arun Iyengar via B4 Relay
7 siblings, 0 replies; 9+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-13 16:39 UTC (permalink / raw)
To: Sandy Huang, Heiko Stübner, Andy Yan, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Sascha Hauer
Cc: Piotr Zalewski, Chaoyi Chen, Damon Ding, dri-devel,
linux-rockchip, linux-arm-kernel, linux-kernel, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
On RK3588 the gamma LUT update writes the whole LUT_PORT_SEL register to
select the write port, which clears the dclk source selection of video
ports 0 and 2 and the VP0/VP1 merge enable held in the same register.
Only update the write select field.
Fixes: 4f537776340d ("rockchip/drm: vop2: add support for gamma LUT")
Reviewed-by: Chaoyi Chen <chaoyi.chen@rock-chips.com>
Reviewed-by: Damon Ding <damon.ding@rock-chips.com>
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index de3da292b05a..0c300279399a 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -1621,8 +1621,9 @@ static void vop2_crtc_atomic_set_gamma_seamless(struct vop2 *vop2,
struct vop2_video_port *vp,
struct drm_crtc *crtc)
{
- vop2_writel(vop2, RK3568_LUT_PORT_SEL,
- FIELD_PREP(RK3588_LUT_PORT_SEL__GAMMA_AHB_WRITE_SEL, vp->id));
+ regmap_update_bits(vop2->map, RK3568_LUT_PORT_SEL,
+ RK3588_LUT_PORT_SEL__GAMMA_AHB_WRITE_SEL,
+ FIELD_PREP(RK3588_LUT_PORT_SEL__GAMMA_AHB_WRITE_SEL, vp->id));
vop2_vp_dsp_lut_enable(vp);
vop2_crtc_write_gamma_lut(vop2, crtc);
vop2_vp_dsp_lut_update_enable(vp);
--
2.55.0
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v3 8/8] drm/rockchip: vop2: Fix the AFBC offsets of a source that starts inside a superblock
2026-11-13 16:39 [PATCH v3 0/8] drm/rockchip: vop2: RK3588 clocking, sync polarity and window fixes Arun Iyengar via B4 Relay
` (6 preceding siblings ...)
2026-11-13 16:39 ` [PATCH v3 7/8] drm/rockchip: vop2: Keep the other LUT_PORT_SEL fields on gamma LUT updates Arun Iyengar via B4 Relay
@ 2026-11-13 16:39 ` Arun Iyengar via B4 Relay
7 siblings, 0 replies; 9+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-13 16:39 UTC (permalink / raw)
To: Sandy Huang, Heiko Stübner, Andy Yan, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
Sascha Hauer
Cc: Piotr Zalewski, Chaoyi Chen, Damon Ding, dri-devel,
linux-rockchip, linux-arm-kernel, linux-kernel, Arun Iyengar
From: Arun Iyengar <aiyengar1990@gmail.com>
For an AFBC source that starts inside a superblock, AFBC_TILE_NUM misses
the first, partial superblock column, and the transform offset is the
whole x position (truncated to 8 bits) instead of the offset inside the
superblock.
Count the columns from the first one the source touches and take the x
offset modulo the superblock width, as the vendor kernel does.
Fixes: 604be85547ce ("drm/rockchip: Add VOP2 driver")
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
index 0c300279399a..fc36edfe79d8 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
@@ -431,7 +431,7 @@ static bool vop2_half_block_enable(struct drm_plane_state *pstate)
}
static u32 vop2_afbc_transform_offset(struct drm_plane_state *pstate,
- bool afbc_half_block_en)
+ bool afbc_half_block_en, u32 block_w)
{
struct drm_rect *src = &pstate->src;
struct drm_framebuffer *fb = pstate->fb;
@@ -479,7 +479,7 @@ static u32 vop2_afbc_transform_offset(struct drm_plane_state *pstate,
ty = act_yoffset;
break;
case DRM_MODE_REFLECT_Y:
- tx = act_xoffset;
+ tx = act_xoffset % block_w;
ty = bottom_crop_line_num - act_yoffset;
break;
case DRM_MODE_ROTATE_90:
@@ -491,7 +491,7 @@ static u32 vop2_afbc_transform_offset(struct drm_plane_state *pstate,
ty = vir_width - width - act_xoffset;
break;
case 0:
- tx = act_xoffset;
+ tx = act_xoffset % block_w;
ty = act_yoffset;
break;
}
@@ -1433,7 +1433,7 @@ static void vop2_plane_atomic_update(struct drm_plane *plane,
if (fb->modifier & AFBC_FORMAT_MOD_YTR)
afbc_format |= (1 << 4);
- afbc_tile_num = ALIGN(src_w, block_w) / block_w;
+ afbc_tile_num = ALIGN(src_w + (src->x1 >> 16) % block_w, block_w) / block_w;
/*
* AFBC pic_vir_width is count by pixel, this is different
@@ -1484,7 +1484,7 @@ static void vop2_plane_atomic_update(struct drm_plane *plane,
vop2_win_write(win, VOP2_WIN_AFBC_PLD_OFFSET, yrgb_mst);
}
- transform_offset = vop2_afbc_transform_offset(pstate, half_block_en);
+ transform_offset = vop2_afbc_transform_offset(pstate, half_block_en, block_w);
vop2_win_write(win, VOP2_WIN_AFBC_HDR_PTR, yrgb_mst);
vop2_win_write(win, VOP2_WIN_AFBC_PIC_SIZE, act_info);
vop2_win_write(win, VOP2_WIN_TRANSFORM_OFFSET, transform_offset);
--
2.55.0
^ permalink raw reply [flat|nested] 9+ messages in thread