drm/rockchip: vop2: rk356x three vp share one gamma

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Change-Id: Iddaf85a902feaa1c2a6004a1b8c2f419135cd039
This commit is contained in:
Sandy Huang
2021-07-13 09:16:19 +08:00
committed by Tao Huang
parent 4d56f3cc51
commit 23110bdcf0
3 changed files with 15 additions and 0 deletions

View File

@@ -672,6 +672,7 @@ struct vop2_data {
uint8_t nr_mixers;
uint8_t nr_layers;
uint8_t nr_axi_intr;
uint8_t nr_gammas;
const struct vop_intr *axi_intr;
const struct vop2_ctrl *ctrl;
const struct vop2_win_data *win;

View File

@@ -2206,6 +2206,7 @@ static void vop2_crtc_load_lut(struct drm_crtc *crtc)
struct vop2_video_port *vp = to_vop2_video_port(crtc);
struct vop2 *vop2 = vp->vop2;
int dle = 0, i = 0;
u8 vp_enable_gamma_nr = 0;
if (!vop2->is_enabled || !vp->lut || !vop2->lut_regs)
return;
@@ -2213,6 +2214,18 @@ static void vop2_crtc_load_lut(struct drm_crtc *crtc)
if (WARN_ON(!drm_modeset_is_locked(&crtc->mutex)))
return;
for (i = 0; i < vop2->data->nr_vps; i++) {
struct vop2_video_port *vp = &vop2->vps[i];
if (vp->gamma_lut_active)
vp_enable_gamma_nr++;
}
if (vop2->data->nr_gammas && vp_enable_gamma_nr >= vop2->data->nr_gammas) {
DRM_INFO("only support %d gamma\n", vop2->data->nr_gammas);
return;
}
spin_lock(&vop2->reg_lock);
VOP_MODULE_SET(vop2, vp, dsp_lut_en, 0);
vop2_cfg_done(crtc);

View File

@@ -1253,6 +1253,7 @@ static const struct vop2_data rk3568_vop = {
.version = VOP_VERSION(0x40, 0x15),
.nr_vps = 3,
.nr_mixers = 5,
.nr_gammas = 1,
.max_input = { 4096, 2304 },
.max_output = { 4096, 2304 },
.ctrl = &rk3568_vop_ctrl,