Skip to content

Commit d8cb424

Browse files
committed
drm/msm/dpu: move pitch check to _dpu_format_get_plane_sizes_linear()
The _dpu_format_get_plane_sizes_linear() already compares pitches of the framebuffer with the calculated pitches. Move the check to the same place, demoting DPU_ERROR to DPU_DEBUG to prevent user from spamming the kernel log. Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Patchwork: https://patchwork.freedesktop.org/patch/612245/ Link: https://lore.kernel.org/r/20240903-dpu-mode-config-width-v6-9-617e1ecc4b7a@linaro.org
1 parent d13445b commit d8cb424

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,13 @@ static int _dpu_format_get_plane_sizes_linear(
229229
* all the components based on ubwc specifications.
230230
*/
231231
for (i = 0; i < layout->num_planes && i < DPU_MAX_PLANES; ++i) {
232-
if (layout->plane_pitch[i] < fb->pitches[i])
232+
if (layout->plane_pitch[i] <= fb->pitches[i]) {
233233
layout->plane_pitch[i] = fb->pitches[i];
234+
} else {
235+
DRM_DEBUG("plane %u expected pitch %u, fb %u\n",
236+
i, layout->plane_pitch[i], fb->pitches[i]);
237+
return -EINVAL;
238+
}
234239
}
235240

236241
for (i = 0; i < DPU_MAX_PLANES; i++)
@@ -360,15 +365,6 @@ static int _dpu_format_populate_addrs_linear(
360365
{
361366
unsigned int i;
362367

363-
/* Can now check the pitches given vs pitches expected */
364-
for (i = 0; i < layout->num_planes; ++i) {
365-
if (layout->plane_pitch[i] > fb->pitches[i]) {
366-
DRM_ERROR("plane %u expected pitch %u, fb %u\n",
367-
i, layout->plane_pitch[i], fb->pitches[i]);
368-
return -EINVAL;
369-
}
370-
}
371-
372368
/* Populate addresses for simple formats here */
373369
for (i = 0; i < layout->num_planes; ++i) {
374370
layout->plane_addr[i] = msm_framebuffer_iova(fb, aspace, i);

0 commit comments

Comments
 (0)