diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h index 4ba1a150d57a..94eff1b2b9f8 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h @@ -40,6 +40,7 @@ * This is a feather on rk3566 */ #define WIN_FEATURE_MIRROR BIT(6) +#define WIN_FEATURE_MULTI_AREA BIT(7) #define DSP_BG_SWAP 0x1 diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 9643459e3c07..ac66d183603b 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -1072,6 +1072,19 @@ static inline void vop2_wb_cfg_done(struct vop2_video_port *vp) } +static void vop2_win_multi_area_disable(struct vop2_win *parent) +{ + struct vop2 *vop2 = parent->vop2; + struct vop2_win *area; + int i; + + for (i = 0; i < vop2->registered_num_wins; i++) { + area = &vop2->win[i]; + if (area->parent == parent) + VOP_WIN_SET(vop2, area, enable, 0); + } +} + static void vop2_win_disable(struct vop2_win *win) { struct vop2 *vop2 = win->vop2; @@ -1091,6 +1104,12 @@ static void vop2_win_disable(struct vop2_win *win) VOP_CLUSTER_SET(vop2, win, enable, 0); } + + /* + * disable all other multi area win if we want disable area0 here + */ + if (!win->parent && (win->feature & WIN_FEATURE_MULTI_AREA)) + vop2_win_multi_area_disable(win); } static inline void vop2_write_lut(struct vop2 *vop2, uint32_t offset, uint32_t v) diff --git a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c index 8f092d458d2e..79c756d3c72b 100644 --- a/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +++ b/drivers/gpu/drm/rockchip/rockchip_vop2_reg.c @@ -1027,6 +1027,7 @@ static const struct vop2_win_data rk3568_vop_win_data[] = { .max_upscale_factor = 8, .max_downscale_factor = 8, .dly = { 20, 47, 41 }, + .feature = WIN_FEATURE_MULTI_AREA, }, { @@ -1049,7 +1050,7 @@ static const struct vop2_win_data rk3568_vop_win_data[] = { .max_upscale_factor = 8, .max_downscale_factor = 8, .dly = { 20, 47, 41 }, - .feature = WIN_FEATURE_MIRROR, + .feature = WIN_FEATURE_MIRROR | WIN_FEATURE_MULTI_AREA, }, { @@ -1072,7 +1073,7 @@ static const struct vop2_win_data rk3568_vop_win_data[] = { .max_upscale_factor = 8, .max_downscale_factor = 8, .dly = { 20, 47, 41 }, - .feature = WIN_FEATURE_MIRROR, + .feature = WIN_FEATURE_MIRROR | WIN_FEATURE_MULTI_AREA, }, { @@ -1095,6 +1096,7 @@ static const struct vop2_win_data rk3568_vop_win_data[] = { .max_upscale_factor = 8, .max_downscale_factor = 8, .dly = { 20, 47, 41 }, + .feature = WIN_FEATURE_MULTI_AREA, }, {