From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=213.167.242.64 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796209756; b=wSw6PjcjueUMHHEX9usONVHbRLTkvXGdsjP6q79bceW5LvAv0HuhB0T93PovKlHaa+z2 FPKBHXzc7aNRh9qWyWBVxFVWAk7/gdSydEZaW++3c41EjnKZgniEU/RkYHM0sajJsz0ez drfn0qhALFS6Q58YyqS9pX6MNEUWgRopQiGucXgWxgkp38IZXKxUiXPfrDGthzOKQN5sj ONSg93EpJlZYDbYNieeFq/1Zeli3bl3B9iOGucFrqEYQrWbi/KEpIbMi5CmuCQwxX62Dz H3tX4V97ZVEKqcAXbPy3ubX1A5VyrGtp6ePLjLTS/Z5i35QCmBFWGqftDKoWBoMN6Gw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796209756; h=DMARC-Filter:Received:DKIM-Signature:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=xQ8TxfBnlliXKA5YG/PeIXoGlUyrDDgoSOOcXOt1aEw=; b=SRVWEIV8mU7VU3Nn9k+P0+G8B+mX/6OmyNNTC+gS8nVrh1axGtMdMYiDvSXugRAZMHbR 1f9u1eF1t2n/Jn55fbUkMD/ET/y7nXRkm8QeDj+MiOx0toi31zxB/azOlcxtDlsx5xpNo 9m3zXX8jFMAnd/lI0odrrPgkzNdArRLRkMUmajpmyxBxqPS8XXp/huVi/sM8Ukci5t2JS Tl6n4mtJfWcAMxew9eV//OmoTfIwzu9h1hIWeDrqXVzVji1xDFcN3A9DuIQpfnCoec723 1e8iN9FUYsDXnm6K3VX0u/m0Yl8yUEoLvSv9CIISTGoCAhU+sSfar6w022rjsvqwCVA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass header.d=ideasonboard.com header.i=@ideasonboard.com header.a=rsa-sha256 header.s=mail header.b=pew2q5fC; arc=none smtp.remote-ip=213.167.242.64 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3076606A31A; Wed, 2 Dec 2026 11:09:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C3076606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.a=rsa-sha256 header.s=mail header.b=pew2q5fC Received: from ideasonboard.com (93-46-82-201.ip106.fastwebnet.it [93.46.82.201]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 136B34BB; Wed, 2 Dec 2026 12:06:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1796209595; bh=92UuuowocRB/+kLGZ77yoSMEZapH6HUeXIlw13FHNKM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pew2q5fCSBob1wvqMVBt9ql+M6czDA9bdC7fSJ3jOU9IlK9+3UB7fqRlJpSCxikqt LBgZXn3iZX60wntZrSIckJf6L2wG5OmR2KU+zTVrVvRxXRj+M2YLyl4R29DWss/14E jlGlQdb7YKg7B+LShR4PZuIvxRUhqcdoVWzWtTB0= Date: Wed, 2 Dec 2026 12:09:10 +0100 From: Jacopo Mondi To: =?utf-8?Q?Barnab=C3=A1s_P=C5=91cze?= , Hans Verkuil Cc: Niklas =?utf-8?Q?S=C3=B6derlund?= , Mauro Carvalho Chehab , Geert Uytterhoeven , Magnus Damm , Hans Verkuil , Lad Prabhakar , 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 Message-ID: References: <20261127102942.2208296-1-barnabas.pocze+renesas@ideasonboard.com> X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 > --- > > 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 > >