From patchwork Tue Oct 2 14:27:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 11946 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 064751A52FC for ; Tue, 2 Oct 2012 14:30:56 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 8B88BA18672 for ; Tue, 2 Oct 2012 14:30:55 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so14258231iej.11 for ; Tue, 02 Oct 2012 07:30:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:x-auditid :from:to:date:message-id:x-mailer:in-reply-to:references :x-brightmail-tracker:cc:subject:x-beenthere:x-mailman-version :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-gm-message-state; bh=7Uoo/Y3Iq8p4pClOmHp5kgmLTKIZ/W0EPvoqYv2BEOw=; b=LPcSNM0t5yMq3hyLl/0N8DWyeoFvfvmwrnuPGmK6nS1XdEXofbMJsMu50xkUFap0Da poyUPHv9Nwh/45fLiLmThTUWlCEzWVGAbfAgHK2PQhvdrN+WL6jE2D8R2Z5b2fq2QJ4j aOcZcGszToXZfTpfieDfhnZhf53ZObssaszoZU//blPZ+yAXmCDlyRnv2haiWZT6OLlR Xv/unBy94VIY5uHOHmts8FiAcQKfGfRtCURC+dNGMaO7jyc42An0+XHb9rthP9Xp96KF 5FRSpSh79rc+jfTp80SN3zSQfSLQxgwqvJQrTCJUtI3xuqOvAv1p5y96RyZLAHqgdXos rkOA== Received: by 10.50.0.193 with SMTP id 1mr9069023igg.0.1349188255302; Tue, 02 Oct 2012 07:30:55 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp85090igc; Tue, 2 Oct 2012 07:30:54 -0700 (PDT) Received: by 10.216.134.227 with SMTP id s77mr9540923wei.165.1349188253606; Tue, 02 Oct 2012 07:30:53 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id m2si1360730wea.64.2012.10.02.07.30.52; Tue, 02 Oct 2012 07:30:53 -0700 (PDT) Received-SPF: neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) client-ip=91.189.95.16; Authentication-Results: mx.google.com; spf=neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) smtp.mail=linaro-mm-sig-bounces@lists.linaro.org Received: from localhost ([127.0.0.1] helo=mombin.canonical.com) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TJ3Up-0005Kx-Go; Tue, 02 Oct 2012 14:30:51 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TJ3Uo-0005KX-6b for linaro-mm-sig@lists.linaro.org; Tue, 02 Oct 2012 14:30:50 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MB9002P8SBDD120@mailout1.samsung.com> for linaro-mm-sig@lists.linaro.org; Tue, 02 Oct 2012 23:30:49 +0900 (KST) X-AuditID: cbfee61a-b7f726d000000ec7-79-506afa9815c1 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 32.DE.03783.89AFA605; Tue, 02 Oct 2012 23:30:49 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MB9005A7S65K790@mmp2.samsung.com> for linaro-mm-sig@lists.linaro.org; Tue, 02 Oct 2012 23:30:48 +0900 (KST) From: Tomasz Stanislawski To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Date: Tue, 02 Oct 2012 16:27:36 +0200 Message-id: <1349188056-4886-26-git-send-email-t.stanislaws@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1349188056-4886-1-git-send-email-t.stanislaws@samsung.com> References: <1349188056-4886-1-git-send-email-t.stanislaws@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEJMWRmVeSWpSXmKPExsVy+t9jQd2Zv7ICDGZ+ZbH4cuUhkwOjx+1/ j5kDGKO4bFJSczLLUov07RK4Mm42LmEt6BGrmLTuDmsD432hLkZODgkBE4kN224wQdhiEhfu rWcDsYUEpjNKrPgp3sXIBWSvZZK4/3cXM0iCDajh2JLPjCC2iICDxOm7s5hBipgF1jBLvFh5 A6xbWMBZYtudP2ANLAKqErufHgFq4ODgFfCQaF0XBLFMXuLp/T6wck6g8M8nF1ggFrtL7Fne xDaBkXcBI8MqRtHUguSC4qT0XEO94sTc4tK8dL3k/NxNjGCfP5PawbiyweIQowAHoxIP786T mQFCrIllxZW5hxglOJiVRHit72cFCPGmJFZWpRblxxeV5qQWH2KU5mBREudt9kgJEBJITyxJ zU5NLUgtgskycXBKNTCazbGbWNmjdFI31kpUdTlrkJa9i833Zs1TAdK511nKJp79ONlPvq28 RuTO99KM30F39h3L12V49Xi5zgnhVVvWTVs65f1K9tP5+Rmpyd97ZtafWKyxcP/yz8qBq5/M LH22YW3M7hmn0vqmik+d3Kaixn188jGf/GMz9U4skErUOxUkEd916qudEktxRqKhFnNRcSIA TICABvUBAAA= Cc: k.debski@samsung.com, s.nawrocki@samsung.com, pawel@osciak.com, sumit.semwal@ti.com, mchehab@redhat.com, robdclark@gmail.com, linaro-mm-sig@lists.linaro.org, kyungmin.park@samsung.com, laurent.pinchart@ideasonboard.com, airlied@redhat.com, remi@remlab.net Subject: [Linaro-mm-sig] [PATCHv9 25/25] v4l: s5p-mfc: support for dmabuf exporting X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Unified memory management interest group." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQkL2jXKRGCDWLtv2kcf6CuNhhHO8bZ61TDbIImviQ1piQK3Uz2j1pSWroWRg0bAR80Yd2GC This patch enhances s5p-mfc with support for DMABUF exporting via VIDIOC_EXPBUF ioctl. Signed-off-by: Tomasz Stanislawski Signed-off-by: Kyungmin Park CC: Kamil Debski --- drivers/media/video/s5p-mfc/s5p_mfc_dec.c | 14 ++++++++++++++ drivers/media/video/s5p-mfc/s5p_mfc_enc.c | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c index c5d567f..c2f4f49 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c @@ -570,6 +570,19 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) return -EINVAL; } +/* Export DMA buffer */ +static int vidioc_expbuf(struct file *file, void *priv, + struct v4l2_exportbuffer *eb) +{ + struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); + + if (eb->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) + return vb2_expbuf(&ctx->vq_src, eb); + if (eb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) + return vb2_expbuf(&ctx->vq_dst, eb); + return -EINVAL; +} + /* Stream on */ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type type) @@ -745,6 +758,7 @@ static const struct v4l2_ioctl_ops s5p_mfc_dec_ioctl_ops = { .vidioc_querybuf = vidioc_querybuf, .vidioc_qbuf = vidioc_qbuf, .vidioc_dqbuf = vidioc_dqbuf, + .vidioc_expbuf = vidioc_expbuf, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, .vidioc_g_crop = vidioc_g_crop, diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c index aa1c244..a08ce0a 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c @@ -1142,6 +1142,19 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) return -EINVAL; } +/* Export DMA buffer */ +static int vidioc_expbuf(struct file *file, void *priv, + struct v4l2_exportbuffer *eb) +{ + struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); + + if (eb->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) + return vb2_expbuf(&ctx->vq_src, eb); + if (eb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) + return vb2_expbuf(&ctx->vq_dst, eb); + return -EINVAL; +} + /* Stream on */ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type type) @@ -1487,6 +1500,7 @@ static const struct v4l2_ioctl_ops s5p_mfc_enc_ioctl_ops = { .vidioc_querybuf = vidioc_querybuf, .vidioc_qbuf = vidioc_qbuf, .vidioc_dqbuf = vidioc_dqbuf, + .vidioc_expbuf = vidioc_expbuf, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, .vidioc_s_parm = vidioc_s_parm,