drm/rockchip: vop2: only legacy gamma set need extra config done

The legacy api drmModeCrtcSetGammalegacy can be called independently, so it need extra config done;
and the atomic api have config done at the vop2_crtc_atomic_flush();

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Change-Id: Idca4c42f1d298ec312dc839ee526e4132d9d8b73
This commit is contained in:
Sandy Huang
2023-04-18 15:54:10 +08:00
parent 903953ddeb
commit 4056d4ef2c

View File

@@ -3391,7 +3391,6 @@ static void rk3568_crtc_load_lut(struct drm_crtc *crtc)
VOP_MODULE_SET(vop2, vp, dsp_lut_en, 1); VOP_MODULE_SET(vop2, vp, dsp_lut_en, 1);
vop2_write_reg_uncached(vop2, &vp->regs->gamma_update_en, 1); vop2_write_reg_uncached(vop2, &vp->regs->gamma_update_en, 1);
vop2_cfg_done(crtc);
vp->gamma_lut_active = true; vp->gamma_lut_active = true;
spin_unlock(&vop2->reg_lock); spin_unlock(&vop2->reg_lock);
@@ -3438,26 +3437,7 @@ static void vop2_crtc_load_lut(struct drm_crtc *crtc)
rk3588_crtc_load_lut(&vp->rockchip_crtc.crtc, vp->lut); rk3588_crtc_load_lut(&vp->rockchip_crtc.crtc, vp->lut);
if (vcstate->splice_mode) if (vcstate->splice_mode)
rk3588_crtc_load_lut(&splice_vp->rockchip_crtc.crtc, vp->lut); rk3588_crtc_load_lut(&splice_vp->rockchip_crtc.crtc, vp->lut);
vop2_cfg_done(crtc);
} }
/*
* maybe appear the following case:
* -> set gamma
* -> config done
* -> atomic commit
* --> update win format
* --> update win address
* ---> here maybe meet vop hardware frame start, and triggle some config take affect.
* ---> as only some config take affect, this maybe lead to iommu pagefault.
* --> update win size
* --> update win other parameters
* -> config done
*
* so we add vop2_wait_for_fs_by_done_bit_status() to make sure the first config done take
* effect and then to do next frame config.
*/
if (VOP_MODULE_GET(vop2, vp, standby) == 0)
vop2_wait_for_fs_by_done_bit_status(vp);
} }
static void rockchip_vop2_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, static void rockchip_vop2_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red,
@@ -3499,6 +3479,7 @@ static int vop2_crtc_legacy_gamma_set(struct drm_crtc *crtc, u16 *red,
struct drm_modeset_acquire_ctx *ctx) struct drm_modeset_acquire_ctx *ctx)
{ {
struct vop2_video_port *vp = to_vop2_video_port(crtc); struct vop2_video_port *vp = to_vop2_video_port(crtc);
struct vop2 *vop2 = vp->vop2;
int i; int i;
if (!vp->lut) if (!vp->lut)
@@ -3513,6 +3494,25 @@ static int vop2_crtc_legacy_gamma_set(struct drm_crtc *crtc, u16 *red,
rockchip_vop2_crtc_fb_gamma_set(crtc, red[i], green[i], rockchip_vop2_crtc_fb_gamma_set(crtc, red[i], green[i],
blue[i], i); blue[i], i);
vop2_crtc_load_lut(crtc); vop2_crtc_load_lut(crtc);
vop2_cfg_done(crtc);
/*
* maybe appear the following case:
* -> set gamma
* -> config done
* -> atomic commit
* --> update win format
* --> update win address
* ---> here maybe meet vop hardware frame start, and triggle some config take affect.
* ---> as only some config take affect, this maybe lead to iommu pagefault.
* --> update win size
* --> update win other parameters
* -> config done
*
* so we add vop2_wait_for_fs_by_done_bit_status() to make sure the first config done take
* effect and then to do next frame config.
*/
if (VOP_MODULE_GET(vop2, vp, standby) == 0)
vop2_wait_for_fs_by_done_bit_status(vp);
return 0; return 0;
} }
@@ -8040,8 +8040,11 @@ static void vop2_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state
/* /*
* restore the lut table. * restore the lut table.
*/ */
if (vp->gamma_lut_active) if (vp->gamma_lut_active) {
vop2_crtc_load_lut(crtc); vop2_crtc_load_lut(crtc);
vop2_cfg_done(crtc);
vop2_wait_for_fs_by_done_bit_status(vp);
}
out: out:
vop2_unlock(vop2); vop2_unlock(vop2);
} }