Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3708394pxb; Mon, 24 Jan 2022 15:59:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJyp2XIBugsEgN8rYejIi+EPe5CTmE0a/6IikmZZlvm1h/oYRTkhKDjEzMRElY/378sbUE8q X-Received: by 2002:a17:90b:3908:: with SMTP id ob8mr686485pjb.47.1643068783547; Mon, 24 Jan 2022 15:59:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643068783; cv=none; d=google.com; s=arc-20160816; b=NzGSRIbmXvnoV6C6pK83b1fxAHoozw7M1GupiBItb/uVBmQAFX9enzSvYPvOgfqd0a RUM+yA7jSYtohbC8UykX8enOP4w16i0eEnN8k5BIW+qjp3xMFoGQPhfGHANUFVmRScBK PBuxQFXRGIkRoj49pYgQ9kDKh5uzK2YLKyBTV4yyf81FZmpl2TqgGu5CU0ls8D772YkF IMOJcWlgDa0Nwcyn9Kj/xa1sRTU40BpBXHuTOiJ3zAjmatScOHvhEAFarkb9V1V+4rfd GrwzX7rCAvpeiEDJSLRzxCqzRlI/uaKLhBKPl62EkcZ7z83GrL2rzTz7KipPIbbugSZv 8vkw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CZCxgCCvjPTJTVSz45jIoG0IC+rrByLqan+yDF1coAY=; b=z4FwiuDqJvzp/m0G6SmN9H/Tx+wEAi1rQgNaakBzGsslxprA+eIqFWIT57mKsLYBNW RpcsuuZBMYRptE+vSfSALLOBsi7KQS9xsPwng7xCEnCVMdNrQBEhlDubnRVuCBGUD+aI OrDEgrrZioN/K+YNBwvLaM+QtaqMMQN8GQoehKELSTYPPheP6Y6OV3Ty/VXA5Fu87c52 FijxQlhQ5njTnZqDDYMJpwzyKKZRQGKWGvSB1Okgc5eRcUozXdEgaxyMxIEid642N/kZ qoo7fogpw9cXej+KMp2vMvgKJnA44W3+Q74Qlqwa6iIcL8Pp/4hEAIFshPJ7fDbGfh5n Gh9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MoTELk0E; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y14si3722452pgl.94.2022.01.24.15.59.32; Mon, 24 Jan 2022 15:59:43 -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=@linuxfoundation.org header.s=korg header.b=MoTELk0E; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2367758AbiAXX40 (ORCPT + 99 others); Mon, 24 Jan 2022 18:56:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1846415AbiAXXPz (ORCPT ); Mon, 24 Jan 2022 18:15:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8572CC0604D2; Mon, 24 Jan 2022 13:24:30 -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 ams.source.kernel.org (Postfix) with ESMTPS id 4E30CB812A8; Mon, 24 Jan 2022 21:24:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E974C340E4; Mon, 24 Jan 2022 21:24:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059468; bh=BybjXRdFrnNgucLm1SBhLKOfxFS0NwCWkQYWRha5CHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MoTELk0EuqWlLWeIGA+4AP9oPrtNc6S/kWkES21PtfdhYsO0t4K7RX1irGg/mDz/B d8GF7r+wVILnY0qWEIfJZ3v3bov2vR97KBzDKk6U+cZewzglGQsIAY9qPL5Uiu3U3o 5R4KypRrbGS+20L3PLE/1VjYbeXIjUXZfMmCXrQ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0618/1039] media: rcar-vin: Update format alignment constraints Date: Mon, 24 Jan 2022 19:40:07 +0100 Message-Id: <20220124184146.112090744@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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