@@ -528,8 +528,7 @@ static const struct dpu_csc_cfg *_dpu_plane_get_csc(struct dpu_sw_pipe *pipe,
528
528
529
529
static void _dpu_plane_setup_scaler (struct dpu_sw_pipe * pipe ,
530
530
const struct msm_format * fmt , bool color_fill ,
531
- struct dpu_sw_pipe_cfg * pipe_cfg ,
532
- unsigned int rotation )
531
+ struct dpu_sw_pipe_cfg * pipe_cfg )
533
532
{
534
533
struct dpu_hw_sspp * pipe_hw = pipe -> sspp ;
535
534
const struct drm_format_info * info = drm_format_info (fmt -> pixel_format );
@@ -552,7 +551,7 @@ static void _dpu_plane_setup_scaler(struct dpu_sw_pipe *pipe,
552
551
dst_height ,
553
552
& scaler3_cfg , fmt ,
554
553
info -> hsub , info -> vsub ,
555
- rotation );
554
+ pipe_cfg -> rotation );
556
555
557
556
/* configure pixel extension based on scalar config */
558
557
_dpu_plane_setup_pixel_ext (& scaler3_cfg , & pixel_ext ,
@@ -604,7 +603,7 @@ static void _dpu_plane_color_fill_pipe(struct dpu_plane_state *pstate,
604
603
if (pipe -> sspp -> ops .setup_rects )
605
604
pipe -> sspp -> ops .setup_rects (pipe , & pipe_cfg );
606
605
607
- _dpu_plane_setup_scaler (pipe , fmt , true, & pipe_cfg , pstate -> rotation );
606
+ _dpu_plane_setup_scaler (pipe , fmt , true, & pipe_cfg );
608
607
}
609
608
610
609
/**
@@ -696,12 +695,17 @@ static void dpu_plane_cleanup_fb(struct drm_plane *plane,
696
695
}
697
696
698
697
static int dpu_plane_check_inline_rotation (struct dpu_plane * pdpu ,
699
- const struct dpu_sspp_sub_blks * sblk ,
700
- struct drm_rect src , const struct msm_format * fmt )
698
+ struct dpu_sw_pipe * pipe ,
699
+ struct drm_rect src ,
700
+ const struct msm_format * fmt )
701
701
{
702
+ const struct dpu_sspp_sub_blks * sblk = pipe -> sspp -> cap -> sblk ;
702
703
size_t num_formats ;
703
704
const u32 * supported_formats ;
704
705
706
+ if (!test_bit (DPU_SSPP_INLINE_ROTATION , & pipe -> sspp -> cap -> features ))
707
+ return - EINVAL ;
708
+
705
709
if (!sblk -> rotation_cfg ) {
706
710
DPU_ERROR ("invalid rotation cfg\n" );
707
711
return - EINVAL ;
@@ -731,6 +735,7 @@ static int dpu_plane_atomic_check_pipe(struct dpu_plane *pdpu,
731
735
{
732
736
uint32_t min_src_size ;
733
737
struct dpu_kms * kms = _dpu_plane_get_kms (& pdpu -> base );
738
+ int ret ;
734
739
735
740
min_src_size = MSM_FORMAT_IS_YUV (fmt ) ? 2 : 1 ;
736
741
@@ -768,6 +773,12 @@ static int dpu_plane_atomic_check_pipe(struct dpu_plane *pdpu,
768
773
return - EINVAL ;
769
774
}
770
775
776
+ if (pipe_cfg -> rotation & DRM_MODE_ROTATE_90 ) {
777
+ ret = dpu_plane_check_inline_rotation (pdpu , pipe , pipe_cfg -> src_rect , fmt );
778
+ if (ret )
779
+ return ret ;
780
+ }
781
+
771
782
/* max clk check */
772
783
if (_dpu_plane_calc_clk (mode , pipe_cfg ) > kms -> perf .max_core_clk_rate ) {
773
784
DPU_DEBUG_PLANE (pdpu , "plane exceeds max mdp core clk limits\n" );
@@ -891,7 +902,6 @@ static int dpu_plane_atomic_check_sspp(struct drm_plane *plane,
891
902
struct dpu_sw_pipe_cfg * pipe_cfg = & pstate -> pipe_cfg ;
892
903
struct dpu_sw_pipe_cfg * r_pipe_cfg = & pstate -> r_pipe_cfg ;
893
904
uint32_t max_linewidth ;
894
- unsigned int rotation ;
895
905
uint32_t supported_rotations ;
896
906
const struct dpu_sspp_cfg * pipe_hw_caps ;
897
907
const struct dpu_sspp_sub_blks * sblk ;
@@ -915,6 +925,15 @@ static int dpu_plane_atomic_check_sspp(struct drm_plane *plane,
915
925
916
926
max_linewidth = pdpu -> catalog -> caps -> max_linewidth ;
917
927
928
+ supported_rotations = DRM_MODE_REFLECT_MASK | DRM_MODE_ROTATE_0 ;
929
+
930
+ if (pipe_hw_caps -> features & BIT (DPU_SSPP_INLINE_ROTATION ))
931
+ supported_rotations |= DRM_MODE_ROTATE_90 ;
932
+
933
+ pipe_cfg -> rotation = drm_rotation_simplify (new_plane_state -> rotation ,
934
+ supported_rotations );
935
+ r_pipe_cfg -> rotation = pipe_cfg -> rotation ;
936
+
918
937
ret = dpu_plane_atomic_check_pipe (pdpu , pipe , pipe_cfg , fmt ,
919
938
& crtc_state -> adjusted_mode );
920
939
if (ret )
@@ -938,6 +957,7 @@ static int dpu_plane_atomic_check_sspp(struct drm_plane *plane,
938
957
drm_rect_height (& pipe_cfg -> src_rect ) != drm_rect_height (& pipe_cfg -> dst_rect ) ||
939
958
(!test_bit (DPU_SSPP_SMART_DMA_V1 , & pipe -> sspp -> cap -> features ) &&
940
959
!test_bit (DPU_SSPP_SMART_DMA_V2 , & pipe -> sspp -> cap -> features )) ||
960
+ pipe_cfg -> rotation & DRM_MODE_ROTATE_90 ||
941
961
MSM_FORMAT_IS_YUV (fmt )) {
942
962
DPU_DEBUG_PLANE (pdpu , "invalid src " DRM_RECT_FMT " line:%u, can't use split source\n" ,
943
963
DRM_RECT_ARG (& pipe_cfg -> src_rect ), max_linewidth );
@@ -961,23 +981,6 @@ static int dpu_plane_atomic_check_sspp(struct drm_plane *plane,
961
981
return ret ;
962
982
}
963
983
964
- supported_rotations = DRM_MODE_REFLECT_MASK | DRM_MODE_ROTATE_0 ;
965
-
966
- if (pipe_hw_caps -> features & BIT (DPU_SSPP_INLINE_ROTATION ))
967
- supported_rotations |= DRM_MODE_ROTATE_90 ;
968
-
969
- rotation = drm_rotation_simplify (new_plane_state -> rotation ,
970
- supported_rotations );
971
-
972
- if ((pipe_hw_caps -> features & BIT (DPU_SSPP_INLINE_ROTATION )) &&
973
- (rotation & DRM_MODE_ROTATE_90 )) {
974
- ret = dpu_plane_check_inline_rotation (pdpu , sblk , pipe_cfg -> src_rect , fmt );
975
- if (ret )
976
- return ret ;
977
- }
978
-
979
- pstate -> rotation = rotation ;
980
-
981
984
return 0 ;
982
985
}
983
986
@@ -1117,14 +1120,14 @@ static void dpu_plane_sspp_update_pipe(struct drm_plane *plane,
1117
1120
pipe_cfg );
1118
1121
}
1119
1122
1120
- _dpu_plane_setup_scaler (pipe , fmt , false, pipe_cfg , pstate -> rotation );
1123
+ _dpu_plane_setup_scaler (pipe , fmt , false, pipe_cfg );
1121
1124
1122
1125
if (pipe -> sspp -> ops .setup_multirect )
1123
1126
pipe -> sspp -> ops .setup_multirect (
1124
1127
pipe );
1125
1128
1126
1129
if (pipe -> sspp -> ops .setup_format ) {
1127
- unsigned int rotation = pstate -> rotation ;
1130
+ unsigned int rotation = pipe_cfg -> rotation ;
1128
1131
1129
1132
src_flags = 0x0 ;
1130
1133
0 commit comments