From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
To: "Barnabás Pőcze" <barnabas.pocze+renesas@ideasonboard.com>,
"Hans Verkuil" <hverkuil@kernel.org>
Cc: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Magnus Damm" <magnus.damm@gmail.com>,
"Hans Verkuil" <hverkuil@kernel.org>,
"Lad Prabhakar" <prabhakar.mahadev-lad.rj@bp.renesas.com>,
linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v1] media: rcar-vin: Use V4L2_COLORSPACE_RAW for raw formats
Date: Wed, 2 Dec 2026 12:09:10 +0100 [thread overview]
Message-ID: <aw_7VsErgk379Epz@zed> (raw)
In-Reply-To: <20261127102942.2208296-1-barnabas.pocze+renesas@ideasonboard.com>
Hi Barnabás
On Fri, Nov 27, 2026 at 11:29:42AM +0100, Barnabás Pőcze wrote:
> In `rvin_mc_try_format()`, `RVIN_DEFAULT_COLORSPACE` is used unconditionally.
> That corresponds to the SRGB color space. However, this is reported even for
> raw formats, where `V4L2_COLORSPACE_RAW` would be a better fit.
>
> So check if the adjusted pixel format has bayer encoding and if so, report
> the raw color space, otherwise fall back to `RVIN_DEFAULT_COLORSPACE`.
>
> Fixes: e87c1a81f158d ("media: rcar-vin: Add support for MEDIA_BUS_FMT_SRGGB8_1X8 format")
> Signed-off-by: Barnabás Pőcze <barnabas.pocze+renesas@ideasonboard.com>
> ---
>
> This is an RFC because this approach feels a bit ad-hoc, and while it solves the
> issue at hand, maybe there is a better solution.
>
> ---
> drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c b/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c
> index 4961d28f42c78..28573c0bde863 100644
> --- a/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c
> @@ -543,19 +543,23 @@ static int rvin_subscribe_event(struct v4l2_fh *fh,
> static void rvin_mc_try_format(struct rvin_dev *vin,
> struct v4l2_pix_format *pix)
> {
> + rvin_format_align(vin, pix);
> +
> /*
> * The V4L2 specification clearly documents the colorspace fields
> * as being set by drivers for capture devices. Using the values
> * supplied by userspace thus wouldn't comply with the API. Until
> * the API is updated force fixed values.
> */
Does this comment apply for bayer formats ?
Should it be moved in the else{} branch, or even be simplified to say
that if not raw we apply SRGB unconditionally ?
> - pix->colorspace = RVIN_DEFAULT_COLORSPACE;
> + if (v4l2_is_format_bayer(v4l2_format_info(pix->pixelformat)))
> + pix->colorspace = V4L2_COLORSPACE_RAW;
> + else
> + pix->colorspace = RVIN_DEFAULT_COLORSPACE;
> +
> pix->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(pix->colorspace);
> pix->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(pix->colorspace);
> pix->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(true, pix->colorspace,
> pix->ycbcr_enc);
These give
V4L2_XFER_FUNC_NONE
V4L2_YCBCR_ENC_601
V4L2_QUANTIZATION_FULL_RANGE
for V4L2_COLORSPACE_RAW, which aligns with was is done for drivers
using RAW
To me the patch looks good, with maybe an updated comment, we can
possibly sneak it in for v7.5 ? (Hans in cc)
Thanks
j
> -
> - rvin_format_align(vin, pix);
> }
>
> static int rvin_mc_try_fmt_vid_cap(struct file *file, void *priv,
> --
> 2.56.1
>
>
prev parent reply other threads:[~2026-12-02 11:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 10:29 [RFC PATCH v1] media: rcar-vin: Use V4L2_COLORSPACE_RAW for raw formats Barnabás Pőcze
2026-11-30 16:29 ` Niklas Söderlund
2026-12-02 11:09 ` Jacopo Mondi [this message]
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=aw_7VsErgk379Epz@zed \
--to=jacopo.mondi@ideasonboard.com \
--cc=barnabas.pocze+renesas@ideasonboard.com \
--cc=geert+renesas@glider.be \
--cc=hverkuil@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mchehab@kernel.org \
--cc=niklas.soderlund@ragnatech.se \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.