@@ -719,6 +719,39 @@ int mtk_crtc_plane_check(struct drm_crtc *crtc, struct drm_plane *plane,
719719 return 0 ;
720720}
721721
722+ void mtk_crtc_plane_disable (struct drm_crtc * crtc , struct drm_plane * plane )
723+ {
724+ #if IS_REACHABLE (CONFIG_MTK_CMDQ )
725+ struct mtk_crtc * mtk_crtc = to_mtk_crtc (crtc );
726+ struct mtk_plane_state * plane_state = to_mtk_plane_state (plane -> state );
727+ int i ;
728+
729+ /* no need to wait for disabling the plane by CPU */
730+ if (!mtk_crtc -> cmdq_client .chan )
731+ return ;
732+
733+ if (!mtk_crtc -> enabled )
734+ return ;
735+
736+ /* set pending plane state to disabled */
737+ for (i = 0 ; i < mtk_crtc -> layer_nr ; i ++ ) {
738+ struct drm_plane * mtk_plane = & mtk_crtc -> planes [i ];
739+ struct mtk_plane_state * mtk_plane_state = to_mtk_plane_state (mtk_plane -> state );
740+
741+ if (mtk_plane -> index == plane -> index ) {
742+ memcpy (mtk_plane_state , plane_state , sizeof (* plane_state ));
743+ break ;
744+ }
745+ }
746+ mtk_crtc_update_config (mtk_crtc , false);
747+
748+ /* wait for planes to be disabled by CMDQ */
749+ wait_event_timeout (mtk_crtc -> cb_blocking_queue ,
750+ mtk_crtc -> cmdq_vblank_cnt == 0 ,
751+ msecs_to_jiffies (500 ));
752+ #endif
753+ }
754+
722755void mtk_crtc_async_update (struct drm_crtc * crtc , struct drm_plane * plane ,
723756 struct drm_atomic_state * state )
724757{
@@ -930,7 +963,8 @@ static int mtk_crtc_init_comp_planes(struct drm_device *drm_dev,
930963 mtk_ddp_comp_supported_rotations (comp ),
931964 mtk_ddp_comp_get_blend_modes (comp ),
932965 mtk_ddp_comp_get_formats (comp ),
933- mtk_ddp_comp_get_num_formats (comp ), i );
966+ mtk_ddp_comp_get_num_formats (comp ),
967+ mtk_ddp_comp_is_afbc_supported (comp ), i );
934968 if (ret )
935969 return ret ;
936970
0 commit comments