From patchwork Tue Mar 14 10:22:41 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: 13174296 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 068E4C6FD1D for ; Tue, 14 Mar 2023 12:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=helyLAaSkHezCDHRaiPEnQcGx2qVQUT/bMk+TbB5Rk8=; b=FZPvHy6UEi/ADwwCookm+QxtGF HKrzUbClTnYimVJMDWFfgTA9KKb/EITWoSc4+7+DHKFKCv4suIPDPURlOpnpdWE5bBkiGeoxMSwU3 UPC90ZHsEQkiHQ/AJ8kMO+6a3uG3EybuR/bOFCxqdHTlYNJNszksMpKN5d6ZM42F7P2R+YFgVPM6r iAoN2dUqoFzZ35BCP4TSspWecyzK5P3A+eWpkes1BTVBfACVCcKabTZR8HMTwTc3Djg2cH/FjxnbW /b1mIFoD1PDs8tWq3yx8I2jOUz8E5LnekBqsn9uUpREf4f9vT91ZbUxFPZkGwSxENxtVdX/8pJwe0 U3IZs9NQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pc43N-00ABgk-32; Tue, 14 Mar 2023 12:46:57 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pc43M-00ABfP-1y for linux-mediatek@bombadil.infradead.org; Tue, 14 Mar 2023 12:46:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=helyLAaSkHezCDHRaiPEnQcGx2qVQUT/bMk+TbB5Rk8=; b=gKO77W3NT1vlpE4bcYMdu3ZFgL XQlgLkNp9idqgJlK/cIwt0DvQHj4ibKkXNl7chDR0L3EFNGCjJasEqKnAp8zueBfZr4FaQJQBArOI 8zFWCiTN7XgHCr+1fx3068QMGzj8HHbe5ezFvupjBovfyuddCy884c3+mhYQBYyrzCzmxiVB/xznd V1p8BaXn+wjijxVme+i6LPm0FMqZRoXyIGUXyPu97nPGTaYhs9iGPl2AOpVLYEITs/kPA5YOUZEH+ NQfGi5uYJGYgsW+Zru5tmMpF5Px981LdNb71rJA5a2i1khVKBwEfn4bX5358yN9HYWRWI/7zH+iZA qWHMcB3A==; Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pc1nu-001k1y-1i for linux-mediatek@lists.infradead.org; Tue, 14 Mar 2023 10:22:52 +0000 Received: by mail-pl1-x634.google.com with SMTP id a2so16068704plm.4 for ; Tue, 14 Mar 2023 03:22:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1678789367; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=helyLAaSkHezCDHRaiPEnQcGx2qVQUT/bMk+TbB5Rk8=; b=bYvaecdDD3x6Hr9bDFOAZzQPuTYOvrXzOL2W3Z+W8i6brWc5Ctp8SyoWm2aVQpeEgb 6DIfZYAAyXId56J9EwmapBH2fqXJff9mRmVFyNPtdlY6dHsezZZGzTIaNsKWeWFZro93 xjxNL0a1AR576oyFoGzpXuNQtGpZbBjuJ2Zv0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678789367; 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=helyLAaSkHezCDHRaiPEnQcGx2qVQUT/bMk+TbB5Rk8=; b=ndTNm4VHT41KpNh1bc1bRf9TQK4NwR1naxVr6zhI1oFUv9E6B4FQthSbjGUJ6xOqLA 1fN4+OM6P6RQEUntSbih0jNFO3Qn2KsdYS0bLcylCvDA8OESbL1cVHW3sxOfxq6zhZWB nN+TdyUla/LEjG8zo+jq3beLI4uRt1i5oTUNKceL+1tgeR6NSfrzNMbb9Mnp1TpJ/MX0 u5FoyFHrygI+dH7LMdsp5C62FGpO8T+lDmsgqrqiukopdpzaB3Oybm5L4nTMoRU1vMl7 P3KBA+ZCGYGJRZn4HvmIhulas01QkI4lnqDcE781du6CjQ6V0AiXKmWUdqM/kDU96jew CLeA== X-Gm-Message-State: AO0yUKVWOuJRqguiQW8zMlofPZucJRUgnfynyY32zxbV5hGj1GOFXk2L fh17/3Fkh6+MplOu86smq266jw== X-Google-Smtp-Source: AK7set9qMrH1n8EpNSZoO1e/VzYoi2/xCMSAQ7Q4krIxrlPWf/u8a4TA/vrS/7VRxRZOGEdKrwLXwA== X-Received: by 2002:a17:903:481:b0:1a0:5bb1:3f13 with SMTP id jj1-20020a170903048100b001a05bb13f13mr3142238plb.39.1678789367645; Tue, 14 Mar 2023 03:22:47 -0700 (PDT) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:3718:fdeb:7d7e:b6c0]) by smtp.gmail.com with ESMTPSA id j5-20020a170902c3c500b0019cb131b8a5sm1417194plj.32.2023.03.14.03.22.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 03:22:47 -0700 (PDT) From: Pin-yen Lin To: Tiffany Lin , Andrew-CT Chen , Yunfei Dong , Mauro Carvalho Chehab , Matthias Brugger Cc: linux-mediatek@lists.infradead.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Tzung-Bi Shih , Hans Verkuil , AngeloGioacchino Del Regno , linux-arm-kernel@lists.infradead.org, Chen-Yu Tsai , Pin-yen Lin Subject: [PATCH v2] media: mediatek: vcodec: Use 4K frame size when supported by stateful decoder Date: Tue, 14 Mar 2023 18:22:41 +0800 Message-Id: <20230314102241.1971120-1-treapking@chromium.org> X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230314_102250_700525_2636B672 X-CRM114-Status: GOOD ( 14.06 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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 Reviewed-by: AngeloGioacchino Del Regno --- Changes in v2: - Rebase to media_tree/master .../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..29991551cf61 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_video_formats[i].frmsize.max_width = + VCODEC_DEC_4K_CODED_WIDTH; + mtk_video_formats[i].frmsize.max_height = + VCODEC_DEC_4K_CODED_HEIGHT; + } + } } static struct vb2_ops mtk_vdec_frame_vb2_ops = {