Hi Simon,

On Sun, Oct 11, 2026 at 11:09 PM Simon Glass <[email protected]> wrote:
>
> Hi Reza,
>
> On 2026-10-08T13:51:38, Reza Kurniawan <[email protected]> wrote:
> > video: use bpp conversion helpers consistently
> >
> > Use bpp conversion helpers for consistency and to reduce the
> > reliance on the specially crafted VIDEO_BPP* enum values. No
> > functional change is made.
>
> Thanks for doing this!
>
> Please can you name the helpers here (VNBYTES() and VNBITS() from
> video.h)? It would also help to say that VNBYTES() is only correct for
> 8bpp and above, and that every site converted here is 16bpp or 32bpp,
> which is why there is no functional change.
>
> >
> > Signed-off-by: Reza Kurniawan <[email protected]>
> >
> > cmd/bdinfo.c                           | 2 +-
> >  drivers/video/atmel_hlcdfb.c           | 2 +-
> >  drivers/video/imx/mxc_ipuv3_fb.c       | 2 +-
> >  drivers/video/meson/meson_vpu.c        | 4 ++--
> >  drivers/video/mvebu_lcd.c              | 2 +-
> >  drivers/video/sunxi/sunxi_de2.c        | 2 +-
> >  drivers/video/tegra/dc.c               | 4 ++--
> >  drivers/video/tegra/tegra124/display.c | 2 +-
> >  drivers/video/ti/tilcdc.c              | 4 ++--
> >  drivers/video/tidss/tidss_drv.c        | 4 ++--
> >  test/cmd/bdinfo.c                      | 2 +-
> >  11 files changed, 15 insertions(+), 15 deletions(-)
>
> > diff --git a/drivers/video/atmel_hlcdfb.c b/drivers/video/atmel_hlcdfb.c
> > @@ -315,7 +315,7 @@ static int atmel_hlcdc_bind(struct udevice *dev)
> >       uc_plat->size = LCD_MAX_WIDTH * LCD_MAX_HEIGHT *
> > -                             (1 << LCD_MAX_LOG2_BPP) / 8;
> > +                             VNBYTES(LCD_MAX_LOG2_BPP);
>
> The subject says 'consistently', but a few sites are not converted.
> atmel_fb_lcd_bind() in drivers/video/atmel_lcdfb.c has exactly the
> same pattern:

Thanks for pointing that out, I did miss some of them. I'll try to
look for more.

>
>     uc_plat->size = LCD_MAX_WIDTH * LCD_MAX_HEIGHT *
>             (1 << VIDEO_BPP16) / 8;
>
> The others I spotted:
>
>     drivers/video/sunxi/sunxi_de2.c:221  (1 << l2bpp) / 8
> (efi_add_memory_map() size)
>     boot/fdt_simplefb.c:62               xsize * (1 << bpix) / 8
>     drivers/video/video_bmp.c:322        1 << bpix             (VNBITS())

Is changing 1 << bpix appropriate in this case? Since bpix is already set to
VNBITS(priv->bpix), that bit shift shouldn't be aimed at calculating the bits
out of a log2 bpp. Should this be left out?

>
> Please can you convert these too, or say in the commit message why
> they are left out?
>
> Regards,
> Simon

Best regards,
Reza Kurniawan

Reply via email to