From: Arun Iyengar <[email protected]>

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 <[email protected]>
Reviewed-by: Damon Ding <[email protected]>
Signed-off-by: Arun Iyengar <[email protected]>
---
 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


Reply via email to