From patchwork Fri Oct 31 09:10:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Kaneko X-Patchwork-Id: 5203431 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 422BFC11AC for ; Fri, 31 Oct 2014 09:10:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6CC9E20172 for ; Fri, 31 Oct 2014 09:10:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 893722015D for ; Fri, 31 Oct 2014 09:10:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932227AbaJaJK2 (ORCPT ); Fri, 31 Oct 2014 05:10:28 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:60095 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932152AbaJaJKW (ORCPT ); Fri, 31 Oct 2014 05:10:22 -0400 Received: by mail-pa0-f49.google.com with SMTP id lj1so7234543pab.8 for ; Fri, 31 Oct 2014 02:10:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=6bHFbCgttkg636NXUy61akETRkAjzpK7JuOc36tSju4=; b=ljTEeuRCwRq4fyAbAJjmO5U1aNA7K75gEF7g0bk0y/dfKtPTcyEAumelYa8lLC6hdv YYxllZYLmn0h46ruqqiqLZqoEDRZQ07gqFqFXv2NHfqpu3FjP7x3dpLO/K7olsWrYvMH oJcaKOxwWU+oD8Qh3HNsh5Y/tUNEGYoESgcyCW/n6PaUbePTtce0s1CR23EsP4giSBWj h8z0chFhQLTuJT2MTYIY5p7m6+IJDWNsi32m7La7m7pP5TRf5abXoDFu+gaVZ0sNXsMQ V27u+D+chbr8XEHC1f+5/Hb7nJk8HBb/qJyKWy92kfFO1yPRqhBrugOlnwRN7GSTKU+6 8+7g== X-Received: by 10.70.140.70 with SMTP id re6mr14868827pdb.149.1414746622034; Fri, 31 Oct 2014 02:10:22 -0700 (PDT) Received: from localhost.localdomain (p5095-ipngn6701marunouchi.tokyo.ocn.ne.jp. [153.174.4.95]) by mx.google.com with ESMTPSA id qu6sm1079350pbc.92.2014.10.31.02.10.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 31 Oct 2014 02:10:21 -0700 (PDT) From: Yoshihiro Kaneko To: linux-media@vger.kernel.org Cc: Guennadi Liakhovetski , Simon Horman , Magnus Damm , linux-sh@vger.kernel.org Subject: [PATCH] media: soc_camera: rcar_vin: Fix alignment of clipping size Date: Fri, 31 Oct 2014 18:10:10 +0900 Message-Id: <1414746610-23194-1-git-send-email-ykaneko0929@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 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. 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 @@ -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); @@ -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 + * to a memory per even pixels. + */ + if ((pixfmt == V4L2_PIX_FMT_NV16) || (pixfmt == V4L2_PIX_FMT_YUYV) || + (pixfmt == V4L2_PIX_FMT_UYVY)) + 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); width = pix->width; height = pix->height;