Hi Tomi,

On Tue, Dec 6, 2022 at 2:44 PM Tomi Valkeinen
<tomi.valkeinen+rene...@ideasonboard.com> wrote:
> Add new pixel formats: XBGR2101010, ABGR2101010, BGRA1010102 and Y210.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+rene...@ideasonboard.com>

Thanks for your patch!

> --- a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c
> +++ b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c
> @@ -109,6 +109,56 @@ static void rpf_configure_stream(struct vsp1_entity 
> *entity,
>         vsp1_rpf_write(rpf, dlb, VI6_RPF_INFMT, infmt);
>         vsp1_rpf_write(rpf, dlb, VI6_RPF_DSWAP, fmtinfo->swap);
>
> +       if ((entity->vsp1->version & VI6_IP_VERSION_MODEL_MASK) == 
> VI6_IP_VERSION_MODEL_VSPD_GEN4) {
> +               u32 ext_infmt0;
> +               u32 ext_infmt1;
> +               u32 ext_infmt2;
> +
> +               switch (fmtinfo->fourcc) {
> +               case V4L2_PIX_FMT_XBGR2101010:
> +                       ext_infmt0 = VI6_RPF_EXT_INFMT0_BYPP_M1_RGB10;
> +                       ext_infmt1 = (0 << 24)  | (10 << 16) |
> +                                    (20 << 8)  | (30 << 0);

Introducing PACK_CPOS(a, b, c, d)...

> +                       ext_infmt2 = (10 << 24) | (10 << 16) |
> +                                    (10 << 8)  | (0 << 0);

... and PACK_CLEN(a, b, c, d) macros (or a single PACK4() macro)
can make this less error-prone.

> +                       break;
> +
> +               case V4L2_PIX_FMT_ABGR2101010:
> +                       ext_infmt0 = VI6_RPF_EXT_INFMT0_BYPP_M1_RGB10;
> +                       ext_infmt1 = (0 << 24)  | (10 << 16) |
> +                                    (20 << 8)  | (30 << 0);
> +                       ext_infmt2 = (10 << 24) | (10 << 16) |
> +                                    (10 << 8)  | (2 << 0);
> +                       break;
> +
> +               case V4L2_PIX_FMT_BGRA1010102:
> +                       ext_infmt0 = VI6_RPF_EXT_INFMT0_BYPP_M1_RGB10;
> +                       ext_infmt1 = (2 << 24)  | (12 << 16) |
> +                                    (22 << 8)  | (22 << 0);
> +                       ext_infmt2 = (10 << 24) | (10 << 16) |
> +                                    (10 << 8)  | (2 << 0);
> +                       break;
> +
> +               case V4L2_PIX_FMT_Y210:
> +                       ext_infmt0 = VI6_RPF_EXT_INFMT0_F2B_MSB |
> +                                    VI6_RPF_EXT_INFMT0_IPBD_Y_10 |
> +                                    VI6_RPF_EXT_INFMT0_IPBD_C_10;
> +                       ext_infmt1 = 0x0;
> +                       ext_infmt2 = 0x0;
> +                       break;
> +
> +               default:
> +                       ext_infmt0 = 0;
> +                       ext_infmt1 = 0;
> +                       ext_infmt2 = 0;
> +                       break;
> +               }
> +
> +               vsp1_rpf_write(rpf, dlb, VI6_RPF_EXT_INFMT0, ext_infmt0);
> +               vsp1_rpf_write(rpf, dlb, VI6_RPF_EXT_INFMT1, ext_infmt1);
> +               vsp1_rpf_write(rpf, dlb, VI6_RPF_EXT_INFMT2, ext_infmt2);
> +       }
> +

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Reply via email to