drm/rockchip: Use normalized zpos on vop2

Some linux app may be set zpos without any check.
For example mpv: change the zpos of overlay
plane from default value 2 to 1, but the primary
plane zpos is also 1.

Change-Id: I6015c171c6512dc7f10bed7c56933941c9d64a2e
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
This commit is contained in:
Andy Yan
2021-08-23 20:02:43 +08:00
committed by Tao Huang
parent e631f93c53
commit dc04341b10

View File

@@ -197,6 +197,7 @@ enum vop2_layer_phy_id {
};
struct vop2_zpos {
struct drm_plane *plane;
int win_phys_id;
int zpos;
};
@@ -4509,7 +4510,10 @@ static int vop2_zpos_cmp(const void *a, const void *b)
struct vop2_zpos *pa = (struct vop2_zpos *)a;
struct vop2_zpos *pb = (struct vop2_zpos *)b;
return pa->zpos - pb->zpos;
if (pa->zpos != pb->zpos)
return pa->zpos - pb->zpos;
else
return pa->plane->base.id - pb->plane->base.id;
}
static int vop2_crtc_atomic_check(struct drm_crtc *crtc,
@@ -5132,6 +5136,7 @@ static void vop2_crtc_atomic_begin(struct drm_crtc *crtc, struct drm_crtc_state
vpstate = to_vop2_plane_state(plane->state);
vop2_zpos[nr_layers].win_phys_id = win->phys_id;
vop2_zpos[nr_layers].zpos = vpstate->zpos;
vop2_zpos[nr_layers].plane = plane;
nr_layers++;
DRM_DEV_DEBUG(vop2->dev, "%s active zpos:%d for vp%d from vp%d\n",
win->name, vpstate->zpos, vp->id, old_vp->id);