Skip to content

Commit

Permalink
drm/rockchip: vop2: Fix possible_crtcs error for cursor plane
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sandy-huang authored and rkhuangtao committed Nov 15, 2023
1 parent f89c0e6 commit f155527
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f155527

Please sign in to comment.