{"id":8797,"url":"https://patchwork.libcamera.org/api/1.1/patches/8797/?format=json","web_url":"https://patchwork.libcamera.org/patch/8797/","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":"<20200714120844.520732-2-naush@raspberrypi.com>","date":"2020-07-14T12:08:43","name":"[libcamera-devel,1/2] include: linux: Add dma-buf.h and dma-heap.h uapi headers","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"b3b9e84f966db4e90ff90f70ac5d0f9fa4b04c5a","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/8797/mbox/","series":[{"id":1105,"url":"https://patchwork.libcamera.org/api/1.1/series/1105/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1105","date":"2020-07-14T12:08:42","name":"Replace vcsm with dmabuf alloc","version":1,"mbox":"https://patchwork.libcamera.org/series/1105/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/8797/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/8797/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 62EE0BD792\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Jul 2020 12:14:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E569D605B2;\n\tTue, 14 Jul 2020 14:14:39 +0200 (CEST)","from mail-wm1-x341.google.com (mail-wm1-x341.google.com\n\t[IPv6:2a00:1450:4864:20::341])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 524DC605B0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Jul 2020 14:14:38 +0200 (CEST)","by mail-wm1-x341.google.com with SMTP id l2so5387236wmf.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Jul 2020 05:14:38 -0700 (PDT)","from naushir-VirtualBox.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\ta15sm33123217wrh.54.2020.07.14.05.08.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 14 Jul 2020 05:08:51 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"Ee5ibDkB\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=a9Loag3vU7o7sdv8trSEnGIpWj4uQQrk5++P+hlVSEM=;\n\tb=Ee5ibDkBbwFGbUhsUOVCoAoF2tF8lIhXQF/MRicqXHhAad2unE0doC+MSUkzM5yRJl\n\tGSRA2MumSbnPqBtpDFSXuRIwlyaEhSE5uY+wW3bS02VvQTlHdQmg5e+m320LuedTqbwm\n\tGFgh76JgxWvhPIOS3im5nNlq0u8lpXNITz4olm0W3QMEuALXkLNVpA1OnpHGNS7d9Uvi\n\tCdBd5qx7R68IWVHC4Hy87/LUs1SgNfPG4wFDjo/ElHu551AH7Soh8ohr3lvBXsI1+M7m\n\tsUeXKWgbyszvkBcrErcU3xx4SDTOXSQJKQ4vvC7RUgF3OIJOLI5+XYlDB6kYAk+Kzerq\n\t3U3g==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=a9Loag3vU7o7sdv8trSEnGIpWj4uQQrk5++P+hlVSEM=;\n\tb=C+dZqm+HUWLDBU8gRYtqzNoQiuDNvCK1CyPIlfU2BF6OeuafLCIlkvWJtGk5GFfJ3H\n\ta18wVEW9ZYSBAK/nHSwZCSDw99088JI2iR6fzxLVXw7ZRFErB+huxu4oA1BPlTakq8wZ\n\tTnPnYmNrgCm0Qw2/G3xIyT4trQm5oOw/xVqZqw/9mIC25qeDR4CG1JUxdjiY/9KmPp+a\n\tOC6rwghB8227uhva53T5Sdcxj/QU3Q8k51eJzdsnEQNnj8jvOIDFMCyfkuYTvl2UtOrs\n\tb3M201vRwh+tZubClUO93EPE78QnvJOSPczW8Tk9uQptlNHVJgMlXhS+WIUH7U1dhgjv\n\tK9cA==","X-Gm-Message-State":"AOAM530i8hq6JMYK0sxHLpALhNKjFSs5vDFcEMvriTi2tASPpjBMPXcK\n\typkK83U0+H8jErVV46rY/6gkyvn1Bfk=","X-Google-Smtp-Source":"ABdhPJz2yPATvfgvApLbXkDMu5Ivhm0+HyYHaIYtBNfyY1xkY56/NWR0NIkrnP2YZnn6ckVQNQkeTA==","X-Received":"by 2002:a05:600c:218f:: with SMTP id\n\te15mr3818374wme.63.1594728532081; \n\tTue, 14 Jul 2020 05:08:52 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 14 Jul 2020 13:08:43 +0100","Message-Id":"<20200714120844.520732-2-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20200714120844.520732-1-naush@raspberrypi.com>","References":"<20200714120844.520732-1-naush@raspberrypi.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 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>","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":"These are required for the Raspberry Pi library for lens shading\ntable allocations.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.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 00000000..7f30393b\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 00000000..6f84fa08\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","1/2"]}