Patch Detail
Show a patch.
GET /api/1.1/patches/2593/?format=api
{ "id": 2593, "url": "https://patchwork.libcamera.org/api/1.1/patches/2593/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2593/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20200112010212.2609025-12-niklas.soderlund@ragnatech.se>", "date": "2020-01-12T01:01:51", "name": "[libcamera-devel,v4,11/32] libcamera: buffers: Remove Plane class", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "f8e462b6b655f2e02f8673ae4f0ae1597f5026ae", "submitter": { "id": 5, "url": "https://patchwork.libcamera.org/api/1.1/people/5/?format=api", "name": "Niklas Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/2593/mbox/", "series": [ { "id": 617, "url": "https://patchwork.libcamera.org/api/1.1/series/617/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=617", "date": "2020-01-12T01:01:40", "name": "libcamera: Rework buffer API", "version": 4, "mbox": "https://patchwork.libcamera.org/series/617/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2593/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2593/checks/", "tags": {}, "headers": { "Return-Path": "<niklas.soderlund@ragnatech.se>", "Received": [ "from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BF5BD606D6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 12 Jan 2020 02:03:07 +0100 (CET)", "from bismarck.berto.se (p54ac5d7b.dip0.t-ipconnect.de\n\t[84.172.93.123]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA\n\tid 490f970c-34d7-11ea-b6d8-005056917f90;\n\tSun, 12 Jan 2020 02:03:03 +0100 (CET)" ], "X-Halon-ID": "490f970c-34d7-11ea-b6d8-005056917f90", "Authorized-sender": "niklas@soderlund.pp.se", "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sun, 12 Jan 2020 02:01:51 +0100", "Message-Id": "<20200112010212.2609025-12-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.24.1", "In-Reply-To": "<20200112010212.2609025-1-niklas.soderlund@ragnatech.se>", "References": "<20200112010212.2609025-1-niklas.soderlund@ragnatech.se>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 11/32] libcamera: buffers: Remove Plane\n\tclass", "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>", "X-List-Received-Date": "Sun, 12 Jan 2020 01:03:08 -0000" }, "content": "There are no users left of the Plane class, drop it.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/buffer.h | 21 ------\n src/libcamera/buffer.cpp | 149 -------------------------------------\n 2 files changed, 170 deletions(-)", "diff": "diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h\nindex d61efad10f7d364d..d3dc9a420aaaa385 100644\n--- a/include/libcamera/buffer.h\n+++ b/include/libcamera/buffer.h\n@@ -71,27 +71,6 @@ private:\n \tunsigned int cookie_;\n };\n \n-class Plane final\n-{\n-public:\n-\tPlane();\n-\t~Plane();\n-\n-\tint dmabuf() const { return fd_; }\n-\tint setDmabuf(int fd, unsigned int length);\n-\n-\tvoid *mem();\n-\tunsigned int length() const { return length_; }\n-\n-private:\n-\tint mmap();\n-\tint munmap();\n-\n-\tint fd_;\n-\tunsigned int length_;\n-\tvoid *mem_;\n-};\n-\n class BufferMemory final\n {\n public:\ndiff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp\nindex ec7c614dd654e4eb..d53e5150b40a3b09 100644\n--- a/src/libcamera/buffer.cpp\n+++ b/src/libcamera/buffer.cpp\n@@ -96,155 +96,6 @@ LOG_DEFINE_CATEGORY(Buffer)\n * \\brief Array of per-plane metadata\n */\n \n-/**\n- * \\class Plane\n- * \\brief A memory region to store a single plane of a frame\n- *\n- * Planar pixel formats use multiple memory regions to store planes\n- * corresponding to the different colour components of a frame. The Plane class\n- * tracks the specific details of a memory region used to store a single plane\n- * for a given frame and provides the means to access the memory, both for the\n- * application and for DMA. A Buffer then contains one or multiple planes\n- * depending on its pixel format.\n- *\n- * To support DMA access, planes are associated with dmabuf objects represented\n- * by file handles. Each plane carries a dmabuf file handle and an offset within\n- * the buffer. Those file handles may refer to the same dmabuf object, depending\n- * on whether the devices accessing the memory regions composing the image\n- * support non-contiguous DMA to planes ore require DMA-contiguous memory.\n- *\n- * To support CPU access, planes carry the CPU address of their backing memory.\n- * Similarly to the dmabuf file handles, the CPU addresses for planes composing\n- * an image may or may not be contiguous.\n- */\n-\n-Plane::Plane()\n-\t: fd_(-1), length_(0), mem_(0)\n-{\n-}\n-\n-Plane::~Plane()\n-{\n-\tmunmap();\n-\n-\tif (fd_ != -1)\n-\t\tclose(fd_);\n-}\n-\n-/**\n- * \\fn Plane::dmabuf()\n- * \\brief Get the dmabuf file handle backing the buffer\n- */\n-\n-/**\n- * \\brief Set the dmabuf file handle backing the buffer\n- * \\param[in] fd The dmabuf file handle\n- * \\param[in] length The size of the memory region\n- *\n- * The \\a fd dmabuf file handle is duplicated and stored. The caller may close\n- * the original file handle.\n- *\n- * \\return 0 on success or a negative error code otherwise\n- */\n-int Plane::setDmabuf(int fd, unsigned int length)\n-{\n-\tif (fd < 0) {\n-\t\tLOG(Buffer, Error) << \"Invalid dmabuf fd provided\";\n-\t\treturn -EINVAL;\n-\t}\n-\n-\tif (fd_ != -1) {\n-\t\tclose(fd_);\n-\t\tfd_ = -1;\n-\t}\n-\n-\tfd_ = dup(fd);\n-\tif (fd_ == -1) {\n-\t\tint ret = -errno;\n-\t\tLOG(Buffer, Error)\n-\t\t\t<< \"Failed to duplicate dmabuf: \" << strerror(-ret);\n-\t\treturn ret;\n-\t}\n-\n-\tlength_ = length;\n-\n-\treturn 0;\n-}\n-\n-/**\n- * \\brief Map the plane memory data to a CPU accessible address\n- *\n- * The file descriptor to map the memory from must be set by a call to\n- * setDmaBuf() before calling this function.\n- *\n- * \\sa setDmaBuf()\n- *\n- * \\return 0 on success or a negative error code otherwise\n- */\n-int Plane::mmap()\n-{\n-\tvoid *map;\n-\n-\tif (mem_)\n-\t\treturn 0;\n-\n-\tmap = ::mmap(NULL, length_, PROT_READ | PROT_WRITE, MAP_SHARED, fd_, 0);\n-\tif (map == MAP_FAILED) {\n-\t\tint ret = -errno;\n-\t\tLOG(Buffer, Error)\n-\t\t\t<< \"Failed to mmap plane: \" << strerror(-ret);\n-\t\treturn ret;\n-\t}\n-\n-\tmem_ = map;\n-\n-\treturn 0;\n-}\n-\n-/**\n- * \\brief Unmap any existing CPU accessible mapping\n- *\n- * Unmap the memory mapped by an earlier call to mmap().\n- *\n- * \\return 0 on success or a negative error code otherwise\n- */\n-int Plane::munmap()\n-{\n-\tint ret = 0;\n-\n-\tif (mem_)\n-\t\tret = ::munmap(mem_, length_);\n-\n-\tif (ret) {\n-\t\tret = -errno;\n-\t\tLOG(Buffer, Warning)\n-\t\t\t<< \"Failed to unmap plane: \" << strerror(-ret);\n-\t} else {\n-\t\tmem_ = 0;\n-\t}\n-\n-\treturn ret;\n-}\n-\n-/**\n- * \\fn Plane::mem()\n- * \\brief Retrieve the CPU accessible memory address of the Plane\n- * \\return The CPU accessible memory address on success or nullptr otherwise.\n- */\n-void *Plane::mem()\n-{\n-\tif (!mem_)\n-\t\tmmap();\n-\n-\treturn mem_;\n-}\n-\n-/**\n- * \\fn Plane::length() const\n- * \\brief Retrieve the length of the memory region\n- * \\return The length of the memory region\n- */\n-\n /**\n * \\class BufferMemory\n * \\brief A memory buffer to store an image\n", "prefixes": [ "libcamera-devel", "v4", "11/32" ] }