From f15552775df1317eafe0ae01d88f50cc91cddb89 Mon Sep 17 00:00:00 2001 From: Sandy Huang Date: Sun, 17 Sep 2023 11:10:46 +0800 Subject: [PATCH] drm/rockchip: vop2: Fix possible_crtcs error for cursor plane Before this commit, because the crtc is not initialized yet, if use the drm_crtc_mask(crtc) at vop2_cursor_plane_init(), the cursor plane possible_crtcs will always be 1 for vp0. After this commit, the plane possible_crtcs will be: if (disable_win_move && vop2) possible_crtcs = BIT(registered_num_crtcs); else if (vop3) possible_crtcs = win->possible_crtcs from reg_data; else possible_crtcs =(1 << vop2_data->nr_vps) - 1;//all crtc Fixes: 1a6b7e170f1e ("drm/rockchip: vop3: add support rk3528") Signed-off-by: Sandy Huang Change-Id: I7d23aab328962c1a77f6d0c11c5f81731bdceb80 --- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 523070072046..e96f0ee2ad15 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -10962,25 +10962,14 @@ static int vop2_plane_init(struct vop2 *vop2, struct vop2_win *win, unsigned lon return 0; } -static struct drm_plane *vop2_cursor_plane_init(struct vop2_video_port *vp) +static struct drm_plane *vop2_cursor_plane_init(struct vop2_video_port *vp, u32 possible_crtcs) { struct vop2 *vop2 = vp->vop2; struct drm_plane *cursor = NULL; struct vop2_win *win; - unsigned long possible_crtcs = 0; win = vop2_find_win_by_phys_id(vop2, vp->cursor_win_id); if (win) { - if (vop2->disable_win_move) { - const struct vop2_data *vop2_data = vop2->data; - struct drm_crtc *crtc = vop2_find_crtc_by_plane_mask(vop2, win->phys_id); - - if (crtc) - possible_crtcs = drm_crtc_mask(crtc); - else - possible_crtcs = (1 << vop2_data->nr_vps) - 1; - } - if (win->possible_crtcs) possible_crtcs = win->possible_crtcs; win->type = DRM_PLANE_TYPE_CURSOR; @@ -11410,7 +11399,7 @@ static int vop2_create_crtc(struct vop2 *vop2) } if (vp->cursor_win_id >= 0) { - cursor = vop2_cursor_plane_init(vp); + cursor = vop2_cursor_plane_init(vp, possible_crtcs); if (!cursor) DRM_WARN("failed to init cursor plane for vp%d\n", vp->id); else