Skip to content

Commit ab52d27

Browse files
committed
drm/msm/dpu: move rot90 checking to dpu_plane_atomic_check_sspp()
Move a call to dpu_plane_check_inline_rotation() to the dpu_plane_atomic_check_sspp() function, so that the rot90 constraints are checked for both SSPP blocks. Also move rotation field from struct dpu_plane_state to struct dpu_sw_pipe_cfg. Signed-off-by: Dmitry Baryshkov <[email protected]> Reviewed-by: Abhinav Kumar <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/621485/ Link: https://lore.kernel.org/r/[email protected]
1 parent dbbf57d commit ab52d27

File tree

3 files changed

+31
-28
lines changed

3 files changed

+31
-28
lines changed

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,12 @@ struct dpu_hw_pixel_ext {
144144
* @src_rect: src ROI, caller takes into account the different operations
145145
* such as decimation, flip etc to program this field
146146
* @dest_rect: destination ROI.
147+
* @rotation: simplified drm rotation hint
147148
*/
148149
struct dpu_sw_pipe_cfg {
149150
struct drm_rect src_rect;
150151
struct drm_rect dst_rect;
152+
unsigned int rotation;
151153
};
152154

153155
/**

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,7 @@ static const struct dpu_csc_cfg *_dpu_plane_get_csc(struct dpu_sw_pipe *pipe,
528528

529529
static void _dpu_plane_setup_scaler(struct dpu_sw_pipe *pipe,
530530
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)
533532
{
534533
struct dpu_hw_sspp *pipe_hw = pipe->sspp;
535534
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,
552551
dst_height,
553552
&scaler3_cfg, fmt,
554553
info->hsub, info->vsub,
555-
rotation);
554+
pipe_cfg->rotation);
556555

557556
/* configure pixel extension based on scalar config */
558557
_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,
604603
if (pipe->sspp->ops.setup_rects)
605604
pipe->sspp->ops.setup_rects(pipe, &pipe_cfg);
606605

607-
_dpu_plane_setup_scaler(pipe, fmt, true, &pipe_cfg, pstate->rotation);
606+
_dpu_plane_setup_scaler(pipe, fmt, true, &pipe_cfg);
608607
}
609608

610609
/**
@@ -696,12 +695,17 @@ static void dpu_plane_cleanup_fb(struct drm_plane *plane,
696695
}
697696

698697
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)
701701
{
702+
const struct dpu_sspp_sub_blks *sblk = pipe->sspp->cap->sblk;
702703
size_t num_formats;
703704
const u32 *supported_formats;
704705

706+
if (!test_bit(DPU_SSPP_INLINE_ROTATION, &pipe->sspp->cap->features))
707+
return -EINVAL;
708+
705709
if (!sblk->rotation_cfg) {
706710
DPU_ERROR("invalid rotation cfg\n");
707711
return -EINVAL;
@@ -731,6 +735,7 @@ static int dpu_plane_atomic_check_pipe(struct dpu_plane *pdpu,
731735
{
732736
uint32_t min_src_size;
733737
struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base);
738+
int ret;
734739

735740
min_src_size = MSM_FORMAT_IS_YUV(fmt) ? 2 : 1;
736741

@@ -768,6 +773,12 @@ static int dpu_plane_atomic_check_pipe(struct dpu_plane *pdpu,
768773
return -EINVAL;
769774
}
770775

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+
771782
/* max clk check */
772783
if (_dpu_plane_calc_clk(mode, pipe_cfg) > kms->perf.max_core_clk_rate) {
773784
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,
891902
struct dpu_sw_pipe_cfg *pipe_cfg = &pstate->pipe_cfg;
892903
struct dpu_sw_pipe_cfg *r_pipe_cfg = &pstate->r_pipe_cfg;
893904
uint32_t max_linewidth;
894-
unsigned int rotation;
895905
uint32_t supported_rotations;
896906
const struct dpu_sspp_cfg *pipe_hw_caps;
897907
const struct dpu_sspp_sub_blks *sblk;
@@ -915,6 +925,15 @@ static int dpu_plane_atomic_check_sspp(struct drm_plane *plane,
915925

916926
max_linewidth = pdpu->catalog->caps->max_linewidth;
917927

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+
918937
ret = dpu_plane_atomic_check_pipe(pdpu, pipe, pipe_cfg, fmt,
919938
&crtc_state->adjusted_mode);
920939
if (ret)
@@ -938,6 +957,7 @@ static int dpu_plane_atomic_check_sspp(struct drm_plane *plane,
938957
drm_rect_height(&pipe_cfg->src_rect) != drm_rect_height(&pipe_cfg->dst_rect) ||
939958
(!test_bit(DPU_SSPP_SMART_DMA_V1, &pipe->sspp->cap->features) &&
940959
!test_bit(DPU_SSPP_SMART_DMA_V2, &pipe->sspp->cap->features)) ||
960+
pipe_cfg->rotation & DRM_MODE_ROTATE_90 ||
941961
MSM_FORMAT_IS_YUV(fmt)) {
942962
DPU_DEBUG_PLANE(pdpu, "invalid src " DRM_RECT_FMT " line:%u, can't use split source\n",
943963
DRM_RECT_ARG(&pipe_cfg->src_rect), max_linewidth);
@@ -961,23 +981,6 @@ static int dpu_plane_atomic_check_sspp(struct drm_plane *plane,
961981
return ret;
962982
}
963983

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-
981984
return 0;
982985
}
983986

@@ -1117,14 +1120,14 @@ static void dpu_plane_sspp_update_pipe(struct drm_plane *plane,
11171120
pipe_cfg);
11181121
}
11191122

1120-
_dpu_plane_setup_scaler(pipe, fmt, false, pipe_cfg, pstate->rotation);
1123+
_dpu_plane_setup_scaler(pipe, fmt, false, pipe_cfg);
11211124

11221125
if (pipe->sspp->ops.setup_multirect)
11231126
pipe->sspp->ops.setup_multirect(
11241127
pipe);
11251128

11261129
if (pipe->sspp->ops.setup_format) {
1127-
unsigned int rotation = pstate->rotation;
1130+
unsigned int rotation = pipe_cfg->rotation;
11281131

11291132
src_flags = 0x0;
11301133

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
* @plane_fetch_bw: calculated BW per plane
3131
* @plane_clk: calculated clk per plane
3232
* @needs_dirtyfb: whether attached CRTC needs pixel data explicitly flushed
33-
* @rotation: simplified drm rotation hint
3433
* @layout: framebuffer memory layout
3534
*/
3635
struct dpu_plane_state {
@@ -48,7 +47,6 @@ struct dpu_plane_state {
4847
u64 plane_clk;
4948

5049
bool needs_dirtyfb;
51-
unsigned int rotation;
5250

5351
struct dpu_hw_fmt_layout layout;
5452
};

0 commit comments

Comments
 (0)