summaryrefslogtreecommitdiff
path: root/drivers/staging/media/imx/imx-media-csi.c
diff options
context:
space:
mode:
authorSteve Longerbeam <slongerbeam@gmail.com>2017-06-07 15:34:11 -0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-06-20 08:03:57 -0300
commit21e54111d2558fa774aec998bba25c6fa5b61791 (patch)
tree7082c60d7641692b1393479b587ab338b050da60 /drivers/staging/media/imx/imx-media-csi.c
parentc24858c3070d7bff7f8d02c05595d4978e7198b6 (diff)
[media] media: imx: set and propagate default field, colorimetry
This patch adds a call to imx_media_fill_default_mbus_fields() in the *_try_fmt() functions at the sink pads, to set empty field order and colorimetry parameters. If the field order is set to ANY, choose the currently set field order at the sink pad. If the colorspace is set to DEFAULT, choose the current colorspace at the sink pad. If any of xfer_func, ycbcr_enc or quantization are set to DEFAULT, either choose the current sink pad setting, or the default setting for the new colorspace, if non-DEFAULT colorspace was given. If a format is destined to be routed through the Image Converter, fixed quantization and Y`CbCr encoding must be set. Colorimetry is also propagated from sink to source pads anywhere this has not already been done. Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/staging/media/imx/imx-media-csi.c')
-rw-r--r--drivers/staging/media/imx/imx-media-csi.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
index b19052fe60bc..6eaf64419a78 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -1244,11 +1244,11 @@ static void csi_try_fmt(struct csi_priv *priv,
struct v4l2_mbus_framefmt *infmt;
u32 code;
+ infmt = __csi_get_fmt(priv, cfg, CSI_SINK_PAD, sdformat->which);
+
switch (sdformat->pad) {
case CSI_SRC_PAD_DIRECT:
case CSI_SRC_PAD_IDMAC:
- infmt = __csi_get_fmt(priv, cfg, CSI_SINK_PAD,
- sdformat->which);
incc = imx_media_find_mbus_format(infmt->code,
CS_SEL_ANY, true);
@@ -1284,6 +1284,12 @@ static void csi_try_fmt(struct csi_priv *priv,
sdformat->format.field = (infmt->height == 480) ?
V4L2_FIELD_SEQ_TB : V4L2_FIELD_SEQ_BT;
}
+
+ /* propagate colorimetry from sink */
+ sdformat->format.colorspace = infmt->colorspace;
+ sdformat->format.xfer_func = infmt->xfer_func;
+ sdformat->format.quantization = infmt->quantization;
+ sdformat->format.ycbcr_enc = infmt->ycbcr_enc;
break;
case CSI_SINK_PAD:
v4l_bound_align_image(&sdformat->format.width, MIN_W, MAX_W,
@@ -1310,6 +1316,10 @@ static void csi_try_fmt(struct csi_priv *priv,
CS_SEL_ANY, false);
sdformat->format.code = (*cc)->codes[0];
}
+
+ imx_media_fill_default_mbus_fields(
+ &sdformat->format, infmt,
+ priv->active_output_pad == CSI_SRC_PAD_DIRECT);
break;
}
}