Re: [PATCH 08/36] drm/msm: use bpp instead of cpp for drm_format_info

From: Rob Clark
Date: Mon Sep 23 2019 - 12:53:56 EST


On Mon, Sep 23, 2019 at 5:44 AM Sandy Huang <hjc@xxxxxxxxxxxxxx> wrote:
>
> cpp[BytePerPlane] can't describe the 10bit data format correctly,
> So we use bpp[BitPerPlane] to instead cpp.
>
> Signed-off-by: Sandy Huang <hjc@xxxxxxxxxxxxxx>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 4 ++--
> drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 2 +-
> drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c | 2 +-
> drivers/gpu/drm/msm/msm_fb.c | 2 +-
> 4 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index b3417d5..c57731c 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -1148,8 +1148,8 @@ static int _dpu_debugfs_status_show(struct seq_file *s, void *data)
> fb->base.id, (char *) &fb->format->format,
> fb->width, fb->height);
> for (i = 0; i < ARRAY_SIZE(fb->format->cpp); ++i)
> - seq_printf(s, "cpp[%d]:%u ",
> - i, fb->format->cpp[i]);
> + seq_printf(s, "bpp[%d]:%u ",
> + i, fb->format->bpp[i]);
> seq_puts(s, "\n\t");
>
> seq_printf(s, "modifier:%8llu ", fb->modifier);
> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
> index ff14555..61ab4dc 100644
> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c
> @@ -790,7 +790,7 @@ static void mdp5_crtc_restore_cursor(struct drm_crtc *crtc)
> width = mdp5_crtc->cursor.width;
> height = mdp5_crtc->cursor.height;
>
> - stride = width * info->cpp[0];
> + stride = width * info->bpp[0] / 8;
>
> get_roi(crtc, &roi_w, &roi_h);
>
> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
> index 776337f..992477d 100644
> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
> @@ -147,7 +147,7 @@ uint32_t mdp5_smp_calculate(struct mdp5_smp *smp,
> for (i = 0; i < nplanes; i++) {
> int n, fetch_stride, cpp;
>
> - cpp = info->cpp[i];
> + cpp = info->bpp[i] / 8;

Unless I missed something in your first patch, I don't think this
series is bisectable, ie. replacing cpp w/ bpp would cause everything
else not to compile. Looks like there was an alternative proposal on
the first patch, but if we do end up going this route, I think you
should add bpp in the first patch, and remove cpp in the last patch.
(And also probably sprinkle around WARN_ON(info->bpp[n] % 8) in places
were it is expected to be a multiple of 8)

BR,
-R


> fetch_stride = width * cpp / (i ? hsub : 1);
>
> n = DIV_ROUND_UP(fetch_stride * nlines, smp->blk_size);
> diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c
> index 5bcd5e5..4545fa1 100644
> --- a/drivers/gpu/drm/msm/msm_fb.c
> +++ b/drivers/gpu/drm/msm/msm_fb.c
> @@ -172,7 +172,7 @@ static struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
> unsigned int min_size;
>
> min_size = (height - 1) * mode_cmd->pitches[i]
> - + width * info->cpp[i]
> + + width * info->bpp[i] / 8
> + mode_cmd->offsets[i];
>
> if (bos[i]->size < min_size) {
> --
> 2.7.4
>
>
>