Return-path: Received: from mail-pg0-f68.google.com ([74.125.83.68]:39311 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751068AbeFAAbQ (ORCPT ); Thu, 31 May 2018 20:31:16 -0400 Received: by mail-pg0-f68.google.com with SMTP id w12-v6so9233068pgc.6 for ; Thu, 31 May 2018 17:31:16 -0700 (PDT) From: Steve Longerbeam To: Philipp Zabel , =?UTF-8?q?Krzysztof=20Ha=C5=82asa?= , Mauro Carvalho Chehab , Greg Kroah-Hartman , Hans Verkuil Cc: linux-media@vger.kernel.org, Steve Longerbeam Subject: [PATCH v2 09/10] media: imx-csi: Move crop/compose reset after filling default mbus fields Date: Thu, 31 May 2018 17:30:48 -0700 Message-Id: <1527813049-3231-10-git-send-email-steve_longerbeam@mentor.com> In-Reply-To: <1527813049-3231-1-git-send-email-steve_longerbeam@mentor.com> References: <1527813049-3231-1-git-send-email-steve_longerbeam@mentor.com> Sender: linux-media-owner@vger.kernel.org List-ID: If caller passes un-initialized field type V4L2_FIELD_ANY to CSI sink pad, the reset CSI crop window would not be correct, because the crop window depends on the current input field type. To fix move the reset of crop and compose windows to after the call to imx_media_fill_default_mbus_fields(). Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/imx-media-csi.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index c878a00..471130a 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -1358,17 +1358,6 @@ static void csi_try_fmt(struct csi_priv *priv, W_ALIGN, &sdformat->format.height, MIN_H, MAX_H, H_ALIGN, S_ALIGN); - /* Reset crop and compose rectangles */ - crop->left = 0; - crop->top = 0; - crop->width = sdformat->format.width; - crop->height = sdformat->format.height; - csi_try_crop(priv, crop, cfg, &sdformat->format, upstream_ep); - compose->left = 0; - compose->top = 0; - compose->width = crop->width; - compose->height = crop->height; - *cc = imx_media_find_mbus_format(sdformat->format.code, CS_SEL_ANY, true); if (!*cc) { @@ -1385,6 +1374,17 @@ static void csi_try_fmt(struct csi_priv *priv, &sdformat->format, infmt, priv->active_output_pad == CSI_SRC_PAD_DIRECT); + /* Reset crop and compose rectangles */ + crop->left = 0; + crop->top = 0; + crop->width = sdformat->format.width; + crop->height = sdformat->format.height; + csi_try_crop(priv, crop, cfg, &sdformat->format, upstream_ep); + compose->left = 0; + compose->top = 0; + compose->width = crop->width; + compose->height = crop->height; + break; } } -- 2.7.4