Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1777961iog; Thu, 16 Jun 2022 13:40:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v1BQ2oYc971y7ixvRm3s4v9F65wjIfaF9fJ2WTK8tPlAohVwq86xT9pTrnghCFoAvz0uzt X-Received: by 2002:a65:6045:0:b0:399:3a5e:e25a with SMTP id a5-20020a656045000000b003993a5ee25amr5850550pgp.139.1655412052991; Thu, 16 Jun 2022 13:40:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655412052; cv=none; d=google.com; s=arc-20160816; b=T6gxNYo8E/EhlRvU9IaVrzSnJGd09JaGrfY86uT8GT+wEmIPH91cZEZ4WwZbd03wC5 g74QBgChOesmG6ZZWJmUoVGBBmZUlteS3KFc+KLH2ZKQHZwa61M684fW8NmUqzeFomEq rzUl2WTNUmii6weq0x3rn+mavveRPWU3v4s/KE5aHZu6mGA//EumAJcpGBzaPCmtR5zx vCfjJEEF0t8ZXryr8WsScooS1YvxHlc2Cc+ReSVK/VbK8ZVy29iMVCxW0SGhsnxZUQM0 VD8/FRFnsY8F81NDZjF6TEwyPNKx9XQjJ23DJrWwZNnip69TH+EIP5/feUCbStea64rm A9UA== 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=i3J94croFMFgt0EIDJ5nBaYvM7f2XLJQTjqgj/3/ZjU=; b=e4pWHMzv7Zkd2YNmOTdcVndzKG6ymQYifPsdfwsjmZfTGEZGQUMOR8yNZ2UkwMyvn+ e75zN8V02I+K83d2PsWr72ic4NqfTSkVi5KREOIvH738yzDBwioG+Lig878n/y5VlA9q AYpstE9X+L2XxvRPlcsNIT/8CZioGif0rxl6fTVEeDTmoFjX23p43qSjTJLWvRHgBkZO bcFcxrK9UtdMpkvcKTKZyNYAgTPgNomMa5s4fCnWGVkJw5WUr+hp8DOH5DXJy38uAn6k wDw/4M5b/WQSHnuz9TWVsFvkdwKWdCyAG/CQsX9F6UKUIhMbvPZRKslEVpx6mcBBJcO0 v61g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OjI41978; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d18-20020a170902729200b001617784ea88si3470578pll.356.2022.06.16.13.40.40; Thu, 16 Jun 2022 13:40:52 -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=@gmail.com header.s=20210112 header.b=OjI41978; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378566AbiFPUZo (ORCPT + 99 others); Thu, 16 Jun 2022 16:25:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378552AbiFPUZ0 (ORCPT ); Thu, 16 Jun 2022 16:25:26 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 168CB5B89B; Thu, 16 Jun 2022 13:25:26 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id x5so3696029edi.2; Thu, 16 Jun 2022 13:25:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=i3J94croFMFgt0EIDJ5nBaYvM7f2XLJQTjqgj/3/ZjU=; b=OjI41978muhCWJpsmE5/OwT4NeZE6oN7hB1HJMp+1zL5tIB2+dDizaiyju2FcUW9qX HIT9QQh11RNhiIn6kAMoJlJ0V1HcIwjQ0byUUh6vDi+Cgz473YAWz60fsAqksaBeOlfo wM6zf5PwHxslOSTrTzTA2LEYc1LmySjTyVOZl+H8czBl3PtiWqTCeNe/xE8Sw9rcDXoD Iowbhe4w+W0cfFkDnWAiYdrkDU0J8lnv8aZ4dgWrEwgnnQ75Sdx22inr6Td2NzeCf1Le kg0V6sUw4MclDdS2J5e7nU/G0cTj+f+OQRZs17+zHUJ5UxwRGgx7r88R08oeK8LFHMPR cvAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i3J94croFMFgt0EIDJ5nBaYvM7f2XLJQTjqgj/3/ZjU=; b=VrUonxT75aVYJuRf6oqRxjAp6aV7xfvb4eHaimL+Qk6WxAqIc1Xet08TG2JxFX5Rq1 AyNm5YtU25C+dcZv1j3N80Ekv9SwejgDYWoO+1YGgtK+v1n/rWoQ4ppt6KdsAw8sRxb/ 3mtsuieXwfAMa7nplgZoVccksXN4KdjDBg+LtmGn/jr6j0yd+C/ilt8HO28zvzgDrW6M Z1B42mncQ+Xlq0Yxf8kjUFfSSqHmkKSLghxCb3KZA50E2T75K0GsF8Ggaz69raIO4vko J+kSWTBx7ii9UOfeq2z/HA1gN1PjX1lviCAKKIYwMFk6nIkJkLxLZehLB6sPn0SVWcuq mNjA== X-Gm-Message-State: AJIora9++XAerLk+OxT0iZ7KeTHcYgogip75gn1gsFdrEeUbtIgLDgqK hmj16ndNEP/Zq6iUHNdL7kk= X-Received: by 2002:a05:6402:2788:b0:431:3f86:1d4e with SMTP id b8-20020a056402278800b004313f861d4emr8890198ede.238.1655411124688; Thu, 16 Jun 2022 13:25:24 -0700 (PDT) Received: from kista.localdomain (213-161-3-76.dynamic.telemach.net. [213.161.3.76]) by smtp.gmail.com with ESMTPSA id 21-20020a170906329500b006fe8a4ec62fsm1186760ejw.4.2022.06.16.13.25.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 13:25:24 -0700 (PDT) From: Jernej Skrabec To: ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de Cc: mchehab@kernel.org, hverkuil-cisco@xs4all.nl, benjamin.gaignard@collabora.com, nicolas.dufresne@collabora.com, gregkh@linuxfoundation.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Jernej Skrabec Subject: [PATCH v2 5/7] media: hantro: postproc: Properly calculate chroma offset Date: Thu, 16 Jun 2022 22:25:11 +0200 Message-Id: <20220616202513.351039-6-jernej.skrabec@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220616202513.351039-1-jernej.skrabec@gmail.com> References: <20220616202513.351039-1-jernej.skrabec@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Currently chroma offset calculation assumes only 1 byte per luma, with no consideration for stride. Take necessary information from destination pixel format which makes calculation completely universal. Signed-off-by: Jernej Skrabec --- drivers/staging/media/hantro/hantro_postproc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c index 8933b4af73ed..a0928c508434 100644 --- a/drivers/staging/media/hantro/hantro_postproc.c +++ b/drivers/staging/media/hantro/hantro_postproc.c @@ -113,12 +113,14 @@ static void hantro_postproc_g2_enable(struct hantro_ctx *ctx) { struct hantro_dev *vpu = ctx->dev; struct vb2_v4l2_buffer *dst_buf; - size_t chroma_offset = ctx->dst_fmt.width * ctx->dst_fmt.height; int down_scale = down_scale_factor(ctx); + size_t chroma_offset; dma_addr_t dst_dma; dst_buf = hantro_get_dst_buf(ctx); dst_dma = vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0); + chroma_offset = ctx->dst_fmt.plane_fmt[0].bytesperline * + ctx->dst_fmt.height; if (down_scale) { hantro_reg_write(vpu, &g2_down_scale_e, 1); -- 2.36.1