mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jai Luthra <jai.luthra@ideasonboard.com>
To: Florian Fainelli <florian.fainelli@broadcom.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Paul Elder <paul.elder@ideasonboard.com>,
	Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>,
	Tomasz Figa <tfiga@chromium.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	Naushir Patuck <naush@raspberrypi.com>,
	Stefan Wahren <wahrenst@gmx.net>,
	Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
	Daniel Scally <dan.scally@ideasonboard.com>,
	linux-media@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 4/9] platform/raspberrypi: vchiq-mmal: Support bayer and gray formats
Date: Thu, 10 Sep 2026 19:47:57 +0530	[thread overview]
Message-ID: <178904987755.11722.4550283822602391871@freya> (raw)
In-Reply-To: <178815780973.1005982.10544870677125118283@neptunite.rasen.tech>

Hi Paul,

Thank you for your review.

Quoting Paul Elder (2026-08-31 12:00:09)
> Quoting Jai Luthra (2026-07-17 20:04:19)
> > Raw camera sensors often send data as packed or unpacked bayer and gray
> > formats, which needs to be processed by the ISP.
> > 
> > Add macros to support bayer and gray format FOURCCs in the MMAL layer.
> > 
> > Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
> > ---
> >  include/linux/raspberrypi/mmal-encodings.h | 64 ++++++++++++++++++++++++++++++
> >  1 file changed, 64 insertions(+)
> > 
> > diff --git a/include/linux/raspberrypi/mmal-encodings.h b/include/linux/raspberrypi/mmal-encodings.h
> > index eadf2e981408..1e13ebbaebf6 100644
> > --- a/include/linux/raspberrypi/mmal-encodings.h
> > +++ b/include/linux/raspberrypi/mmal-encodings.h
> > @@ -69,6 +69,70 @@
> >   */
> >  #define MMAL_ENCODING_OPAQUE           MMAL_FOURCC('O', 'P', 'Q', 'V')
> >  
> > +/**
> > + * Bayer formats
> > + * FourCC values copied from V4L2 where defined.
> 
> Is this matching a requirement? I've noticed that 12-bit packed and SBGGR16
> don't match the v4l2 fourcc, but the ones that you defined are nicer.
> 

I believe these are what the VC4 firmware expects as the fourcc values. I
don't know the historic reason why these were chosen, but we do use
standard v4l2 fourcc here when dealing with userspace applications.

I don't know if it's worth it to change these to match V4L2 fourcc,
especially because we want to avoid breaking changes to the firmware.

Thanks,
Jai

> 
> Paul
> 
> > + */
> > +/* 8 bit per pixel Bayer formats. */
> > +#define MMAL_ENCODING_BAYER_SBGGR8     MMAL_FOURCC('B', 'A', '8', '1')
> > +#define MMAL_ENCODING_BAYER_SGBRG8     MMAL_FOURCC('G', 'B', 'R', 'G')
> > +#define MMAL_ENCODING_BAYER_SGRBG8     MMAL_FOURCC('G', 'R', 'B', 'G')
> > +#define MMAL_ENCODING_BAYER_SRGGB8     MMAL_FOURCC('R', 'G', 'G', 'B')
> > +
> > +/* 10 bit per pixel packed Bayer formats. */
> > +#define MMAL_ENCODING_BAYER_SBGGR10P   MMAL_FOURCC('p', 'B', 'A', 'A')
> > +#define MMAL_ENCODING_BAYER_SGRBG10P   MMAL_FOURCC('p', 'g', 'A', 'A')
> > +#define MMAL_ENCODING_BAYER_SGBRG10P   MMAL_FOURCC('p', 'G', 'A', 'A')
> > +#define MMAL_ENCODING_BAYER_SRGGB10P   MMAL_FOURCC('p', 'R', 'A', 'A')
> > +
> > +/* 12 bit per pixel packed Bayer formats. */
> > +#define MMAL_ENCODING_BAYER_SBGGR12P   MMAL_FOURCC('p', 'B', '1', '2')
> > +#define MMAL_ENCODING_BAYER_SGRBG12P   MMAL_FOURCC('p', 'g', '1', '2')
> > +#define MMAL_ENCODING_BAYER_SGBRG12P   MMAL_FOURCC('p', 'G', '1', '2')
> > +#define MMAL_ENCODING_BAYER_SRGGB12P   MMAL_FOURCC('p', 'R', '1', '2')
> > +
> > +/* 14 bit per pixel packed Bayer formats. */
> > +#define MMAL_ENCODING_BAYER_SBGGR14P   MMAL_FOURCC('p', 'B', 'E', 'E')
> > +#define MMAL_ENCODING_BAYER_SGBRG14P   MMAL_FOURCC('p', 'G', 'E', 'E')
> > +#define MMAL_ENCODING_BAYER_SGRBG14P   MMAL_FOURCC('p', 'g', 'E', 'E')
> > +#define MMAL_ENCODING_BAYER_SRGGB14P   MMAL_FOURCC('p', 'R', 'E', 'E')
> > +
> > +/* 16 bit per pixel Bayer formats. */
> > +#define MMAL_ENCODING_BAYER_SBGGR16    MMAL_FOURCC('B', 'G', '1', '6')
> > +#define MMAL_ENCODING_BAYER_SGBRG16    MMAL_FOURCC('G', 'B', '1', '6')
> > +#define MMAL_ENCODING_BAYER_SGRBG16    MMAL_FOURCC('G', 'R', '1', '6')
> > +#define MMAL_ENCODING_BAYER_SRGGB16    MMAL_FOURCC('R', 'G', '1', '6')
> > +
> > +/* 10 bit per pixel unpacked (16bit) Bayer formats. */
> > +#define MMAL_ENCODING_BAYER_SBGGR10    MMAL_FOURCC('B', 'G', '1', '0')
> > +#define MMAL_ENCODING_BAYER_SGRBG10    MMAL_FOURCC('B', 'A', '1', '0')
> > +#define MMAL_ENCODING_BAYER_SGBRG10    MMAL_FOURCC('G', 'B', '1', '0')
> > +#define MMAL_ENCODING_BAYER_SRGGB10    MMAL_FOURCC('R', 'G', '1', '0')
> > +
> > +/* 12 bit per pixel unpacked (16bit) Bayer formats */
> > +#define MMAL_ENCODING_BAYER_SBGGR12    MMAL_FOURCC('B', 'G', '1', '2')
> > +#define MMAL_ENCODING_BAYER_SGRBG12    MMAL_FOURCC('B', 'A', '1', '2')
> > +#define MMAL_ENCODING_BAYER_SGBRG12    MMAL_FOURCC('G', 'B', '1', '2')
> > +#define MMAL_ENCODING_BAYER_SRGGB12    MMAL_FOURCC('R', 'G', '1', '2')
> > +
> > +/* 14 bit per pixel unpacked (16bit) Bayer formats */
> > +#define MMAL_ENCODING_BAYER_SBGGR14    MMAL_FOURCC('B', 'G', '1', '4')
> > +#define MMAL_ENCODING_BAYER_SGBRG14    MMAL_FOURCC('G', 'B', '1', '4')
> > +#define MMAL_ENCODING_BAYER_SGRBG14    MMAL_FOURCC('G', 'R', '1', '4')
> > +#define MMAL_ENCODING_BAYER_SRGGB14    MMAL_FOURCC('R', 'G', '1', '4')
> > +
> > +/* MIPI packed monochrome images */
> > +#define MMAL_ENCODING_GREY    MMAL_FOURCC('G', 'R', 'E', 'Y')
> > +#define MMAL_ENCODING_Y10P    MMAL_FOURCC('Y', '1', '0', 'P')
> > +#define MMAL_ENCODING_Y12P    MMAL_FOURCC('Y', '1', '2', 'P')
> > +#define MMAL_ENCODING_Y14P    MMAL_FOURCC('Y', '1', '4', 'P')
> > +#define MMAL_ENCODING_Y16     MMAL_FOURCC('Y', '1', '6', ' ')
> > +
> > +/* Unpacked monochrome formats (16bit per sample, but only N LSBs used) */
> > +#define MMAL_ENCODING_Y10     MMAL_FOURCC('Y', '1', '0', ' ')
> > +#define MMAL_ENCODING_Y12     MMAL_FOURCC('Y', '1', '2', ' ')
> > +#define MMAL_ENCODING_Y14     MMAL_FOURCC('Y', '1', '4', ' ')
> > +
> >  /** An EGL image handle
> >   */
> >  #define MMAL_ENCODING_EGL_IMAGE        MMAL_FOURCC('E', 'G', 'L', 'I')
> > 
> > -- 
> > 2.54.0
> > 
> >

  reply	other threads:[~2026-09-10 14:18 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 11:04 [PATCH v3 0/9] media: Add support for Broadcom/RPi BCM2835 ISP Jai Luthra
2026-07-17 11:04 ` [PATCH v3 1/9] platform/raspberrypi: vchiq-mmal: Include missing headers Jai Luthra
2026-08-31  5:37   ` Paul Elder
2026-07-17 11:04 ` [PATCH v3 2/9] platform/raspberrypi: vchiq-mmal: Move headers to include/linux Jai Luthra
2026-08-31  5:45   ` Paul Elder
2026-07-17 11:04 ` [PATCH v3 3/9] platform/raspberrypi: vchiq-mmal: Support ISP parameters and stats Jai Luthra
2026-08-31  6:29   ` Paul Elder
2026-07-17 11:04 ` [PATCH v3 4/9] platform/raspberrypi: vchiq-mmal: Support bayer and gray formats Jai Luthra
2026-08-31  6:30   ` Paul Elder
2026-09-10 14:17     ` Jai Luthra [this message]
2026-09-10 16:46       ` Dave Stevenson
2026-07-17 11:04 ` [PATCH v3 5/9] platform/raspberrypi: vchiq: Add helpers for vchiq driver data Jai Luthra
2026-08-31  6:40   ` Paul Elder
2026-07-17 11:04 ` [PATCH v3 6/9] media: videobuf2: Allow exporting of a struct dmabuf Jai Luthra
2026-08-31  6:55   ` Paul Elder
2026-09-10 14:29     ` Jai Luthra
2026-09-10 15:04   ` Laurent Pinchart
2026-07-17 11:04 ` [PATCH v3 7/9] media: platform: broadcom: Move unicam driver to subdir Jai Luthra
2026-07-17 11:36   ` Jai Luthra
2026-08-31  6:27     ` Paul Elder
2026-07-17 11:04 ` [PATCH v3 8/9] media: platform: broadcom: Add bcm2835-isp driver Jai Luthra
2026-09-04  9:17   ` Paul Elder
2026-09-16  7:53     ` Jai Luthra
2026-07-17 11:04 ` [PATCH v3 9/9] platform/raspberrypi: vchiq: Load bcm2835_isp driver from vchiq Jai Luthra
2026-09-04  9:18   ` Paul Elder
2026-08-31  5:42 ` [PATCH v3 0/9] media: Add support for Broadcom/RPi BCM2835 ISP Paul Elder

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=178904987755.11722.4550283822602391871@freya \
    --to=jai.luthra@ideasonboard.com \
    --cc=dan.scally@ideasonboard.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=kernel-list@raspberrypi.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@kernel.org \
    --cc=naush@raspberrypi.com \
    --cc=paul.elder@ideasonboard.com \
    --cc=tfiga@chromium.org \
    --cc=wahrenst@gmx.net \
    /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®