{"id":8836,"url":"https://patchwork.libcamera.org/api/1.1/patches/8836/?format=json","web_url":"https://patchwork.libcamera.org/patch/8836/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200717001518.20285-2-laurent.pinchart@ideasonboard.com>","date":"2020-07-17T00:15:17","name":"[libcamera-devel,v3,1/2] include: linux: Add dma-buf.h and dma-heap.h UAPI headers","commit_ref":"3c02a808e8934a0c2d875d5585403ce0a09d7c93","pull_url":null,"state":"accepted","archived":false,"hash":"b3b9e84f966db4e90ff90f70ac5d0f9fa4b04c5a","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/8836/mbox/","series":[{"id":1113,"url":"https://patchwork.libcamera.org/api/1.1/series/1113/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1113","date":"2020-07-17T00:15:16","name":"Replace Raspberry Pi VCSM CMA with DMA heaps","version":3,"mbox":"https://patchwork.libcamera.org/series/1113/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/8836/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8836/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id F3E61C2E7A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 17 Jul 2020 00:15:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 188E5610D5;\n\tFri, 17 Jul 2020 02:15:35 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7D12C6049C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 17 Jul 2020 02:15:33 +0200 (CEST)","from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 09FCC514;\n\tFri, 17 Jul 2020 02:15:32 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Jsx3kSLt\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1594944933;\n\tbh=3czI3WomyfKNhFm2lRe50/F2N7rOoDfKpomWSWJORpI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Jsx3kSLtfgwUv7Xdr7J6dm+q15F3HzF5sZI7mtmFSCOtn31bqSxyrlwGmdK9wevEi\n\taEpUBXHt1Wsv9Wdfi9kRJRdFoiPwbAYvFgiPhjD9dXKPvPmEgmNq9ep2teDi4YbkYC\n\tmWVWKEj1L/sKKRTCMOlID55QZp7qYn8FbIdEwKkM=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Date":"Fri, 17 Jul 2020 03:15:17 +0300","Message-Id":"<20200717001518.20285-2-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20200717001518.20285-1-laurent.pinchart@ideasonboard.com>","References":"<20200717001518.20285-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v3 1/2] include: linux: Add dma-buf.h and\n\tdma-heap.h UAPI headers","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: Naushir Patuck <naush@raspberrypi.com>\n\nThis commit adds the dmabuf UAPI headers from the mainline Linux kernel\nv5.6.19. They are required by the Raspberry Pi library for lens shading\ntable allocations.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/linux/dma-buf.h  | 50 +++++++++++++++++++++++++++++++++++++\n include/linux/dma-heap.h | 53 ++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 103 insertions(+)\n create mode 100644 include/linux/dma-buf.h\n create mode 100644 include/linux/dma-heap.h","diff":"diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h\nnew file mode 100644\nindex 000000000000..7f30393b92c3\n--- /dev/null\n+++ b/include/linux/dma-buf.h\n@@ -0,0 +1,50 @@\n+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */\n+/*\n+ * Framework for buffer objects that can be shared across devices/subsystems.\n+ *\n+ * Copyright(C) 2015 Intel Ltd\n+ *\n+ * This program is free software; you can redistribute it and/or modify it\n+ * under the terms of the GNU General Public License version 2 as published by\n+ * the Free Software Foundation.\n+ *\n+ * This program is distributed in the hope that it will be useful, but WITHOUT\n+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\n+ * more details.\n+ *\n+ * You should have received a copy of the GNU General Public License along with\n+ * this program.  If not, see <http://www.gnu.org/licenses/>.\n+ */\n+\n+#ifndef _DMA_BUF_UAPI_H_\n+#define _DMA_BUF_UAPI_H_\n+\n+#include <linux/types.h>\n+\n+/* begin/end dma-buf functions used for userspace mmap. */\n+struct dma_buf_sync {\n+\t__u64 flags;\n+};\n+\n+#define DMA_BUF_SYNC_READ      (1 << 0)\n+#define DMA_BUF_SYNC_WRITE     (2 << 0)\n+#define DMA_BUF_SYNC_RW        (DMA_BUF_SYNC_READ | DMA_BUF_SYNC_WRITE)\n+#define DMA_BUF_SYNC_START     (0 << 2)\n+#define DMA_BUF_SYNC_END       (1 << 2)\n+#define DMA_BUF_SYNC_VALID_FLAGS_MASK \\\n+\t(DMA_BUF_SYNC_RW | DMA_BUF_SYNC_END)\n+\n+#define DMA_BUF_NAME_LEN\t32\n+\n+#define DMA_BUF_BASE\t\t'b'\n+#define DMA_BUF_IOCTL_SYNC\t_IOW(DMA_BUF_BASE, 0, struct dma_buf_sync)\n+\n+/* 32/64bitness of this uapi was botched in android, there's no difference\n+ * between them in actual uapi, they're just different numbers.\n+ */\n+#define DMA_BUF_SET_NAME\t_IOW(DMA_BUF_BASE, 1, const char *)\n+#define DMA_BUF_SET_NAME_A\t_IOW(DMA_BUF_BASE, 1, u32)\n+#define DMA_BUF_SET_NAME_B\t_IOW(DMA_BUF_BASE, 1, u64)\n+\n+#endif\ndiff --git a/include/linux/dma-heap.h b/include/linux/dma-heap.h\nnew file mode 100644\nindex 000000000000..6f84fa08e074\n--- /dev/null\n+++ b/include/linux/dma-heap.h\n@@ -0,0 +1,53 @@\n+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */\n+/*\n+ * DMABUF Heaps Userspace API\n+ *\n+ * Copyright (C) 2011 Google, Inc.\n+ * Copyright (C) 2019 Linaro Ltd.\n+ */\n+#ifndef _UAPI_LINUX_DMABUF_POOL_H\n+#define _UAPI_LINUX_DMABUF_POOL_H\n+\n+#include <linux/ioctl.h>\n+#include <linux/types.h>\n+\n+/**\n+ * DOC: DMABUF Heaps Userspace API\n+ */\n+\n+/* Valid FD_FLAGS are O_CLOEXEC, O_RDONLY, O_WRONLY, O_RDWR */\n+#define DMA_HEAP_VALID_FD_FLAGS (O_CLOEXEC | O_ACCMODE)\n+\n+/* Currently no heap flags */\n+#define DMA_HEAP_VALID_HEAP_FLAGS (0)\n+\n+/**\n+ * struct dma_heap_allocation_data - metadata passed from userspace for\n+ *                                      allocations\n+ * @len:\t\tsize of the allocation\n+ * @fd:\t\t\twill be populated with a fd which provides the\n+ *\t\t\thandle to the allocated dma-buf\n+ * @fd_flags:\t\tfile descriptor flags used when allocating\n+ * @heap_flags:\t\tflags passed to heap\n+ *\n+ * Provided by userspace as an argument to the ioctl\n+ */\n+struct dma_heap_allocation_data {\n+\t__u64 len;\n+\t__u32 fd;\n+\t__u32 fd_flags;\n+\t__u64 heap_flags;\n+};\n+\n+#define DMA_HEAP_IOC_MAGIC\t\t'H'\n+\n+/**\n+ * DOC: DMA_HEAP_IOCTL_ALLOC - allocate memory from pool\n+ *\n+ * Takes a dma_heap_allocation_data struct and returns it with the fd field\n+ * populated with the dmabuf handle of the allocation.\n+ */\n+#define DMA_HEAP_IOCTL_ALLOC\t_IOWR(DMA_HEAP_IOC_MAGIC, 0x0,\\\n+\t\t\t\t      struct dma_heap_allocation_data)\n+\n+#endif /* _UAPI_LINUX_DMABUF_POOL_H */\n","prefixes":["libcamera-devel","v3","1/2"]}