Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5234290rdb; Wed, 13 Dec 2023 03:02:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEKYmzgictSZqaIb0utA5sv0HfONson6Atw/UdnMySZ3tUSgQYpFr+3GzeX1wSy9g+u50cP X-Received: by 2002:a05:6870:b8a:b0:1fb:75b:2fde with SMTP id lg10-20020a0568700b8a00b001fb075b2fdemr9787481oab.117.1702465355921; Wed, 13 Dec 2023 03:02:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702465355; cv=none; d=google.com; s=arc-20160816; b=CzBpz9gbpbNf00+0SViysLVvNyD5rKd1ySO7zNVQScC0nZrwDvjN7ZSGh9dC6HpakW LvDwejdH60oiTlEONXwiIxB4L1tOaFizjmLKkqWjJyjWlcdnmf9TVbLsUNZOgtmh73Wy LVjpXVay4KOkd1ISrjtdsQ809BXQV4jYKYoZpncqXxccHjrxzHxfEo9wp44ZJ4VOn5GK l7HenGnnlE13hEnOgWUI42gs4Vwbwtm5lPSLOkis2czmmZTZ2trKWbXeKlWZIY7Ytq16 8+yOT1SonyMtZRvNCP9vRRqTMgCiHfuHLJdt2tUsLQ08wSoD6GgntoZHA7WsRmyStEgz OgPw== 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=2lm3qEVBSJdxq4/4EUzCWV6QE445bHlIbiCqwVyw6Ns=; fh=jRZx2CGeeFZcE3BVWyyQfQMU6DACuExpX/LJhkP3QWU=; b=dGBrJv1Bp/7IAfOOeY7RyRN5DwI3d59ev7bcUf7ZO4redISyI1nN7XUAFkACgpve9k AYEUzYm2tDXJ4jq87M3TYprBuSLPvxtfW6fn61DE+Y1pAeA9XSyAbMIY4N/0EVsmeujr R4J8RzxackU2K/ecvk5/PKOvfzCYpGL2IF8cdn8qAf+u8BnWXSaIIt5Mbbj20NSfEFst lhp10kiKj+qFpfurG0Jxy6s3g/4JzioMS2WwMj4qt4dbe6x8k+arY7WI6YXFZtEb1BzZ WHnaOlZ39sJDAcPkER2n9bNJxWs6HxzeKOBrvgIRALUFG4NSHbdT73NQ80ugudcAt0j0 AKSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=gMsfmIur; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id o13-20020a65614d000000b00565f0e9cfbbsi9243556pgv.382.2023.12.13.03.02.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 03:02:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=gMsfmIur; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 0650F8227780; Wed, 13 Dec 2023 03:02:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378535AbjLMLCP (ORCPT + 99 others); Wed, 13 Dec 2023 06:02:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378598AbjLMLCJ (ORCPT ); Wed, 13 Dec 2023 06:02:09 -0500 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AAF1189 for ; Wed, 13 Dec 2023 03:02:09 -0800 (PST) Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20231213110208epoutp04015a850cd622685bf158290a27aa4849~gXzI5pbqq0794607946epoutp04a for ; Wed, 13 Dec 2023 11:02:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20231213110208epoutp04015a850cd622685bf158290a27aa4849~gXzI5pbqq0794607946epoutp04a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1702465328; bh=2lm3qEVBSJdxq4/4EUzCWV6QE445bHlIbiCqwVyw6Ns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gMsfmIur42JVQIOh6hVFVeTsKPidfcITtpLzmTSmUG9u2JohfF2TgWAaE5eJsswD+ iLns5YPln/481vK90lnZUFmBsMh+VUJCxQY4yQyaoziPpzr0zooJ2eVT5zQl8Aj3Nc YMoEsEb6f/FW3Ao/0uorv2uLy+/PuNZLbFzvCLzg= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20231213110207epcas5p3e33afff16ddcd8364be6b5fa84972da2~gXzIaq4C70873008730epcas5p3b; Wed, 13 Dec 2023 11:02:07 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.181]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4Sqsxp2cn5z4x9Pt; Wed, 13 Dec 2023 11:02:06 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 7D.09.09672.E2F89756; Wed, 13 Dec 2023 20:02:06 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20231213081148epcas5p215061f6452b43e00dd20e5db6b50bbb9~gVea1QCbK1902219022epcas5p2t; Wed, 13 Dec 2023 08:11:48 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231213081148epsmtrp1ad214c600c06faf6999d54905457e3e5~gVeatpkwc2335123351epsmtrp1n; Wed, 13 Dec 2023 08:11:48 +0000 (GMT) X-AuditID: b6c32a4b-60bfd700000025c8-55-65798f2ec816 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 20.35.07368.44769756; Wed, 13 Dec 2023 17:11:48 +0900 (KST) Received: from cheetah.sa.corp.samsungelectronics.net (unknown [107.109.115.53]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231213081143epsmtip2b7286351edc2ff3bd11978342dc54eab~gVeWYOpzH1538715387epsmtip2P; Wed, 13 Dec 2023 08:11: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, 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 10/10] media: s5p-mfc: DPB Count Independent of VIDIOC_REQBUF Date: Wed, 13 Dec 2023 13:41:05 +0530 Message-Id: <20231213081105.25817-11-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: H4sIAAAAAAAAA+NgFtrLJsWRmVeSWpSXmKPExsWy7bCmhq5ef2WqwZsrAhZPd8xktTjw/iCL xYN529gsFv94zmRxf/FnFotDm7eyW6zZe47JYv6Rc6wWNw/sZLK4OPMui0Xfi4fMFpseX2O1 ePgq3OLyrjlsFj0btrJazDi/j8li7ZG77BbLNv1hsli09Qu7ReveI+wWLY1LWB1EPa4v+cTs sXPWXXaPxXteMnlsWtXJ5nHn2h42j81L6j36tqxi9PjXNJfd4/MmOY9TXz+zB3BFZdtkpCam pBYppOYl56dk5qXbKnkHxzvHm5oZGOoaWlqYKynkJeam2iq5+AToumXmAP2opFCWmFMKFApI LC5W0rezKcovLUlVyMgvLrFVSi1IySkwKdArTswtLs1L18tLLbEyNDAwMgUqTMjO+HJbreC4 dMXK+b+YGhj/inUxcnJICJhITH44nb2LkYtDSGA3o8TC7RdZIJxPjBKn2w8xQjjfGCU+vPrF CtOyqGs5E0RiL6PEs67/rBBOK5PEsROHgfo5ONgEdCXObs8BaRARaGSUeNxRAlLDLHCcWWLB hJksIAlhgSCJz99usYHYLAKqEu83dILZvAJ2Ek+PH2aC2CYvsXrDAWYQmxMo/q5pP9hJEgI3 OCT+P+1nhihykfh1aQ/UecISr45vYYewpSRe9rdB2ckSjxe9hKrPkVi/ZwoLhG0vceDKHLCj mQU0Jdbv0ocIy0pMPbUO7AZmAT6J3t9PoO7hldgxD8ZWk5hz5wfUWhmJw6uXMkLYHhIti7uY IYEykVFi5cHPzBMY5WYhrFjAyLiKUTK1oDg3PbXYtMA4L7UcHmvJ+bmbGMHpWMt7B+OjBx/0 DjEycTAeYpTgYFYS4T25ozxViDclsbIqtSg/vqg0J7X4EKMpMAAnMkuJJucDM0JeSbyhiaWB iZmZmYmlsZmhkjjv69a5KUIC6YklqdmpqQWpRTB9TBycUg1MfFM42xr5qmw+3JCfL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g/nZo5mqjO/cDpnYz5m34V/sy9l7PntHrHzg Vbb0aOH2fzHSwdNOrjl7IdZzqfv9eYyrXpo/Ws67q2LrlgOSUR6f/+868Hz34sc7xJZPOpV3 d/HP4gmveKfEat/e3fzs6kn3lV+us8gs+trnWsc9q86UUcrw7us1j7RYP3q8v5vW1V1rd9DP jXWKf5Xo9X/sOqvlI7ucwspi+/1PGnHILzkveP35PpN3jm9e94TmVdmrXpn60zDmi/aXbcsj slZELFnZytdzbY3Zsy1Km22Ujp0/O185Ys0/uSsRf4Rvls7L+//BrmZm45vcrnrXyXuSo256 bzAQzsm6eEiJpTgj0VCLuag4EQCl7SCPBwMAAA== X-CMS-MailID: 20231213081148epcas5p215061f6452b43e00dd20e5db6b50bbb9 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20231213081148epcas5p215061f6452b43e00dd20e5db6b50bbb9 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 howler.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 (howler.vger.email [0.0.0.0]); Wed, 13 Dec 2023 03:02:33 -0800 (PST) Add allocation of DPB buffers based on MFC requirement so, codec buffers allocations has been moved after state MFCINST_HEAD_PRODUCED. It is taken care that codec buffer allocation is performed in process context from userspace IOCTL call. Cc: linux-fsd@tesla.com Signed-off-by: Smitha T Murthy Signed-off-by: Aakarsh Jain --- .../platform/samsung/s5p-mfc/s5p_mfc_enc.c | 18 ++---------------- .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 7 +++++++ 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c index ae3764969473..ef8bb40b9712 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c @@ -1164,7 +1164,6 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx) struct s5p_mfc_dev *dev = ctx->dev; struct s5p_mfc_enc_params *p = &ctx->enc_params; struct s5p_mfc_buf *dst_mb; - unsigned int enc_pb_count; if (p->seq_hdr_mode == V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE) { if (!list_empty(&ctx->dst_queue)) { @@ -1186,10 +1185,7 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx) set_work_bit_irqsave(ctx); s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); } else { - enc_pb_count = s5p_mfc_hw_call(dev->mfc_ops, - get_enc_dpb_count, dev); - if (ctx->pb_count < enc_pb_count) - ctx->pb_count = enc_pb_count; + ctx->pb_count = s5p_mfc_hw_call(dev->mfc_ops, get_enc_dpb_count, dev); if (FW_HAS_E_MIN_SCRATCH_BUF(dev)) { ctx->scratch_buf_size = s5p_mfc_hw_call(dev->mfc_ops, get_e_min_scratch_buf_size, dev); @@ -1564,14 +1560,6 @@ static int vidioc_reqbufs(struct file *file, void *priv, } ctx->capture_state = QUEUE_BUFS_REQUESTED; - ret = s5p_mfc_hw_call(ctx->dev->mfc_ops, - alloc_codec_buffers, ctx); - if (ret) { - mfc_err("Failed to allocate encoding buffers\n"); - reqbufs->count = 0; - ret = vb2_reqbufs(&ctx->vq_dst, reqbufs); - return -ENOMEM; - } } else if (reqbufs->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { if (reqbufs->count == 0) { mfc_debug(2, "Freeing buffers\n"); @@ -1587,15 +1575,13 @@ static int vidioc_reqbufs(struct file *file, void *priv, return -EINVAL; } - if (IS_MFCV6_PLUS(dev)) { + if (IS_MFCV6_PLUS(dev) && (!IS_MFCV12(dev))) { /* Check for min encoder buffers */ if (ctx->pb_count && (reqbufs->count < ctx->pb_count)) { reqbufs->count = ctx->pb_count; mfc_debug(2, "Minimum %d output buffers needed\n", ctx->pb_count); - } else { - ctx->pb_count = reqbufs->count; } } 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 572293f3b190..fd945211d28e 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 @@ -2110,6 +2110,13 @@ static inline int s5p_mfc_run_init_enc_buffers(struct s5p_mfc_ctx *ctx) struct s5p_mfc_dev *dev = ctx->dev; int ret; + ret = s5p_mfc_hw_call(ctx->dev->mfc_ops, alloc_codec_buffers, ctx); + if (ret) { + mfc_err("Failed to allocate encoding buffers\n"); + return -ENOMEM; + } + mfc_debug(2, "Allocated Internal Encoding Buffers\n"); + dev->curr_ctx = ctx->num; ret = s5p_mfc_set_enc_ref_buffer_v6(ctx); if (ret) { -- 2.17.1