From 4b0af1a9d7bfe97a5e75b2b33155a68b9e50bf4c Mon Sep 17 00:00:00 2001 From: Andy Yan Date: Tue, 6 Apr 2021 11:00:06 +0800 Subject: [PATCH] drm/rockchip: vop2: skip fist frame when port_mux is changed we must make sure the port_mux configuration is take effet before configure a window that is moved from another VP. Change-Id: I4ca581292e08ef30cc4b6eb47aef02e678f38a66 Signed-off-by: Andy Yan --- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index b3cab2474795..a01247df96d1 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -299,6 +299,11 @@ struct vop2_win { * one win can only attach to one vp at the one time. */ uint8_t vp_mask; + /** + * @old_vp_mask: Bitmask of video_port0/1/2 this win attached of last commit, + * this is used for trackng the change of VOP2_PORT_SEL register. + */ + uint8_t old_vp_mask; uint8_t zpos; uint32_t offset; enum drm_plane_type type; @@ -2345,6 +2350,7 @@ static void vop2_layer_map_initial(struct vop2 *vop2, uint32_t current_vp_id) VOP_CTRL_SET(vop2, win_vp_id[win->phys_id], last_active_vp->id); } + win->old_vp_mask = win->vp_mask; } } } @@ -2824,6 +2830,18 @@ static void vop2_plane_atomic_update(struct drm_plane *plane, struct drm_plane_s return; } + /* + * This means this window is moved from another vp + * so the VOP2_PORT_SEL register is changed + * in this commit, we should not change this + * win register before the VOP2_PORT_SEL take effect + * on this VP, so skip this frame for safe. + */ + if (win->old_vp_mask != win->vp_mask) { + win->old_vp_mask = win->vp_mask; + return; + } + actual_w = drm_rect_width(src) >> 16; actual_h = drm_rect_height(src) >> 16; dsp_w = drm_rect_width(dest);