From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5EE0FC7619A for ; Wed, 12 Apr 2023 13:14:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Dnjszs2FWiX+HBNeKxYSag7GNS67tD+C4na/IhF1/98=; b=sHIj/1HMmj4EKl S8nLEJVZ72HNxy8koNWPzWF9kQ0fgrAUxwtLSNS+2jF8+JjWJNQ2mK7jr5ldQbKD7SBfWKRwp3jMb 6snZ/oZFdNG9+UWvLmX+FE2u0B6/yGJKTik7gy99xq0+WQ8IjIfgHuDzufX48l4c78PR1SikcuTnd nVzWybOnB5ejqyQ8q0nTBQEHFOE6wm0McGAKUIz7FtFo7vvhI1jDjrKEwvuM5wVMZsY616SBtlVlv ksanLJ3w/Vp823vf1EGFPwlo2mic2An6mpKTDPW5XoH8yBij9XMjqkWntT1Rmxg1hzmqJFFD1ETcP Vx3v4lHTIDRMNpiQhu0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pmaI7-003I1m-17; Wed, 12 Apr 2023 13:13:39 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pmaI4-003HwC-0m for linux-arm-kernel@lists.infradead.org; Wed, 12 Apr 2023 13:13:38 +0000 Received: from pendragon.ideasonboard.com (133-32-181-51.west.xps.vectant.ne.jp [133.32.181.51]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3B0BE75B; Wed, 12 Apr 2023 15:13:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1681305209; bh=nWyYwUZl1VGRNabSRnZlJsBsl3HWSiDt1aFuE6cpMZ8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AdG9wA1VvQpC5iDs2T9UI8CZh1qTP3p7tjaCXDLnn837y/hVdq9nw8V5jyUvCdUME 0RGG8o9CwsfB4ovya56DMJtzm8dScDY2wJ2EVYpY7wnkrx1gmotNIu+OoO/SNU8rCN IwazTmZ8DPqtZrcQJlKvDk2JxqPNuk9UuJwCYQZ8= Date: Wed, 12 Apr 2023 16:13:41 +0300 From: Laurent Pinchart To: Alexander Stein Cc: Rui Miguel Silva , Mauro Carvalho Chehab , Shawn Guo , Sascha Hauer , Fabio Estevam , Pengutronix Kernel Team , NXP Linux Team , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 1/1] media: imx: imx7-media-csi: Set pixfmt field, width, height & sizeimage Message-ID: <20230412131341.GA30436@pendragon.ideasonboard.com> References: <20230406135637.257580-1-alexander.stein@ew.tq-group.com> <20230407022214.GE31272@pendragon.ideasonboard.com> <1934107.PYKUYFuaPT@steina-w> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1934107.PYKUYFuaPT@steina-w> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230412_061336_425176_B8819638 X-CRM114-Status: GOOD ( 40.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Alexander, On Tue, Apr 11, 2023 at 09:38:38AM +0200, Alexander Stein wrote: > Am Freitag, 7. April 2023, 04:22:14 CEST schrieb Laurent Pinchart: > > On Thu, Apr 06, 2023 at 03:56:37PM +0200, Alexander Stein wrote: > > > Fixes the following v4l2-comliance errors for VIDIOC_TRY_FMT: > > > * !pix.width || !pix.height > > > * !pix.sizeimage > > > * pix.field == V4L2_FIELD_ANY > > > > > > Signed-off-by: Alexander Stein > > > --- > > > This patch is based on [1] and fixes the last v4l2-compliance errors and > > > a 'WARN_ON(!plane_sizes[i])' in vb2_core_reqbufs(). > > > My platform: TQMa8MQML (imx8mm) + imx327lqr. > > > > > > The v4l2-compliance output: > > > --8<-- > > > v4l2-compliance 1.24.1-5010, 64 bits, 64-bit time_t > > > v4l2-compliance SHA: 8799081b1436 2023-02-24 17:03:58 > > > > > > Compliance test for imx-capture device /dev/video0: > > > > > > Driver Info: > > > Driver name : imx-capture > > > Card type : imx-capture > > > Bus info : platform:32e20000.csi > > > Driver version : 6.3.0 > > > Capabilities : 0xa4200001 > > > > > > Video Capture > > > I/O MC > > > Streaming > > > Extended Pix Format > > > Device Capabilities > > > > > > Device Caps : 0x24200001 > > > > > > Video Capture > > > I/O MC > > > Streaming > > > Extended Pix Format > > > > > > Media Driver Info: > > > Driver name : imx7-csi > > > Model : imx-media > > > Serial : > > > Bus info : platform:32e20000.csi > > > Media version : 6.3.0 > > > Hardware revision: 0x00000000 (0) > > > Driver version : 6.3.0 > > > > > > Interface Info: > > > ID : 0x03000006 > > > Type : V4L Video > > > > > > Entity Info: > > > ID : 0x00000004 (4) > > > Name : csi capture > > > Function : V4L2 I/O > > > Pad 0x01000005 : 0: Sink > > > > > > Link 0x02000008: from remote pad 0x1000003 of entity 'csi' > > > (Video Interface Bridge): Data, Enabled, Immutable> > > > Required ioctls: > > > test MC information (see 'Media Driver Info' above): OK > > > test VIDIOC_QUERYCAP: OK > > > test invalid ioctls: OK > > > > > > Allow for multiple opens: > > > test second /dev/video0 open: OK > > > test VIDIOC_QUERYCAP: OK > > > test VIDIOC_G/S_PRIORITY: OK > > > test for unlimited opens: OK > > > > > > Debug ioctls: > > > test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) > > > test VIDIOC_LOG_STATUS: OK (Not Supported) > > > > > > Input ioctls: > > > test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) > > > test VIDIOC_G/S_FREQUENCY: OK (Not Supported) > > > test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) > > > test VIDIOC_ENUMAUDIO: OK (Not Supported) > > > test VIDIOC_G/S/ENUMINPUT: OK > > > test VIDIOC_G/S_AUDIO: OK (Not Supported) > > > Inputs: 1 Audio Inputs: 0 Tuners: 0 > > > > > > Output ioctls: > > > test VIDIOC_G/S_MODULATOR: OK (Not Supported) > > > test VIDIOC_G/S_FREQUENCY: OK (Not Supported) > > > test VIDIOC_ENUMAUDOUT: OK (Not Supported) > > > test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) > > > test VIDIOC_G/S_AUDOUT: OK (Not Supported) > > > Outputs: 0 Audio Outputs: 0 Modulators: 0 > > > > > > Input/Output configuration ioctls: > > > test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) > > > test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) > > > test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) > > > test VIDIOC_G/S_EDID: OK (Not Supported) > > > > > > Control ioctls (Input 0): > > > test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported) > > > test VIDIOC_QUERYCTRL: OK (Not Supported) > > > test VIDIOC_G/S_CTRL: OK (Not Supported) > > > test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) > > > test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) > > > test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) > > > Standard Controls: 0 Private Controls: 0 > > > > > > Format ioctls (Input 0): > > > test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK > > > test VIDIOC_G/S_PARM: OK (Not Supported) > > > test VIDIOC_G_FBUF: OK (Not Supported) > > > test VIDIOC_G_FMT: OK > > > > > > fail: v4l2-test-formats.cpp(468): !pix.width || > > > !pix.height > > > > > > test VIDIOC_TRY_FMT: FAIL > > > > > > fail: v4l2-test-formats.cpp(468): !pix.width || > > > !pix.height > > > > > > test VIDIOC_S_FMT: FAIL > > > test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) > > > test Cropping: OK (Not Supported) > > > > > > fail: v4l2-test-formats.cpp(1726): !sel_padded.r.width || > > > !sel_padded.r.height fail: v4l2-test-formats.cpp(1778): > > > testBasicCompose(node, V4L2_BUF_TYPE_VIDEO_CAPTURE)> > > > test Composing: FAIL > > > test Scaling: OK > > > > > > Codec ioctls (Input 0): > > > test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) > > > test VIDIOC_G_ENC_INDEX: OK (Not Supported) > > > test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) > > > > > > Buffer ioctls (Input 0): > > > fail: v4l2-test-buffers.cpp(607): q.reqbufs(node, 1) > > > > > > test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL > > > > > > fail: v4l2-test-buffers.cpp(783): VIDIOC_EXPBUF is > > > supported, but the V4L2_MEMORY_MMAP support is missing or > > > malfunctioning. fail: v4l2-test-buffers.cpp(784): > > > VIDIOC_EXPBUF is supported, but the V4L2_MEMORY_MMAP > > > support is missing, probably due to earlier failing > > > format tests.> > > > test VIDIOC_EXPBUF: OK (Not Supported) > > > test Requests: OK (Not Supported) > > > > > > Total for imx-capture device /dev/video0: 46, Succeeded: 42, Failed: 4, > > > Warnings: 0 --8<-- > > > > > > Best regards, > > > Alexander > > > > > > [1] > > > https://lore.kernel.org/all/20230321072707.678039-1-alexander.stein@ew.tq > > > -group.com/> > > > drivers/media/platform/nxp/imx7-media-csi.c | 12 ++++++++++++ > > > 1 file changed, 12 insertions(+) > > > > > > diff --git a/drivers/media/platform/nxp/imx7-media-csi.c > > > b/drivers/media/platform/nxp/imx7-media-csi.c index > > > 389d7d88b341..1888559a6531 100644 > > > --- a/drivers/media/platform/nxp/imx7-media-csi.c > > > +++ b/drivers/media/platform/nxp/imx7-media-csi.c > > > @@ -1147,6 +1147,7 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format > > > *pixfmt,> > > > { > > > > > > struct v4l2_mbus_framefmt fmt_src; > > > const struct imx7_csi_pixfmt *cc; > > > > > > + unsigned int walign; > > > > > > /* > > > > > > * Find the pixel format, default to the first supported format if > not > > > > > > @@ -1175,6 +1176,17 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format > > > *pixfmt,> > > > v4l2_fill_mbus_format(&fmt_src, pixfmt, 0); > > > imx7_csi_mbus_fmt_to_pix_fmt(pixfmt, &fmt_src, cc); > > > > > > + if (cc->bpp == 8) > > > + walign = 8; > > > + else > > > + walign = 4; > > > + > > > + v4l_bound_align_image(&pixfmt->width, 1, 0xffff / (cc->bpp / 8), > walign, > > > + &pixfmt->height, 1, 0xffff, 1, 0); > > > + > > > + pixfmt->sizeimage = (cc->bpp * pixfmt->width * pixfmt->height) / > > > BITS_PER_BYTE; > > > > No need for parentheses, and I'd wrap the line. Or replace BITS_PER_BYTE > > with 8: > > > > pixfmt->sizeimage = pixfmt->width * pixfmt->height * cc->bpp / 8; > > > > which I think is as readable. > > Fine with me. Will change that. > > > You also need to handle bytesperline. > > I originally had a patch for that as well. But with some debugging output I > noticed this already has the correct value. But maybe this was just > coincidence and it actually needs to be set as well. > > > I'd go one step further, and get rid of imx7_csi_mbus_fmt_to_pix_fmt(). > > This is historical, there's no need to convert between mbus and pixel > > formats anymore. > > Okay, but that is an additional change. It could be, but it can also be done now, and have the side effect of fixing the V4L2 compliance failures :-) > > > + pixfmt->field = V4L2_FIELD_NONE; > > > > This should probably be moved to a separate patch. Interlaced format > > handling is broken, there's no IDMAC on i.MX7. The code comes from > > shared helpers with i.MX6 before the driver got destaged. > > The motivation for this patch came from the v4l2-compliance errors, so I > grouped setting missing properties into a single patch. It's not so much about > interlaced format, but an uninitialized pixfmt->field, so I would prefer > keeping them in a single patch. I understand, but fixing V4L2 compliance failures doesn't mean that everything should be done in a single patch. Silencing the failure related to the field without actually fixing field handling is a compliance test workaround, I don't like that much. Let's address the root cause, not the symptoms. > > > + > > > > > > if (compose) { > > > > > > compose->width = fmt_src.width; > > > compose->height = fmt_src.height; -- Regards, Laurent Pinchart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel