From patchwork Wed Sep 7 06:47:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Smitha T Murthy X-Patchwork-Id: 12968497 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 CD79BECAAD3 for ; Wed, 7 Sep 2022 06:42:33 +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:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: 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: List-Owner; bh=e46nByb4FMbVF2kkvIAD07/vDFJaIwYKWPBD3YDhXJM=; b=Klb4xNRUvOJqmX uM7H6Vls2yr3VwHfCs8tlOMy+V/TG+Vjwc9yvWPC6jE9JiVAFDIk9hEW45jg9YPDYv/8/NjmGWcVl l6m15uoo5rSybMLUSdb2ouocn4pN3XGGZ+h4lp6d8GxpbUCpcOz68utq7d2WUwhIoVDhoo7al2gpn YCG1LJXCjB+iVD9OCXsfGkD0TtvmgWMN1mOaueM3PJ1wUZK/kfsvCMtwWkUWOKEnRLqGlWaxCASda DBmdfAYLdSjTVT6UxvRoRtRG+0NTeQ33gCL2KvMsz2jN1b56qnySvbBZ4aqIrMehpQApYrPf8pp8Y CeMA8Il9F5LPT8jIaUqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVokF-003Ize-Bi; Wed, 07 Sep 2022 06:41:10 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVogH-003H5V-Lo for linux-arm-kernel@lists.infradead.org; Wed, 07 Sep 2022 06:37:11 +0000 Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20220907063659epoutp0358daaec2a7e2168e412edf7fdfbd4e12~SgJv1Z5AL2332323323epoutp03K for ; Wed, 7 Sep 2022 06:36:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20220907063659epoutp0358daaec2a7e2168e412edf7fdfbd4e12~SgJv1Z5AL2332323323epoutp03K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1662532619; bh=QrwgRF8Qrx0EDQphUA8YIVN+b01WVyCCN3WTPSBOk6A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZEhqSpMe8NHL/r8+4HN+RcVVxuRIaaM67KhvLbXwRkT3BNYQb/TvmfF6lW0jd01Oi xjqm4G2cg6HzvMNQIK0HQ74sNF6BL7x1MyDNA0/kkYTAGVMcq5zolcRhHZxSSIMbE5 Mv3bdl/bTpDylHiYaXhxm2FrNQx8Nfg0FZpKe54c= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20220907063658epcas5p42e7cd286c01aeaf23b47b91487938cdc~SgJuX024W3173331733epcas5p4u; Wed, 7 Sep 2022 06:36:58 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.176]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4MMsx268jVz4x9Pt; Wed, 7 Sep 2022 06:36:54 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id F7.D0.54060.60C38136; Wed, 7 Sep 2022 15:36:54 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20220907063348epcas5p15d482a6f03f21489aedde74f93c64ae4~SgG95A6Ts1824518245epcas5p1Z; Wed, 7 Sep 2022 06:33:48 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220907063348epsmtrp190de2606b8f9671f6d3f4d7303682145~SgG93sh0K0507305073epsmtrp1E; Wed, 7 Sep 2022 06:33:48 +0000 (GMT) X-AuditID: b6c32a4b-e33fb7000000d32c-a4-63183c06c377 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id EC.DC.14392.C4B38136; Wed, 7 Sep 2022 15:33:48 +0900 (KST) Received: from Jaguar.sa.corp.samsungelectronics.net (unknown [107.109.115.6]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220907063344epsmtip1929229c3dfbd42a64dc308759b19a404~SgG6Vcsse2625726257epsmtip1z; Wed, 7 Sep 2022 06:33:44 +0000 (GMT) From: Smitha T Murthy 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, ezequiel@vanguardiasur.com.ar, jernej.skrabec@gmail.com, benjamin.gaignard@collabora.com, stanimir.varbanov@linaro.org, dillon.minfei@gmail.com, david.plowman@raspberrypi.com, mark.rutland@arm.com, robh+dt@kernel.org, krzk+dt@kernel.org, andi@etezian.org, alim.akhtar@samsung.com, aswani.reddy@samsung.com, pankaj.dubey@samsung.com, linux-fsd@tesla.com, smitha.t@samsung.com, aakarsh.jain@samsung.com Subject: [Patch v2 09/15] media: s5p-mfc: Add support for rate controls in MFCv12 Date: Wed, 7 Sep 2022 12:17:09 +0530 Message-Id: <20220907064715.55778-10-smitha.t@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220907064715.55778-1-smitha.t@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WTeVBTVxTG5+blvRdgwryJtL3FCvShreyJQLwotM5o6WuxHabMtLQzlcbk FRBIQhKqbdksBVpGcCN1QCAWsDjIIpGwFTDQuAxVpwjIaI0iS1kUEDCojV0SAu1/v3POd865 8917eZhghHDnJco1rEouSaYJZ27LLz6+AUQ4lAoX+gLQRFsJjkYqWghU9XSSg+5VLXFR73kD iZoHT2Ko5rIRRzrTdRy19oxyUdOUrdpfYuaiSV0DQNOldwmkH7uJo/szH6GBjjICHTpnwFG9 yUyi08P9HPST/jkHVRoekyi3y0Qic2cLQN/mmTg7IFNXUQeYNnM1YIarFzGmvdRMMlWd0xxG X/s9wdy52Ukw56uzmNyLf3KZouZawPz9TTnJFJiGCWZJ78H0WZbIaNdPksITWImMVXmxcqlC liiPj6CjYuJ2xoWKhaIAURjaSnvJJSlsBL1rd3RAZGKyzQba6wtJcpotFS1Rq+mgN8JVijQN 65WgUGsiaFYpS1aGKAPVkhR1mjw+UM5qtomEwi2hNuFnSQn92iOk0kgd0JuO4dlghF8AnHiQ CoF/VY9zC4AzT0D9DKD1bAXuCBYBPKm1chzBMoDdlVP4WkteewPmKHQBeKPlDGkvCKgcDmx+ EmZngvKHy/O/EnZ2ow4COPadxt6AUTlcaL5qXWlYR8XAW/88xOzMpTbB1u45YGc+tQ2O/D5G OLZ5wrPnjCsaJ1u+v/jKyvkgle8EB4tybIN4tmAXvD5xwKFfB2cuN5MOdofTh/NWOR7eW8oB DlbC8uxmjoPfhMbBMq59DEb5wMaOIEd6A9T2NaxIMMoVFlrHV+V82FaxxjSsvHpldTyEQ7OG VYMYuDz6kHQYVAjgb7nF5BHgUfr/ilMA1IKXWaU6JZ5VhyqD5ez+/25NqkjRg5Wn7hvVBkZH HgX2Ag4P9ALI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zUvXS87P3cQIjj0tzR2M21d90DvEyMTBeIhRgoNZSYQ3ZYdIshBvSmJl VWpRfnxRaU5q8SFGaQ4WJXHeC10n44UE0hNLUrNTUwtSi2CyTBycUg1MU9eECM7cIdA2U5l/ gUjMry9eS52SfJRepPdvWhIkIbNcYcGxyGPdOXkOmipPq+ddtd4bX97b+CvjYoVvw/9cQ+b2 d69vTGiU8/GXaDx/48t97zye3gR5F4fK/zOEH0rwrpI3P1Obutf6/0M20ct3OYytAmIPm0/O y3/1dv6Gx4s+CjXxuTMlOaVwbqno4O4QS56QeuLIr0N7aoQt9ZzmNvxdoOa8UiicM37Nbi+z SE8vifgdjBtPT+tQcHn+u7tbKOv6LmanKHGrr64OitqytZlvnz4xZes6scZp9lKBHLNX1btX 7PHP9xdaFTdd56rUjcVn4qafO9Mx+XDoOcbvW89NuThn/529R+ImhvsrsRRnJBpqMRcVJwIA AKyzyCwDAAA= X-CMS-MailID: 20220907063348epcas5p15d482a6f03f21489aedde74f93c64ae4 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220907063348epcas5p15d482a6f03f21489aedde74f93c64ae4 References: <20220907064715.55778-1-smitha.t@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220906_233702_174526_71192537 X-CRM114-Status: GOOD ( 17.18 ) 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 --- .../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 eecefcfc683b..c0b8434812e0 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 @@ -1039,10 +1039,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