Skip to content

Commit 10f2062

Browse files
author
Abhinav Kumar
committed
drm/msm/dpu: fail dpu_plane_atomic_check() based on mdp clk limits
Currently, dpu_plane_atomic_check() does not check whether the plane can process the image without exceeding the per chipset limits for MDP clock. This leads to underflow issues because the SSPP is not able to complete the processing for the data rate of the display. Fail the dpu_plane_atomic_check() if the SSPP cannot process the image without exceeding the MDP clock limits. changes in v2: - use crtc_state's adjusted_mode instead of mode Fixes: 25fdd59 ("drm/msm: Add SDM845 DPU support") Signed-off-by: Abhinav Kumar <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/556819/ Link: https://lore.kernel.org/r/[email protected]
1 parent eba8c99 commit 10f2062

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -733,9 +733,11 @@ static int dpu_plane_check_inline_rotation(struct dpu_plane *pdpu,
733733
static int dpu_plane_atomic_check_pipe(struct dpu_plane *pdpu,
734734
struct dpu_sw_pipe *pipe,
735735
struct dpu_sw_pipe_cfg *pipe_cfg,
736-
const struct dpu_format *fmt)
736+
const struct dpu_format *fmt,
737+
const struct drm_display_mode *mode)
737738
{
738739
uint32_t min_src_size;
740+
struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base);
739741

740742
min_src_size = DPU_FORMAT_IS_YUV(fmt) ? 2 : 1;
741743

@@ -774,6 +776,12 @@ static int dpu_plane_atomic_check_pipe(struct dpu_plane *pdpu,
774776
return -EINVAL;
775777
}
776778

779+
/* max clk check */
780+
if (_dpu_plane_calc_clk(mode, pipe_cfg) > kms->perf.max_core_clk_rate) {
781+
DPU_DEBUG_PLANE(pdpu, "plane exceeds max mdp core clk limits\n");
782+
return -E2BIG;
783+
}
784+
777785
return 0;
778786
}
779787

@@ -899,12 +907,13 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
899907
r_pipe_cfg->dst_rect.x1 = pipe_cfg->dst_rect.x2;
900908
}
901909

902-
ret = dpu_plane_atomic_check_pipe(pdpu, pipe, pipe_cfg, fmt);
910+
ret = dpu_plane_atomic_check_pipe(pdpu, pipe, pipe_cfg, fmt, &crtc_state->adjusted_mode);
903911
if (ret)
904912
return ret;
905913

906914
if (r_pipe->sspp) {
907-
ret = dpu_plane_atomic_check_pipe(pdpu, r_pipe, r_pipe_cfg, fmt);
915+
ret = dpu_plane_atomic_check_pipe(pdpu, r_pipe, r_pipe_cfg, fmt,
916+
&crtc_state->adjusted_mode);
908917
if (ret)
909918
return ret;
910919
}

0 commit comments

Comments
 (0)