Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3386537pxb; Mon, 17 Jan 2022 19:18:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJwLKf4A6mdWdisYqYtBVU17EvzFgRJ4rxMWG3RL5FHQkyyflJP4/6tIAC4tHvcalTRJzNWc X-Received: by 2002:a05:6a00:1749:b0:4c2:eb5f:88e with SMTP id j9-20020a056a00174900b004c2eb5f088emr16234675pfc.46.1642475895967; Mon, 17 Jan 2022 19:18:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642475895; cv=none; d=google.com; s=arc-20160816; b=pY4d+ZT0FRFztNGdARu3AS5JJq1dU7AuDMTuKOyTr1GfBDndf8WoMw1AYSFL3EQK7Q ivHhTdlXC+9Z5jU9HUUkYsmt6fzP6N8qkH1vreqjTQyjmDwxzUthVf6W7KhXETgwEdYr hiHVjZJPCdXrnzcjKyK323xfbyoMpuAge2V2coUfTVXRut0KT4jFCrJRGFq/mUGsh+62 FuY+z4vq6Wh7Ii0D+MNpIcVZxt3Ysyml51Y4O65R//TFgMWAdNzmhUxJx7hdelnP6ABh A4tY42SUKcM70UCihcE+kVXTk3ILIrvlYhVS7R6aAAs3r29QB6R+53TEdaBpd2+e96P/ AQhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CZCxgCCvjPTJTVSz45jIoG0IC+rrByLqan+yDF1coAY=; b=I9W1A890gNnks8J0Fvcrwkms6YbkgJSbpd0U9VJPAECc7skrfoerr+wJUJhVJrj5vI EOOP0qMLRAmxxxDz8jhDjkYdAG7yYcMEzgSS65syJ8g42FvN6Yw9aBD+XmcCNO0hGvjQ rhS0AppjduXxe4j2NWE4TVvR1PktNjczcD79lIiNvDKan5/F9WB1MkY0Fx3+rghg5Kko pUjIza2ktfOe+/y0IBZY02Pb8UqIDGTHIBkzGTqN8iTRUZFhyURlaTGCVF2/Coynu5g3 lRooBp3TGOi5dVvd5VfbkzXiy1mCvJS8kVjXL1Cm3hDlmfXB2exp2/uPa+3TgsSrbi7G XAAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=F8OonCXj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x9si1177973pjo.75.2022.01.17.19.18.00; Mon, 17 Jan 2022 19:18:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=F8OonCXj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236875AbiARC2Z (ORCPT + 99 others); Mon, 17 Jan 2022 21:28:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244989AbiARC0O (ORCPT ); Mon, 17 Jan 2022 21:26:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D1F9C061368; Mon, 17 Jan 2022 18:24:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A508E60C96; Tue, 18 Jan 2022 02:24:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05531C36AE3; Tue, 18 Jan 2022 02:24:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642472684; bh=BybjXRdFrnNgucLm1SBhLKOfxFS0NwCWkQYWRha5CHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F8OonCXj85jnBxsFzLLvn/sN5DKMK2MAnX6xLbgS2JhlBV63B/ghzcm7mndvzAtRN lulCyZFSV5UK+dM5Pmfv/uXb3DDWQWk7fGc5v+8DYQSbzsvqz+OML6BEnIbbQL7dZF fsjbycBlcenQoht5Fi5wzTB2JllxMH+AWXNh4AGL7yrV4tBqqPtwV8a2dxVrPpby3W P3iH7UawmwWb46guOLNoUzZb+xoMVZCJTyR9ts7qJOrtdIzqm3Xll65z+S4rKfghyC R43UYBvv9sZXBJKAEc+SGGIncyOdYUCyvxowSAn4ZXpJ0C4rJqwqWUhiGEF3h0h6ST ZlQl4rHN0axuQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin , niklas.soderlund@ragnatech.se, mchehab@kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH AUTOSEL 5.16 098/217] media: rcar-vin: Update format alignment constraints Date: Mon, 17 Jan 2022 21:17:41 -0500 Message-Id: <20220118021940.1942199-98-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220118021940.1942199-1-sashal@kernel.org> References: <20220118021940.1942199-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Niklas Söderlund [ Upstream commit da6911f330d40cfe115a37249e47643eff555e82 ] This change fixes two issues with the size constraints for buffers. - There is no width alignment constraint for RGB formats. Prior to this change they were treated as YUV and as a result were more restricted than needed. Add a new check to differentiate between the two. - The minimum width and height supported is 5x2, not 2x4, this is an artifact from the driver's soc-camera days. Fix this incorrect assumption. Signed-off-by: Niklas Söderlund Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index a5bfa76fdac6e..2e60b9fce03b0 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -179,20 +179,27 @@ static void rvin_format_align(struct rvin_dev *vin, struct v4l2_pix_format *pix) break; } - /* HW limit width to a multiple of 32 (2^5) for NV12/16 else 2 (2^1) */ + /* Hardware limits width alignment based on format. */ switch (pix->pixelformat) { + /* Multiple of 32 (2^5) for NV12/16. */ case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV16: walign = 5; break; - default: + /* Multiple of 2 (2^1) for YUV. */ + case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_UYVY: walign = 1; break; + /* No multiple for RGB. */ + default: + walign = 0; + break; } /* Limit to VIN capabilities */ - v4l_bound_align_image(&pix->width, 2, vin->info->max_width, walign, - &pix->height, 4, vin->info->max_height, 2, 0); + v4l_bound_align_image(&pix->width, 5, vin->info->max_width, walign, + &pix->height, 2, vin->info->max_height, 0, 0); pix->bytesperline = rvin_format_bytesperline(vin, pix); pix->sizeimage = rvin_format_sizeimage(pix); -- 2.34.1