]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/msm/dpu: move pitch check to _dpu_format_get_plane_sizes_linear()
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Tue, 3 Sep 2024 03:22:52 +0000 (06:22 +0300)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Mon, 21 Oct 2024 11:11:12 +0000 (14:11 +0300)
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
drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c

index df046bc88715e0570bc2b4e5a08e97d899890bb0..4d17eb88af403d9aad602196eabb339922252e1b 100644 (file)
@@ -229,8 +229,13 @@ static int _dpu_format_get_plane_sizes_linear(
         * all the components based on ubwc specifications.
         */
        for (i = 0; i < layout->num_planes && i < DPU_MAX_PLANES; ++i) {
-               if (layout->plane_pitch[i] < fb->pitches[i])
+               if (layout->plane_pitch[i] <= fb->pitches[i]) {
                        layout->plane_pitch[i] = fb->pitches[i];
+               } else {
+                       DRM_DEBUG("plane %u expected pitch %u, fb %u\n",
+                                 i, layout->plane_pitch[i], fb->pitches[i]);
+                       return -EINVAL;
+               }
        }
 
        for (i = 0; i < DPU_MAX_PLANES; i++)
@@ -360,15 +365,6 @@ static int _dpu_format_populate_addrs_linear(
 {
        unsigned int i;
 
-       /* Can now check the pitches given vs pitches expected */
-       for (i = 0; i < layout->num_planes; ++i) {
-               if (layout->plane_pitch[i] > fb->pitches[i]) {
-                       DRM_ERROR("plane %u expected pitch %u, fb %u\n",
-                               i, layout->plane_pitch[i], fb->pitches[i]);
-                       return -EINVAL;
-               }
-       }
-
        /* Populate addresses for simple formats here */
        for (i = 0; i < layout->num_planes; ++i) {
                layout->plane_addr[i] = msm_framebuffer_iova(fb, aspace, i);