From patchwork Tue Aug 14 15:34:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 10755 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 2E50C23E00 for ; Tue, 14 Aug 2012 15:38:44 +0000 (UTC) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by fiordland.canonical.com (Postfix) with ESMTP id DE052A18A29 for ; Tue, 14 Aug 2012 15:38:43 +0000 (UTC) Received: by vcbfw7 with SMTP id fw7so500097vcb.11 for ; Tue, 14 Aug 2012 08:38:43 -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:x-tm-as-mml: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=TGRK1yXXaLZuJ8/84gxAXedNB2Wv0js3lbpSMqfNbcA=; b=VA5frZ8M9xSi9iB60Mu4x2MHT5gYNrfdYRFENROxwCN8LokcrWYzZcJDGL+dlV6niD NNfNv62e3SRKS5+xBqhQEnG99Td/Tp0k3ke1vU0op4RfvFewD6hhqg6UR/0CMr4+TqvK lmRXbi2iBSTMvd2sRGzLYB03Uv2V7MOa9Cp+qXhjS9oK+1eGpfqSkxdMUicJyLvLPq2A yK1l7VwsG/IEKGmebsD9z6hw+iAphDK7cGjc9pNygrb0zFbRGmjfJ9yVKmniQEFo9ahl vdQRsMideUdv5fIZpYlQAJmXogAgsl9zKnddKiAz8fyfoRJRrqgQ6pgJJa70OEgO4m/O wmmA== Received: by 10.42.249.205 with SMTP id ml13mr6637750icb.49.1344958723079; Tue, 14 Aug 2012 08:38:43 -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.200 with SMTP id ew8csp20729igc; Tue, 14 Aug 2012 08:38:42 -0700 (PDT) Received: by 10.204.130.146 with SMTP id t18mr6458920bks.65.1344958721500; Tue, 14 Aug 2012 08:38:41 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id hy16si3989082bkc.133.2012.08.14.08.38.34; Tue, 14 Aug 2012 08:38:41 -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 1T1JCT-00009J-Nd; Tue, 14 Aug 2012 15:38:33 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1T1JCS-000094-Hg for linaro-mm-sig@lists.linaro.org; Tue, 14 Aug 2012 15:38:32 +0000 Received: from epcpsbgm2.samsung.com (mailout1.samsung.com [203.254.224.24]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M8R0051T4RRDSF0@mailout1.samsung.com> for linaro-mm-sig@lists.linaro.org; Wed, 15 Aug 2012 00:38:31 +0900 (KST) X-AuditID: cbfee61b-b7faf6d00000476a-7c-502a70f7380d Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 85.3A.18282.7F07A205; Wed, 15 Aug 2012 00:38:31 +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 <0M8R004J44MBC810@mmp1.samsung.com> for linaro-mm-sig@lists.linaro.org; Wed, 15 Aug 2012 00:38:31 +0900 (KST) From: Tomasz Stanislawski To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Date: Tue, 14 Aug 2012 17:34:56 +0200 Message-id: <1344958496-9373-27-git-send-email-t.stanislaws@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1344958496-9373-1-git-send-email-t.stanislaws@samsung.com> References: <1344958496-9373-1-git-send-email-t.stanislaws@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEJMWRmVeSWpSXmKPExsVy+t9jAd3vBVoBBn0LJC2+XHnI5MDocfvf Y+YAxigum5TUnMyy1CJ9uwSujMW73jMVnBOr2LnvPWMDY6dwFyMnh4SAicSrlWtZIGwxiQv3 1rOB2EICixgl5u3S6WLkArLXMkkcXX2BESTBBtRwbMlnMFtEwEHi9N1ZzCBFzAKHmCX2975m B0kICzhL/F/4CmwSi4CqxJuLe5hBbF4BD4m+dZdYIbbJSzy93wdWwwkUf7mpG2goB9A2d4mF P/0nMPIuYGRYxSiaWpBcUJyUnmukV5yYW1yal66XnJ+7iRHs82fSOxhXNVgcYhTgYFTi4S1M 1AwQYk0sK67MPcQowcGsJMJbFKQVIMSbklhZlVqUH19UmpNafIhRmoNFSZzXxPurv5BAemJJ anZqakFqEUyWiYNTqoFxaz3Tu72MZ9c/yn9WF/434beM972mcFuhyAcTjQtELsbKr1r66ynH 7+9P849v+Jw15dbm12wPnh3bFxvi3RvMp1zV9aB83q1P343sd0k8sbqlrGR39NfS9rktZl2C rHIJHHZfloqIv+CNa860u3Bl9q8lxd/XXtnqYVu3kTXTKONERFCNn8QaJZbijERDLeai4kQA uWtLH/UBAAA= X-TM-AS-MML: No Cc: k.debski@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, dmitriyz@google.com, laurent.pinchart@ideasonboard.com, s.nawrocki@samsung.com, airlied@redhat.com, remi@remlab.net, g.liakhovetski@gmx.de Subject: [Linaro-mm-sig] [PATCHv8 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: ALoCoQnTscHfzvL3bypiGJO1lGCxQrsHjBQ9IemUfihRvk/4QSRndU7lpW65D4MBJRLxZTaTCWwB 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 | 18 ++++++++++++++++++ drivers/media/video/s5p-mfc/s5p_mfc_enc.c | 18 ++++++++++++++++++ 2 files changed, 36 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..b375209 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c @@ -570,6 +570,23 @@ 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); + int ret; + + if (eb->mem_offset < DST_QUEUE_OFF_BASE) + return vb2_expbuf(&ctx->vq_src, eb); + + eb->mem_offset -= DST_QUEUE_OFF_BASE; + ret = vb2_expbuf(&ctx->vq_dst, eb); + eb->mem_offset += DST_QUEUE_OFF_BASE; + + return ret; +} + /* Stream on */ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type type) @@ -745,6 +762,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..df3da50 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c @@ -1142,6 +1142,23 @@ 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); + int ret; + + if (eb->mem_offset < DST_QUEUE_OFF_BASE) + return vb2_expbuf(&ctx->vq_src, eb); + + eb->mem_offset -= DST_QUEUE_OFF_BASE; + ret = vb2_expbuf(&ctx->vq_dst, eb); + eb->mem_offset += DST_QUEUE_OFF_BASE; + + return ret; +} + /* Stream on */ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type type) @@ -1487,6 +1504,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,