mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: "Barnabás Pőcze" <barnabas.pocze+renesas@ideasonboard.com>
Cc: 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: Mon, 30 Nov 2026 17:29:17 +0100	[thread overview]
Message-ID: <20261130162818.GD3157946@ragnatech.se> (raw)
In-Reply-To: <20261127102942.2208296-1-barnabas.pocze+renesas@ideasonboard.com>

Hi Barnabás,

Thanks for your work.

On 2026-11-27 11:29:42 +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.

I thin this works and it solves the issue,

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> 
> ---
>  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.
>  	 */
> -	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);
> -
> -	rvin_format_align(vin, pix);
>  }
>  
>  static int rvin_mc_try_fmt_vid_cap(struct file *file, void *priv,
> -- 
> 2.56.1
> 

-- 
Kind Regards,
Niklas Söderlund

      reply	other threads:[~2026-11-30 16:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 10:29 Barnabás Pőcze
2026-11-30 16:29 ` Niklas Söderlund [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=20261130162818.GD3157946@ragnatech.se \
    --to=niklas.soderlund@ragnatech.se \
    --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=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 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®