From patchwork Tue Mar 21 11:27:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 9636437 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 01AAD60216 for ; Tue, 21 Mar 2017 11:29:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0326D26E4D for ; Tue, 21 Mar 2017 11:29:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBB6027B81; Tue, 21 Mar 2017 11:29:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 94A3826E4D for ; Tue, 21 Mar 2017 11:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lxeNQSloUGkvGbNYDdnmpWnoA/jGhcQYfqJaX2hNsHo=; b=IEcUkC06dlqpDB /r1XsTVVnMykIHdRzWAuxw1tmdEdXnmpWcfT0bKTFjyTBaecdqlc4FWQP/js4gx6/pv6oyuHoxA5f xzKMOssISY+fRl1+mqodNU3hQnO9KFFB11g/GfWj6SO/DWcZMEtZG67SMyTKRHhBzr6y0J5llME8U dzjFFs83+NywbwATdDtc8IWVSFRsra7ld3dNHXHzFfxLzY5g3I8rDTSLsGQ1cQqfg18PmleHVnsf7 xFf0CxzUu69YwScQT+r3oEIt6bos42n/9QheLkal1yDkWyIcTkp07ziUzf4a8aH1aTVU0Pw1uTacF 0F3q236LIesg3VtTuOpA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqHyY-0007wx-U2; Tue, 21 Mar 2017 11:29:18 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqHyU-0007t0-JR for linux-arm-kernel@lists.infradead.org; Tue, 21 Mar 2017 11:29:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=gCqLJkRPfVYt0JoBtyfl/1PGq0/Y5pcLdkJll0JEGx4=; b=G/3O+tvMzv1nbeuyubMs5BmWqrKCg57rcLgdgcDp2aQIxzQo2Eq+HJZbFsw4Mdjthq76sMeYEef2Q8/8GHlMlI8U7jFMXA6X5rx7VDQ0qroPUdHqOFYjKjNEsKV7WM/lb5pZMpaE4YriHpa0cxTh5W1SEHHmmvHgxBXugCjeTWk=; Received: from n2100.armlinux.org.uk ([fd8f:7570:feb6:1:214:fdff:fe10:4f86]:33932) by pandora.armlinux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1cqHx4-0001L2-Nj; Tue, 21 Mar 2017 11:27:46 +0000 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.76) (envelope-from ) id 1cqHx0-0005nT-AK; Tue, 21 Mar 2017 11:27:42 +0000 Date: Tue, 21 Mar 2017 11:27:41 +0000 From: Russell King - ARM Linux To: Philipp Zabel Subject: Re: [PATCH v5 38/39] media: imx: csi: fix crop rectangle reset in sink set_fmt Message-ID: <20170321112741.GV21222@n2100.armlinux.org.uk> References: <1489121599-23206-1-git-send-email-steve_longerbeam@mentor.com> <1489121599-23206-39-git-send-email-steve_longerbeam@mentor.com> <20170319152233.GW21222@n2100.armlinux.org.uk> <327d67d9-68c1-7f74-0c0f-f6aee1c4b546@gmail.com> <1490010926.2917.59.camel@pengutronix.de> <20170320120855.GH21222@n2100.armlinux.org.uk> <1490018451.2917.86.camel@pengutronix.de> <20170320141705.GL21222@n2100.armlinux.org.uk> <1490030604.2917.103.camel@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1490030604.2917.103.camel@pengutronix.de> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170321_042915_062961_D9430189 X-CRM114-Status: GOOD ( 13.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, andrew-ct.chen@mediatek.com, minghsiu.tsai@mediatek.com, nick@shmanahar.org, songjun.wu@microchip.com, hverkuil@xs4all.nl, Steve Longerbeam , pavel@ucw.cz, robert.jarzmik@free.fr, devel@driverdev.osuosl.org, markus.heiser@darmarIT.de, laurent.pinchart+renesas@ideasonboard.com, shuah@kernel.org, geert@linux-m68k.org, Steve Longerbeam , linux-media@vger.kernel.org, devicetree@vger.kernel.org, sakari.ailus@linux.intel.com, arnd@arndb.de, mchehab@kernel.org, bparrot@ti.com, robh+dt@kernel.org, horms+renesas@verge.net.au, tiffany.lin@mediatek.com, linux-arm-kernel@lists.infradead.org, niklas.soderlund+renesas@ragnatech.se, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, jean-christophe.trotin@st.com, kernel@pengutronix.de, fabio.estevam@nxp.com, shawnguo@kernel.org, sudipm.mukherjee@gmail.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Mon, Mar 20, 2017 at 06:23:24PM +0100, Philipp Zabel wrote: > @@ -1173,15 +1196,8 @@ static void csi_try_fmt(struct csi_priv *priv, > incc = imx_media_find_mbus_format(infmt->code, > CS_SEL_ANY, true); > > - if (sdformat->format.width < priv->crop.width * 3 / 4) > - sdformat->format.width = priv->crop.width / 2; > - else > - sdformat->format.width = priv->crop.width; > - > - if (sdformat->format.height < priv->crop.height * 3 / 4) > - sdformat->format.height = priv->crop.height / 2; > - else > - sdformat->format.height = priv->crop.height; > + sdformat->format.width = compose->width; > + sdformat->format.height = compose->height; > > if (incc->bayer) { > sdformat->format.code = infmt->code; We need to do more in here, because right now setting the source pads overwrites the colorimetry etc information. Maybe something like the below? I'm wondering if it would be a saner approach to copy the sink format and update the parameters that can be changed, rather than trying to list all the parameters that shouldn't be changed. What if the format structure gains a new member? diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index 1492b92e1970..756204ced53c 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -1221,6 +1221,12 @@ static void csi_try_fmt(struct csi_priv *priv, sdformat->format.field = (infmt->height == 480) ? V4L2_FIELD_SEQ_TB : V4L2_FIELD_SEQ_BT; } + + /* copy settings we can't change */ + sdformat->format.colorspace = infmt->colorspace; + sdformat->format.ycbcr_enc = infmt->ycbcr_enc; + sdformat->format.quantization = infmt->quantization; + sdformat->format.xfer_func = infmt->xfer_func; break; case CSI_SINK_PAD: v4l_bound_align_image(&sdformat->format.width, MIN_W, MAX_W,