From patchwork Wed May 23 13:07:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 8929 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 2536023F04 for ; Wed, 23 May 2012 13:13:56 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id CA0CFA1818B for ; Wed, 23 May 2012 13:13:55 +0000 (UTC) Received: by ggnf1 with SMTP id f1so7980476ggn.11 for ; Wed, 23 May 2012 06:13: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:date:from :in-reply-to:to:message-id:mime-version:x-mailer:references:cc :subject:x-beenthere:x-mailman-version:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :content-type:content-transfer-encoding:sender:errors-to :x-gm-message-state; bh=PlD2SHW9q192WVIj01BHfeRCp+JLVMSsyYXiGlxoSq8=; b=Ixybfjh1DepuqDZY+fA0sMs8hwghAkRm/jLfRgNhdWMqSGTNok0aSMM+sILh2SxZ/0 SKwvxZ+r9+zjLbvFZayEQ4YK5mg9xhkjaJcRDjil4TYJ78RpsVNiFEicB+27vc2XYT9v TOc8tJluz1TAKplYBAfvRTa/7VpYvYSC+YK60BQVZE8++Ew/gtF03nTmh3KV51DoGgNG LospsVTtQ+ws5fsz4ZkkJbG+huzut7FGqWqG8PqswhsCneyYfLnGbzkILfRjYpxKUP7x hfKJP7zwh/csJpIu7db7xFvy2cMOg6haoYc5xQO7aHnfTLapqvfm+2IH7pno2wXiGX9y kSTg== Received: by 10.50.154.169 with SMTP id vp9mr12815499igb.53.1337778834728; Wed, 23 May 2012 06:13:54 -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.231.35.72 with SMTP id o8csp443813ibd; Wed, 23 May 2012 06:13:53 -0700 (PDT) Received: by 10.180.74.193 with SMTP id w1mr46060961wiv.4.1337778476770; Wed, 23 May 2012 06:07:56 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id bo7si4243605wib.45.2012.05.23.06.07.55; Wed, 23 May 2012 06:07:56 -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 1SXBIB-0006X5-4y; Wed, 23 May 2012 13:07:55 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SXBI3-0006Tv-SF for linaro-mm-sig@lists.linaro.org; Wed, 23 May 2012 13:07:47 +0000 Received: from euspt1 (mailout2.w1.samsung.com [210.118.77.12]) by mailout2.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0M4H000NT8GN1U@mailout2.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Wed, 23 May 2012 14:07:35 +0100 (BST) Received: from linux.samsung.com ([106.116.38.10]) by spt1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0M4H00KYY8GXMD@spt1.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Wed, 23 May 2012 14:07:45 +0100 (BST) Received: from mcdsrvbld02.digital.local (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id 37B15270056; Wed, 23 May 2012 15:19:02 +0200 (CEST) Date: Wed, 23 May 2012 15:07:32 +0200 From: Tomasz Stanislawski In-reply-to: <1337778455-27912-1-git-send-email-t.stanislaws@samsung.com> To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Message-id: <1337778455-27912-10-git-send-email-t.stanislaws@samsung.com> MIME-version: 1.0 X-Mailer: git-send-email 1.7.10 References: <1337778455-27912-1-git-send-email-t.stanislaws@samsung.com> Cc: Kamil Debski , pawel@osciak.com, sumit.semwal@ti.com, mchehab@redhat.com, robdclark@gmail.com, linaro-mm-sig@lists.linaro.org, kyungmin.park@samsung.com, airlied@redhat.com, remi@remlab.net, g.liakhovetski@gmx.de Subject: [Linaro-mm-sig] [PATCH 09/12] 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: , Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQkPVkesIHvip/EYhlLwXyT/2B5eXoCOLhTZU3omdb7EbB4N73o1WpZUc3qvqlRRcfDKEo6d 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 | 13 +++++++++++++ drivers/media/video/s5p-mfc/s5p_mfc_enc.c | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c index c25ec02..e1ebc76 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c @@ -564,6 +564,18 @@ 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->mem_offset < DST_QUEUE_OFF_BASE) + return vb2_expbuf(&ctx->vq_src, eb); + else + return vb2_expbuf(&ctx->vq_dst, eb); +} + /* Stream on */ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type type) @@ -739,6 +751,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 acedb20..887f1aa 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c @@ -1141,6 +1141,18 @@ 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->mem_offset < DST_QUEUE_OFF_BASE) + return vb2_expbuf(&ctx->vq_src, eb); + else + return vb2_expbuf(&ctx->vq_dst, eb); +} + /* Stream on */ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type type) @@ -1486,6 +1498,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,