Show a patch.

GET /api/patches/13350/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 13350,
    "url": "https://patchwork.libcamera.org/api/patches/13350/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/13350/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20210813144437.138005-4-umang.jain@ideasonboard.com>",
    "date": "2021-08-13T14:44:36",
    "name": "[libcamera-devel,v2,3/4] ipa: vimc: Map and unmap buffers",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "8230745349e546de9f5aad7ff15155c9b3225195",
    "submitter": {
        "id": 86,
        "url": "https://patchwork.libcamera.org/api/people/86/?format=api",
        "name": "Umang Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "delegate": {
        "id": 12,
        "url": "https://patchwork.libcamera.org/api/users/12/?format=api",
        "username": "uajain",
        "first_name": "Umang",
        "last_name": "Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/13350/mbox/",
    "series": [
        {
            "id": 2356,
            "url": "https://patchwork.libcamera.org/api/series/2356/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2356",
            "date": "2021-08-13T14:44:33",
            "name": "Pass buffers to VIMC IPA",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2356/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/13350/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/13350/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 D7535C3240\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 13 Aug 2021 14:44:56 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9AE5E688A5;\n\tFri, 13 Aug 2021 16:44:56 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6241E687FA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 13 Aug 2021 16:44:55 +0200 (CEST)",
            "from perceval.ideasonboard.com (unknown [103.251.226.198])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5B1598F;\n\tFri, 13 Aug 2021 16:44:54 +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=\"oclIokAM\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1628865895;\n\tbh=8y/DyMenMBrLhvsGAGEO/13PmCyL+mKFt+zQf8b8Vpg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=oclIokAMqZj3VYYSemO8vVW1XbgBFtDY7cj98FxkfJicmYD+m9nbLVuedt3vOG6Qv\n\tzTayPAUCkQLGQITqRtujKYEemrohkMDZ0cyP036bp2RJMVZ/chH5HgKz8kGE1X0iC6\n\t6u8enzFncNrbrMr3y2qZUwuV7mCWOc3FNc4cbcIo=",
        "From": "Umang Jain <umang.jain@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 13 Aug 2021 20:14:36 +0530",
        "Message-Id": "<20210813144437.138005-4-umang.jain@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.31.1",
        "In-Reply-To": "<20210813144437.138005-1-umang.jain@ideasonboard.com>",
        "References": "<20210813144437.138005-1-umang.jain@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 3/4] ipa: vimc: Map and unmap buffers",
        "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": "VIMC pipeline-handler have dmabuf-backed mock FrameBuffers which are\nspecifically targetted mimicking IPA buffers(parameter and statistics).\nMap these mock buffers to the VIMC IPA that would enable exercising IPA\nIPC code paths. This will provide leverage to our test suite to test\nIPA IPC code paths, which are common to various platforms.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n include/libcamera/ipa/vimc.mojom     |  3 +++\n src/ipa/vimc/vimc.cpp                | 26 ++++++++++++++++++++++++++\n src/libcamera/pipeline/vimc/vimc.cpp | 16 ++++++++++++++++\n 3 files changed, 45 insertions(+)",
    "diff": "diff --git a/include/libcamera/ipa/vimc.mojom b/include/libcamera/ipa/vimc.mojom\nindex ee66353d..8cb240d3 100644\n--- a/include/libcamera/ipa/vimc.mojom\n+++ b/include/libcamera/ipa/vimc.mojom\n@@ -26,6 +26,9 @@ interface IPAVimcInterface {\n \n \tstart() => (int32 ret);\n \tstop();\n+\n+\tmapBuffers(array<libcamera.IPABuffer> buffers);\n+\tunmapBuffers(array<uint32> ids);\n };\n \n interface IPAVimcEventInterface {\ndiff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp\nindex 0535c740..082b2db7 100644\n--- a/src/ipa/vimc/vimc.cpp\n+++ b/src/ipa/vimc/vimc.cpp\n@@ -19,6 +19,8 @@\n #include <libcamera/ipa/ipa_interface.h>\n #include <libcamera/ipa/ipa_module_info.h>\n \n+#include \"libcamera/internal/mapped_framebuffer.h\"\n+\n namespace libcamera {\n \n LOG_DEFINE_CATEGORY(IPAVimc)\n@@ -38,11 +40,15 @@ public:\n \t\t      const std::map<unsigned int, IPAStream> &streamConfig,\n \t\t      const std::map<unsigned int, ControlInfoMap> &entityControls) override;\n \n+\tvoid mapBuffers(const std::vector<IPABuffer> &buffers) override;\n+\tvoid unmapBuffers(const std::vector<unsigned int> &ids) override;\n+\n private:\n \tvoid initTrace();\n \tvoid trace(enum ipa::vimc::IPAOperationCode operation);\n \n \tint fd_;\n+\tstd::map<unsigned int, MappedFrameBuffer> buffers_;\n };\n \n IPAVimc::IPAVimc()\n@@ -99,6 +105,26 @@ int IPAVimc::configure([[maybe_unused]] const IPACameraSensorInfo &sensorInfo,\n \treturn 0;\n }\n \n+void IPAVimc::mapBuffers(const std::vector<IPABuffer> &buffers)\n+{\n+\tfor (const IPABuffer &buffer : buffers) {\n+\t\tconst FrameBuffer fb(buffer.planes);\n+\t\tbuffers_.emplace(buffer.id,\n+\t\t\t\t MappedFrameBuffer(&fb, MappedFrameBuffer::MapFlag::Read));\n+\t}\n+}\n+\n+void IPAVimc::unmapBuffers(const std::vector<unsigned int> &ids)\n+{\n+\tfor (unsigned int id : ids) {\n+\t\tauto it = buffers_.find(id);\n+\t\tif (it == buffers_.end())\n+\t\t\tcontinue;\n+\n+\t\tbuffers_.erase(it);\n+\t}\n+}\n+\n void IPAVimc::initTrace()\n {\n \tstruct stat fifoStat;\ndiff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp\nindex edf8c58e..c44a6242 100644\n--- a/src/libcamera/pipeline/vimc/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc/vimc.cpp\n@@ -63,6 +63,7 @@ public:\n \n \tstd::unique_ptr<ipa::vimc::IPAProxyVimc> ipa_;\n \tstd::vector<std::unique_ptr<FrameBuffer>> mockIPABufs_;\n+\tstd::vector<IPABuffer> ipaBuffers_;\n };\n \n class VimcCameraConfiguration : public CameraConfiguration\n@@ -334,6 +335,15 @@ int PipelineHandlerVimc::start(Camera *camera, [[maybe_unused]] const ControlLis\n \tif (ret < 0)\n \t\treturn ret;\n \n+\t/* Map the mock IPA buffers to VIMC IPA to exercise IPC code paths */\n+\tunsigned int ipaBufferId = 1;\n+\tfor (unsigned int i = 0; i < data->mockIPABufs_.size(); i++) {\n+\t\tstd::unique_ptr<FrameBuffer> &buffer = data->mockIPABufs_[i];\n+\t\tbuffer->setCookie(ipaBufferId++);\n+\t\tdata->ipaBuffers_.emplace_back(buffer->cookie(), buffer->planes());\n+\t}\n+\tdata->ipa_->mapBuffers(data->ipaBuffers_);\n+\n \tret = data->ipa_->start();\n \tif (ret) {\n \t\tdata->video_->releaseBuffers();\n@@ -354,7 +364,13 @@ void PipelineHandlerVimc::stop(Camera *camera)\n {\n \tVimcCameraData *data = cameraData(camera);\n \tdata->video_->streamOff();\n+\n+\tstd::vector<unsigned int> ids;\n+\tfor (IPABuffer &ipabuf : data->ipaBuffers_)\n+\t\tids.push_back(ipabuf.id);\n+\tdata->ipa_->unmapBuffers(ids);\n \tdata->ipa_->stop();\n+\n \tdata->video_->releaseBuffers();\n }\n \n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "3/4"
    ]
}