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: 1321421 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 90C6040210 for ; Tue, 14 Aug 2012 15:38:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756710Ab2HNPie (ORCPT ); Tue, 14 Aug 2012 11:38:34 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:9734 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756703Ab2HNPic (ORCPT ); Tue, 14 Aug 2012 11:38:32 -0400 Received: from epcpsbgm1.samsung.com (mailout2.samsung.com [203.254.224.25]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M8R00J7V4S0DVJ0@mailout2.samsung.com> for linux-media@vger.kernel.org; Wed, 15 Aug 2012 00:38:31 +0900 (KST) X-AuditID: cbfee61a-b7fc66d0000043b7-62-502a70f7b02d Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id B9.AD.17335.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 linux-media@vger.kernel.org; Wed, 15 Aug 2012 00:38:31 +0900 (KST) From: Tomasz Stanislawski To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: airlied@redhat.com, m.szyprowski@samsung.com, t.stanislaws@samsung.com, kyungmin.park@samsung.com, laurent.pinchart@ideasonboard.com, sumit.semwal@ti.com, daeinki@gmail.com, daniel.vetter@ffwll.ch, robdclark@gmail.com, pawel@osciak.com, linaro-mm-sig@lists.linaro.org, hverkuil@xs4all.nl, remi@remlab.net, subashrp@gmail.com, mchehab@redhat.com, g.liakhovetski@gmx.de, dmitriyz@google.com, s.nawrocki@samsung.com, k.debski@samsung.com Subject: [PATCHv8 26/26] v4l: s5p-mfc: support for dmabuf exporting 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+t9jAd3vBVoBBu/2KVj0bNjK6sDo8XmT XABjFJdNSmpOZllqkb5dAlfG4l3vmQrOiVXs3PeesYGxU7iLkZNDQsBEYueFTewQtpjEhXvr 2boYuTiEBBYxSkz70coE4axikpjy9yUTSBUbUMexJZ8ZQWwRAQeJ03dnMYMUMQscYpbY3/sa bJSwgLPE/4Wv2EBsFgFViTcX9zCD2LwCHhJ96y6xQqyTl3h6vw+shhMo/nJTN9BQDqBt7hIL f/pPYORdwMiwilE0tSC5oDgpPddQrzgxt7g0L10vOT93EyPY58+kdjCubLA4xCjAwajEw6uQ phkgxJpYVlyZe4hRgoNZSYS3KEgrQIg3JbGyKrUoP76oNCe1+BCjNAeLkjivsfdXfyGB9MSS 1OzU1ILUIpgsEwenVANjcZ2ezUqN0GCxeQt3PRW3aFobcvxVK7eB8H/HJZe4BB+dkFhXurpE 4JToEoPtbZtPqHsbaOq+ilm97fn1lfurfSbUswsHT3OfkTCJ+Qzr24PrnF5M9I1cMSnp8FRD wYRrHT3ps+ybsrY+UbzLdNrlRnxNxP6fT4oPB7DdDY5f7vl54aVfNm+qlFiKMxINtZiLihMB 355Bj/UBAAA= X-TM-AS-MML: No Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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,