From: Arun Iyengar <[email protected]>

vop2_find_start_mixer_id_for_vp() looks for the first layer that holds a
window of the video port, but for_each_set_bit() takes the number of bits
to search, and ROCKCHIP_VOP2_ESMART3 is the highest window id, so Esmart3
is never found. A video port whose bottom layer shows Esmart3 then starts
its alpha setup at the mixer of a higher layer, or, if Esmart3 is its
only window, past all layers, and programs 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")
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 ccbfbdb8d246..290990632388 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h
@@ -857,6 +857,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 83203d18865b..088c1f3a972f 100644
--- a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
+++ b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
@@ -1889,7 +1889,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