From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Eugen Hristev <ehristev@kernel.org>
Cc: Jai Luthra <jai.luthra@ideasonboard.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Hans Verkuil <hverkuil+cisco@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Maxime Ripard <mripard@redhat.com>,
Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>,
Ray Jui <rjui@broadcom.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Scott Branden <sbranden@broadcom.com>,
linux-media@vger.kernel.org,
linux-rpi-kernel@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: bcm2835-unicam: Fix pipeline wrong validation for unpacked formats
Date: Thu, 16 Jul 2026 11:12:40 +0300 [thread overview]
Message-ID: <20260716081240.GA1837346@killaraus.ideasonboard.com> (raw)
In-Reply-To: <bb075afb-56bf-4cea-9732-f2613feb88d1@kernel.org>
On Thu, Jul 16, 2026 at 10:22:03AM +0300, Eugen Hristev wrote:
> On 6/3/26 09:48, Jai Luthra wrote:
> > Quoting Eugen Hristev (2026-05-20 21:07:00)
> >> The commit
> >> 08f9794d9b79 ("media: bcm2835-unicam: Fix RGB format / mbus code association")
> >> introduced a check to see whether the format requested is the same as the
> >> fourcc in the format list.
> >>
> >> However, this breaks the case when userspace requested an unpacked fourcc,
> >> e.g. RG10.
> >>
> >> Unicam can work with or without unpacking pixels, e.g. pRAA or RG10, depending
> >> on what userspace requests.
> >> In the unpacking case, a dedicated register is being set.
> >>
> >> If the userspace requests pRAA, this works, because the check validates the
> >> pipeline:
> >>
> >> v4l2-ctl -d /dev/video0 --set-fmt-video=width=3280,height=2464,pixelformat=pRAA \
> >> --stream-mmap --stream-count=1 --stream-to=frame.raw
> >>
> >> but, with
> >> v4l2-ctl -d /dev/video0 --set-fmt-video=width=3280,height=2464,pixelformat=RG10 \
> >> --stream-mmap --stream-count=1 --stream-to=frame.raw
> >>
> >> unicam complains at validation level:
> >>
> >> image: format mismatch: 0x300f <=> RG10 little-endian (0x30314752)
> >>
> >> This should work, because MEDIA_BUS_FMT_SRGGB10_1X10 can be packed into either
> >> RG10 or pRAA depending on the packing register.
> >>
> >> To fix this, modified the condition check to also allow in the case when
> >> requested format (fmt->pixelformat) is equal to fmtinfo->unpacked_fourcc.
> >>
> >> Fixes: 08f9794d9b79 ("media: bcm2835-unicam: Fix RGB format / mbus code association")
> >> Signed-off-by: Eugen Hristev <ehristev@kernel.org>
> >> ---
> >> drivers/media/platform/broadcom/bcm2835-unicam.c | 3 ++-
> >> 1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/media/platform/broadcom/bcm2835-unicam.c b/drivers/media/platform/broadcom/bcm2835-unicam.c
> >> index 8d28ba0b59a3..cc7627e9a51a 100644
> >> --- a/drivers/media/platform/broadcom/bcm2835-unicam.c
> >> +++ b/drivers/media/platform/broadcom/bcm2835-unicam.c
> >> @@ -2158,7 +2158,8 @@ static int unicam_video_link_validate(struct media_link *link)
> >> * In order to allow the applications using the old behaviour to
> >> * run, let's accept the old combination, but warn about it.
> >> */
> >> - if (fmtinfo->fourcc != fmt->pixelformat) {
> >> + if (fmt->pixelformat != fmtinfo->fourcc &&
> >> + fmt->pixelformat != fmtinfo->unpacked_fourcc) {
> >> if ((fmt->pixelformat == V4L2_PIX_FMT_BGR24 &&
> >> format->code == MEDIA_BUS_FMT_BGR888_1X24) ||
> >> (fmt->pixelformat == V4L2_PIX_FMT_RGB24 &&
> >>
> >
> > Reviewed-by: Jai Luthra <jai.luthra@ideasonboard.com>
> >
>
> Hi Sakari,
>
> I saw you taking some of the patches on unicam, this one is the most
> important as all unpacked formats are basically broken for a very long
> time (months) and the patch is pending for quite some time.
>
> This should also go in stable as some older versions also affected.
The commit message should include
Cc: stable@vger.kernel.org
after the Fixes: tag. Sakari can likely add that when applying.
> >> ---
> >> base-commit: e98d21c170b01ddef366f023bbfcf6b31509fa83
> >> change-id: 20260520-bcmpi-2c4850314e21
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2026-07-16 8:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 15:37 [PATCH] media: bcm2835-unicam: Fix pipeline wrong validation for unpacked formats Eugen Hristev
2026-05-22 9:54 ` Dave Stevenson
2026-06-03 6:48 ` Jai Luthra
2026-07-16 7:22 ` Eugen Hristev
2026-07-16 8:12 ` Laurent Pinchart [this message]
2026-07-16 14:01 ` Sakari Ailus
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=20260716081240.GA1837346@killaraus.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=ehristev@kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=hverkuil+cisco@kernel.org \
--cc=jai.luthra@ideasonboard.com \
--cc=kernel-list@raspberrypi.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=mchehab@kernel.org \
--cc=mripard@redhat.com \
--cc=rjui@broadcom.com \
--cc=sakari.ailus@linux.intel.com \
--cc=sbranden@broadcom.com \
/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