From patchwork Wed May 23 12:10:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Stanislawski X-Patchwork-Id: 8906 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 633F323E49 for ; Wed, 23 May 2012 12:11:01 +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 1EF8EA187C9 for ; Wed, 23 May 2012 12:11:01 +0000 (UTC) Received: by vcbfk26 with SMTP id fk26so1223139vcb.11 for ; Wed, 23 May 2012 05:11:00 -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=lRORlnSGryylYFPWOna5Y3PTnadHZ/pP7H5fLDHvBfA=; b=a07Qye3HRLVnc7q6B73LBTK63ZJc3jc/mbnm4jQc2tAunRzI4i1bCT0EWQvSW3Cgjk dyGAczLnKHRy1Gqe4wI9AmjkVeIksV82IRxET5K14WS0yFiVVsqBrgZiaS5nBenh0bi5 Fbh7aQZ8V1d/Q+lpAhMMb84vHblf8IMZZmG8hkLuETvzDexMd2bOs1sr/OEMYJK5HZjd z9Dwqr3IW9MRQGrobYB6zMJk8zaO0RcK/wkjrrknv7A4uToHoPHNLBP1lxLOuFQbWQkc j7sU9YyOr47fkAgqvJ04qZGwKlXvur52FOVT8ZGuYtBr0WViO34ppyA/LMlCFu/gJz1g RFoA== Received: by 10.50.195.234 with SMTP id ih10mr12854651igc.0.1337775060367; Wed, 23 May 2012 05:11:00 -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 o8csp439854ibd; Wed, 23 May 2012 05:10:56 -0700 (PDT) Received: by 10.204.150.92 with SMTP id x28mr11460949bkv.61.1337775055542; Wed, 23 May 2012 05:10:55 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id m49si28691839wee.22.2012.05.23.05.10.50; Wed, 23 May 2012 05:10:54 -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 1SXAOv-00064e-Vb; Wed, 23 May 2012 12:10:50 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SXAOt-00060w-AU for linaro-mm-sig@lists.linaro.org; Wed, 23 May 2012 12:10: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 <0M4H000RE5TK2S@mailout2.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Wed, 23 May 2012 13:10:32 +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 <0M4H00KSZ5TUMD@spt1.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Wed, 23 May 2012 13:10:42 +0100 (BST) Received: from mcdsrvbld02.digital.local (unknown [106.116.37.23]) by linux.samsung.com (Postfix) with ESMTP id BC5B827004D; Wed, 23 May 2012 14:21:58 +0200 (CEST) Date: Wed, 23 May 2012 14:10:15 +0200 From: Tomasz Stanislawski In-reply-to: <1337775027-9489-1-git-send-email-t.stanislaws@samsung.com> To: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Message-id: <1337775027-9489-2-git-send-email-t.stanislaws@samsung.com> MIME-version: 1.0 X-Mailer: git-send-email 1.7.10 References: <1337775027-9489-1-git-send-email-t.stanislaws@samsung.com> Cc: 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] [PATCHv6 01/13] v4l: Add DMABUF as a memory type 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: ALoCoQkE5FWWjFATod1I9bTtuROE5sy5nX75IVa/R2B3LOb2pvns6wbhzJFn2BAgRU/9B8FoB69D From: Sumit Semwal Adds DMABUF memory type to v4l framework. Also adds the related file descriptor in v4l2_plane and v4l2_buffer. Signed-off-by: Tomasz Stanislawski [original work in the PoC for buffer sharing] Signed-off-by: Sumit Semwal Signed-off-by: Sumit Semwal Acked-by: Laurent Pinchart --- drivers/media/video/v4l2-ioctl.c | 1 + include/linux/videodev2.h | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 91be4e8..31fc2ad 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -175,6 +175,7 @@ static const char *v4l2_memory_names[] = { [V4L2_MEMORY_MMAP] = "mmap", [V4L2_MEMORY_USERPTR] = "userptr", [V4L2_MEMORY_OVERLAY] = "overlay", + [V4L2_MEMORY_DMABUF] = "dmabuf", }; #define prt_names(a, arr) ((((a) >= 0) && ((a) < ARRAY_SIZE(arr))) ? \ diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 370d111..51b20f4 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -185,6 +185,7 @@ enum v4l2_memory { V4L2_MEMORY_MMAP = 1, V4L2_MEMORY_USERPTR = 2, V4L2_MEMORY_OVERLAY = 3, + V4L2_MEMORY_DMABUF = 4, }; /* see also http://vektor.theorem.ca/graphics/ycbcr/ */ @@ -591,6 +592,8 @@ struct v4l2_requestbuffers { * should be passed to mmap() called on the video node) * @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer * pointing to this plane + * @fd: when memory is V4L2_MEMORY_DMABUF, a userspace file + * descriptor associated with this plane * @data_offset: offset in the plane to the start of data; usually 0, * unless there is a header in front of the data * @@ -605,6 +608,7 @@ struct v4l2_plane { union { __u32 mem_offset; unsigned long userptr; + int fd; } m; __u32 data_offset; __u32 reserved[11]; @@ -629,6 +633,8 @@ struct v4l2_plane { * (or a "cookie" that should be passed to mmap() as offset) * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR; * a userspace pointer pointing to this buffer + * @fd: for non-multiplanar buffers with memory == V4L2_MEMORY_DMABUF; + * a userspace file descriptor associated with this buffer * @planes: for multiplanar buffers; userspace pointer to the array of plane * info structs for this buffer * @length: size in bytes of the buffer (NOT its payload) for single-plane @@ -655,6 +661,7 @@ struct v4l2_buffer { __u32 offset; unsigned long userptr; struct v4l2_plane *planes; + int fd; } m; __u32 length; __u32 input;