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: 177871 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp7690409dys; Wed, 13 Dec 2023 03:01:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IFkRBkSArKcjFoiFNP7rnO6XMdYCVNpEj0FP/2axQHqpvvpBcYxunGki6SR7Cb3j3sBFL+g X-Received: by 2002:a05:6359:6519:b0:170:55e1:1729 with SMTP id sk25-20020a056359651900b0017055e11729mr1723432rwb.48.1702465300893; Wed, 13 Dec 2023 03:01:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702465300; cv=none; d=google.com; s=arc-20160816; b=X2W+M8Grsz7aVnIy4IzFxJU6WoQ76eWhDWq4RYoPupSIei1cxR5FkkLyBtPhtA6Zj5 IP+UfkyhzZILAWJQi6dL8zbNzCeKwwutqd6g8WtGbJre6rXnE4ZfXgNmrOLNQlEeV9xD 8X/2AlGZC67eV+q9ODX7uHP9nTGL9fTLojHDJxMLHsmXkxYbHAwi0vp3XeZ6ZZTeY46U kPj6qYjiOrMQg+k2W99zUXMS6z3Gx1b0EaWAk6rHblBv6EkpGMOykNcYosllRtig04Nm HyoMs4L+orF1+GbCG/zHpaqVvo0TZEH3reLai147pMyOlP79OLcuwMqStqHsK+OZEFDY VEVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=BuzCw9s44y8vOCjVUfZWEiQy85UK4HFZlEIF9gRnXwA=; fh=jRZx2CGeeFZcE3BVWyyQfQMU6DACuExpX/LJhkP3QWU=; b=bTHEQ8oOlM/UuquN3MpnCNi/o5lGcJm7MZxY4eIoFv6GttC/+GyA+KwADlJsNH7vpt wUyVXazN/DMmRy2YF0A47VNvCt+kPc1kQ6ckVcyQZoJmDnjvPzIZ50Kvroos0O96BVK4 YqTf8YuF2LuB1/oYdFU/nUJretx9kbqITnbWm5bbh/Xo2mYr5A8OHR3vc0YuHkyLWs52 XsBrZ2B3DccuTr8PvpXUlDg47dOIZhGqK/4oleqEpv1qLl8DDW7OnkmED4v978I19ic9 cC9qrhX026I0KtnqryEjtSZ6UO48E0zP0Wj6RigF+1V5Mi0lhaKE3lJVWznVTx5VDoi4 lEmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=d96nmvKc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id o62-20020a634141000000b005c662c8da8csi9206340pga.210.2023.12.13.03.01.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 03:01:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=d96nmvKc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 076768168239; Wed, 13 Dec 2023 03:01:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378403AbjLMLA7 (ORCPT + 99 others); Wed, 13 Dec 2023 06:00:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378337AbjLMLA4 (ORCPT ); Wed, 13 Dec 2023 06:00:56 -0500 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C56AAF7 for ; Wed, 13 Dec 2023 03:01:00 -0800 (PST) Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20231213110059epoutp02726d84ed0717353e6528c48558cd1d2c~gXyIfanVT0120001200epoutp02F for ; Wed, 13 Dec 2023 11:00:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20231213110059epoutp02726d84ed0717353e6528c48558cd1d2c~gXyIfanVT0120001200epoutp02F 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+x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d5qhBvSmJlVWpRfnxRaU5q8SFGaQ4WJXFe5ZzOFCGB9MSS1OzU1ILUIpgsEwen 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> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 13 Dec 2023 03:01:34 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785164255387664353 X-GMAIL-MSGID: 1785164255387664353 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