Message ID | 20170321112741.GV21222@n2100.armlinux.org.uk (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from <linux-media-owner@vger.kernel.org>) id 1cqHyO-0004rj-Nq; Tue, 21 Mar 2017 11:29:09 +0000 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.84_2/mailfrontend-6) with esmtp id 1cqHyM-0005oG-4k; Tue, 21 Mar 2017 12:29:08 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756974AbdCUL2x (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Tue, 21 Mar 2017 07:28:53 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:49968 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756585AbdCUL2w (ORCPT <rfc822;linux-media@vger.kernel.org>); Tue, 21 Mar 2017 07:28:52 -0400 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 <linux@armlinux.org.uk>) 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 <linux@n2100.armlinux.org.uk>) 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 <linux@armlinux.org.uk> To: Philipp Zabel <p.zabel@pengutronix.de> Cc: Steve Longerbeam <slongerbeam@gmail.com>, robh+dt@kernel.org, mark.rutland@arm.com, shawnguo@kernel.org, kernel@pengutronix.de, fabio.estevam@nxp.com, mchehab@kernel.org, hverkuil@xs4all.nl, nick@shmanahar.org, markus.heiser@darmarIT.de, laurent.pinchart+renesas@ideasonboard.com, bparrot@ti.com, geert@linux-m68k.org, arnd@arndb.de, sudipm.mukherjee@gmail.com, minghsiu.tsai@mediatek.com, tiffany.lin@mediatek.com, jean-christophe.trotin@st.com, horms+renesas@verge.net.au, niklas.soderlund+renesas@ragnatech.se, robert.jarzmik@free.fr, songjun.wu@microchip.com, andrew-ct.chen@mediatek.com, gregkh@linuxfoundation.org, shuah@kernel.org, sakari.ailus@linux.intel.com, pavel@ucw.cz, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, devel@driverdev.osuosl.org, Steve Longerbeam <steve_longerbeam@mentor.com> 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1490030604.2917.103.camel@pengutronix.de> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2017.3.21.112115 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, FROM_NAME_PHRASE 0, IN_REP_TO 0, LEGITIMATE_SIGNS 0, MSG_THREAD 0, MULTIPLE_REAL_RCPTS 0, NO_URI_HTTPS 0, REFERENCES 0, SINGLE_URI_IN_BODY 0, __ANY_URI 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CC_NAME 0, __CC_NAME_DIFF_FROM_ACC 0, __CC_REAL_NAMES 0, __CD 0, __CP_URI_IN_BODY 0, __CT 0, __CT_TEXT_PLAIN 0, __FORWARDED_MSG 0, __HAS_CC_HDR 0, __HAS_FROM 0, __HAS_LIST_ID 0, __HAS_MSGID 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __NO_HTML_TAG_RAW 0, __REFERENCES 0, __SANE_MSGID 0, __SINGLE_URI_TEXT 0, __SUBJ_ALPHA_NEGATE 0, __TO_MALFORMED_2 0, __TO_NAME 0, __TO_NAME_DIFF_FROM_ACC 0, __TO_REAL_NAMES 0, __URI_IN_BODY 0, __URI_NO_MAILTO 0, __URI_NS , __URI_WITH_PATH 0, __USER_AGENT 0' |
Commit Message
Russell King (Oracle)
March 21, 2017, 11:27 a.m. UTC
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?
Comments
On 03/21/2017 04:27 AM, Russell King - ARM Linux wrote: > 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 thinking, to support propagating the colorimetry params, there should be a util function void imx_media_copy_colorimetry(struct v4l2_mbus_framefmt *out, struct v4l2_mbus_framefmt *in); that can be used throughout the pipeline, that does exactly what you add 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. For CSI that is a bit difficult, because the source formats are hardly related to the sink formats, so so much would have to be modified after copying the sink format that it would be rather pointless, except to forward the colorimetry params. Steve > 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, > > >
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,