From patchwork Thu Jan 4 17:57:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Harvey X-Patchwork-Id: 10145305 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4C7C3602A0 for ; Thu, 4 Jan 2018 17:57:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58DD128811 for ; Thu, 4 Jan 2018 17:57:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DAC728817; Thu, 4 Jan 2018 17:57:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8934128813 for ; Thu, 4 Jan 2018 17:57:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752479AbeADR5f (ORCPT ); Thu, 4 Jan 2018 12:57:35 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:34820 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752263AbeADR5e (ORCPT ); Thu, 4 Jan 2018 12:57:34 -0500 Received: by mail-wm0-f42.google.com with SMTP id a79so4852057wma.0 for ; Thu, 04 Jan 2018 09:57:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gateworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=mLqaQUzlss9o7cSLL8Gktv8CUqVJ73zVsYAwO6yjAds=; b=yN2lZ7nfp2GpabByP7giB7k1z9Zr6Wpz3j5eLTWJU+DKrtW84RgubhGt6CZorBU3xB mvQiNzPbtpXVkR49hp0Vd/w8sSuSyUrzrW7wW8PCJiOx1A+dmhfn6ZjDc1A949Dc1d6l ln0D6ZxT0kSteMnPBmfuw/qjH7Mc9Bq839BRs8si+IZVABRYH2ojiNy7DFURXuP1v3mj nIR3ccnb43Tz12R5NzN3JOKtZqPmwuRMkBDuuwZNNROjVYaZVhOd3yGLtjfNjow8GSop kw7IYhAe3Mqju4zX+GJ7EEweO7jE8pS0VoFsrgmhUXhW7Fk/eaO5LC5z0ffqgjoOcnK8 S+ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=mLqaQUzlss9o7cSLL8Gktv8CUqVJ73zVsYAwO6yjAds=; b=f2JmKcuE4tQNIr7rJi6JpUmCEQYdQmqZ77T3ziiaYs3/494R0/VDKMZI/mhn4Dqh/M +SJ74P6qtMS8/pLKK8ygVo/8b50q98b/hGU04BAJLAxaiAkDA6hYUf68PmRK7nP3pUEk 7FogX0jV/+C3MtBjFHy5Z/d09lFNX6Xm6/epfn1jvYA1hnSbR3LzKWERJ8R9T99JhSDw xgyrieXDIE2PAEEBr57LJjlCIAbW2fC96jDVxyd7JjhfG+EzekXbAo2QyeKrOPdOnBKr iz1kx01EkfEgjMWz1YzztQtQjxKpkiJzWO430gNnKLfDMmwJ+86wU6+sBGCANGh7fZxO UJoA== X-Gm-Message-State: AKGB3mJMikLTToKEnuCRGULzeHrjEVG52qrLe+snCfgDX7RxDNGmTnHl l1V6mlzdx8/5sxiIy4b0iWGeblhYCA2zBJy3GkeEpQ== X-Google-Smtp-Source: ACJfBotPk4dPITuv8XUjq29TmEFQdqZ8Jrui95czEQq94xDV20QvTiye8pkxJWZiCpislL0qfIxzhmpe5ZpoEoZGxus= X-Received: by 10.28.14.133 with SMTP id 127mr210461wmo.152.1515088652740; Thu, 04 Jan 2018 09:57:32 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.56.2 with HTTP; Thu, 4 Jan 2018 09:57:31 -0800 (PST) In-Reply-To: <76a1cd63-7338-7f23-6228-5dc4db276b23@gmail.com> References: <76a1cd63-7338-7f23-6228-5dc4db276b23@gmail.com> From: Tim Harvey Date: Thu, 4 Jan 2018 09:57:31 -0800 Message-ID: Subject: Re: IMX6 interlaced capture To: Steve Longerbeam Cc: Hans Verkuil , linux-media Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Jan 2, 2018 at 6:00 PM, Steve Longerbeam wrote: > Hi Tim, > > Happy New Year! And pardon the delay. > > > On 12/28/2017 01:56 PM, Tim Harvey wrote: >> >> Steve/Hans, >> >> I'm trying to get interlaced capture working with the TDA1997x driver >> I've been working on which is connected to an IMX6 CSI. >> >> The particular board I'm currently testing on is an IMX6Q which has >> both a TDA19971 HDMI receiver as well as an ADV7180 analog video >> decoder. The media-ctl topology for this board can be found at >> http://dev.gateworks.com/docs/linux/media/imx6q-gw54xx-media.png. >> >> For adv7180 everything appears to be working as expected: >> - media-ctl --get-v4l2 '"adv7180 2-0020":0' shows: >> [fmt:UYVY8_2X8/720x480 field:interlaced colorspace:smpte170m] >> - he following captures/streams from the adv7180 using the vdic to >> de-interlace: >> media-ctl --link "adv7180 2-0020":0 -> "ipu2_csi1_mux":1[1] >> media-ctl --link "ipu2_csi1_mux":2 -> "ipu2_csi1":0[1] >> media-ctl --link "ipu2_csi1":1 -> "ipu2_vdic":0[1] >> media-ctl --link "ipu2_vdic":2 -> "ipu2_ic_prp":0[1] >> media-ctl --link "ipu2_ic_prp":2 -> "ipu2_ic_prpvf":0[1] >> media-ctl --link "ipu2_ic_prpvf":1 -> "ipu2_ic_prpvf capture":0[1] >> media-ctl --set-v4l2 'adv7180 2-0020':0 [fmt:UYVY2X8/720x480] >> media-ctl --set-v4l2 'ipu2_csi1_mux':2 [fmt:UYVY2X8/720x480 >> field:interlaced] >> media-ctl --set-v4l2 'ipu2_csi1':1 [fmt:UYVY2X8/720x480 field:interlaced] >> media-ctl --set-v4l2 'ipu2_vdic':2 [fmt:UYVY2X8/720x480 field:interlaced] >> media-ctl --set-v4l2 'ipu2_ic_prp':2 [fmt:UYVY2X8/720x480 field:none] >> media-ctl --set-v4l2 'ipu2_ic_prpvf':1 [fmt:UYVY2X8/720x480 field:none] >> v4l2-ctl -d /dev/video3 >> --set-fmt-video=width=720,height=480,pixelformat=UYVY >> # capture 1 frame >> v4l2-ctl -d /dev/video1 --stream-mmap --stream-skip=1 >> --stream-to=/tmp/x.raw --stream-count=1 >> # stream jpeg/rtp >> gst-launch-1.0 v4l2src device=/dev/video3 ! >> "video/x-raw,width=720,height=480,format=UYVY" ! >> jpegenc ! rtpjpegpay ! udpsink host=$SERVER port=5000" >> >> For the tda1997x I'm trying to do something similar: >> - media-ctl --get-v4l2 '"tda19971 2-0048":0' shows: >> [fmt:UYVY8_1X16/1920x1080 field:alternate colorspace:srgb] >> ^^^^ still not sure V4L2_FIELD_ALTERNATE/SRGB returned from tda1997x >> get_fmt is correct >> - I setup the pipeline with: >> media-ctl --link "tda19971 2-0048":0 -> "ipu1_csi0_mux":1[1] >> media-ctl --link "ipu1_csi0_mux":2 -> "ipu1_csi0":0[1] >> media-ctl --link "ipu1_csi0":1 -> "ipu1_vdic":0[1] >> media-ctl --link "ipu1_vdic":2 -> "ipu1_ic_prp":0[1] >> media-ctl --link "ipu1_ic_prp":2 -> "ipu1_ic_prpvf":0[1] >> media-ctl --link "ipu1_ic_prpvf":1 -> "ipu1_ic_prpvf capture":0[1] >> media-ctl --set-v4l2 'tda19971 2-0048':0[fmt:UYVY8_1X16/1920x1080] >> media-ctl --set-v4l2 'ipu1_csi0_mux':2[fmt:UYVY8_1X16/1920x1080 >> field:alternate] >> media-ctl --set-v4l2 'ipu1_csi0':1[fmt:UYVY8_1X16/1920x1080 >> field:alternate] >> media-ctl --set-v4l2 'ipu1_vdic':2[fmt:UYVY8_1X16/1920x1080 >> field:alternate] >> media-ctl --set-v4l2 'ipu1_ic_prp':2[fmt:UYVY8_1X16/1920x1080 field:none] >> media-ctl --set-v4l2 'ipu1_ic_prpvf':1[fmt:UYVY8_1X16/1920x1080 >> field:none] >> v4l2-ctl -d /dev/video1 >> --set-fmt-video=width=1920,height=1080,pixelformat=UYVY >> v4l2-ctl -d /dev/v4l-subdev1 --set-dv-bt-timings=query >> v4l2-ctl -d /dev/video1 --stream-mmap --stream-skip=1 >> --stream-to=/tmp/x.raw --stream-count=1 >> ipu1_csi0: bayer/16-bit parallel buses must go to IDMAC pad >> ipu1_ic_prpvf: pipeline start failed with -22 >> VIDIOC_STREAMON: failed: Invalid argument > Steve, Thanks for the help. > > Right, according to the i.MX6 reference manual, if the CSI muxes > are receiving from the parallel bus input with width >= 16 bits, > that data can't be passed to the IC. It never really made much sense > to me, and I can't remember if I ever tried it, maybe not, because > I don't have such hardware. hmmm... that's not good. I may have to dig into what's being done in my 3.14 kernel with the Freescale capture driver where I can capture 1080p60 fine with my tda1997x driver there. > > Try this hack as an experiment: modify is_parallel_16bit_bus() in > imx-media-csi.c to simply return false, and see if the above pipeline > works. I'm currently on 4.15-rc1 which doesn't have a 'is_parallel_16bit_bus()' but if I comment out the check we are talking about in csi_link_validate as such: I get a pipeline start failure for ipu1_ic_prpvf: root@ventana:~# v4l2-ctl -d /dev/video1 --stream-mmap --stream-skip=1 --stream-to=/tmp/x.raw --stream-count=1 [ 909.993353] tda1997x 2-0048: tda1997x_get_pad_format [ 909.998342] tda1997x 2-0048: tda1997x_fill_format ^^^^ my tda1997x driver debug messages [ 910.004483] ipu1_ic_prpvf: pipeline start failed with -32 VIDIOC_STREAMON: failed: Broken pipe > >> - if I try to use the idmac for deinterlace I configure the pipeline with: >> media-ctl --link "tda19971 2-0048":0 -> "ipu1_csi0_mux":1[1] >> media-ctl --link "ipu1_csi0_mux":2 -> "ipu1_csi0":0[1] >> media-ctl --link "ipu1_csi0":1 -> "ipu1_ic_prp":0[1] >> media-ctl --link "ipu1_ic_prp":2 -> "ipu1_ic_prpvf":0[1] >> media-ctl --link "ipu1_ic_prpvf":1 -> "ipu1_ic_prpvf capture":0[1] >> media-ctl --set-v4l2 'tda19971 2-0048':0[fmt:UYVY8_1X16/1920x1080] >> media-ctl --set-v4l2 'ipu1_csi0_mux':2[fmt:UYVY8_1X16/1920x1080 >> field:alternate] >> media-ctl --set-v4l2 'ipu1_csi0':1[fmt:UYVY8_1X16/1920x1080 >> field:alternate] >> media-ctl --set-v4l2 'ipu1_ic_prp':2[fmt:UYVY8_1X16/1920x1080 >> field:alternate] >> media-ctl --set-v4l2 'ipu1_ic_prpvf':1[fmt:UYVY8_1X16/1920x1080 >> field:none] >> v4l2-ctl -d /dev/video1 >> --set-fmt-video=width=1920,height=1080,pixelformat=UYVY >> v4l2-ctl -d /dev/v4l-subdev1 --set-dv-bt-timings=query >> v4l2-ctl -d /dev/video1 --stream-mmap --stream-to=/tmp/x.raw >> --stream-count=1 >> ipu1_csi0: bayer/16-bit parallel buses must go to IDMAC pad >> ipu1_ic_prpvf: pipeline start failed with -22 >> VIDIOC_STREAMON: failed: Invalid argument > > > For idmac de-interlace (interweaving w/o motion compensation), you > don't need to use the Image Converter paths (and the IC is not required > here because I don't see any scaling or colorspace conversion in your > pipeline). Send directly to the "ipu1_csi0 capture" device node. Try this, > which doesn't need the hack I mentioned above: > > media-ctl --link "tda19971 2-0048":0 -> "ipu1_csi0_mux":1[1] > media-ctl --link "ipu1_csi0_mux":2 -> "ipu1_csi0":0[1] > media-ctl --link "ipu1_csi0":2 -> "ipu1_csi0 capture":0[1] > > media-ctl --set-v4l2 'tda19971 2-0048':0[fmt:UYVY8_1X16/1920x1080] > media-ctl --set-v4l2 'ipu1_csi0_mux':2[fmt:UYVY8_1X16/1920x1080 > field:alternate] > media-ctl --set-v4l2 'ipu1_csi0':2[fmt:UYVY8_1X16/1920x1080 field:none > > v4l2-ctl -d /dev/video4 > --set-fmt-video=width=1920,height=1080,pixelformat=UYVY > v4l2-ctl -d /dev/v4l-subdev1 --set-dv-bt-timings=query > v4l2-ctl -d /dev/video4 --stream-mmap --stream-to=/tmp/x.raw > --stream-count=1 > This produced a 4147200 byte frame (http://dev.gateworks.com/docs/linux/media/x.raw) yet I couldn't seem to convert it with 'convert -size 1920x1080 -depth 16'. If I stream with gstreamer (gst-launch-1.0 v4l2src device=/dev/video4 ! video/x-raw,width=1920,height=1080,format=UYVY ! jpegenc ! rtpjpegpay ! udpsink host=172.24.20.19 port=5000) I see both top/bot frames within the same image whereas a non-interlaced source looks fine. Perhaps my gstreamer config is wrong? Tim --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -999,6 +999,7 @@ static int csi_link_validate(struct v4l2_subdev *sd, is_csi2 = (sensor_ep->bus_type == V4L2_MBUS_CSI2); incc = priv->cc[CSI_SINK_PAD]; +/* if (priv->dest != IPU_CSI_DEST_IDMAC && (incc->bayer || (!is_csi2 && sensor_ep->bus.parallel.bus_width >= 16))) { @@ -1007,6 +1008,7 @@ static int csi_link_validate(struct v4l2_subdev *sd, ret = -EINVAL; goto out; } +*/ if (is_csi2) { int vc_num = 0;