From patchwork Thu Mar 2 13:18:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pin-yen Lin X-Patchwork-Id: 13157334 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 65421C678D4 for ; Thu, 2 Mar 2023 13:19:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=tTFwngNHEHtX3epwwjmuM7Yu1WmUXhELIVpu2TTdGGI=; b=JRp+xxtxGydyMc UBeBfL6PQO2TBiH6B51LbTi/cDboaVB7KRN5c6C3RgpuOJWEZ2EHNiohhH4jMC0QW9Y8yS5v902Ex SiMK56s/Oq2HbhAEmt35+N9VHmy0h8+jEjjSYWDoLNbHH1vZEcd06tPlP75EnT/dHQtf6+qFYxPOw +X040qZjb5MfOaItJ913cZUhWRmXBjzfeUybHGLss073ua1YqSMQ89dg2d5K8EYvODr0NJ4uaUb6X HHAvm83u994RHWE7UlSjUdqqkTTW6xllqrqR3Not/hP/ffLM0/uVFpckUmMb4ptReaQK0kfRmUMPx vWEYeCFc25ba6GyO5CsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pXipL-002Ik1-VA; Thu, 02 Mar 2023 13:18:32 +0000 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pXipJ-002Ij2-1X for linux-arm-kernel@lists.infradead.org; Thu, 02 Mar 2023 13:18:30 +0000 Received: by mail-pg1-x52c.google.com with SMTP id z10so9738896pgr.8 for ; Thu, 02 Mar 2023 05:18:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1677763107; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=E166X9hjpFg3mdEW6iD+dySuMT8kiQ1PL60Qkh8UwsI=; b=TG5uXivyNeE/uoFeSDp+u5QoerHsyjFLS7lek+Tf1ikHN52gtt0elSpqkLtCPZW6ii W9CAReiVFbYFHVv+l7tSM7T26G7D7eRK5DYrTLuHGSw9CexbtpUHtZmti+kD/mvHiTb6 mWvv4X7tHbBuKoClb79/qw+aiqm/2uT0784MQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677763107; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=E166X9hjpFg3mdEW6iD+dySuMT8kiQ1PL60Qkh8UwsI=; b=EY/NuH9vJ8hw5HiuWBELliaVNZiLU6Y5EvCmeFcUkRVzC3rFphoRxE3pnBes8PGbYU D4xs0aqRgEeKykYfuxLFDHEQxJps98OBov5+gG4+dIvo7QLsDHReDa3Mzypz9wQhUOyZ Zb8jeNAm6yr4aDbUlXQC4669z+Q3dR9np3HhpDE4ZPR6vaRHOYWmyzuiIQjN3DkDiE0l REBaY30XsNfh2W7vS1CrWn9Pku5DKHKSVK5opwUfrl4sJvGs0/XA5KP9OqI9ZrDYcUOu 6E/3Bo9c57dSyAi7JDQ8ApL8P3vUZfIa1wceH2pzLstcUNPuTwVIogxJNoU3q7vKfBP2 2sQg== X-Gm-Message-State: AO0yUKX8B7N1+44H03cffYUk8vJ7keGfZCPYlALZ0RoAzwUlNYV+fX63 CPMs/cpCESx522KI7IZf+vCpuw== X-Google-Smtp-Source: AK7set8K94g2rR6EFJDYXdaB7Du5j026byxnZEvzejgfLdVXgs+t85RvFhpPuQA9xTO2WjR7dpu7AA== X-Received: by 2002:a62:4ec8:0:b0:5cb:eecd:387b with SMTP id c191-20020a624ec8000000b005cbeecd387bmr7538411pfb.33.1677763107334; Thu, 02 Mar 2023 05:18:27 -0800 (PST) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:739f:8bcf:3d43:dae5]) by smtp.gmail.com with ESMTPSA id s15-20020aa7828f000000b005905d2fe760sm9840086pfm.155.2023.03.02.05.18.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 05:18:26 -0800 (PST) From: Pin-yen Lin To: Tiffany Lin , Andrew-CT Chen , Yunfei Dong , Mauro Carvalho Chehab , Matthias Brugger Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Tzung-Bi Shih , Hans Verkuil , AngeloGioacchino Del Regno , Chen-Yu Tsai , linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org, Pin-yen Lin Subject: [PATCH] media: mediatek: vcodec: Use 4K frame size when supported by stateful decoder Date: Thu, 2 Mar 2023 21:18:21 +0800 Message-Id: <20230302131821.2060936-1-treapking@chromium.org> X-Mailer: git-send-email 2.39.2.722.g9855ee24e9-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230302_051829_109180_1F1C1184 X-CRM114-Status: GOOD ( 15.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org After commit b018be06f3c7 ("media: mediatek: vcodec: Read max resolution from dec_capability"), the stateful video decoder driver never really sets its output frame size to 4K. Parse the decoder capability reported by the firmware, and update the output frame size in mtk_init_vdec_params to enable 4K frame size when available. Fixes: b018be06f3c7 ("media: mediatek: vcodec: Read max resolution from dec_capability") Signed-off-by: Pin-yen Lin --- .../mediatek/vcodec/mtk_vcodec_dec_stateful.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c index 035c86e7809f..679f4dc9acfb 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c @@ -11,7 +11,7 @@ #include "mtk_vcodec_dec_pm.h" #include "vdec_drv_if.h" -static const struct mtk_video_fmt mtk_video_formats[] = { +static struct mtk_video_fmt mtk_video_formats[] = { { .fourcc = V4L2_PIX_FMT_H264, .type = MTK_FMT_DEC, @@ -580,6 +580,16 @@ static int mtk_vcodec_dec_ctrls_setup(struct mtk_vcodec_ctx *ctx) static void mtk_init_vdec_params(struct mtk_vcodec_ctx *ctx) { + unsigned int i; + + if (!(ctx->dev->dec_capability & VCODEC_CAPABILITY_4K_DISABLED)) { + for (i = 0; i < num_supported_formats; i++) { + mtk_vdec_framesizes[i].stepwise.max_width = + VCODEC_DEC_4K_CODED_WIDTH; + mtk_vdec_framesizes[i].stepwise.max_height = + VCODEC_DEC_4K_CODED_HEIGHT; + } + } } static struct vb2_ops mtk_vdec_frame_vb2_ops = {