From patchwork Wed Oct 25 10:22:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aakarsh Jain X-Patchwork-Id: 738889 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 470DEC0032E for ; Wed, 25 Oct 2023 10:35:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234732AbjJYKfX (ORCPT ); Wed, 25 Oct 2023 06:35:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234946AbjJYKfB (ORCPT ); Wed, 25 Oct 2023 06:35:01 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F821170D for ; Wed, 25 Oct 2023 03:34:48 -0700 (PDT) Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20231025103446epoutp029d97a3d5c6ff7c4af907ebca617c8bb5~RU0Qg4aVz0144401444epoutp02e for ; Wed, 25 Oct 2023 10:34:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20231025103446epoutp029d97a3d5c6ff7c4af907ebca617c8bb5~RU0Qg4aVz0144401444epoutp02e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1698230086; bh=Z+KKbPVPr965VdQGjwihOK7YJEPYhTFdKL7s8gr9R5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ch/SYzkM4DZHoJpdS1NHOIhnzgS0I3kBjXTYNv62tzCWZDAQqCIXF+m6ELNQrJj14 lvFEyQv2aeY413HMp0Wysd0nmRuBrR/tUwOGco8rdPZ5cznyLGu5MhTOpOuJcOpZ28 2HeURVU/ofdJAuIFCPXebvpGaBsZTQXWR/sKvJZQ= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20231025103445epcas5p1e4dbabb8af54cd509b820ad7d25c0826~RU0P54RZj1501915019epcas5p1E; Wed, 25 Oct 2023 10:34:45 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.183]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4SFlfr1YXFz4x9Py; Wed, 25 Oct 2023 10:34:44 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id F2.C5.09672.34FE8356; Wed, 25 Oct 2023 19:34:44 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20231025102247epcas5p1103ae6d3194f2ffc354984e263ab7b4a~RUpyjUwAa2162221622epcas5p1G; Wed, 25 Oct 2023 10:22:47 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231025102247epsmtrp1b1aa4014eec5498ebd9a9f47c0acd370~RUpyg6Wk32140421404epsmtrp14; Wed, 25 Oct 2023 10:22:47 +0000 (GMT) X-AuditID: b6c32a4b-39fff700000025c8-8a-6538ef439205 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id 61.40.18939.77CE8356; Wed, 25 Oct 2023 19:22:47 +0900 (KST) Received: from cheetah.sa.corp.samsungelectronics.net (unknown [107.109.115.53]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20231025102243epsmtip1fe0e041b500a410447cf8821b871a749~RUpvbjkYQ0054700547epsmtip1O; Wed, 25 Oct 2023 10:22:43 +0000 (GMT) From: Aakarsh Jain To: linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: m.szyprowski@samsung.com, andrzej.hajda@intel.com, mchehab@kernel.org, hverkuil-cisco@xs4all.nl, krzysztof.kozlowski+dt@linaro.org, dillon.minfei@gmail.com, david.plowman@raspberrypi.com, mark.rutland@arm.com, robh+dt@kernel.org, conor+dt@kernel.org, linux-samsung-soc@vger.kernel.org, andi@etezian.org, gost.dev@samsung.com, alim.akhtar@samsung.com, aswani.reddy@samsung.com, pankaj.dubey@samsung.com, ajaykumar.rs@samsung.com, aakarsh.jain@samsung.com, linux-fsd@tesla.com, Smitha T Murthy Subject: [Patch v4 05/11] media: s5p-mfc: Add support for rate controls in MFCv12 Date: Wed, 25 Oct 2023 15:52:10 +0530 Message-Id: <20231025102216.50480-6-aakarsh.jain@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231025102216.50480-1-aakarsh.jain@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WTe0xTVxzHd+697S3Gspsq4awRx5rIAhNope0Oi9WpnVyGbgRdmPIHa+gd EEp701s2BskGxhLHxsONobxKEZgOEEkRKAgOCo7oAgRFCUYmBckGPkA7CMyNraXo/vv8vuf7 e5yXABeN8cWCVL2JMeo1Ogl/E9HeHxwcql5AjDS/Bkez9jIe6l3oI9CUpZ2Pald+x9D9WheB HK1tJGrqGcbQ+cFeHqoeGOahjr5pAk30dmJotGySQIV/OHFkm7nDQ875eHSrq5KPvm1p46Gz I1cxdHFgkkT146MY+tH2N4bOtf1JInPPAIlO5tbx3oV0k6UJ0ON1z3C6s3ySpGu75zDa1vA1 n753p5tPt9Z9RZuv/UXQhZcbAL12ooqkXbbt9I0lFxm7+Xja7hRGo2WMgYw+yaBN1SerJDFH Eg8kKpRSWagsEr0tCdRr0hmVRH0oNvRgqs69eUngZxpdhluK1XCcJHzPbqMhw8QEphg4k0rC sFodK2fDO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82iZ8NWVosZ5/cxWaw9cpfdYun1i0wWyzb9YbJYtPULu0Xr 3iPsFi2NS1gdJDzWzFvD6HF9ySdmj52z7rJ7LN7zkslj06pONo871/aweWxeUu/RevQXi0ff llWMHv+a5rJ7fN4k53Hq62f2AJ4oLpuU1JzMstQifbsEroz3V84zFfwWqHjUf5y5gXEaXxcj B4eEgIlE37+QLkYuDiGB7YwS17eeZepi5ASKy0j8bzvGDmELS6z895wdoqiZSWLPjHksIM1s AroSZ7fngMRFBFqBmld2MoE4zALrWSSObFgC1i0sECjxdeZRMJtFQFXi7JK5LCA2r4CtxOvj T1kgNshLrN5wgBnE5hSwk1jwrQmsXgio5v79H4wTGPkWMDKsYhRNLSjOTc9NLjDUK07MLS7N S9dLzs/dxAiOLa2gHYzL1v/VO8TIxMF4iFGCg1lJhDfSxyJViDclsbIqtSg/vqg0J7X4EKM0 B4uSOK9yTmeKkEB6YklqdmpqQWoRTJaJg1OqgcnD+kClUdYbh7R3IZtZJKenyrN/WnCC+b3T x6bk45d9dqScXXTLn7FWe7fNGXW5rS1ScqKxD7oNLnwV7DdT82nme797X86sufPDdNw2Jk/Y kPFK84zNobfinnw/PX22dede+KDG+OSIq3yRxvzOyg1buPz/7etg5u0672NjbXvCQnRG0gzb HV5LQwKOmnxVl+xIPpS2YKrFxUTZ270MSoHdRjma9lusOkwvTtErLrRx0F1duWPfSR/hsxGs c4wY3Oxs3J6ffb+i7M/08gXiwnELDdSi5xac+/FQfDFHgvb3n81lWv//2Ab6P6z34GG1KaqV fKl+9cSXYyrGPp05m+K2fbe8eCjwx6x/u/rKlFiKMxINtZiLihMBk9NIlhwDAAA= X-CMS-MailID: 20231025102247epcas5p1103ae6d3194f2ffc354984e263ab7b4a X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20231025102247epcas5p1103ae6d3194f2ffc354984e263ab7b4a References: <20231025102216.50480-1-aakarsh.jain@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org In MFCv12, the rc configs are changed with support for CBR loose, CBR tight and Variable Bitrate (VBR) added. Cc: linux-fsd@tesla.com Signed-off-by: Smitha T Murthy Signed-off-by: Aakarsh Jain --- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 22 +++++++++++++++---- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.h | 1 + 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c index e579c765e902..bed45857bd6c 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c @@ -1025,10 +1025,24 @@ static int s5p_mfc_set_enc_params(struct s5p_mfc_ctx *ctx) /* reaction coefficient */ if (p->rc_frame) { - if (p->rc_reaction_coeff < TIGHT_CBR_MAX) /* tight CBR */ - writel(1, mfc_regs->e_rc_mode); - else /* loose CBR */ - writel(2, mfc_regs->e_rc_mode); + if (IS_MFCV12(dev)) { + /* loose CBR */ + if (p->rc_reaction_coeff < LOOSE_CBR_MAX) + writel(1, mfc_regs->e_rc_mode); + /* tight CBR */ + else if (p->rc_reaction_coeff < TIGHT_CBR_MAX) + writel(0, mfc_regs->e_rc_mode); + /* VBR */ + else + writel(2, mfc_regs->e_rc_mode); + } else { + /* tight CBR */ + if (p->rc_reaction_coeff < TIGHT_CBR_MAX) + writel(1, mfc_regs->e_rc_mode); + /* loose CBR */ + else + writel(2, mfc_regs->e_rc_mode); + } } /* seq header ctrl */ diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.h b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.h index 30269f3e68e8..24752a712fbf 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.h +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.h @@ -40,6 +40,7 @@ #define ENC_H264_LEVEL_MAX 42 #define ENC_MPEG4_VOP_TIME_RES_MAX ((1 << 16) - 1) #define FRAME_DELTA_H264_H263 1 +#define LOOSE_CBR_MAX 5 #define TIGHT_CBR_MAX 10 #define ENC_HEVC_RC_FRAME_RATE_MAX ((1 << 16) - 1) #define ENC_HEVC_QP_INDEX_MIN -12