Skip to content

Commit bcaa391

Browse files
niejAbhinav Kumar
authored andcommitted
drm/msm/dpu: check every pipe per capability
The capability stored in sblk and pipe_hw_caps is checked only for SSPP of the first pipe in the pair with current implementation. That of the 2nd pipe, r_pipe, is not checked and may violate hardware capability. Move requirement check to dpu_plane_atomic_check_pipe() for the check of every pipe. Fixes: ("dbbf57dfd04e6 drm/msm/dpu: split dpu_plane_atomic_check()") Signed-off-by: Jun Nie <jun.nie@linaro.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com> Patchwork: https://patchwork.freedesktop.org/patch/640513/ Link: https://lore.kernel.org/r/20250303-sm8650-v6-14-hmd-deckard-mdss-quad-upstream-oldbootwrapper-36-prep-v8-1-eb5df105c807@linaro.org Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
1 parent 83ee6d2 commit bcaa391

File tree

1 file changed

+36
-35
lines changed

1 file changed

+36
-35
lines changed

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

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -729,12 +729,40 @@ static int dpu_plane_check_inline_rotation(struct dpu_plane *pdpu,
729729
static 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
}

0 commit comments

Comments
 (0)