Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp443189iog; Mon, 13 Jun 2022 06:06:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgHLk9XRAP1fdF09+NYLyGUjaGpKfUA3y7LhiapOP7pO5VMr/CBQaiRZtvlf8wx6gYVlf4 X-Received: by 2002:a05:6402:28a9:b0:42d:cde1:cf87 with SMTP id eg41-20020a05640228a900b0042dcde1cf87mr66494597edb.368.1655125590647; Mon, 13 Jun 2022 06:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125590; cv=none; d=google.com; s=arc-20160816; b=0M1URbGrL81o1qecpPK7T+haYiBr2Z0qEGx9GvH7WYKGhnQ+8xZltLu04NIPd15a2G H2Q5T6kgrp5oNil6i/o8AF7ftYlhXVlJS+VM3EM/5csFJbxdRuiZ6oCxR+JUh5nouvdt LVKGr8NEUNg0BiY/RZ+tlrYDEyXAG9/9FhurEj76J2yrPflSJ4jnu4Founpq1b4gKnmu oYBfLLiiTthChfS7s5Vss/IX1SGl496Leu3WweblBhUPkhhEyjVMG4MY/Zx1W1szkBpt dAjryvLxFAJUknGmORZa/RIJTa3TJ8UewrVTUR7hUlmcskFLdAmpTXGDsLZzatzmj7U9 /N5A== 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=zJdWqdc5S7tBcL+09+E69mDW2xAnQw9sF0miYMID/5Y=; b=pvfsmHQpmoov/jH5S3viLzq3Fmsg4qu56h5YWdE1byeyJfQNgyNmFXU+WBfI5y/viU SSagp/TwBq3GQSiRNpm4wXHBF4udaSyXUrhUFafHPC8keFR1oF79MoL9xdFqkdAITIQY C67zUJdqpXjPUOf6sGuquEMkEXCbaEM/kwMi0kiME6ssF5YjLoPCiNUSm9GQVdNJqbMT KOre4AOdKUXVEIpT+crCrleyvbrGwlE5Hb98pcmc8CoQ7CuZ9xvrFpesjyDMVBJAF4hI fnVsFw+RPmFbUz3VNq6/Q28RPa2PPwSkVZgRvzNDM5Sm3IsT1g4mlTMgBeeMMI0XXrDr Dacg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cRybTqmS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h17-20020a056402281100b0042bd9d36e02si8553860ede.584.2022.06.13.06.05.54; Mon, 13 Jun 2022 06:06:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cRybTqmS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1353276AbiFMLTi (ORCPT + 99 others); Mon, 13 Jun 2022 07:19:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353171AbiFMLPK (ORCPT ); Mon, 13 Jun 2022 07:15:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E243D167D0; Mon, 13 Jun 2022 03:37:43 -0700 (PDT) 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 3619CB80E93; Mon, 13 Jun 2022 10:37:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A772CC34114; Mon, 13 Jun 2022 10:37:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655116661; bh=QcTT9tWSEZAh16mynkwIDPHeS0sPX5L9CulWKauULAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cRybTqmSuf1/WH8KfHuW2Ltl6ZN7sytKrXTob5z2BKmIgDGceu9KWhL/qvw/bsS9b NUV1jsoRD6ew0sq0O2gZX0etRr+uduanyRlMKmVhKf4yyYKSHIW+Bn4ebPltXwoHKF ZIym9UizuTCjQ/zNX0VWwtTYdQI8xhYdu07VnHzs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Rodin , LUU HOAI , Laurent Pinchart , Kieran Bingham , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.4 139/411] media: vsp1: Fix offset calculation for plane cropping Date: Mon, 13 Jun 2022 12:06:52 +0200 Message-Id: <20220613094932.838140321@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094928.482772422@linuxfoundation.org> References: <20220613094928.482772422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Rodin [ Upstream commit 5f25abec8f21b7527c1223a354d23c270befddb3 ] The vertical subsampling factor is currently not considered in the offset calculation for plane cropping done in rpf_configure_partition. This causes a distortion (shift of the color plane) when formats with the vsub factor larger than 1 are used (e.g. NV12, see vsp1_video_formats in vsp1_pipe.c). This commit considers vsub factor for all planes except plane 0 (luminance). Drop generalization of the offset calculation to reduce the binary size. Fixes: e5ad37b64de9 ("[media] v4l: vsp1: Add cropping support") Signed-off-by: Michael Rodin Signed-off-by: LUU HOAI Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/vsp1/vsp1_rpf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c index 85587c1b6a37..75083cb234fe 100644 --- a/drivers/media/platform/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/vsp1/vsp1_rpf.c @@ -291,11 +291,11 @@ static void rpf_configure_partition(struct vsp1_entity *entity, + crop.left * fmtinfo->bpp[0] / 8; if (format->num_planes > 1) { + unsigned int bpl = format->plane_fmt[1].bytesperline; unsigned int offset; - offset = crop.top * format->plane_fmt[1].bytesperline - + crop.left / fmtinfo->hsub - * fmtinfo->bpp[1] / 8; + offset = crop.top / fmtinfo->vsub * bpl + + crop.left / fmtinfo->hsub * fmtinfo->bpp[1] / 8; mem.addr[1] += offset; mem.addr[2] += offset; } -- 2.35.1