Received: by 10.223.176.46 with SMTP id f43csp931907wra; Fri, 19 Jan 2018 04:26:34 -0800 (PST) X-Google-Smtp-Source: ACJfBosWf2JKbCuNnOcp00Qqp55C/SXiCDXhk6HVatH2pCh8+UcvLu+bDYtYacxAVESD1JysVmoc X-Received: by 2002:a17:902:82cb:: with SMTP id u11-v6mr1541943plz.389.1516364793969; Fri, 19 Jan 2018 04:26:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516364793; cv=none; d=google.com; s=arc-20160816; b=METMdeKAawAh+nQ9ueOZreDhnlc+y1ekMXT2tvTYMeiC3ScuyUr7k8TgKc0ZZZknnV 1K5c4UsmyIAiPkyQo0yjyaYeLOJTYgO+uhev4mnLy17DzBzOUIYcNv1sR6K988Ay/Sy6 2NXI2m8UkSBzd1SXyr8aEqt1PfA/fZEU78HpqvtTH5G+px5bJl3F9mN1wGevfSsYKKJY 4NmbB3GfdlsPHZaPEEltmYp2W3zCxTPy8XbCAb7XcaecPlqUtLpZ5CNJuA2EijolE4zQ Jlh/09n/MJgOkRjytvRPHmJI4pdm2ByNCeyhZ6/zyjZRlHo/hEcUhzZ6IpwBgXI+Olje 4lcQ== 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=2Rzezjq7tz8OmcHvHRK5JmsyvmCb7SBEw4EL0cSre3M=; b=m9zteJRNh10SM6XzPWzXy0FO12zIfabuZfvsJ+tUT0reB7Q88eCK1GR4kGw23yINIZ I49pmKlZJ5Syxweock7QGE+s6guWrDa21gu3mFBKmUP6azgTDlNcj8IXoUTeUIWXZEW3 hZCZdsVtnGKCC0yxPOy8+GXmwwAunpiPtodPWEbRSWgczEQaui6OSNAtpUaLwDX6RTyV w/1zqdPvGqT/07EBYrs2BpVHIHpYqCh9kf/ZzgZIb6L2eaIk08Oy9fdx3pUGFZahbqI1 +gNgvJ5SlndWMvqfGWnrK2h4L7UrFoAHPAiUMU+5VA0MzzgYdOT6qiOVHaxnuILFbyJ1 PJeA== 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 d18si7976821pgo.43.2018.01.19.04.26.19; Fri, 19 Jan 2018 04:26:33 -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 S1755398AbeASMZv (ORCPT + 99 others); Fri, 19 Jan 2018 07:25:51 -0500 Received: from lb3-smtp-cloud9.xs4all.net ([194.109.24.30]:53404 "EHLO lb3-smtp-cloud9.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754104AbeASMZp (ORCPT ); Fri, 19 Jan 2018 07:25:45 -0500 Received: from [IPv6:2001:420:44c1:2579:7a24:afff:fed9:e375] ([IPv6:2001:420:44c1:2579:7a24:afff:fed9:e375]) by smtp-cloud9.xs4all.net with ESMTPA id cVjneJWVq6VzTcVjqebK0m; Fri, 19 Jan 2018 13:25:43 +0100 Subject: Re: [PATCH v6 3/9] v4l: platform: Add Renesas CEU driver To: 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: <1516139101-7835-1-git-send-email-jacopo+renesas@jmondi.org> <1516139101-7835-4-git-send-email-jacopo+renesas@jmondi.org> <2529707.jzkV7c2yGz@avalon> From: Hans Verkuil Message-ID: <4195ec6a-b99d-2fad-3898-9ce9c02fce00@xs4all.nl> Date: Fri, 19 Jan 2018 13:25:39 +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: <2529707.jzkV7c2yGz@avalon> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfNvqnKxW3bJUJKpYQf9j7VrHQSIGQe31VstYdWmmhZe0fxT8gfH55vi2KUEhHMRlJEBXCEVK5WJISyIVakInZISta/lWCoO6XxMd5GLB5WljC9CI1EEw 2Bhrqz4K84bvg+4E4voVtEjsM72jboplrmviwvwRTQ8RJXJoAG6QUjHmHaEtLPywMkFxDzoC3ySUdieyniF7/CPBf1RVl3NNtWCtj7f/jCSFoOCDFKe0JTOY IFVnIdorkioLtnF60T87UJyC5V1RVkKncEDHgbB86iEi2NLau4GrOyiKGiCM94fpeqLPU537iawYgtr2dbXlOAoBSwbk5p9oTlMeVVyDDMz85Eei+mJnEWmL a/bYf71h6L4S0pIZXeoN0dtAusyO2Kkx64gXkGNvNbUHIkUfX5ZPGTlpapTVRcuq4bsHbYRYWDcDU/+RvT0ilhjkIzPOkvKEISE3ddcksLUyfzyZw4nGZlz6 DL7GK0oQ2Zl20u+pYo6p6G6mrE9sgOM7Gxl7rdbRd4niKO/87eJL5Rsn5rniGb8rTqoWhazLTCZAcBilj7JjAm9Pa8WeG3JtEGaCfxRmPRlqkANt4aRKUMkZ TUAwMMfQYJ2uw9mZcdXJtf5BRFnrmet84J2jgnogDbhPsVouiTxIytrS9EW/ru/lJ2+FTUKNxGY7vOcmjit5n8rYbwCX1O4TPpMvvDiO/gZ6B/3PPCcVynJM TwfVCgOEZrotm0DzQ9upN5BnQvI4cxdHKp16fXJJanL0cnkHE5P6hRkYL+NQ0JffMW7FgN6Sm8loRhXw1Ms0pQncs61JebDy2ft0aQffRFmPR5fAhvq4Py6o pmxVaCbZfqkaTCTQgVibCfzId/V553LgAQUgx4SWiEOv5BHG9SH+WeUaVAUMICIJ3oSwHz6GPlnNYpGSrKEuqCI6ukol63QdV+qX3KrYWgsTaN/8LnLbKmTR oMXy9kcsj67LKmWrvQ2x788RqrkaY3sw/Jcz/BU7VHs8xfRH Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/19/18 13:20, Laurent Pinchart wrote: > Hi Hans, > > On Friday, 19 January 2018 13:20:19 EET Hans Verkuil wrote: >> On 01/16/18 22:44, Jacopo Mondi wrote: >>> Add driver for Renesas Capture Engine Unit (CEU). >>> >>> The CEU interface supports capturing 'data' (YUV422) and 'images' >>> (NV[12|21|16|61]). >>> >>> This driver aims to replace the soc_camera-based sh_mobile_ceu one. >>> >>> Tested with ov7670 camera sensor, providing YUYV_2X8 data on Renesas RZ >>> platform GR-Peach. >>> >>> Tested with ov7725 camera sensor on SH4 platform Migo-R. >>> >>> Signed-off-by: Jacopo Mondi >>> Reviewed-by: Laurent Pinchart >>> --- >>> >>> drivers/media/platform/Kconfig | 9 + >>> drivers/media/platform/Makefile | 1 + >>> drivers/media/platform/renesas-ceu.c | 1659 +++++++++++++++++++++++++++++ >>> 3 files changed, 1669 insertions(+) >>> create mode 100644 drivers/media/platform/renesas-ceu.c > > [snip] > >>> diff --git a/drivers/media/platform/renesas-ceu.c >>> b/drivers/media/platform/renesas-ceu.c new file mode 100644 >>> index 0000000..1b8f0ef >>> --- /dev/null >>> +++ b/drivers/media/platform/renesas-ceu.c > > [snip] > >>> +static void ceu_update_plane_sizes(struct v4l2_plane_pix_format *plane, >>> + unsigned int bpl, unsigned int szimage) >>> +{ >>> + if (plane->bytesperline < bpl) >>> + plane->bytesperline = bpl; >>> + if (plane->sizeimage < szimage) >>> + plane->sizeimage = szimage; >> >> As mentioned in your cover letter, you do need to check for invalid >> bytesperline values. The v4l2-compliance test is to see what happens >> when userspace gives insane values, so yes, drivers need to be able >> to handle that. > > What limit would you set, what is an acceptable large value versus an invalid > large value ? I think we should have rules for this at the API level (or at > least, if not part of the API, rules that are consistent across drivers). I would expect this to be the max of what the hardware can support. If that's really high, then this can be, say, 4 times the width. Note that there are very few drivers that can handle a user-specified stride. >> plane->sizeimage is set by the driver, so drop the 'if' before the >> assignment. > > I don't think that's correct. Userspace should be able to control padding > lines at the end of the image, the same way it controls padding pixels at the > end of lines. If userspace wants larger buffers, then it should use VIDIOC_CREATE_BUFS. sizeimage is exclusively set by the driver, applications rely on that. > >>> +} > > [snip] > >>> +static const struct v4l2_ioctl_ops ceu_ioctl_ops = { >>> + .vidioc_querycap = ceu_querycap, >>> + >>> + .vidioc_enum_fmt_vid_cap_mplane = ceu_enum_fmt_vid_cap, >>> + .vidioc_try_fmt_vid_cap_mplane = ceu_try_fmt_vid_cap, >>> + .vidioc_s_fmt_vid_cap_mplane = ceu_s_fmt_vid_cap, >>> + .vidioc_g_fmt_vid_cap_mplane = ceu_g_fmt_vid_cap, >>> + >>> + .vidioc_enum_input = ceu_enum_input, >>> + .vidioc_g_input = ceu_g_input, >>> + .vidioc_s_input = ceu_s_input, >>> + >>> + .vidioc_reqbufs = vb2_ioctl_reqbufs, >>> + .vidioc_querybuf = vb2_ioctl_querybuf, >>> + .vidioc_qbuf = vb2_ioctl_qbuf, >>> + .vidioc_expbuf = vb2_ioctl_expbuf, >>> + .vidioc_dqbuf = vb2_ioctl_dqbuf, >>> + .vidioc_create_bufs = vb2_ioctl_create_bufs, >>> + .vidioc_prepare_buf = vb2_ioctl_prepare_buf, >>> + .vidioc_streamon = vb2_ioctl_streamon, >>> + .vidioc_streamoff = vb2_ioctl_streamoff, >>> + >>> + .vidioc_g_parm = ceu_g_parm, >>> + .vidioc_s_parm = ceu_s_parm, >>> + .vidioc_enum_framesizes = ceu_enum_framesizes, >>> + .vidioc_enum_frameintervals = ceu_enum_frameintervals, >> >> You're missing these ioctls: >> >> .vidioc_log_status = v4l2_ctrl_log_status, > > Is log status mandatory ? No, but it doesn't hurt to add this one. It comes for free. > >> .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, >> .vidioc_unsubscribe_event = v4l2_event_unsubscribe, >> >> These missing _event ops are the reason for this compliance failure: >> >> fail: v4l2-test-controls.cpp(782): subscribe event for control 'User >> Controls' failed >>> +}; > > [snip] > Regards, Hans