drm/rockchip: vop2: Only register used vp to drm

A registered vp(crtc) need a primary plane, some
linux style display software(X11/weston) want more
overlay plane, so we don't register unused vp to
save some plane for overlay.

Change-Id: I66846af7364d1a20f38f35d65ed3fe34b7f280ab
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
This commit is contained in:
Andy Yan
2021-06-11 17:19:33 +08:00
committed by Sandy Huang
parent e7a722ad59
commit d8d8a665cd

View File

@@ -5998,6 +5998,8 @@ static int vop2_gamma_init(struct vop2 *vop2)
for (i = 0; i < vop2_data->nr_vps; i++) { for (i = 0; i < vop2_data->nr_vps; i++) {
vp = &vop2->vps[i]; vp = &vop2->vps[i];
crtc = &vp->crtc; crtc = &vp->crtc;
if (!crtc->dev)
continue;
vp_data = &vop2_data->vp[vp->id]; vp_data = &vop2_data->vp[vp->id];
lut_len = vp_data->gamma_lut_len; lut_len = vp_data->gamma_lut_len;
vp->gamma_lut_len = vp_data->gamma_lut_len; vp->gamma_lut_len = vp_data->gamma_lut_len;
@@ -6029,7 +6031,6 @@ static int vop2_gamma_init(struct vop2 *vop2)
return 0; return 0;
} }
static int vop2_crtc_create_plane_mask_property(struct vop2 *vop2, static int vop2_crtc_create_plane_mask_property(struct vop2 *vop2,
struct drm_crtc *crtc) struct drm_crtc *crtc)
{ {
@@ -6084,10 +6085,26 @@ static int vop2_create_crtc(struct vop2 *vop2)
int ret = 0; int ret = 0;
bool be_used_for_primary_plane = false; bool be_used_for_primary_plane = false;
bool find_primary_plane = false; bool find_primary_plane = false;
bool bootloader_initialized = false;
/* all planes can attach to any crtc */ /* all planes can attach to any crtc */
possible_crtcs = (1 << vop2_data->nr_vps) - 1; possible_crtcs = (1 << vop2_data->nr_vps) - 1;
/*
* We set plane_mask from dts or bootloader
* if all the plane_mask are zero, that means
* the bootloader don't initialized the vop, or
* something is wrong, the kernel will try to
* initial all the vp.
*/
for (i = 0; i < vop2_data->nr_vps; i++) {
vp = &vop2->vps[i];
if (vp->plane_mask) {
bootloader_initialized = true;
break;
}
}
/* /*
* Create primary plane for eache crtc first, since we need * Create primary plane for eache crtc first, since we need
* to pass them to drm_crtc_init_with_planes, which sets the * to pass them to drm_crtc_init_with_planes, which sets the
@@ -6100,6 +6117,14 @@ static int vop2_create_crtc(struct vop2 *vop2)
vp->id = vp_data->id; vp->id = vp_data->id;
vp->regs = vp_data->regs; vp->regs = vp_data->regs;
vp->cursor_win_id = -1; vp->cursor_win_id = -1;
/*
* we assume a vp with a zere plane_mask(set from dts or bootloader)
* as unused.
*/
if (!vp->plane_mask && bootloader_initialized)
continue;
if (vop2_soc_is_rk3566()) if (vop2_soc_is_rk3566())
soc_id = vp_data->soc_id[1]; soc_id = vp_data->soc_id[1];
else else