From: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
Rob Clark <robin.clark@oss.qualcomm.com>,
Dmitry Baryshkov <lumag@kernel.org>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Jordan Crouse <jordan@cosmicpenguin.net>
Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 09/12] drm/msm/dpu: simplify _dpu_format_populate_plane_sizes_*
Date: Thu, 4 Sep 2025 16:19:19 -0700 [thread overview]
Message-ID: <6e8b5af4-c4c3-4354-84ce-5d35475032ac@oss.qualcomm.com> (raw)
In-Reply-To: <20250705-dpu-formats-v1-9-40f0bb31b8c8@oss.qualcomm.com>
On 7/4/2025 7:47 PM, Dmitry Baryshkov wrote:
> Move common bits of _dpu_format_populate_plane_sizes_ubwc() and
> _linear() to dpu_format_populate_plane_sizes(), reducing unnecessary
> duplication and simplifying code flow fror the UBWC function.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c | 41 +++++++++++++----------------
> 1 file changed, 19 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
> index 59c9427da7dda07b8e8ee3d070d2dfb3c165698e..195a6b7c4075eef40e7a5d0fee208168421cee35 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_formats.c
> @@ -95,15 +95,9 @@ static int _dpu_format_populate_plane_sizes_ubwc(
> struct drm_framebuffer *fb,
> struct dpu_hw_fmt_layout *layout)
> {
> - int i;
> int color;
> bool meta = MSM_FORMAT_IS_UBWC(fmt);
>
> - memset(layout, 0, sizeof(struct dpu_hw_fmt_layout));
> - layout->width = fb->width;
> - layout->height = fb->height;
> - layout->num_planes = fmt->num_planes;
> -
> color = _dpu_format_get_media_color_ubwc(fmt);
> if (color < 0) {
> DRM_ERROR("UBWC format not supported for fmt: %p4cc\n",
> @@ -128,7 +122,7 @@ static int _dpu_format_populate_plane_sizes_ubwc(
> uv_sclines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
>
> if (!meta)
> - goto done;
> + return 0;
>
> layout->num_planes += 2;
> layout->plane_pitch[2] = VENUS_Y_META_STRIDE(color, fb->width);
> @@ -152,7 +146,8 @@ static int _dpu_format_populate_plane_sizes_ubwc(
> rgb_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
>
> if (!meta)
> - goto done;
> + return 0;
> +
> layout->num_planes += 2;
> layout->plane_pitch[2] = VENUS_RGB_META_STRIDE(color, fb->width);
> rgb_meta_scanlines = VENUS_RGB_META_SCANLINES(color, fb->height);
> @@ -160,10 +155,6 @@ static int _dpu_format_populate_plane_sizes_ubwc(
> rgb_meta_scanlines, DPU_UBWC_PLANE_SIZE_ALIGNMENT);
> }
>
> -done:
> - for (i = 0; i < DPU_MAX_PLANES; i++)
> - layout->total_size += layout->plane_size[i];
> -
> return 0;
> }
>
> @@ -174,11 +165,6 @@ static int _dpu_format_populate_plane_sizes_linear(
> {
> int i;
>
> - memset(layout, 0, sizeof(struct dpu_hw_fmt_layout));
> - layout->width = fb->width;
> - layout->height = fb->height;
> - layout->num_planes = fmt->num_planes;
> -
> /* Due to memset above, only need to set planes of interest */
> if (fmt->fetch_type == MDP_PLANE_INTERLEAVED) {
> layout->num_planes = 1;
> @@ -235,9 +221,6 @@ static int _dpu_format_populate_plane_sizes_linear(
> }
> }
>
> - for (i = 0; i < DPU_MAX_PLANES; i++)
> - layout->total_size += layout->plane_size[i];
> -
> return 0;
> }
>
> @@ -254,6 +237,7 @@ int dpu_format_populate_plane_sizes(
> struct dpu_hw_fmt_layout *layout)
> {
> const struct msm_format *fmt;
> + int ret, i;
>
> if (!layout || !fb) {
> DRM_ERROR("invalid pointer\n");
> @@ -268,10 +252,23 @@ int dpu_format_populate_plane_sizes(
>
> fmt = msm_framebuffer_format(fb);
>
> + memset(layout, 0, sizeof(struct dpu_hw_fmt_layout));
> + layout->width = fb->width;
> + layout->height = fb->height;
> + layout->num_planes = fmt->num_planes;
> +
> if (MSM_FORMAT_IS_UBWC(fmt) || MSM_FORMAT_IS_TILE(fmt))
> - return _dpu_format_populate_plane_sizes_ubwc(fmt, fb, layout);
> + ret = _dpu_format_populate_plane_sizes_ubwc(fmt, fb, layout);
> + else
> + ret = _dpu_format_populate_plane_sizes_linear(fmt, fb, layout);
>
> - return _dpu_format_populate_plane_sizes_linear(fmt, fb, layout);
> + if (ret)
> + return ret;
> +
> + for (i = 0; i < DPU_MAX_PLANES; i++)
> + layout->total_size += layout->plane_size[i];
> +
> + return 0;
> }
>
> static void _dpu_format_populate_addrs_ubwc(struct msm_gem_address_space *aspace,
>
next prev parent reply other threads:[~2025-09-04 23:19 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-05 2:47 [PATCH 00/12] drm/msm/dpu: rework format handling code Dmitry Baryshkov
2025-07-05 2:47 ` [PATCH 01/12] drm/msm/disp: set num_planes to 1 for interleaved YUV formats Dmitry Baryshkov
2025-09-04 18:39 ` Jessica Zhang
2025-07-05 2:47 ` [PATCH 02/12] drm/msm/disp: set num_planes and fetch_mode in INTERLEAVED_RGB_FMT Dmitry Baryshkov
2025-09-04 21:35 ` Jessica Zhang
2025-07-05 2:47 ` [PATCH 03/12] drm/msm/disp: set num_planes, fetch_mode and tile_height in INTERLEAVED_RGB_FMT_TILED Dmitry Baryshkov
2025-07-05 2:47 ` [PATCH 04/12] drm/msm/disp: simplify RGB{,A,X} formats definitions Dmitry Baryshkov
2025-09-04 23:05 ` Jessica Zhang
2025-09-04 23:06 ` Jessica Zhang
2025-07-05 2:47 ` [PATCH 05/12] drm/msm/disp: simplify tiled " Dmitry Baryshkov
2025-09-04 23:06 ` Jessica Zhang
2025-07-05 2:47 ` [PATCH 06/12] drm/msm/disp: pull in common YUV format parameters Dmitry Baryshkov
2025-09-04 23:07 ` Jessica Zhang
2025-07-05 2:47 ` [PATCH 07/12] drm/msm/disp: pull in common tiled " Dmitry Baryshkov
2025-09-04 22:22 ` Jessica Zhang
2025-09-04 22:37 ` Dmitry Baryshkov
2025-07-05 2:47 ` [PATCH 08/12] drm/msm/disp: drop PSEUDO_YUV_FMT_LOOSE_TILED Dmitry Baryshkov
2025-09-04 23:04 ` Jessica Zhang
2025-07-05 2:47 ` [PATCH 09/12] drm/msm/dpu: simplify _dpu_format_populate_plane_sizes_* Dmitry Baryshkov
2025-09-04 23:19 ` Jessica Zhang [this message]
2025-07-05 2:47 ` [PATCH 10/12] drm/msm/dpu: drop redundant num_planes assignment in _dpu_format_populate_plane_sizes*() Dmitry Baryshkov
2025-09-04 23:19 ` Jessica Zhang
2025-07-05 2:47 ` [PATCH 11/12] drm/msm/dpu: rewrite _dpu_format_populate_plane_sizes_ubwc() Dmitry Baryshkov
2025-07-05 17:53 ` kernel test robot
2025-07-05 2:47 ` [PATCH 12/12] drm/msm/dpu: use standard functions in _dpu_format_populate_plane_sizes_ubwc() Dmitry Baryshkov
2025-09-04 18:38 ` Jessica Zhang
2025-09-04 20:19 ` Dmitry Baryshkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6e8b5af4-c4c3-4354-84ce-5d35475032ac@oss.qualcomm.com \
--to=jessica.zhang@oss.qualcomm.com \
--cc=abhinav.kumar@linux.dev \
--cc=airlied@gmail.com \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jordan@cosmicpenguin.net \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lumag@kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=robin.clark@oss.qualcomm.com \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®