From patchwork Wed Jul 5 12:10:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 116096 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp1822191vqx; Wed, 5 Jul 2023 05:14:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlEhVDqq2mt/rxIyrcCaGc+TYs2nKOMwoxVNI3Ywfng3rb3gnVsG6yHJgIiTscbXzH30pVS7 X-Received: by 2002:a17:902:bf0b:b0:1b6:ab53:c7a5 with SMTP id bi11-20020a170902bf0b00b001b6ab53c7a5mr7623162plb.46.1688559266163; Wed, 05 Jul 2023 05:14:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688559266; cv=none; d=google.com; s=arc-20160816; b=Ra3Mkxc+RoXuz5CE1F3EMv5eUIo4B6zh/V3CWq17ImnpOwtfO1B7I18fGVnP0I5h4x yglHnf3MmT1Tk22EvuG+b+Xwc0oGMf2wABS0ljT+1ClsUIML7UcG88FmT4eJ7mlZNj+P WteYPTZv3r2AC8WO8GmaRVSuOhuHD2QoOTE32izWjij73G4bTc8eJJs/HdfO1OhMheaj oPYktD2lGzHJ0hNcSBO538yrAdW/M58ptV121RDR6xvKPOWUyiBQd4VQDq5Vi32BBIOP xCSs8V8nMq9o/ZEzUV372sEPVB+1+zZp/3UOZX6ZK3W1OrcdXha00sf0Remu0VAh66Ni t99Q== 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=yHgGPeTz0b5NJ2/HodHoF+FrbwufwKaWr6rDqpcbxws=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=xkvr/heQLgeR0lRAKYn2bADOEJUJ/McxDxURdSPeJqZM0iVvkWYIBCJrwSjHdEqttS 7WLZVQrl4WJuQOlFdhszMpOBh5G060Dj1da94sHBQXj6qQcbSEo9h0sHlRdWYSnQDdhh NyGmpEqQKy+mhqePGNw0Fb4JERaKRYFxYXWbFK8yZPqs4DsgZDy6MkPamFjZMqTm0OoH 5Ewg8aMjuclsjCBOS8+afsoAJRLUAGuIta65hVTQXewhHZr+TUesVr82ZpEtVC5vfj+6 nR/O0h4Qw48q1cnjf+7wIVLEGmBABsVkmHH8dmGZQ/6Ddokk4rrmr6PF/z/cEDkFjOhJ Fw5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=R6pZ9c99; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p12-20020a170902f08c00b001b7eb86ae1asi20087606pla.204.2023.07.05.05.14.12; Wed, 05 Jul 2023 05:14:26 -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=@collabora.com header.s=mail header.b=R6pZ9c99; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232085AbjGEMLU (ORCPT + 99 others); Wed, 5 Jul 2023 08:11:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230100AbjGEMLI (ORCPT ); Wed, 5 Jul 2023 08:11:08 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1424EBE; Wed, 5 Jul 2023 05:11:08 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:cbfb:e358:222c:d8c1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by madras.collabora.co.uk (Postfix) with ESMTPSA id 5F1146606FB6; Wed, 5 Jul 2023 13:11:06 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1688559066; bh=08pz2UKBXmFkMllWQeyJmK7L9R8AXzq83ydZhWVZx80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R6pZ9c993XtQk914uQhpn088GBYIK0W6YxofCqv1NKy0heOsdBzG3sZJppsnSXPFj p0aXIYIBhGIQsG2rwSuycV53WOF+tHtLOBFlDkuG88uLo5F5lhsIz+2+DF2ltbnddn jjmdfNZ7cmxe0P3uCQRc41vX60gZ5K9NxUM1SsAmSUGce7VzpQ+7rR7xcpVjm46oBE 87H1Jk277U5gPbGvjo1hykSewirSdDL0ermsca4libtzSSbV3o2gjq8gdfETFRG0BW X7wtKDVpdIwQpT8eCHEhj672vTNyFrj4m3HlpyhEGXoCSgijAsFz/e4ynS3KfIQkj1 aHpRkoqvwwdJg== From: Benjamin Gaignard To: mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com, ming.qian@nxp.com, ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, gregkh@linuxfoundation.org, hverkuil-cisco@xs4all.nl, nicolas.dufresne@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, kernel@collabora.com, Benjamin Gaignard Subject: [PATCH v4 06/10] media: verisilicon: vp9: Use destination buffer height to compute chroma offset Date: Wed, 5 Jul 2023 14:10:52 +0200 Message-Id: <20230705121056.37017-7-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230705121056.37017-1-benjamin.gaignard@collabora.com> References: <20230705121056.37017-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770582721090409618?= X-GMAIL-MSGID: =?utf-8?q?1770582721090409618?= Source and destination buffer height may not be the same because alignment constraint are different. Use destination height to compute chroma offset because we target this buffer as hardware output. Signed-off-by: Benjamin Gaignard Fixes: e2da465455ce ("media: hantro: Support VP9 on the G2 core") --- version 4: - Add Fixes tag drivers/media/platform/verisilicon/hantro_g2_vp9_dec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/platform/verisilicon/hantro_g2_vp9_dec.c b/drivers/media/platform/verisilicon/hantro_g2_vp9_dec.c index 6db1c32fce4d..1f3f5e7ce978 100644 --- a/drivers/media/platform/verisilicon/hantro_g2_vp9_dec.c +++ b/drivers/media/platform/verisilicon/hantro_g2_vp9_dec.c @@ -93,9 +93,7 @@ static int start_prepare_run(struct hantro_ctx *ctx, const struct v4l2_ctrl_vp9_ static size_t chroma_offset(const struct hantro_ctx *ctx, const struct v4l2_ctrl_vp9_frame *dec_params) { - int bytes_per_pixel = dec_params->bit_depth == 8 ? 1 : 2; - - return ctx->src_fmt.width * ctx->src_fmt.height * bytes_per_pixel; + return ctx->dst_fmt.width * ctx->dst_fmt.height * ctx->bit_depth / 8; } static size_t mv_offset(const struct hantro_ctx *ctx,