linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: p.zabel@pengutronix.de (Philipp Zabel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 29/36] media: imx: mipi-csi2: enable setting and getting of frame rates
Date: Tue, 21 Feb 2017 09:50:23 +0100	[thread overview]
Message-ID: <1487667023.2331.8.camel@pengutronix.de> (raw)
In-Reply-To: <25596b21-70de-5e46-f149-f9ce3a86ecb7@gmail.com>

On Mon, 2017-02-20 at 16:18 -0800, Steve Longerbeam wrote:
> 
> On 02/20/2017 04:13 PM, Russell King - ARM Linux wrote:
> > On Tue, Feb 21, 2017 at 12:04:10AM +0200, Sakari Ailus wrote:
> >> On Wed, Feb 15, 2017 at 06:19:31PM -0800, Steve Longerbeam wrote:
> >>> From: Russell King <rmk+kernel@armlinux.org.uk>
> >>>
> >>> Setting and getting frame rates is part of the negotiation mechanism
> >>> between subdevs.  The lack of support means that a frame rate at the
> >>> sensor can't be negotiated through the subdev path.
> >>
> >> Just wondering --- what do you need this for?
> >
> > The v4l2 documentation contradicts the media-ctl implementation.
> >
> > While v4l2 documentation says:
> >
> >   These ioctls are used to get and set the frame interval at specific
> >   subdev pads in the image pipeline. The frame interval only makes sense
> >   for sub-devices that can control the frame period on their own. This
> >   includes, for instance, image sensors and TV tuners. Sub-devices that
> >   don't support frame intervals must not implement these ioctls.
> >
> > However, when trying to configure the pipeline using media-ctl, eg:
> >
> > media-ctl -d /dev/media1 --set-v4l2 '"imx219 pixel 0-0010":0[crop:(0,0)/3264x2464]'
> > media-ctl -d /dev/media1 --set-v4l2 '"imx219 0-0010":1[fmt:SRGGB10/3264x2464 at 1/30]'
> > media-ctl -d /dev/media1 --set-v4l2 '"imx219 0-0010":0[fmt:SRGGB8/816x616 at 1/30]'
> > media-ctl -d /dev/media1 --set-v4l2 '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616 at 1/30]'
> > Unable to setup formats: Inappropriate ioctl for device (25)
> > media-ctl -d /dev/media1 --set-v4l2 '"ipu1_csi0_mux":2[fmt:SRGGB8/816x616 at 1/30]'
> > media-ctl -d /dev/media1 --set-v4l2 '"ipu1_csi0":2[fmt:SRGGB8/816x616 at 1/30]'
> >
> > The problem there is that the format setting for the csi2 does not get
> > propagated forward:
> >
> > $ strace media-ctl -d /dev/media1 --set-v4l2 '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616 at 1/30]'
> > ...
> > open("/dev/v4l-subdev16", O_RDWR)       = 3
> > ioctl(3, VIDIOC_SUBDEV_S_FMT, 0xbec16244) = 0
> > ioctl(3, VIDIOC_SUBDEV_S_FRAME_INTERVAL, 0xbec162a4) = -1 ENOTTY (Inappropriate
> > ioctl for device)
> > fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 2), ...}) = 0
> > write(1, "Unable to setup formats: Inappro"..., 61) = 61
> > Unable to setup formats: Inappropriate ioctl for device (25)
> > close(3)                                = 0
> > exit_group(1)                           = ?
> > +++ exited with 1 +++
> >
> > because media-ctl exits as soon as it encouters the error while trying
> > to set the frame rate.
> >
> > This makes implementing setup of the media pipeline in shell scripts
> > unnecessarily difficult - as you need to then know whether an entity
> > is likely not to support the VIDIOC_SUBDEV_S_FRAME_INTERVAL call,
> > and either avoid specifying a frame rate:
> >
> > $ strace media-ctl -d /dev/media1 --set-v4l2 '"imx6-mipi-csi2":1[fmt:SRGGB8/816x616]'
> > ...
> > open("/dev/v4l-subdev16", O_RDWR)       = 3
> > ioctl(3, VIDIOC_SUBDEV_S_FMT, 0xbeb1a254) = 0
> > open("/dev/v4l-subdev0", O_RDWR)        = 4
> > ioctl(4, VIDIOC_SUBDEV_S_FMT, 0xbeb1a254) = 0
> > close(4)                                = 0
> > close(3)                                = 0
> > exit_group(0)                           = ?
> > +++ exited with 0 +++
> >
> > or manually setting the format on the sink.
> >
> > Allowing the S_FRAME_INTERVAL call seems to me to be more in keeping
> > with the negotiation mechanism that is implemented in subdevs, and
> > IMHO should be implemented inside the kernel as a pad operation along
> > with the format negotiation, especially so as frame skipping is
> > defined as scaling, in just the same way as the frame size is also
> > scaling:
> >
> >        -  ``MEDIA_ENT_F_PROC_VIDEO_SCALER``
> >
> >        -  Video scaler. An entity capable of video scaling must have
> >           at least one sink pad and one source pad, and scale the
> >           video frame(s) received on its sink pad(s) to a different
> >           resolution output on its source pad(s). The range of
> >           supported scaling ratios is entity-specific and can differ
> >           between the horizontal and vertical directions (in particular
> >           scaling can be supported in one direction only). Binning and
> >           skipping are considered as scaling.
> >
> > Although, this is vague, as it doesn't define what it means by "skipping",
> > whether that's skipping pixels (iow, sub-sampling) or whether that's
> > frame skipping.

I'd interpret this as meaning pixel skipping, not frame skipping.

> > Then there's the issue where, if you have this setup:
> >
> >  camera --> csi2 receiver --> csi --> capture
> >
> > and the "csi" subdev can skip frames, you need to know (a) at the CSI
> > sink pad what the frame rate is of the source (b) what the desired
> > source pad frame rate is, so you can configure the frame skipping.
> > So, does the csi subdev have to walk back through the media graph
> > looking for the frame rate?  Does the capture device have to walk back
> > through the media graph looking for some subdev to tell it what the
> > frame rate is - the capture device certainly can't go straight to the
> > sensor to get an answer to that question, because that bypasses the
> > effect of the CSI frame skipping (which will lower the frame rate.)
> >
> > IMHO, frame rate is just another format property, just like the
> > resolution and data format itself, and v4l2 should be treating it no
> > differently.
> >
> 
> I agree, frame rate, if indicated/specified by both sides of a link,
> should match. So maybe this should be part of v4l2 link validation.
> 
> This might be a good time to propose the following patch.

I agree with Steve and Russell. I don't see why the (nominal) frame
interval should be handled differently than resolution, data format, and
colorspace information. I think it should just be propagated in the same
way, and there is no reason to have two connected pads set to a
different interval. That would make implementing the g/s_frame_interval
subdev calls mandatory.

regards
Philipp

  reply	other threads:[~2017-02-21  8:50 UTC|newest]

Thread overview: 228+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16  2:19 [PATCH v4 00/36] i.MX Media Driver Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 01/36] [media] dt-bindings: Add bindings for i.MX media driver Steve Longerbeam
2017-02-16 11:54   ` Philipp Zabel
2017-02-16 19:20     ` Steve Longerbeam
2017-02-27 14:38   ` Rob Herring
2017-03-01  0:00     ` Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 02/36] ARM: dts: imx6qdl: Add compatible, clocks, irqs to MIPI CSI-2 node Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 03/36] ARM: dts: imx6qdl: Add mipi_ipu1/2 multiplexers, mipi_csi, and their connections Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 04/36] ARM: dts: imx6qdl: add capture-subsystem device Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 05/36] ARM: dts: imx6qdl-sabrelite: remove erratum ERR006687 workaround Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 06/36] ARM: dts: imx6-sabrelite: add OV5642 and OV5640 camera sensors Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 07/36] ARM: dts: imx6-sabresd: " Steve Longerbeam
2017-02-17  0:51   ` Fabio Estevam
2017-02-17  0:56     ` Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 08/36] ARM: dts: imx6-sabreauto: create i2cmux for i2c3 Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 09/36] ARM: dts: imx6-sabreauto: add reset-gpios property for max7310_b Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 10/36] ARM: dts: imx6-sabreauto: add pinctrl for gpt input capture Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 11/36] ARM: dts: imx6-sabreauto: add the ADV7180 video decoder Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 12/36] add mux and video interface bridge entity functions Steve Longerbeam
2017-02-19 21:28   ` Pavel Machek
2017-02-22 17:19     ` Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 13/36] [media] v4l2: add a frame timeout event Steve Longerbeam
2017-03-02 15:53   ` Sakari Ailus
2017-03-02 23:07     ` Steve Longerbeam
2017-03-03 11:45       ` Sakari Ailus
2017-03-03 22:43         ` Steve Longerbeam
2017-03-04 10:56           ` Sakari Ailus
2017-03-05  0:37             ` Steve Longerbeam
2017-03-05 21:31               ` Sakari Ailus
2017-03-05 22:41               ` Russell King - ARM Linux
2017-03-10  2:38                 ` Steve Longerbeam
2017-03-10  9:33                   ` Russell King - ARM Linux
2017-02-16  2:19 ` [PATCH v4 14/36] [media] v4l2-mc: add a function to inherit controls from a pipeline Steve Longerbeam
2017-02-19 21:44   ` Pavel Machek
2017-03-02 16:02   ` Sakari Ailus
2017-03-02 23:48     ` Steve Longerbeam
2017-03-03  0:46       ` Steve Longerbeam
2017-03-03  2:12       ` Steve Longerbeam
2017-03-03 19:17         ` Sakari Ailus
2017-03-03 22:47           ` Steve Longerbeam
2017-03-03 23:06     ` Russell King - ARM Linux
2017-03-04  0:36       ` Steve Longerbeam
2017-03-04 13:13       ` Sakari Ailus
2017-03-10 12:54         ` Hans Verkuil
2017-03-10 13:07           ` Russell King - ARM Linux
2017-03-10 13:22             ` Hans Verkuil
2017-03-10 14:01               ` Russell King - ARM Linux
2017-03-10 14:20                 ` Hans Verkuil
2017-03-10 15:53                   ` Mauro Carvalho Chehab
2017-03-10 22:37                     ` Sakari Ailus
2017-03-11 11:25                       ` Mauro Carvalho Chehab
2017-03-11 21:52                         ` Pavel Machek
2017-03-11 23:14                         ` Russell King - ARM Linux
2017-03-12  0:19                           ` Steve Longerbeam
2017-03-12 21:29                           ` Pavel Machek
2017-03-12 22:37                             ` Mauro Carvalho Chehab
2017-03-14 18:26                               ` Pavel Machek
2017-03-13 12:46                         ` Sakari Ailus
2017-03-14  3:45                           ` Mauro Carvalho Chehab
2017-03-14  7:55                             ` Hans Verkuil
2017-03-14 10:21                               ` Mauro Carvalho Chehab
2017-03-14 22:32                                 ` media / v4l2-mc: wishlist for complex cameras (was Re: [PATCH v4 14/36] [media] v4l2-mc: add a function to inherit controls from a pipeline) Pavel Machek
2017-03-15  0:54                                   ` Mauro Carvalho Chehab
2017-03-15 10:50                                     ` Philippe De Muyter
2017-03-15 18:55                                       ` Nicolas Dufresne
2017-03-16  9:26                                         ` Philipp Zabel
2017-03-16  9:47                                           ` Philippe De Muyter
2017-03-16 10:01                                             ` Philipp Zabel
2017-03-16 10:19                                               ` Philippe De Muyter
2017-03-15 18:04                                     ` Pavel Machek
2017-03-15 20:26                                       ` Mauro Carvalho Chehab
2017-03-16 22:11                                         ` Pavel Machek
2017-03-20 13:24                                 ` [PATCH v4 14/36] [media] v4l2-mc: add a function to inherit controls from a pipeline Hans Verkuil
2017-03-20 15:39                                   ` Mauro Carvalho Chehab
2017-03-20 16:10                                     ` Russell King - ARM Linux
2017-03-20 17:37                                       ` Mauro Carvalho Chehab
2017-03-17 11:42                               ` Russell King - ARM Linux
2017-03-17 11:55                                 ` Sakari Ailus
2017-03-17 13:24                                   ` Mauro Carvalho Chehab
2017-03-17 13:51                                     ` Philipp Zabel
2017-03-17 14:37                                       ` Russell King - ARM Linux
2017-03-20 13:10                                         ` Hans Verkuil
2017-03-20 15:06                                           ` Mauro Carvalho Chehab
2017-03-21 11:11                                     ` Pavel Machek
2017-03-20 11:16                                   ` Hans Verkuil
2017-03-17 12:02                                 ` Philipp Zabel
2017-03-17 12:16                                   ` Russell King - ARM Linux
2017-03-17 17:49                                     ` Mauro Carvalho Chehab
2017-03-19 13:25                                 ` Pavel Machek
2017-03-26 16:44                               ` Laurent Pinchart
2017-03-10 15:26             ` Mauro Carvalho Chehab
2017-03-10 15:57               ` Russell King - ARM Linux
2017-03-10 17:06                 ` Russell King - ARM Linux
2017-03-10 20:42                 ` Mauro Carvalho Chehab
2017-03-10 21:55                   ` Pavel Machek
2017-03-10 15:09           ` Mauro Carvalho Chehab
2017-03-11 11:32             ` Hans Verkuil
2017-03-11 13:14               ` Mauro Carvalho Chehab
2017-03-11 15:32                 ` Sakari Ailus
2017-03-11 17:32                   ` Russell King - ARM Linux
2017-03-11 18:08                   ` Steve Longerbeam
2017-03-11 18:45                     ` Russell King - ARM Linux
2017-03-11 18:54                       ` Steve Longerbeam
2017-03-11 18:59                         ` Russell King - ARM Linux
2017-03-11 19:06                           ` Steve Longerbeam
2017-03-11 20:41                             ` Russell King - ARM Linux
2017-03-12  3:31                           ` Steve Longerbeam
2017-03-12  7:37                             ` Russell King - ARM Linux
2017-03-12 17:56                               ` Steve Longerbeam
2017-03-12 21:58                                 ` Mauro Carvalho Chehab
2017-03-26  9:12                                   ` script to setup pipeline was " Pavel Machek
2017-03-13 10:44                                 ` Hans Verkuil
2017-03-13 10:58                                   ` Russell King - ARM Linux
2017-03-13 11:08                                     ` Hans Verkuil
2017-03-13 11:42                                     ` Mauro Carvalho Chehab
2017-03-13 12:35                                       ` Russell King - ARM Linux
2017-03-12 18:14                               ` Pavel Machek
2017-03-11 20:26                     ` Pavel Machek
2017-03-11 20:33                       ` Steve Longerbeam
2017-03-11 21:30                 ` Pavel Machek
2017-02-16  2:19 ` [PATCH v4 15/36] platform: add video-multiplexer subdevice driver Steve Longerbeam
2017-02-19 22:02   ` Pavel Machek
2017-02-21  9:11     ` Philipp Zabel
2017-02-24 20:09       ` Pavel Machek
2017-02-27 14:41   ` Rob Herring
2017-03-01  0:20     ` Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 16/36] UAPI: Add media UAPI Kbuild file Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 17/36] media: Add userspace header file for i.MX Steve Longerbeam
2017-02-16 11:33   ` Philipp Zabel
2017-02-22 23:54     ` Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 18/36] media: Add i.MX media core driver Steve Longerbeam
2017-02-16 10:27   ` Russell King - ARM Linux
2017-02-16 17:53     ` Steve Longerbeam
2017-02-16 13:02   ` Philipp Zabel
2017-02-16 13:44     ` Russell King - ARM Linux
2017-02-17  1:33     ` Steve Longerbeam
2017-02-17  8:34       ` Philipp Zabel
2017-02-16  2:19 ` [PATCH v4 19/36] media: imx: Add Capture Device Interface Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 20/36] media: imx: Add CSI subdev driver Steve Longerbeam
2017-02-16 11:52   ` Russell King - ARM Linux
2017-02-16 12:40     ` Russell King - ARM Linux
2017-02-16 13:09       ` Russell King - ARM Linux
2017-02-16 14:20         ` Russell King - ARM Linux
2017-02-16 19:07           ` Steve Longerbeam
2017-02-16 18:44       ` Steve Longerbeam
2017-02-16 19:09         ` Russell King - ARM Linux
2017-02-16  2:19 ` [PATCH v4 21/36] media: imx: Add VDIC " Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 22/36] media: imx: Add IC subdev drivers Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 23/36] media: imx: Add MIPI CSI-2 Receiver subdev driver Steve Longerbeam
2017-02-16 10:28   ` Russell King - ARM Linux
2017-02-16 17:54     ` Steve Longerbeam
2017-02-17 10:47   ` Philipp Zabel
2017-02-17 11:06     ` Russell King - ARM Linux
2017-02-17 11:38       ` Philipp Zabel
2017-02-22 23:38         ` Steve Longerbeam
2017-02-22 23:41           ` Steve Longerbeam
2017-02-23  0:06       ` Steve Longerbeam
2017-02-23  0:09         ` Steve Longerbeam
2017-02-17 14:16     ` Philipp Zabel
2017-02-17 18:27       ` Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 24/36] [media] add Omnivision OV5640 sensor driver Steve Longerbeam
2017-02-27 14:45   ` Rob Herring
2017-03-01  0:43     ` Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 25/36] ARM: imx_v6_v7_defconfig: Enable staging video4linux drivers Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 26/36] media: imx: add support for bayer formats Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 27/36] media: imx: csi: " Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 28/36] media: imx: csi: fix crop rectangle changes in set_fmt Steve Longerbeam
2017-02-16 11:05   ` Russell King - ARM Linux
2017-02-16 18:16     ` Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 29/36] media: imx: mipi-csi2: enable setting and getting of frame rates Steve Longerbeam
2017-02-18  1:11   ` Steve Longerbeam
2017-02-18  1:12   ` Steve Longerbeam
2017-02-18  9:23     ` Russell King - ARM Linux
2017-02-18 17:29       ` Steve Longerbeam
2017-02-18 18:08         ` Russell King - ARM Linux
2017-02-20 22:04   ` Sakari Ailus
2017-02-20 22:56     ` Steve Longerbeam
2017-02-20 23:47       ` Steve Longerbeam
2017-02-21 12:15       ` Sakari Ailus
2017-02-21 22:21         ` Steve Longerbeam
2017-02-21 23:34           ` Steve Longerbeam
2017-02-21  0:13     ` Russell King - ARM Linux
2017-02-21  0:18       ` Steve Longerbeam
2017-02-21  8:50         ` Philipp Zabel [this message]
2017-03-13 13:16           ` Sakari Ailus
2017-03-13 13:27             ` Russell King - ARM Linux
2017-03-13 13:55               ` Philipp Zabel
2017-03-13 18:06                 ` Steve Longerbeam
2017-03-13 21:03                   ` Sakari Ailus
2017-03-13 21:29                     ` Russell King - ARM Linux
2017-03-14  7:34                     ` Hans Verkuil
2017-03-14 10:43                       ` Philipp Zabel
2017-03-13 20:56               ` Sakari Ailus
2017-03-13 21:07                 ` Russell King - ARM Linux
2017-02-21 12:37       ` Sakari Ailus
2017-02-21 13:21         ` Russell King - ARM Linux
2017-02-21 15:38           ` Sakari Ailus
2017-02-21 16:03             ` Russell King - ARM Linux
2017-02-21 16:15               ` Sakari Ailus
2017-02-16  2:19 ` [PATCH v4 30/36] media: imx: update capture dev format on IDMAC output pad set_fmt Steve Longerbeam
2017-02-16 11:29   ` Philipp Zabel
2017-02-16  2:19 ` [PATCH v4 31/36] media: imx: csi: add __csi_get_fmt Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 32/36] media: imx: csi/fim: add support for frame intervals Steve Longerbeam
2017-02-16  2:38   ` Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 33/36] media: imx: redo pixel format enumeration and negotiation Steve Longerbeam
2017-02-16 11:32   ` Philipp Zabel
2017-02-22 23:52     ` Steve Longerbeam
2017-02-23  9:10       ` Philipp Zabel
2017-02-24  1:30         ` Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 34/36] media: imx: csi: add frame skipping support Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 35/36] media: imx: csi: fix crop rectangle reset in sink set_fmt Steve Longerbeam
2017-02-16  2:19 ` [PATCH v4 36/36] media: imx: propagate sink pad formats to source pads Steve Longerbeam
2017-02-16 11:29   ` Philipp Zabel
2017-02-16 18:19     ` Steve Longerbeam
2017-02-16 11:37 ` [PATCH v4 00/36] i.MX Media Driver Russell King - ARM Linux
2017-02-16 18:30   ` Steve Longerbeam
2017-02-16 22:20 ` Russell King - ARM Linux
2017-02-16 22:27   ` Steve Longerbeam
2017-02-16 22:57     ` Russell King - ARM Linux
2017-02-17 10:39       ` Philipp Zabel
2017-02-17 10:56         ` Russell King - ARM Linux
2017-02-17 11:21           ` Philipp Zabel
2017-02-18 17:21       ` Steve Longerbeam
2017-02-17 11:43     ` Philipp Zabel
2017-02-17 12:22       ` Sakari Ailus
2017-02-17 12:31         ` Russell King - ARM Linux
2017-02-17 15:04         ` Philipp Zabel
2017-02-18 11:58           ` Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1487667023.2331.8.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).