From patchwork Thu Oct 4 20:04:00 2018 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: 10626589 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 84FF6174A for ; Thu, 4 Oct 2018 20:05:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 790A229633 for ; Thu, 4 Oct 2018 20:05:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D387296B2; Thu, 4 Oct 2018 20:05: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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 198F429633 for ; Thu, 4 Oct 2018 20:05:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727519AbeJEDAP (ORCPT ); Thu, 4 Oct 2018 23:00:15 -0400 Received: from vsp-unauthed02.binero.net ([195.74.38.227]:56421 "EHLO vsp-unauthed02.binero.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727526AbeJEDAO (ORCPT ); Thu, 4 Oct 2018 23:00:14 -0400 X-Halon-ID: c8a23265-c810-11e8-ab18-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id c8a23265-c810-11e8-ab18-005056917a89; Thu, 04 Oct 2018 22:05:04 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: Laurent Pinchart , linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [PATCH v2 1/3] rcar-vin: align width before stream start Date: Thu, 4 Oct 2018 22:04:00 +0200 Message-Id: <20181004200402.15113-2-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181004200402.15113-1-niklas.soderlund+renesas@ragnatech.se> References: <20181004200402.15113-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 Instead of aligning the image width to match the image stride at stream start time do so when configuring the format. This allows the format width to strictly match the image stride which is useful when enabling scaling on Gen3. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-dma.c | 5 +---- drivers/media/platform/rcar-vin/rcar-v4l2.c | 9 +++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 92323310f7352147..e752bc86e40153b1 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -597,10 +597,7 @@ void rvin_crop_scale_comp(struct rvin_dev *vin) if (vin->info->model != RCAR_GEN3) rvin_crop_scale_comp_gen2(vin); - if (vin->format.pixelformat == V4L2_PIX_FMT_NV16) - rvin_write(vin, ALIGN(vin->format.width, 0x20), VNIS_REG); - else - rvin_write(vin, ALIGN(vin->format.width, 0x10), VNIS_REG); + rvin_write(vin, vin->format.width, VNIS_REG); } /* ----------------------------------------------------------------------------- diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index dc77682b47857c97..94bc559a0cb1e47a 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -96,6 +96,15 @@ static void rvin_format_align(struct rvin_dev *vin, struct v4l2_pix_format *pix) pix->pixelformat == V4L2_PIX_FMT_XBGR32)) pix->pixelformat = RVIN_DEFAULT_FORMAT; + switch (pix->pixelformat) { + case V4L2_PIX_FMT_NV16: + pix->width = ALIGN(pix->width, 0x20); + break; + default: + pix->width = ALIGN(pix->width, 0x10); + break; + } + switch (pix->field) { case V4L2_FIELD_TOP: case V4L2_FIELD_BOTTOM: