From patchwork Thu Nov 20 01:45:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 27049 X-Patchwork-Delegate: g.liakhovetski@gmx.de Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1XrGon-00010E-2M; Thu, 20 Nov 2014 02:45:57 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-5) with esmtp id 1XrGok-0004RS-8A; Thu, 20 Nov 2014 02:45:56 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756032AbaKTBpv (ORCPT + 1 other); Wed, 19 Nov 2014 20:45:51 -0500 Received: from kirsty.vergenet.net ([202.4.237.240]:33463 "EHLO kirsty.vergenet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754751AbaKTBpu (ORCPT ); Wed, 19 Nov 2014 20:45:50 -0500 Received: from ayumi.isobedori.kobe.vergenet.net (p7231-ipbfp1204kobeminato.hyogo.ocn.ne.jp [118.11.151.231]) by kirsty.vergenet.net (Postfix) with ESMTP id 92D29266CED; Thu, 20 Nov 2014 12:45:48 +1100 (EST) Received: by ayumi.isobedori.kobe.vergenet.net (Postfix, from userid 7100) id 2D790EDE5BF; Thu, 20 Nov 2014 10:45:47 +0900 (JST) Date: Thu, 20 Nov 2014 10:45:47 +0900 From: Simon Horman To: Sergei Shtylyov Cc: Yoshihiro Kaneko , linux-media@vger.kernel.org, Guennadi Liakhovetski , Magnus Damm , linux-sh@vger.kernel.org Subject: Re: [PATCH] media: soc_camera: rcar_vin: Fix alignment of clipping size Message-ID: <20141120014547.GA29752@verge.net.au> References: <1414746610-23194-1-git-send-email-ykaneko0929@gmail.com> <5453915E.3020100@cogentembedded.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <5453915E.3020100@cogentembedded.com> Organisation: Horms Solutions Ltd. User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2014.11.20.13918 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, MSGID_ADDED_BY_MTA 0.05, BODY_SIZE_4000_4999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, REFERENCES 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CD 0, __CP_MEDIA_BODY 0, __CP_URI_IN_BODY 0, __CT 0, __CT_TEXT_PLAIN 0, __FORWARDED_MSG 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __REFERENCES 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __SUBJ_ALPHA_NEGATE 0, __TO_MALFORMED_2 0, __URI_NO_WWW 0, __URI_NS , __USER_AGENT 0' Hi, On Fri, Oct 31, 2014 at 04:40:46PM +0300, Sergei Shtylyov wrote: > Hello. > > On 10/31/2014 12:10 PM, Yoshihiro Kaneko wrote: > > >From: Koji Matsuoka > > >Since the Start Line Pre-Clip register, the Start Pixel Pre-Clip > >register and the End Line Post-Clip register do not have restriction > > Hm, my R-Car H1 manual says to specify an even number for the Start Pixel > Pre-Clip Register. Thanks. I have confirmed with Matsuoka-san that you are correct. It seems to me that the following portion of the patch should be removed accordingly. > >of H/W to a setting value, the processing of alignment is unnecessary. > >This patch corrects so that processing of alignment is not performed. > > >However, the End Pixel Post-Clip register has restriction > >of H/W which must be an even number value at the time of the > >output of YCbCr-422 format. By this patch, the processing of > >alignment to an even number value is added on the above-mentioned > >conditions. > > Well, the R-Car H1/M1A manuals don't specify such restriction. Thanks, I have confirmed with Matsuoka-san that the above text is somewhat misleading. And I think it should read something more like this: In the case where YCbCr-422 is used and (End pixel post clip) - (Start pixel post clip) is odd one will be added by the hardware to round it up to an even number. I see this in section 26.2.11 Video n End Pixel Post-Clip Register (VnEPPoC) if the R-Car Gen 2 manual. > >The variable set to a register is as follows. > > > - Start Line Pre-Clip register > > cam->vin_top > > - Start Pixel Pre-Clip register > > cam->vin_left > > - End Line Post-Clip register > > pix->height > > - End Pixel Post-Clip register > > pix->width > > >Signed-off-by: Koji Matsuoka > >Signed-off-by: Yoshihiro Kaneko > >--- > > drivers/media/platform/soc_camera/rcar_vin.c | 18 ++++++++++++++---- > > 1 file changed, 14 insertions(+), 4 deletions(-) > > >diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c > >index d3d2f7d..1934e15 100644 > >--- a/drivers/media/platform/soc_camera/rcar_vin.c > >+++ b/drivers/media/platform/soc_camera/rcar_vin.c > [...] > >@@ -1761,8 +1761,18 @@ static int rcar_vin_try_fmt(struct soc_camera_device *icd, > > } > > > > /* FIXME: calculate using depth and bus width */ > >- v4l_bound_align_image(&pix->width, 2, VIN_MAX_WIDTH, 1, > >- &pix->height, 4, VIN_MAX_HEIGHT, 2, 0); > >+ /* > >+ * When performing a YCbCr-422 format output, even if it performs > >+ * odd number clipping by pixel post clip processing, it is outputted > > s/outputted/output/ -- it's an irregular verb. > > >+ * to a memory per even pixels. > >+ */ > >+ if ((pixfmt == V4L2_PIX_FMT_NV16) || (pixfmt == V4L2_PIX_FMT_YUYV) || > >+ (pixfmt == V4L2_PIX_FMT_UYVY)) > > This is certainly asking to be a *switch* statement instead... > > >+ v4l_bound_align_image(&pix->width, 5, VIN_MAX_WIDTH, 1, > >+ &pix->height, 2, VIN_MAX_HEIGHT, 0, 0); > >+ else > >+ v4l_bound_align_image(&pix->width, 5, VIN_MAX_WIDTH, 0, > >+ &pix->height, 2, VIN_MAX_HEIGHT, 0, 0); > > WBR, Sergei > > -- > To unsubscribe from this list: send the line "unsubscribe linux-sh" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/media/platform/soc_camera/rcar_vin.c +++ b/drivers/media/platform/soc_camera/rcar_vin.c @@ -1558,8 +1558,8 @@ static int rcar_vin_set_crop(struct soc_camera_device *icd, cam->width = mf.width; cam->height = mf.height; - cam->vin_left = rect->left & ~1; - cam->vin_top = rect->top & ~1; + cam->vin_left = rect->left; + cam->vin_top = rect->top; /* Use VIN cropping to crop to the new window. */ ret = rcar_vin_set_rect(icd);