From patchwork Fri Sep 14 02:13:43 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: 10600251 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 1CFF115A7 for ; Fri, 14 Sep 2018 02:14:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C5D62B6AE for ; Fri, 14 Sep 2018 02:14:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40FFC2B6B5; Fri, 14 Sep 2018 02:14:36 +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 2426B2B6AE for ; Fri, 14 Sep 2018 02:14:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728211AbeINH0g (ORCPT ); Fri, 14 Sep 2018 03:26:36 -0400 Received: from bin-mail-out-05.binero.net ([195.74.38.228]:57126 "EHLO bin-mail-out-05.binero.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728218AbeINH0g (ORCPT ); Fri, 14 Sep 2018 03:26:36 -0400 X-Halon-ID: e66fba2e-b7c3-11e8-b628-0050569116f7 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id e66fba2e-b7c3-11e8-b628-0050569116f7; Fri, 14 Sep 2018 04:14:24 +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 1/3] rcar-vin: align format width with hardware limits Date: Fri, 14 Sep 2018 04:13:43 +0200 Message-Id: <20180914021345.9277-2-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180914021345.9277-1-niklas.soderlund+renesas@ragnatech.se> References: <20180914021345.9277-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 The Gen3 datasheets lists specific alignment restrictions compared to Gen2. This was overlooked when adding Gen3 support as no problematic configuration was encountered. However when adding support for Gen3 Up Down Scaler (UDS) strange issues could be observed for odd widths without taking this limit into consideration. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index dc77682b47857c97..2fc2a05eaeacb134 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -673,6 +673,21 @@ static void rvin_mc_try_format(struct rvin_dev *vin, pix->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(true, pix->colorspace, pix->ycbcr_enc); + switch (vin->format.pixelformat) { + case V4L2_PIX_FMT_NV16: + pix->width = ALIGN(pix->width, 0x80); + break; + case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_UYVY: + case V4L2_PIX_FMT_RGB565: + case V4L2_PIX_FMT_XRGB555: + pix->width = ALIGN(pix->width, 0x40); + break; + default: + pix->width = ALIGN(pix->width, 0x20); + break; + } + rvin_format_align(vin, pix); }