From patchwork Wed Jul 5 12:10:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 116102 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp1824772vqx; Wed, 5 Jul 2023 05:18:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlGzjCg+vk+4b1KXoEQvJq1Ri7DvXckFFMjKowrmNvw2Mp+trlxlDdUSmw5Lt1a+ow3CsREz X-Received: by 2002:a17:90b:3b88:b0:25b:d4bc:28d4 with SMTP id pc8-20020a17090b3b8800b0025bd4bc28d4mr15279964pjb.40.1688559510295; Wed, 05 Jul 2023 05:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688559510; cv=none; d=google.com; s=arc-20160816; b=VHESsvqxYL2xKlq3d6zObm4pzJPYZOXDCjp5x88uyAI8I+9Utq6K3y6VbFDuvFAC2H 2o/VQlwUUD9yXhhKrI8DqtaeSBbA/j5YsenRut9fSf12SQvpNRX+P8KAbqobNQElFGIU 9qlEktXe64EkCy7XY9lUMItgEZJun0QBiuOme+R7NUnDotudXB7nak1OUoxllISYIlOB 2xa3zS1yci+h8jGRYGpTvdODLAHhTUNs7qc2SOaVMFg5gl8E1/nt6YPkiw+KPJiqbpgf oPK9ZS2kb8sT4p0bozLz83UWhhmrrVR+nwZaZi9TR/MU+Jot4ubHi8nQ/f+RznthG7qb wM/A== 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=8cs58WscjGVJguqAFPf2FXfmo/gQ+PnwrkEsbIc3elo=; fh=3pf9JkNmRGZBkStzUqHrUB32R1X0xQFHsWSY3Ejl6B4=; b=UZc9fzAp+0Ox/xBHlxASRPIsq4EtcNdA9ilSl/yDnpfWDHRDD8VytcDx2yE3miy3Ef TitjoaOR/7JWdXppXKtLHOCEZ5dmK+cWgobaccdTJ4M/Qua5gs8VTOajpqb8U+qshIS9 AQdCvd+oFWRWWYcaaUktrQnb/tTeVM3QYR4Pk3AeVSbd8yTUPBIWGBlCJrJYiRiNdFo7 2nniPKG2BejXSxHYBX8B3wZMtk89Pf/yrKxgJbS6VSIHzoycWVl0WUwaeg/5yIBFiEMJ WyTBcMfMB5StT8dcvI2dSRpBPO2iRZ2nNr3XBABm2QcYDU5Y5Dhqmok1O8sz53FjT5wb oFKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=f+qEyBX+; 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 cm11-20020a17090afa0b00b002568a675b65si1490395pjb.141.2023.07.05.05.18.17; Wed, 05 Jul 2023 05:18: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=@collabora.com header.s=mail header.b=f+qEyBX+; 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 S231703AbjGEMLX (ORCPT + 99 others); Wed, 5 Jul 2023 08:11:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231984AbjGEMLJ (ORCPT ); Wed, 5 Jul 2023 08:11:09 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 148D4D8; 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 D23566606FBC; Wed, 5 Jul 2023 13:11:05 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1688559066; bh=ACC3xoNkJT9qQWxJUQoYucGV+r6arnzV1XyWpEjCZL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f+qEyBX+T7u4jLYhbuJhVQDuAZQx+CsYxgqubncFGUDW2kGViawXuVH13iMD75QMN PaOpXk1OWriSNtF+WvOMmUVOS8KwAnQmiEMj5JTxgml0gDtj7GO0d4xtJ3pE+tNrgh 5MjWkqeIMoLXxU4c9h4Gt2RrOxEUTwRQDUKKq2R4MwLZUQ9nyJKQUj+XnhKkF6plYJ ipMoySc5b+nNJqMmw+WPSmLo1tDkfy/GUsSCvQM5C8aMHXfJjLbZzidO/+kSUdX0Yl zav02m8jvl85giRdFfV6JwIigGc99TDiNkhX1Y0WLGuAv8VNuERzPHkZTsIqFUhQ+q 3I1ewFQ4fuaFg== 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 05/10] media: verisilicon: Store chroma and motion vectors offset Date: Wed, 5 Jul 2023 14:10:51 +0200 Message-Id: <20230705121056.37017-6-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?1770582977200439409?= X-GMAIL-MSGID: =?utf-8?q?1770582977200439409?= Store computed values of chroma and motion vectors offset because they depends on width and height values which change if the resolution change. Signed-off-by: Benjamin Gaignard --- drivers/media/platform/verisilicon/hantro.h | 2 ++ drivers/media/platform/verisilicon/hantro_g2_vp9_dec.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/verisilicon/hantro.h b/drivers/media/platform/verisilicon/hantro.h index c8a3cf10cc64..53be00142473 100644 --- a/drivers/media/platform/verisilicon/hantro.h +++ b/drivers/media/platform/verisilicon/hantro.h @@ -320,6 +320,8 @@ struct hantro_vp9_decoded_buffer_info { /* Info needed when the decoded frame serves as a reference frame. */ unsigned short width; unsigned short height; + size_t chroma_offset; + size_t mv_offset; u32 bit_depth : 4; }; diff --git a/drivers/media/platform/verisilicon/hantro_g2_vp9_dec.c b/drivers/media/platform/verisilicon/hantro_g2_vp9_dec.c index 6fc4b555517f..6db1c32fce4d 100644 --- a/drivers/media/platform/verisilicon/hantro_g2_vp9_dec.c +++ b/drivers/media/platform/verisilicon/hantro_g2_vp9_dec.c @@ -158,9 +158,11 @@ static void config_output(struct hantro_ctx *ctx, chroma_addr = luma_addr + chroma_offset(ctx, dec_params); hantro_write_addr(ctx->dev, G2_OUT_CHROMA_ADDR, chroma_addr); + dst->vp9.chroma_offset = chroma_offset(ctx, dec_params); mv_addr = luma_addr + mv_offset(ctx, dec_params); hantro_write_addr(ctx->dev, G2_OUT_MV_ADDR, mv_addr); + dst->vp9.mv_offset = mv_offset(ctx, dec_params); } struct hantro_vp9_ref_reg { @@ -195,7 +197,7 @@ static void config_ref(struct hantro_ctx *ctx, luma_addr = hantro_get_dec_buf_addr(ctx, &buf->base.vb.vb2_buf); hantro_write_addr(ctx->dev, ref_reg->y_base, luma_addr); - chroma_addr = luma_addr + chroma_offset(ctx, dec_params); + chroma_addr = luma_addr + buf->vp9.chroma_offset; hantro_write_addr(ctx->dev, ref_reg->c_base, chroma_addr); } @@ -238,7 +240,7 @@ static void config_ref_registers(struct hantro_ctx *ctx, config_ref(ctx, dst, &ref_regs[2], dec_params, dec_params->alt_frame_ts); mv_addr = hantro_get_dec_buf_addr(ctx, &mv_ref->base.vb.vb2_buf) + - mv_offset(ctx, dec_params); + mv_ref->vp9.mv_offset; hantro_write_addr(ctx->dev, G2_REF_MV_ADDR(0), mv_addr); hantro_reg_write(ctx->dev, &vp9_last_sign_bias,