Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2128182iof; Tue, 7 Jun 2022 20:41:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwhdHgS0v8Upuf19xeBNIqu8ZdXIaYkWsai0ZMXYUaLtF+rpe3UXui1xT0TUmelr0Euxy7 X-Received: by 2002:a17:902:e0c2:b0:167:6128:e63d with SMTP id e2-20020a170902e0c200b001676128e63dmr20530865pla.16.1654659664327; Tue, 07 Jun 2022 20:41:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654659664; cv=none; d=google.com; s=arc-20160816; b=ZrCqN1bk3D8v2/d5tKWtym4JIZUXNSZp4/RICiHSABCKQpphxjtC3uYN3O80egoLqZ wbigf6TQUx0tBBaJy+iIX6tiZ87CfppOsnHF4kYa+0957eFSySMP3ERnfCKlfrvx3sFJ pxyfe/B2b62GY/0ypeGx2BC0Q1cj/oFK+WE9J921gz+DanZozdoNVyvylg7efIxsiK5A EoCZT2xjtbiTUE1HMAlaEzAm24Ykw25JG+/2hbvkGT3yQhrRasegUmcCLKOEeTGKQq+5 /r4A4+Lhyxpu0P13XZ6aoMFUd/uKT09DND0ptRQih0hWjSD+2cauBYgWwW1JtWtbOFRm PlKQ== 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=vLaE2v9u4x+CgqPafBmVhi+VhdZTpTb4v+hFkii1Vk8=; b=ZbCO3npkTMb51p/SiRXVg5cMOYpFey/R8KSksQ9/GfUB/erwrfD7Hp2zKz0q8bo304 LRgPBZI2k6yVXu/IoRg+RynRoaL3db7sp/Wb/WdGw3wuobbBFN9FnJw7yMyVi3N6WkD/ +rkfe+K8oAVE2D9tjcH2fXoHWH34HGVQH6Zg90m/AEXPB6+lbs2H/QJUl9f18gTwAiTt 3siEctVnVHl+ZRhyVEBygsdj2Nmd88/0euTWDtahzQdKRcaVCmwHFBh7JrPKtToEhW1P Z6nuDEBChLJnEtSR4fOxFmPLhdlYnvKXwHJqiC7lICqfmS2r6cac1IiNtvEBsHWVStfY eYBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DMDbfDbc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e62-20020a636941000000b003fdac19f9easi11320139pgc.733.2022.06.07.20.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 20:41:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DMDbfDbc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 812E92B2EA4; Tue, 7 Jun 2022 19:59:09 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386170AbiFGWsR (ORCPT + 99 others); Tue, 7 Jun 2022 18:48:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381285AbiFGVkY (ORCPT ); Tue, 7 Jun 2022 17:40:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60A0616FEEC; Tue, 7 Jun 2022 12:06:10 -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 dfw.source.kernel.org (Postfix) with ESMTPS id EFB48617DA; Tue, 7 Jun 2022 19:06:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F44DC385A2; Tue, 7 Jun 2022 19:06:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628769; bh=/LaCpluMEeShuvIrMiUNHXDWu5sar2QacCl1BpBcrRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DMDbfDbchsYrYAb2frUDigqtdocfe9MlSEqkZIUx3zgVZEPCri2UXlOecnESeCc2D yQFJyuongZk8VT//uewKgxgJ9AEckb8p5fs2fh2cXFeOR1sO+fsZjPnyfnvvPNo2dg LlmoNqvnO8ddNJwgJZB8DJaWCOLCIdUSlXzU0/l8= 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.18 448/879] media: vsp1: Fix offset calculation for plane cropping Date: Tue, 7 Jun 2022 18:59:26 +0200 Message-Id: <20220607165015.873509496@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no 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/renesas/vsp1/vsp1_rpf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c b/drivers/media/platform/renesas/vsp1/vsp1_rpf.c index 85587c1b6a37..75083cb234fe 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/renesas/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