Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2162929iof; Tue, 7 Jun 2022 21:51:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxL9mG0Rzu8/EBNFj+5KxrB8WDM6+2gLtb3LanI9DWmPOe9pLDRY+ghdKkk4fSJmTVHfQ60 X-Received: by 2002:a17:902:e484:b0:167:5b79:2b61 with SMTP id i4-20020a170902e48400b001675b792b61mr21222510ple.132.1654663869279; Tue, 07 Jun 2022 21:51:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654663869; cv=none; d=google.com; s=arc-20160816; b=wjqJJanWok3bGlj+EYmzmE4PopgxSloRFDj4ns3HRvtN8mQgV5dIoYRurtAinTYbQw FjPV3Humz8nmNBs+ifdVOqW5vVTYLJ6xkaYcl0N7QlNpyP6i5kNNDE6i1PsxY7Z3FhYB 1CzH0/EoUOvHIwe26mB+SWsYoP8jKuJImeIZrihNYl9UFqDTMPz+tsYe9t1pE0/o1pAR anmtuEFI1iKwpfdW5dAFWDM0mdKEIQ7ABjfkgy+z3ISnH3WAoeSPQ0grzYWctQoTQU32 YLBSAJynyuCVni0AFoEnLNkgGQUYFMYLTt0c1MewlkDWeeQC1h4upWGH/Gw8qiC6e3kA zSBA== 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=A/ZesDTjXR6bsGjY8WKLjt+Ua2035/HYSxkbm/jIRgfJhIfAldQCciAUm6vJc7genS bFwDI7yG0j/plfWBDCNkb0IArATp5nUamBbCrik5RsmAZFvaUMW2MsZLL56ZnQ7HRCYx o1F+tDo7z850XV4+j0KBtwHavPz+1nUVjmkqDIXN6jCE1JIb5MxGpTgRLEX+Ch9bCMrx 36b9hsfVRXoiLLOVQVTN3ht8LkVF5eybY68Bt3kTOs+GzvHJKoUoZG/vCCcIyKSmDW+u sPOsXkRbDoz9NEJT7JQn4ACA9EzwIuYsmlZ8cUp51SvD1u7xaDN28iBxW0QcZkuCDRHd 7Nog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rB3IFviH; 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 h7-20020a170902f70700b00163e05df91asi25795863plo.37.2022.06.07.21.51.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:51:09 -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=rB3IFviH; 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 3503E45016D; Tue, 7 Jun 2022 21:21:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379332AbiFGVJ2 (ORCPT + 99 others); Tue, 7 Jun 2022 17:09:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359404AbiFGULf (ORCPT ); Tue, 7 Jun 2022 16:11:35 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 136FA13AF21; Tue, 7 Jun 2022 11:27:31 -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 sin.source.kernel.org (Postfix) with ESMTPS id 03A82CE244F; Tue, 7 Jun 2022 18:27:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A7B4C385A2; Tue, 7 Jun 2022 18:27:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654626448; bh=QcTT9tWSEZAh16mynkwIDPHeS0sPX5L9CulWKauULAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rB3IFviHK2Div/CgL7QV6QuTE+IvRI5taD3aGjWzvFvFWwIpRN4cqQHN2lFsIGNuo /ddhjPPXWAr/Au7H/nY+iBjesL9GzJHjkkkdtH9GRrsoy0lLgSs2l9LJXzhmcRWGTl 44lyC1Cqj3f9oUfg3NYGNXfFAoC8HlNxDhZuNQT0= 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.17 380/772] media: vsp1: Fix offset calculation for plane cropping Date: Tue, 7 Jun 2022 18:59:32 +0200 Message-Id: <20220607165000.212958582@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164948.980838585@linuxfoundation.org> References: <20220607164948.980838585@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/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