Received: by 10.223.185.116 with SMTP id b49csp1041190wrg; Wed, 21 Feb 2018 11:03:27 -0800 (PST) X-Google-Smtp-Source: AH8x225fLla2/TOE8M+I/z/5g4oayOZTosgtkdllv6HN/viJit/QQJTi2BQWBVDIWhxMfP0bU609 X-Received: by 2002:a17:902:5982:: with SMTP id p2-v6mr3862166pli.289.1519239807136; Wed, 21 Feb 2018 11:03:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519239807; cv=none; d=google.com; s=arc-20160816; b=JeYm5YNxbQX8egvqU+2ixqa2ALgjjb61AA2fQqQtjs9ohjstku6xbEsj1GMv+roYb1 1s3dB8rT57z46VBRK+DDashyqcKMDQnlW+Wlh3sBSPzw1HO2LhXaghQHaQNUYR8RkZcv 6aSXnFYck8w9mWfVkuy7GT1k8OwrzGSQccA9rfIhpKdtlz5j7GOnlc5l/CN6sAfXmcID NuppjRetWPeyrNoHmMGmJ/Pgv1k2gY9V6IZNbOSyi7KDu8hcldtSOMpJb7QfMaTPAfj3 zGjGhZ0nsH0mlAoEWIqVvmKMCEsrzWbSj7bEs2920bT7G//7jcLNGITXr1xS8m7BmjzM 3BBw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=rrelUTkZ8BQpMOlRd3n0PTm781uHg4mRKiOe+NwKcWU=; b=QF1ASmMkMAcANvGuJrT8RX06NveDgbSn0oNADmC3bYII6CS8FJ9qfchWHEgccQ/Smo IzuAMqG3Jco12bvaCsdbPhJZMAIoLbBWCEjGE1XcLbvPiLzTucBxoXVI+IKueqaiSjz4 Jn0eGNwoNLkF++3KRVSxQRpQd4UtGk4pm55WTntLSmZFHUWnqt5xPh74ACFKjlRxB0YK 2YetqnJwczfQ1w3s91/BPDSZABi9E36dlOwg5KLCYn3cBH4uXmeLyDV6g2BhI6Fzyath Y6hf0+L3OYsvCv+CbKPnkaKHybsI9tlTYSgS09wg4pwAKxd3padRIw3j29Gv3pKVTEBm MKVw== ARC-Authentication-Results: i=1; mx.google.com; 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 d65si1058462pfc.174.2018.02.21.11.03.12; Wed, 21 Feb 2018 11:03:27 -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; 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 S932537AbeBUQ2f (ORCPT + 99 others); Wed, 21 Feb 2018 11:28:35 -0500 Received: from lb2-smtp-cloud8.xs4all.net ([194.109.24.25]:41476 "EHLO lb2-smtp-cloud8.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932328AbeBUQ2d (ORCPT ); Wed, 21 Feb 2018 11:28:33 -0500 Received: from [192.168.2.10] ([212.251.195.8]) by smtp-cloud8.xs4all.net with ESMTPA id oXFrevdeiar0woXFveXfPQ; Wed, 21 Feb 2018 17:28:31 +0100 Subject: Re: [PATCH v9 11/11] media: i2c: ov7670: Fully set mbus frame fmt To: jacopo mondi , Laurent Pinchart Cc: Jacopo Mondi , magnus.damm@gmail.com, geert@glider.be, 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 References: <1519059584-30844-1-git-send-email-jacopo+renesas@jmondi.org> <1519059584-30844-12-git-send-email-jacopo+renesas@jmondi.org> <1963190.TI9O1pFqZp@avalon> <20180220085857.GC7203@w540> <20180221154712.GJ7203@w540> From: Hans Verkuil Message-ID: <287b38a5-d952-7600-2180-df08ab002b03@xs4all.nl> Date: Wed, 21 Feb 2018 17:28:27 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20180221154712.GJ7203@w540> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfO2GE4kV2s8ncU2rlI79soF2w9Ao5ZxFALm/6f+jcoYHZxB+vZtuauzWSUHdQB9aEvJOrsIh441hk3Sx1zfp3DH4BsNTU1AbOQh8IDTXy2eauYj0lehp zgfFzPK9PvGO9q/hMiCK81bu1wJl3eUZfnI1iPh9TkfCBTjRx2XY1KLPhGGMjdVaIeOUv6vkuQHDBbHKXPjx35ukbo5B85j+OT+TOe7cgGZb+ADztBl6S5qs T8daXWLv2bt9JTLrKWC4kPNuhhVmOpfL1OqbwTvoGNFlrbG0WzrbmnT6Xe8QJXyvCtZhrpsGdg5obQBvcrFTBU/ftnriCj8pe4z9N95h0d/F3vRUpv0ejG9p cjWBFk11HKE2N2ZKvbihMM1w2G8vA5lFbXE9bhBweObIbQIBqVhmrIYa6/Ay1vMt+2uAGTE/D8J5wZLAWJGLv1VCLrWQt/gRGU570QG6vDmjGlywYU+vIcgH OFZNU8kkgkXTZ38/GFv2taGE14EObibnYbchi62RUyRXHvIin/Lg2ZtTtv/lpola3UVNMEtN4VaK6qv/3L29ntA7UOp6jciBS4rI2pX1ObYlFO0Qeqak8rS8 yB0= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/21/2018 04:47 PM, jacopo mondi wrote: > Hello again, > > On Tue, Feb 20, 2018 at 09:58:57AM +0100, jacopo mondi wrote: >> Hi Laurent, >> >> On Mon, Feb 19, 2018 at 09:19:32PM +0200, Laurent Pinchart wrote: >>> Hi Jacopo, >>> >>> Thank you for the patch. >>> >>> 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.. >> > > What if I repropose this as separate patch not part of the CEU series > in order not to hold back v10 (which I hope will be the last CEU > iteration)? I would definitely be fine with that. We first need to define what exactly should be done by drivers. See also this thread: https://www.spinics.net/lists/linux-renesas-soc/msg23888.html I'll work on that going forward as part of the compliance tests. Regards, Hans > >> Thanks >> j >> >>>> info->format = *fmt; >>>> >>>> return 0; >>> >>> -- >>> Regards, >>> >>> Laurent Pinchart >>>