Patch Detail
Show a patch.
GET /api/1.1/patches/13448/?format=api
{ "id": 13448, "url": "https://patchwork.libcamera.org/api/1.1/patches/13448/?format=api", "web_url": "https://patchwork.libcamera.org/patch/13448/", "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": "<20210823131221.1034059-6-hiroh@chromium.org>", "date": "2021-08-23T13:12:16", "name": "[libcamera-devel,RFC,v2,05/10] ipa: rkisp1: Use offset in mapping IPABuffer", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "841d0455e8097d3a1668d693d2f106c449aa96ec", "submitter": { "id": 63, "url": "https://patchwork.libcamera.org/api/1.1/people/63/?format=api", "name": "Hirokazu Honda", "email": "hiroh@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/13448/mbox/", "series": [ { "id": 2386, "url": "https://patchwork.libcamera.org/api/1.1/series/2386/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2386", "date": "2021-08-23T13:12:11", "name": "Add offset to FrameBuffer::Plane", "version": 2, "mbox": "https://patchwork.libcamera.org/series/2386/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/13448/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/13448/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 9D96BBD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Aug 2021 13:12:45 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 65F44688D2;\n\tMon, 23 Aug 2021 15:12:45 +0200 (CEST)", "from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com\n\t[IPv6:2607:f8b0:4864:20::42c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6A51D688A3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Aug 2021 15:12:43 +0200 (CEST)", "by mail-pf1-x42c.google.com with SMTP id t13so15331087pfl.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Aug 2021 06:12:43 -0700 (PDT)", "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:184e:5d20:8fcb:dfcd])\n\tby smtp.gmail.com with ESMTPSA id\n\tj4sm18596891pgi.6.2021.08.23.06.12.40\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 23 Aug 2021 06:12:41 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"gz6wmSwq\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=WBeECzFwDoKtSJgAd7bs4ycayuxrXnEKLo1XxSC+/qI=;\n\tb=gz6wmSwqQ1UCLjtELzAPepIrOGRtxN1M01/9bTzCb20KcYynoF0U5J0kuIxnoTPTG0\n\tbS99Y2V6B8dF7ygXJiB8AKbCpu4rTUM5NTRq6SpTIqLmqcdUeCPKjOhNx7fDjlxFQNw8\n\thMxH2gWQYVmHQhQVUs3OrtK+r3ryQnuMvCmnE=", "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=WBeECzFwDoKtSJgAd7bs4ycayuxrXnEKLo1XxSC+/qI=;\n\tb=s+KFv0bVz08XMok/75MyzH/b2zy0ZTOYWSC6l9xElmUA0OKxXxaSjkR2fHI0Ao1EsH\n\tXBjmQayxpAeuvYAhdjEFu6n8ZiZmPs8xMA+OifsJIBQJdwb26JDQE/5lbB8ui8+mcbcU\n\tGCi49RhN63iKyVACYwbBGJU5b9jj0U01QALmnNGD4pYVAwkLDRfYmCwG4FKWQeqh1drF\n\tL6F5gkyoSJvLki57VMPdRplEkb2K0lJAoy0v0mDbGbiqrKPhJ++bNwqbfXrK719dTfOg\n\tSQJqfQPxOSYuwq/A2NhxIfjI9qS1zGcJhfz18oUdRdN1Z6fVNCJNotTmIGDW9Dkz4JT6\n\tutXQ==", "X-Gm-Message-State": "AOAM530Df7mZIPSr7ReC55sN0DGCFcHLVZa4cshNf24hGqOAXu85dNJM\n\tJuCGwod5WmybUsDt5pscLQpETBzp57aUQQ==", "X-Google-Smtp-Source": "ABdhPJzlT/JaKRe58XnO8LQj4bjnhAY/3pfN70HJRl1kJoLcI7ocoz4zH5qq6tN2nKRflv/w4qtB8w==", "X-Received": "by 2002:a63:d607:: with SMTP id\n\tq7mr32144408pgg.268.1629724361779; \n\tMon, 23 Aug 2021 06:12:41 -0700 (PDT)", "From": "Hirokazu Honda <hiroh@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 23 Aug 2021 22:12:16 +0900", "Message-Id": "<20210823131221.1034059-6-hiroh@chromium.org>", "X-Mailer": "git-send-email 2.33.0.rc2.250.ged5fa647cd-goog", "In-Reply-To": "<20210823131221.1034059-1-hiroh@chromium.org>", "References": "<20210823131221.1034059-1-hiroh@chromium.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [RFC PATCH v2 05/10] ipa: rkisp1: Use offset in\n\tmapping IPABuffer", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "IPABuffer is represented by FrameBuffer. FrameBuffer::Plane has\nnow an offset. This uses the offset variable to map the IPABuffer.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n .../libcamera/internal/mapped_framebuffer.h | 1 +\n src/ipa/rkisp1/rkisp1.cpp | 31 +++++++------------\n src/libcamera/mapped_framebuffer.cpp | 7 +++++\n 3 files changed, 19 insertions(+), 20 deletions(-)", "diff": "diff --git a/include/libcamera/internal/mapped_framebuffer.h b/include/libcamera/internal/mapped_framebuffer.h\nindex 42479541..ee0583d0 100644\n--- a/include/libcamera/internal/mapped_framebuffer.h\n+++ b/include/libcamera/internal/mapped_framebuffer.h\n@@ -55,6 +55,7 @@ public:\n \n \tusing MapFlags = Flags<MapFlag>;\n \n+\tMappedFrameBuffer();\n \tMappedFrameBuffer(const FrameBuffer *buffer, MapFlags flags);\n };\n \ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 06fb9640..54cf2885 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -10,7 +10,6 @@\n #include <queue>\n #include <stdint.h>\n #include <string.h>\n-#include <sys/mman.h>\n \n #include <linux/rkisp1-config.h>\n #include <linux/v4l2-controls.h>\n@@ -24,6 +23,8 @@\n #include <libcamera/ipa/rkisp1_ipa_interface.h>\n #include <libcamera/request.h>\n \n+#include <libcamera/internal/mapped_framebuffer.h>\n+\n namespace libcamera {\n \n LOG_DEFINE_CATEGORY(IPARkISP1)\n@@ -54,7 +55,7 @@ private:\n \tvoid metadataReady(unsigned int frame, unsigned int aeState);\n \n \tstd::map<unsigned int, FrameBuffer> buffers_;\n-\tstd::map<unsigned int, void *> buffersMemory_;\n+\tstd::map<unsigned int, MappedFrameBuffer> mappedBuffers_;\n \n \tControlInfoMap ctrls_;\n \n@@ -160,21 +161,10 @@ void IPARkISP1::mapBuffers(const std::vector<IPABuffer> &buffers)\n \t\t\t\t\t std::forward_as_tuple(buffer.planes));\n \t\tconst FrameBuffer &fb = elem.first->second;\n \n-\t\t/*\n-\t\t * \\todo Provide a helper to mmap() buffers (possibly exposed\n-\t\t * to applications).\n-\t\t */\n-\t\tbuffersMemory_[buffer.id] = mmap(NULL,\n-\t\t\t\t\t\t fb.planes()[0].length,\n-\t\t\t\t\t\t PROT_READ | PROT_WRITE,\n-\t\t\t\t\t\t MAP_SHARED,\n-\t\t\t\t\t\t fb.planes()[0].fd.fd(),\n-\t\t\t\t\t\t 0);\n-\n-\t\tif (buffersMemory_[buffer.id] == MAP_FAILED) {\n-\t\t\tint ret = -errno;\n+\t\tmappedBuffers_[buffer.id] = MappedFrameBuffer(&fb, MappedFrameBuffer::MapFlag::ReadWrite);\n+\t\tif (!mappedBuffers_[buffer.id].isValid()) {\n \t\t\tLOG(IPARkISP1, Fatal) << \"Failed to mmap buffer: \"\n-\t\t\t\t\t << strerror(-ret);\n+\t\t\t\t\t << strerror(mappedBuffers_[buffer.id].error());\n \t\t}\n \t}\n }\n@@ -186,8 +176,7 @@ void IPARkISP1::unmapBuffers(const std::vector<unsigned int> &ids)\n \t\tif (fb == buffers_.end())\n \t\t\tcontinue;\n \n-\t\tmunmap(buffersMemory_[id], fb->second.planes()[0].length);\n-\t\tbuffersMemory_.erase(id);\n+\t\tmappedBuffers_.erase(id);\n \t\tbuffers_.erase(id);\n \t}\n }\n@@ -200,7 +189,8 @@ void IPARkISP1::processEvent(const RkISP1Event &event)\n \t\tunsigned int bufferId = event.bufferId;\n \n \t\tconst rkisp1_stat_buffer *stats =\n-\t\t\tstatic_cast<rkisp1_stat_buffer *>(buffersMemory_[bufferId]);\n+\t\t\treinterpret_cast<rkisp1_stat_buffer *>(\n+\t\t\t\tmappedBuffers_[bufferId].maps()[0].data());\n \n \t\tupdateStatistics(frame, stats);\n \t\tbreak;\n@@ -210,7 +200,8 @@ void IPARkISP1::processEvent(const RkISP1Event &event)\n \t\tunsigned int bufferId = event.bufferId;\n \n \t\trkisp1_params_cfg *params =\n-\t\t\tstatic_cast<rkisp1_params_cfg *>(buffersMemory_[bufferId]);\n+\t\t\treinterpret_cast<rkisp1_params_cfg *>(\n+\t\t\t\tmappedBuffers_[bufferId].maps()[0].data());\n \n \t\tqueueRequest(frame, params, event.controls);\n \t\tbreak;\ndiff --git a/src/libcamera/mapped_framebuffer.cpp b/src/libcamera/mapped_framebuffer.cpp\nindex 03425dea..34d9564d 100644\n--- a/src/libcamera/mapped_framebuffer.cpp\n+++ b/src/libcamera/mapped_framebuffer.cpp\n@@ -168,6 +168,13 @@ MappedBuffer::~MappedBuffer()\n * \\brief A bitwise combination of MappedFrameBuffer::MapFlag values\n */\n \n+/**\n+ * \\brief Construct an empty MappedFrameBuffer\n+ */\n+MappedFrameBuffer::MappedFrameBuffer()\n+\t: MappedBuffer()\n+{\n+}\n /**\n * \\brief Map all planes of a FrameBuffer\n * \\param[in] buffer FrameBuffer to be mapped\n", "prefixes": [ "libcamera-devel", "RFC", "v2", "05/10" ] }