From patchwork Wed Oct 10 14:46:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 12135 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 A064223EFB for ; Wed, 10 Oct 2012 15:04:26 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 7A5F1A19091 for ; Wed, 10 Oct 2012 15:04:25 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id f6so428064iag.11 for ; Wed, 10 Oct 2012 08:04:24 -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=CgMet/OV7g37n8Ua5b00GY0KnYenv+tULuyOo9O3b/g=; b=iuLKkSuA4o89a3uiEBoIWa3UUpH3F9Yn6liGqz/azolyFU52wDbkV4DTZ/jrwE2pyl sFm9IJgQ4VFP6wGDp810tXmQrGD8LFUk8vYDREN5GQ+19XI9id4Fel7V/g3o51VxTowX Ndn4dapI9GA2ySiJQgObv8XOY6j07+DIugvvwSIUP/1+xLGBrrj6HReJ35mMtRR/JBgi PQIqWrY/GreS6DHe414tQXAZdGN1y3EY4Jq1nugLCV6B2QuDcwmAMD2EIaMX/nbNmKBC 253usn+Ibmy08pFu4/rf+6Zct/ao+wZI86nzgraHI2WxzD0xXQaZDiGCfR0o3N0faKiV 6P3A== Received: by 10.50.152.137 with SMTP id uy9mr5482027igb.62.1349881464907; Wed, 10 Oct 2012 08:04:24 -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.67.148 with SMTP id n20csp237643igt; Wed, 10 Oct 2012 08:04:24 -0700 (PDT) Received: by 10.14.4.201 with SMTP id 49mr33681330eej.0.1349881463328; Wed, 10 Oct 2012 08:04:23 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id j5si637866eeo.50.2012.10.10.08.04.22; Wed, 10 Oct 2012 08:04:23 -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 1TLxpc-00032s-W1; Wed, 10 Oct 2012 15:04:21 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TLxpc-00032n-26 for linaro-mm-sig@lists.linaro.org; Wed, 10 Oct 2012 15:04:20 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MBO00AN6N76Q580@mailout4.samsung.com> for linaro-mm-sig@lists.linaro.org; Thu, 11 Oct 2012 00:04:18 +0900 (KST) X-AuditID: cbfee61b-b7f2b6d000000f14-f6-50758e72671a Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 49.1D.03860.27E85705; Thu, 11 Oct 2012 00:04:18 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MBO002YDME0EC70@mmp1.samsung.com> for linaro-mm-sig@lists.linaro.org; Thu, 11 Oct 2012 00:04:18 +0900 (KST) From: Tomasz Stanislawski To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Date: Wed, 10 Oct 2012 16:46:45 +0200 Message-id: <1349880405-26049-27-git-send-email-t.stanislaws@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1349880405-26049-1-git-send-email-t.stanislaws@samsung.com> References: <1349880405-26049-1-git-send-email-t.stanislaws@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCJMWRmVeSWpSXmKPExsVy+t9jAd2ivtIAg+0TZCy+XHnI5MDocfvf Y+YAxigum5TUnMyy1CJ9uwSujFmv7rMXXBer2NrwkL2BcalwFyMnh4SAicSN233MELaYxIV7 69m6GLk4hAQWMUpcOvqFGcJZyyTR3bmIBaSKDajj2JLPjCC2iICDxOm7s8CKmAXWMEu8WHmD DSQhLOAi0bpnLyuIzSKgKvHrQzdYA6+Ap8TlaftZIdbJSzy93wdWzwkUvzBvOtgZQgIeEv/X b2aawMi7gJFhFaNoakFyQXFSeq6RXnFibnFpXrpecn7uJkaw359J72Bc1WBxiFGAg1GJh7ci oyRAiDWxrLgy9xCjBAezkgivqU9pgBBvSmJlVWpRfnxRaU5q8SFGaQ4WJXHeZo+UACGB9MSS 1OzU1ILUIpgsEwenVANjYXeSjszuvk0l3GyJ8Vrf76xaK8e9rPbhsbygO8WyBcwOW+acP5d0 4ew9JZ2TVt6TTGs/VCcHeO367jr3z+ue2Se4EwLOvFLrXKrl4rlEZ0H4q5ocDRX/K0dKl08T UrrkMU+NVysqJWtpour0YPFVF+wY/GwedDZvPLq/bWNeQmjC3Y+W+12VWIozEg21mIuKEwGW QgKY9wEAAA== 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] [PATCHv10 26/26] 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: ALoCoQkDp6RVnv9HO/f1YxhWdv77Um0Igko0oBs6nFN/FFMoDZqcg/NbVFnGG9PI+2HwyH0CWoba 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 Acked-by: Hans Verkuil --- drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 14 ++++++++++++++ drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index eb6a70b..6dad9a7 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c @@ -636,6 +636,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) @@ -813,6 +826,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/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 2af6d52..22bf684 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c @@ -1165,6 +1165,19 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) return ret; } +/* 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) @@ -1568,6 +1581,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,