Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5233787rdb; Wed, 13 Dec 2023 03:01:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IH/tbjwBZ5Rgos1hQpUjCIav+q6ENdNRH5BK0LBe80H6TZ1YZradmvzLOC1/l3DGtJBMk7K X-Received: by 2002:a17:903:2b0f:b0:1d3:44ad:2156 with SMTP id mc15-20020a1709032b0f00b001d344ad2156mr2397624plb.2.1702465312414; Wed, 13 Dec 2023 03:01:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702465311; cv=none; d=google.com; s=arc-20160816; b=tUy21Hy1r6VPTWUQtNgKN/cO+qkkLea7PD1qidDEDSkgj05I1dEDC40OPUoLPqDmeA LkxyUU/sPQoH52E800bsaTJcpdcg2frBr7Mk35TjgvBFr3cTvsjuLXXuGLr4a1BrGNVC s/UjWAU5xxi305R05NmTYrYWhtmb4PvQxRdRbsS01aLRBPPfhWwqhHCpInH+4fYcDJyO Leg7AbmNHXeJFVl/92TA/QJTzvaB5JH+QcbuEA8VHa7UBKuhC2mOAPMdZYa66oHFFaa3 pjUVy7h7hFRA3qZ7YqpP2m/Mkys1jcqOn4K6b6MAvoLWuEYNMkTfQsIEIHSd/o7K2tH+ Ewkw== 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=HKFsd5Jp8gHQwfs4RaCuZrcBXhPbGiu83l8haXmBs2M=; fh=jRZx2CGeeFZcE3BVWyyQfQMU6DACuExpX/LJhkP3QWU=; b=Qculhxm+/dgy8L4dlX0o3yxJzAU/do82mWaT5Y+3SWIOgD9jVqcKCC4AYuihFuCdV0 DrnHLUZQ+0lOAy4G5AFvL7MuP2BJrZxLkeBnOqynPiSKzvq/IeT9jcECGqGfOzbXi8eg HkQwMSNd/AM3bPFPLSl+x90RjADAswJa0a3Fjt/Ih/LGiwzys85ZLjltxQKIP/n6/LnV ic/TTUxeagL6Q9ipTMAwTvMfolyJR39OwEVvbmq88AmdgB6uhDKDbtyzOMDcui89bF52 hx+nRvFepDbkQAakO2EfHUtPTCyBcb+u6VfsBEn9ZLFvKScuYyBG04b8k/tS2sZK19/f 8AnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=lfMaLUxu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id j4-20020a170902da8400b001d0b6ba6109si9699823plx.248.2023.12.13.03.01.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 03:01:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=lfMaLUxu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id C9C63803E8E1; Wed, 13 Dec 2023 03:01:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378434AbjLMLBe (ORCPT + 99 others); Wed, 13 Dec 2023 06:01:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378487AbjLMLB1 (ORCPT ); Wed, 13 Dec 2023 06:01:27 -0500 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14523109 for ; Wed, 13 Dec 2023 03:01:33 -0800 (PST) Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20231213110131epoutp021b8bd3b9ac3b9a26046c341365998f16~gXymZ_ztd0499804998epoutp02Y for ; Wed, 13 Dec 2023 11:01:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20231213110131epoutp021b8bd3b9ac3b9a26046c341365998f16~gXymZ_ztd0499804998epoutp02Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1702465291; bh=HKFsd5Jp8gHQwfs4RaCuZrcBXhPbGiu83l8haXmBs2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lfMaLUxunozDeewh0KSTBTP3MyEHz1i8wEkNNv0uw8WlrxA4cBQvjlrQ5n4c4Jj9h nqd8cEq1rixm15LvENeO9eyT9YXmNJTOmtHBCmTxSHdnJhBkXAmLFjgTZt1QUG4A2F Rd+b+TegNGoiiQpTNpDBoVEpbIJN/hX3CFxP1RJQ= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20231213110130epcas5p10385db06b44ac09a942023416f000990~gXyldyykn2229322293epcas5p1n; Wed, 13 Dec 2023 11:01:30 +0000 (GMT) Received: from epsmgec5p1-new.samsung.com (unknown [182.195.38.178]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4Sqsx45CPhz4x9Pw; Wed, 13 Dec 2023 11:01:28 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmgec5p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id 00.00.19369.80F89756; Wed, 13 Dec 2023 20:01:28 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20231213081137epcas5p132baeb4789897e3386b9357b55cc63c4~gVeQq93hZ0249502495epcas5p1t; Wed, 13 Dec 2023 08:11:37 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20231213081137epsmtrp27935b007b8a1d83ac3801e4f5bf4cc15~gVeQpl2jq2160121601epsmtrp27; Wed, 13 Dec 2023 08:11:37 +0000 (GMT) X-AuditID: b6c32a50-9e1ff70000004ba9-35-65798f083fc9 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 0B.4B.08755.93769756; Wed, 13 Dec 2023 17:11:37 +0900 (KST) Received: from cheetah.sa.corp.samsungelectronics.net (unknown [107.109.115.53]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231213081134epsmtip24589ad762b4a63b3fba5aaca93315d30~gVeN2wJcV1539415394epsmtip2y; Wed, 13 Dec 2023 08:11:34 +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 07/10] media: s5p-mfc: Add support for DMABUF for encoder Date: Wed, 13 Dec 2023 13:41:02 +0530 Message-Id: <20231213081105.25817-8-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: H4sIAAAAAAAAA0WTe0xbVRzHPffethe0egNMD9Uhu0Ym05ZeaeGUAHOM6U22KYrZIn/QdfSm IO1t04dsw42Bq2G4TXAyBgNceCXAFCiDlUexQuXlhhI2FhXiJpsTjDNSUIwwpRT0v8/vdb6/ 3++cQ+JBLqGEzOKtnJnX6GlhINE5EBkpJT88zMnH27eiu85yAXL/9gWBblV3ClHt0j0M/VDr JVB/e4cIXXKNYegTz5gAfevuwtB4+TSBzvx8G0eOmUkBuj23H010VwrRqdYOATr/dR+GPvVM i1CDYxlDNR0LImR3eUToRH6d4KVN7M26eZztqpgWsbW9sxjraDopZKcme4Vse10ee+ZyE2Af FFSJWK8jjB1d9IpSAtOy4zM5jZYzh3N8hlGbxesS6N2p6p1qZYyckTIqFEuH8xoDl0An70mR vpylX52RDn9Ho7etulI0FgsdlRhvNtqsXHim0WJNoDmTVm9SmGQWjcFi43UynrPGMXL5i8rV xAPZmY01yyLTe6GH6rsWseNgJKQIBJCQUsDxigmsCASSQVQvgB+1VAv9xjyAPWUl68YfANrb /sQ3Sjoq7SJ/wAXg95ULhC8QRNkx+KU3rAiQpJCSwmtX9D53CJUP4Eyh1ZePU0M4vFhcvpYf TO2B+U0jQh8T1LPQ1V4h8LGYSoAOz1eYX+xp2NzqXhMOoBLh/YLPge8gSF0n4fSls4RPDFLJ cOraq/78YDg3dFnkZwn03ncJ/ZwBZ2pm1wfQw5bejwk/b4fu65Vrx+BUJGzpjvK7N8PS0c/W WsCpR+Hpv++styOGzuoNjoCVU0sCPz8FB5rrgZ9ZOF82sr64EgBXer4hikFYxf8SFwFoAhLO ZDHouAyliZHyXM5/t5ZhNDjA2jveluIEza0rsn6AkaAfQBKnQ8QjzhwuSKzVHD7CmY1qs03P WfqBcnWBJbhkU4Zx9SPwVjWjUMkVMTExClV0DEM/If7FXqUNonQaK5fNc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b7NaKTyzsKdEdsxim/vn31Lk9XLWS a9XLSRcE1u31W+eddeRU6+2W0/xy5u/+1l3jibkeGrzTRJJL+RDXj/CaOecYiji67slZJd+f aMK/hl8+hbd0YZxaj9WM3m2lCTZ/qx1Ekifeac6Mqjlv6l0UFnzPImjC1mM7N6caPLWQulDN 7718U+0jYYcwJu+01p3PL/zcUvJcMiwqIfhpyf6TPDeNTotvefB51wa7zg7bw+t2r3V4+rJ9 rVmJ41nnDUKz3fWOWn0/vtysX+Wz9HeJ2KCePj+fH07FEwprbGWv3/Xcnjn5qUqM7KqHjWXS 5YJKeTOVWIozEg21mIuKEwEfScjTBwMAAA== X-CMS-MailID: 20231213081137epcas5p132baeb4789897e3386b9357b55cc63c4 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: 20231213081137epcas5p132baeb4789897e3386b9357b55cc63c4 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Wed, 13 Dec 2023 03:01:47 -0800 (PST) Add dmabuf support for mfc encoder Cc: linux-fsd@tesla.com Signed-off-by: Smitha T Murthy Signed-off-by: Aakarsh Jain --- .../media/platform/samsung/s5p-mfc/s5p_mfc.c | 4 ++-- .../platform/samsung/s5p-mfc/s5p_mfc_enc.c | 20 ++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c index dee9ef017997..bd055dea827e 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c @@ -865,7 +865,7 @@ static int s5p_mfc_open(struct file *file) q->io_modes = VB2_MMAP; q->ops = get_dec_queue_ops(); } else if (vdev == dev->vfd_enc) { - q->io_modes = VB2_MMAP | VB2_USERPTR; + q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; q->ops = get_enc_queue_ops(); } else { ret = -ENOENT; @@ -892,7 +892,7 @@ static int s5p_mfc_open(struct file *file) q->io_modes = VB2_MMAP; q->ops = get_dec_queue_ops(); } else if (vdev == dev->vfd_enc) { - q->io_modes = VB2_MMAP | VB2_USERPTR; + q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; q->ops = get_enc_queue_ops(); } else { ret = -ENOENT; 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 67fe0302464f..ae3764969473 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c @@ -1538,9 +1538,10 @@ static int vidioc_reqbufs(struct file *file, void *priv, struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); int ret = 0; - /* if memory is not mmp or userptr return error */ + /* if memory is not mmp or userptr or dmabuf return error */ if ((reqbufs->memory != V4L2_MEMORY_MMAP) && - (reqbufs->memory != V4L2_MEMORY_USERPTR)) + (reqbufs->memory != V4L2_MEMORY_USERPTR) && + (reqbufs->memory != V4L2_MEMORY_DMABUF)) return -EINVAL; if (reqbufs->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { if (reqbufs->count == 0) { @@ -1617,9 +1618,10 @@ static int vidioc_querybuf(struct file *file, void *priv, struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); int ret = 0; - /* if memory is not mmp or userptr return error */ + /* if memory is not mmp or userptr or dmabuf return error */ if ((buf->memory != V4L2_MEMORY_MMAP) && - (buf->memory != V4L2_MEMORY_USERPTR)) + (buf->memory != V4L2_MEMORY_USERPTR) && + (buf->memory != V4L2_MEMORY_DMABUF)) return -EINVAL; if (buf->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { if (ctx->state != MFCINST_GOT_INST) { @@ -2581,11 +2583,11 @@ static int s5p_mfc_start_streaming(struct vb2_queue *q, unsigned int count) S5P_MFC_R2H_CMD_SEQ_DONE_RET, 0); } - - if (ctx->src_bufs_cnt < ctx->pb_count) { - mfc_err("Need minimum %d OUTPUT buffers\n", - ctx->pb_count); - return -ENOBUFS; + if (q->memory != V4L2_MEMORY_DMABUF) { + if (ctx->src_bufs_cnt < ctx->pb_count) { + mfc_err("Need minimum %d OUTPUT buffers\n", ctx->pb_count); + return -ENOBUFS; + } } } -- 2.17.1