Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1570844
| From | Philipp Zabel <p.zabel@pengutronix.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3 17/24] media: imx: Add CSI subdev driver |
| Date | 2017-01-31 17:00 +0100 |
| Message-ID | <t5J0B-2tO-13@gated-at.bofh.it> (permalink) |
| References | <sWOLT-2qI-3@gated-at.bofh.it> <sWOLU-2qI-27@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, 2017-01-06 at 18:11 -0800, Steve Longerbeam wrote:
[...]
> +static int csi_set_fmt(struct v4l2_subdev *sd,
> + struct v4l2_subdev_pad_config *cfg,
> + struct v4l2_subdev_format *sdformat)
> +{
> + struct csi_priv *priv = v4l2_get_subdevdata(sd);
> + struct v4l2_mbus_framefmt *infmt, *outfmt;
> + struct v4l2_rect crop;
> + int ret;
> +
> + if (sdformat->pad >= CSI_NUM_PADS)
> + return -EINVAL;
> +
> + if (priv->stream_on)
> + return -EBUSY;
> +
> + infmt = &priv->format_mbus[priv->input_pad];
> + outfmt = &priv->format_mbus[priv->output_pad];
> +
> + if (sdformat->pad == priv->output_pad) {
> + sdformat->format.code = infmt->code;
> + sdformat->format.field = infmt->field;
> + crop.left = priv->crop.left;
> + crop.top = priv->crop.top;
> + crop.width = sdformat->format.width;
> + crop.height = sdformat->format.height;
> + ret = csi_try_crop(priv, &crop);
This is the wrong way around, see also below.
Here the the output sdformat->format.width/height should be set to the
priv->crop.width/height (or priv->crop.width/height / 2, to enable
downscaling). The crop rectangle should not be changed by an output pad
set_fmt.
> + if (ret)
> + return ret;
> + sdformat->format.width = crop.width;
> + sdformat->format.height = crop.height;
> + }
> +
> + if (sdformat->which == V4L2_SUBDEV_FORMAT_TRY) {
> + cfg->try_fmt = sdformat->format;
> + } else {
> + priv->format_mbus[sdformat->pad] = sdformat->format;
> + /* Update the crop window if this is output pad */
> + if (sdformat->pad == priv->output_pad)
> + priv->crop = crop;
The crop rectangle instead should be reset to the full input frame when
the input pad format is set.
regards
Philipp
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [PATCH v3 17/24] media: imx: Add CSI subdev driver Philipp Zabel <p.zabel@pengutronix.de> - 2017-01-31 17:00 +0100
Re: [PATCH v3 17/24] media: imx: Add CSI subdev driver Philipp Zabel <p.zabel@pengutronix.de> - 2017-01-31 18:10 +0100
Re: [PATCH v3 17/24] media: imx: Add CSI subdev driver Steve Longerbeam <slongerbeam@gmail.com> - 2017-02-01 02:50 +0100
csiph-web