From patchwork Wed Dec 13 08:11:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aakarsh Jain X-Patchwork-Id: 754254 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="d96nmvKc" Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF7A310C for ; Wed, 13 Dec 2023 03:01:00 -0800 (PST) Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20231213110059epoutp014c880dfb809bfe9a2593418c52825808~gXyIe8OCP1005610056epoutp01A for ; Wed, 13 Dec 2023 11:00:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20231213110059epoutp014c880dfb809bfe9a2593418c52825808~gXyIe8OCP1005610056epoutp01A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1702465259; bh=BuzCw9s44y8vOCjVUfZWEiQy85UK4HFZlEIF9gRnXwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d96nmvKcNgoKUcqL5+I3GagC4f8+dL+GJtoiXlWZfoRM4aQAkjNPwPAm2A4O7Yd+i euZlv7s8yDa7dfYrT3G/7HIBCEm9AhD67ARKFFxqjHIFA2dNQkzWI/2RodMOEBnpGF tYCNQ7+hJU/cjfKN2YDInVkBcNLascJz+WqGToCY= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20231213110058epcas5p344be0b5ac6e731b27635838e3562362b~gXyH422sM0879108791epcas5p3L; Wed, 13 Dec 2023 11:00:58 +0000 (GMT) Received: from epsmgec5p1-new.samsung.com (unknown [182.195.38.182]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4SqswS71xbz4x9Pw; Wed, 13 Dec 2023 11:00:56 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmgec5p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id 14.FF.19369.8EE89756; Wed, 13 Dec 2023 20:00:56 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20231213081131epcas5p181e1178375a69d021e138b4c16f8da67~gVeLBD1wI0225002250epcas5p1W; Wed, 13 Dec 2023 08:11:31 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231213081131epsmtrp102ee6bb28eed07ee52e81905ea8e4f7d~gVeLAGzxZ2318823188epsmtrp1w; Wed, 13 Dec 2023 08:11:31 +0000 (GMT) X-AuditID: b6c32a50-c99ff70000004ba9-ea-65798ee869d0 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id 42.96.18939.33769756; Wed, 13 Dec 2023 17:11:31 +0900 (KST) Received: from cheetah.sa.corp.samsungelectronics.net (unknown [107.109.115.53]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231213081127epsmtip2fd2029a643c56e25faaabcde40a581ef~gVeHVMmum1420914209epsmtip2W; Wed, 13 Dec 2023 08:11:27 +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, 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 v6 05/10] media: s5p-mfc: Add support for rate controls in MFCv12 Date: Wed, 13 Dec 2023 13:41:00 +0530 Message-Id: <20231213081105.25817-6-aakarsh.jain@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231213081105.25817-1-aakarsh.jain@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WTf0xbVRTHc99r+woZyxsDvKlzkmeGYUtL6wpcyKhOUV+iyXBMUSPiC1wL obRdfwxRzAABZye/FBQYIAHErPzqCoyC4LoW3IaDMViYbhBARhwMZMJIMNQppWz+9znf+z33 nHN/CEnfPoFImKI2YJ2aUzECb955Z3Cw+G5hBpY6rsjRnK2Cj+zLF3louua8ANWv/0GgqfpV HnK0d1KouW+YQN/1D/PRb/ZuAl2vmOShwrszJLLOjvPRzEIcGuupEqAvLZ18VH7tJwK19E9S qNHqIlBd5wMK5fX1Uyg3u4H/gj97s2GFZLsrJym2vneeYK3mLwTsxHivgG1vOMkWdpgB+zCn mmJXrXvZwbVVKsb73dRDyZhLwrpArE7UJKWolVHMa7EJLyWEhkllYlkECmcC1VwajmKiX48R v5Ki2pyRCTzBqYybUgyn1zMhikM6jdGAA5M1ekMUg7VJKq1cK9FzaXqjWilRY0OkTCp9LnTT +EFq8vrSOKX9m/6ozjUgyAKlO03ASwhpOcydrOGbgLfQl+4F0H7/MuUJVgA8M9RBPA6udjl5 JiDcSrlc/rJH7wZw0Tm1bcoj4OeNc4TbJKDFcKhL5S7hR2cDOHvK4PaQ9CUS1hZX8NwLu+lY eG3ARLqZR++DzS25fHeuDx0FS9f9Pe09DZss9i2LF62Af+ZcAO59ID0ihMvOQb7HFA3PZZ8F Ht4NFy51UB4Wwfmi/G1OhLN186SHVbCtt5Tn4eeh/UbV1mAkHQzbekI88lOwbLCVcDNJ74QF G3cIj+4DbTWPOAhWTaxvt7AHOpu+326BhR1Z57ZPsQTAvh9GiWKwt/L/ErUAmIEIa/VpSpwY qpWJ1Tj98a0latKsYOsd74+xgSbL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BvSmJlVWpRfnxRaU5q8SFGaQ4WJXFe5ZzOFCGB9MSS1OzU1ILUIpgsEwen VANT5uPyoBKPrYUxrFZ7SvkFmTt5poU8XfxppeEmUauTi6IFqqJfcYm+zH+3+FjEY71Nzsfj WE4pNPQe+i52parS5UDPE9cVXx1XLXvQwWSdLK2S+93a4FnAkkMz6rRMFOsf7Hz6UcylVdlu WvWh6ccZmiTXlvHcNFzheND6Weo8oYMiRlNmmm+YcnH12pSowp1/fD6/fKdwoT+4RyVw2uNF umI/5rjdKdim/D+cSywnz6JfoWPB1nefFjKuerHoacOpbdalIoHZOY8MtDsWKdya8ibh0P+Y rY/S69orQvzdJlQYf1/DKtZidjRI+Jji02n/S9dl5H6blTb39BKjSRt8TgiF2r0Qy2KNm1YU cWCBEktxRqKhFnNRcSIAOlTbSwEDAAA= X-CMS-MailID: 20231213081131epcas5p181e1178375a69d021e138b4c16f8da67 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20231213081131epcas5p181e1178375a69d021e138b4c16f8da67 References: <20231213081105.25817-1-aakarsh.jain@samsung.com> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 36aebca11313..4a0d0e228e78 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 @@ -992,10 +992,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 ff582eea4217..94ecb0e6e7c7 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