linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: slongerbeam@gmail.com (Steve Longerbeam)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] media: imx-media-capture: add frame sizes/interval enumeration
Date: Sun, 19 Mar 2017 15:21:37 -0700	[thread overview]
Message-ID: <a9f6445c-97e4-fee9-d795-50724e98a766@gmail.com> (raw)
In-Reply-To: <E1cpYOa-0006Eu-CL@rmk-PC.armlinux.org.uk>



On 03/19/2017 03:49 AM, Russell King wrote:
> Add support for enumerating frame sizes and frame intervals from the
> first subdev via the V4L2 interfaces.
>
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> ---
>   drivers/staging/media/imx/imx-media-capture.c | 62 +++++++++++++++++++++++++++
>   1 file changed, 62 insertions(+)
>
> diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c
> index cdeb2cd8b1d7..bc99d9310e36 100644
> --- a/drivers/staging/media/imx/imx-media-capture.c
> +++ b/drivers/staging/media/imx/imx-media-capture.c
> @@ -82,6 +82,65 @@ static int vidioc_querycap(struct file *file, void *fh,
>   	return 0;
>   }
>   
> +static int capture_enum_framesizes(struct file *file, void *fh,
> +				   struct v4l2_frmsizeenum *fsize)
> +{
> +	struct capture_priv *priv = video_drvdata(file);
> +	const struct imx_media_pixfmt *cc;
> +	struct v4l2_subdev_frame_size_enum fse = {
> +		.index = fsize->index,
> +		.pad = priv->src_sd_pad,
> +		.which = V4L2_SUBDEV_FORMAT_ACTIVE,
> +	};
> +	int ret;
> +
> +	cc = imx_media_find_format(fsize->pixel_format, CS_SEL_ANY, true);
> +	if (!cc)
> +		return -EINVAL;
> +
> +	fse.code = cc->codes[0];
> +
> +	ret = v4l2_subdev_call(priv->src_sd, pad, enum_frame_size, NULL, &fse);
> +	if (ret)
> +		return ret;
> +
> +	fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
> +	fsize->discrete.width = fse.min_width;
> +	fsize->discrete.height = fse.max_height;
> +
> +	return 0;
> +}


The PRP ENC/VF subdevices will return a continuous range of
supported frame sizes at their source pad, so this should be
modified to:

...
     if (fse.min_width == fse.max_width &&
         fse.min_height == fse.max_height) {
         fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
         fsize->discrete.width = fse.min_width;
         fsize->discrete.height = fse.min_height;
     } else {
         fsize->type = V4L2_FRMSIZE_TYPE_CONTINUOUS;
         fsize->stepwise.min_width = fse.min_width;
         fsize->stepwise.max_width = fse.max_width;
         fsize->stepwise.min_height = fse.min_height;
         fsize->stepwise.max_height = fse.max_height;
         fsize->stepwise.step_width = 1;
         fsize->stepwise.step_height = 1;
     }
...

Steve


> +
> +static int capture_enum_frameintervals(struct file *file, void *fh,
> +				       struct v4l2_frmivalenum *fival)
> +{
> +	struct capture_priv *priv = video_drvdata(file);
> +	const struct imx_media_pixfmt *cc;
> +	struct v4l2_subdev_frame_interval_enum fie = {
> +		.index = fival->index,
> +		.pad = priv->src_sd_pad,
> +		.width = fival->width,
> +		.height = fival->height,
> +		.which = V4L2_SUBDEV_FORMAT_ACTIVE,
> +	};
> +	int ret;
> +
> +	cc = imx_media_find_format(fival->pixel_format, CS_SEL_ANY, true);
> +	if (!cc)
> +		return -EINVAL;
> +
> +	fie.code = cc->codes[0];
> +
> +	ret = v4l2_subdev_call(priv->src_sd, pad, enum_frame_interval, NULL, &fie);
> +	if (ret)
> +		return ret;
> +
> +	fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
> +	fival->discrete = fie.interval;
> +
> +	return 0;
> +}
> +
>   static int capture_enum_fmt_vid_cap(struct file *file, void *fh,
>   				    struct v4l2_fmtdesc *f)
>   {
> @@ -270,6 +329,9 @@ static int capture_s_parm(struct file *file, void *fh,
>   static const struct v4l2_ioctl_ops capture_ioctl_ops = {
>   	.vidioc_querycap	= vidioc_querycap,
>   
> +	.vidioc_enum_framesizes = capture_enum_framesizes,
> +	.vidioc_enum_frameintervals = capture_enum_frameintervals,
> +
>   	.vidioc_enum_fmt_vid_cap        = capture_enum_fmt_vid_cap,
>   	.vidioc_g_fmt_vid_cap           = capture_g_fmt_vid_cap,
>   	.vidioc_try_fmt_vid_cap         = capture_try_fmt_vid_cap,

  reply	other threads:[~2017-03-19 22:21 UTC|newest]

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

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=a9f6445c-97e4-fee9-d795-50724e98a766@gmail.com \
    --to=slongerbeam@gmail.com \
    --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).