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 <hjc@rock-chips.com>
Change-Id: I7d23aab328962c1a77f6d0c11c5f81731bdceb80
This commit is contained in:
Sandy Huang
2023-09-17 11:10:46 +08:00
committed by Tao Huang
parent f89c0e66e0
commit f15552775d
+2 -13
View File
@@ -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