Received: by 10.223.185.116 with SMTP id b49csp1121097wrg; Wed, 21 Feb 2018 12:28:55 -0800 (PST) X-Google-Smtp-Source: AH8x2253AwqG2C9D8JddmuojxBFGWGj1cIYV6zeVednjAQM0MF4oOCsQQGIzz2PnnBgrKYoyjc9e X-Received: by 2002:a17:902:900b:: with SMTP id a11-v6mr4221322plp.249.1519244935594; Wed, 21 Feb 2018 12:28:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519244935; cv=none; d=google.com; s=arc-20160816; b=s0W0rTLaJmyVuWdpQShOlAX9FQHIeR6eHIbXDbB0YPwqXFK/mNRKwvre+uuvHlnL8w r27eM5a3ME4vEOxU40KzCZGU0Kz8LKHRiuvI4bfUCn8es63AwX0oKhW7bCWSceo4hK4v RUdgDIgp/wMUmQN1n1HUQUAKqmj3UENlal/f4gmqNLgYkU3UMys7ohXVTd980E2EqV98 R9UaFyn33X7THIC2gvDSRt/4jTz1RHNI+sD1CJY419JB6OF146OQjlY8tkvHRz21y+vu Oe+w/K4+HT8P1x0dZFJQiNmX92Hz1MF1joFOg/j7toQMLsvZlrAMbsCScIM/TlXqUvBp kTLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=b50Cndj4n1DAMFDj+2+kp8+4Tz+9b5nBFQbuSpcTUDY=; b=VXpkrYNhywDv0cKT5n1s9ESnaST81erK3LuQLCZia/PUdPMymrSq92MrwFLPLIsGJa eyY3oAVvum/456S/x3jzvJa0pbZ0mEZXhSokY4Mc8PJWQX4NMyVM0T46f7WBzlEPJ7WE qzQdWR0aCtJLBGe+YlMcgOZdlyVUMPphXVrwLrVeev67X770wRvpKP9x6NvbOaRk0KjY h8myOYRLS1hqAusaBI1xWryr79wYvK+vKf3F0OkK68sY2APUPajoIsDiw3XZ31OgjdmY qA+68og0nPDchO2rEIIpX4G1sMTsUv9eDYQN5vvqKmjxrphuW4SfUumdhh98RJgX4c3M pM0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=a+JSAuX8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g9-v6si441635pli.676.2018.02.21.12.28.41; Wed, 21 Feb 2018 12:28:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=a+JSAuX8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751410AbeBUU10 (ORCPT + 99 others); Wed, 21 Feb 2018 15:27:26 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:52794 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751329AbeBUU1Y (ORCPT ); Wed, 21 Feb 2018 15:27:24 -0500 Received: from avalon.localnet (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id 8C40E200BF; Wed, 21 Feb 2018 21:25:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1519244740; bh=hrSYTY1NikeEoN+L4YDixwsYTMmF/urMxTbOZSGhuI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a+JSAuX85NIAih0s/kpZ4mYm4U7oZ8hvRLW+h02oXMmQCFc67vXPV5FTW3+NZxOEN OE103fgMsyzigAgBQZxRRe+3F9pEjWvu20/WI/8fcOaRUwXGRhT3a+DAJ7zmPzY82Q RbyLwmHntHxYWSnmDZDmlIq2j7AXNBblOnl4zNKg= From: Laurent Pinchart To: jacopo mondi Cc: Jacopo Mondi , magnus.damm@gmail.com, geert@glider.be, hverkuil@xs4all.nl, mchehab@kernel.org, festevam@gmail.com, sakari.ailus@iki.fi, robh+dt@kernel.org, mark.rutland@arm.com, pombredanne@nexb.com, linux-renesas-soc@vger.kernel.org, linux-media@vger.kernel.org, linux-sh@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v9 11/11] media: i2c: ov7670: Fully set mbus frame fmt Date: Wed, 21 Feb 2018 22:28:06 +0200 Message-ID: <56271779.hLAmkO6BAC@avalon> Organization: Ideas on Board Oy In-Reply-To: <20180220085857.GC7203@w540> References: <1519059584-30844-1-git-send-email-jacopo+renesas@jmondi.org> <1963190.TI9O1pFqZp@avalon> <20180220085857.GC7203@w540> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jacopo, On Tuesday, 20 February 2018 10:58:57 EET jacopo mondi wrote: > On Mon, Feb 19, 2018 at 09:19:32PM +0200, Laurent Pinchart wrote: > > On Monday, 19 February 2018 18:59:44 EET Jacopo Mondi wrote: > >> The sensor driver sets mbus format colorspace information and sizes, > >> but not ycbcr encoding, quantization and xfer function. When supplied > >> with an badly initialized mbus frame format structure, those fields > >> need to be set explicitly not to leave them uninitialized. This is > >> tested by v4l2-compliance, which supplies a mbus format description > >> structure and checks for all fields to be properly set. > >> > >> Without this commit, v4l2-compliance fails when testing formats with: > >> fail: v4l2-test-formats.cpp(335): ycbcr_enc >= 0xff > >> > >> Signed-off-by: Jacopo Mondi > >> --- > >> > >> drivers/media/i2c/ov7670.c | 4 ++++ > >> 1 file changed, 4 insertions(+) > >> > >> diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c > >> index 25b26d4..61c472e 100644 > >> --- a/drivers/media/i2c/ov7670.c > >> +++ b/drivers/media/i2c/ov7670.c > >> @@ -996,6 +996,10 @@ static int ov7670_try_fmt_internal(struct > >> v4l2_subdev > >> *sd, fmt->height = wsize->height; > >> > >> fmt->colorspace = ov7670_formats[index].colorspace; > > > > On a side note, if I'm not mistaken the colorspace field is set to SRGB > > for all entries. Shouldn't you hardcode it here and remove the field ? > > > >> + fmt->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; > >> + fmt->quantization = V4L2_QUANTIZATION_DEFAULT; > >> + fmt->xfer_func = V4L2_XFER_FUNC_DEFAULT; > > > > How about setting the values explicitly instead of relying on defaults ? > > That would be V4L2_YCBCR_ENC_601, V4L2_QUANTIZATION_LIM_RANGE and > > V4L2_XFER_FUNC_SRGB. And could you then check a captured frame to see if > > the sensor outputs limited or full range ? > > This actually makes me wonder if those informations (ycbcb_enc, > quantization and xfer_func) shouldn't actually be part of the > supported format list... I blindly added those default fields in the > try_fmt function, but I doubt they applies to all supported formats. > > Eg. the sensor supports YUYV as well as 2 RGB encodings (RGB444 and > RGB 565) and 1 raw format (BGGR). I now have a question here: > > 1) ycbcr_enc transforms non-linear R'G'B' to Y'CbCr: does this > applies to RGB and raw formats? I don't think so, and what value is > the correct one for the ycbcr_enc field in this case? I assume > xfer_func and quantization applies to all formats instead.. There's no encoding for RGB formats if I understand things correctly, so I'd set ycbcr_enc to V4L2_YCBCR_ENC_DEFAULT. The transfer function and the quantization apply to all formats, but I'd be surprised to find a sensor outputting limited range for RGB. Have you been able to check whether the sensor outputs limited range of full range YUV ? If it outputs full range you can hardcode quantization to V4L2_QUANTIZATION_FULL_RANGE for all formats. > >> info->format = *fmt; > >> > >> return 0; -- Regards, Laurent Pinchart