From patchwork Thu Apr 27 22:41:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 9703603 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 3A95A603F7 for ; Thu, 27 Apr 2017 22:43:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F31EA2846F for ; Thu, 27 Apr 2017 22:43:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7E5F285F3; Thu, 27 Apr 2017 22:43:13 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AA9E28521 for ; Thu, 27 Apr 2017 22:43:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034246AbdD0WnL (ORCPT ); Thu, 27 Apr 2017 18:43:11 -0400 Received: from smtp-4.sys.kth.se ([130.237.48.193]:57479 "EHLO smtp-4.sys.kth.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031951AbdD0Wmz (ORCPT ); Thu, 27 Apr 2017 18:42:55 -0400 Received: from smtp-4.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-4.sys.kth.se (Postfix) with ESMTP id 2CBB83328; Fri, 28 Apr 2017 00:42:51 +0200 (CEST) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-4.sys.kth.se ([127.0.0.1]) by smtp-4.sys.kth.se (smtp-4.sys.kth.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id iyo7Q-p_nukP; Fri, 28 Apr 2017 00:42:50 +0200 (CEST) X-KTH-Auth: niso [89.233.230.99] X-KTH-mail-from: niklas.soderlund+renesas@ragnatech.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by smtp-4.sys.kth.se (Postfix) with ESMTPSA id 09224D42; Fri, 28 Apr 2017 00:42:49 +0200 (CEST) From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= To: Laurent Pinchart , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, tomoharu.fukawa.eb@renesas.com, Sakari Ailus , Geert Uytterhoeven , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Kieran Bingham Subject: [PATCH v4 10/27] rcar-vin: do not reset crop and compose when setting format Date: Fri, 28 Apr 2017 00:41:46 +0200 Message-Id: <20170427224203.14611-11-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170427224203.14611-1-niklas.soderlund+renesas@ragnatech.se> References: <20170427224203.14611-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It was a bad idea to reset the crop and compose settings when a new format is set. This would overwrite any crop/compose set by s_select and cause unexpected behaviors, remove it. Also fold the reset helper in to the only remaining caller. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 40bb3d7e73131d3b..e14f0aff8ceecc68 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -90,17 +90,6 @@ static u32 rvin_format_sizeimage(struct v4l2_pix_format *pix) * V4L2 */ -static void rvin_reset_crop_compose(struct rvin_dev *vin) -{ - vin->crop.top = vin->crop.left = 0; - vin->crop.width = vin->source.width; - vin->crop.height = vin->source.height; - - vin->compose.top = vin->compose.left = 0; - vin->compose.width = vin->format.width; - vin->compose.height = vin->format.height; -} - static int rvin_reset_format(struct rvin_dev *vin) { struct v4l2_subdev_format fmt = { @@ -147,7 +136,13 @@ static int rvin_reset_format(struct rvin_dev *vin) break; } - rvin_reset_crop_compose(vin); + vin->crop.top = vin->crop.left = 0; + vin->crop.width = mf->width; + vin->crop.height = mf->height; + + vin->compose.top = vin->compose.left = 0; + vin->compose.width = mf->width; + vin->compose.height = mf->height; vin->format.bytesperline = rvin_format_bytesperline(&vin->format); vin->format.sizeimage = rvin_format_sizeimage(&vin->format); @@ -323,8 +318,6 @@ static int rvin_s_fmt_vid_cap(struct file *file, void *priv, vin->format = f->fmt.pix; - rvin_reset_crop_compose(vin); - return 0; }