@@ -729,12 +729,40 @@ static int dpu_plane_check_inline_rotation(struct dpu_plane *pdpu,
729729static int dpu_plane_atomic_check_pipe (struct dpu_plane * pdpu ,
730730 struct dpu_sw_pipe * pipe ,
731731 struct dpu_sw_pipe_cfg * pipe_cfg ,
732- const struct msm_format * fmt ,
733- const struct drm_display_mode * mode )
732+ const struct drm_display_mode * mode ,
733+ struct drm_plane_state * new_plane_state )
734734{
735735 uint32_t min_src_size ;
736736 struct dpu_kms * kms = _dpu_plane_get_kms (& pdpu -> base );
737737 int ret ;
738+ const struct msm_format * fmt ;
739+ uint32_t supported_rotations ;
740+ const struct dpu_sspp_cfg * pipe_hw_caps ;
741+ const struct dpu_sspp_sub_blks * sblk ;
742+
743+ pipe_hw_caps = pipe -> sspp -> cap ;
744+ sblk = pipe -> sspp -> cap -> sblk ;
745+
746+ /*
747+ * We already have verified scaling against platform limitations.
748+ * Now check if the SSPP supports scaling at all.
749+ */
750+ if (!sblk -> scaler_blk .len &&
751+ ((drm_rect_width (& new_plane_state -> src ) >> 16 !=
752+ drm_rect_width (& new_plane_state -> dst )) ||
753+ (drm_rect_height (& new_plane_state -> src ) >> 16 !=
754+ drm_rect_height (& new_plane_state -> dst ))))
755+ return - ERANGE ;
756+
757+ fmt = msm_framebuffer_format (new_plane_state -> fb );
758+
759+ supported_rotations = DRM_MODE_REFLECT_MASK | DRM_MODE_ROTATE_0 ;
760+
761+ if (pipe_hw_caps -> features & BIT (DPU_SSPP_INLINE_ROTATION ))
762+ supported_rotations |= DRM_MODE_ROTATE_90 ;
763+
764+ pipe_cfg -> rotation = drm_rotation_simplify (new_plane_state -> rotation ,
765+ supported_rotations );
738766
739767 min_src_size = MSM_FORMAT_IS_YUV (fmt ) ? 2 : 1 ;
740768
@@ -923,47 +951,20 @@ static int dpu_plane_atomic_check_sspp(struct drm_plane *plane,
923951 struct dpu_plane_state * pstate = to_dpu_plane_state (new_plane_state );
924952 struct dpu_sw_pipe * pipe = & pstate -> pipe ;
925953 struct dpu_sw_pipe * r_pipe = & pstate -> r_pipe ;
926- const struct msm_format * fmt ;
927954 struct dpu_sw_pipe_cfg * pipe_cfg = & pstate -> pipe_cfg ;
928955 struct dpu_sw_pipe_cfg * r_pipe_cfg = & pstate -> r_pipe_cfg ;
929- uint32_t supported_rotations ;
930- const struct dpu_sspp_cfg * pipe_hw_caps ;
931- const struct dpu_sspp_sub_blks * sblk ;
932956 int ret = 0 ;
933957
934- pipe_hw_caps = pipe -> sspp -> cap ;
935- sblk = pipe -> sspp -> cap -> sblk ;
936-
937- /*
938- * We already have verified scaling against platform limitations.
939- * Now check if the SSPP supports scaling at all.
940- */
941- if (!sblk -> scaler_blk .len &&
942- ((drm_rect_width (& new_plane_state -> src ) >> 16 !=
943- drm_rect_width (& new_plane_state -> dst )) ||
944- (drm_rect_height (& new_plane_state -> src ) >> 16 !=
945- drm_rect_height (& new_plane_state -> dst ))))
946- return - ERANGE ;
947-
948- fmt = msm_framebuffer_format (new_plane_state -> fb );
949-
950- supported_rotations = DRM_MODE_REFLECT_MASK | DRM_MODE_ROTATE_0 ;
951-
952- if (pipe_hw_caps -> features & BIT (DPU_SSPP_INLINE_ROTATION ))
953- supported_rotations |= DRM_MODE_ROTATE_90 ;
954-
955- pipe_cfg -> rotation = drm_rotation_simplify (new_plane_state -> rotation ,
956- supported_rotations );
957- r_pipe_cfg -> rotation = pipe_cfg -> rotation ;
958-
959- ret = dpu_plane_atomic_check_pipe (pdpu , pipe , pipe_cfg , fmt ,
960- & crtc_state -> adjusted_mode );
958+ ret = dpu_plane_atomic_check_pipe (pdpu , pipe , pipe_cfg ,
959+ & crtc_state -> adjusted_mode ,
960+ new_plane_state );
961961 if (ret )
962962 return ret ;
963963
964964 if (drm_rect_width (& r_pipe_cfg -> src_rect ) != 0 ) {
965- ret = dpu_plane_atomic_check_pipe (pdpu , r_pipe , r_pipe_cfg , fmt ,
966- & crtc_state -> adjusted_mode );
965+ ret = dpu_plane_atomic_check_pipe (pdpu , r_pipe , r_pipe_cfg ,
966+ & crtc_state -> adjusted_mode ,
967+ new_plane_state );
967968 if (ret )
968969 return ret ;
969970 }
@@ -1059,6 +1060,9 @@ static int dpu_plane_virtual_atomic_check(struct drm_plane *plane,
10591060 struct drm_crtc_state * crtc_state ;
10601061 int ret ;
10611062
1063+ if (IS_ERR (plane_state ))
1064+ return PTR_ERR (plane_state );
1065+
10621066 if (plane_state -> crtc )
10631067 crtc_state = drm_atomic_get_new_crtc_state (state ,
10641068 plane_state -> crtc );
0 commit comments