Show a patch.

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

{
    "id": 16453,
    "url": "https://patchwork.libcamera.org/api/patches/16453/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16453/",
    "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": "<20220630101702.45781-1-jeanmichel.hautbois@ideasonboard.com>",
    "date": "2022-06-30T10:16:57",
    "name": "[libcamera-devel,0/5] Add a params buffer dump tool for IPU3",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "f2d78751ab06e34ba799133124fa5a7594650e1e",
    "submitter": {
        "id": 75,
        "url": "https://patchwork.libcamera.org/api/people/75/?format=api",
        "name": "Jean-Michel Hautbois",
        "email": "jeanmichel.hautbois@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/16453/mbox/",
    "series": [],
    "comments": "https://patchwork.libcamera.org/api/patches/16453/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16453/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 123B5BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 30 Jun 2022 10:17:12 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3C40265656;\n\tThu, 30 Jun 2022 12:17:09 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B3D836559A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Jun 2022 12:17:06 +0200 (CEST)",
            "from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:4fb3:9c17:e136:8792])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 36D5B45F;\n\tThu, 30 Jun 2022 12:17:06 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656584229;\n\tbh=LS/YPMJMKYnX2roVk64fSHNqcm+dJKV20Ux3u0ysvLw=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=vDuemYBfev0hnYdipkCs2KmEQsKQ9SGT6rS8P7lxr4X1sP6yBvPE4WYanIzGP47JK\n\taL9oO6wFaTMGYtvCr0VcpWsjWNuZE8StYcXNxUYojZAIPESnCLtWg7XAcdHmPa0AJF\n\t7C1fetmvRXxiq5eQ1CJHCg7/qEV43glkCIjOfVzxy0+MQiFfIsxf/c8I9+MMSyPsa4\n\trqFbC9dAoslOwHulxb216UmRKTDUljCMHSBzUTGu2UycKDOwtqvpMB//pBwhND1qfC\n\tUDfZN6sOZNuUytkuBSJ5rpSu/Oxk6lA1FZO7fRI3SZSX/sgBQ/i2bg0scWLusmQfHq\n\tEeyE1fr2AYQhA==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1656584226;\n\tbh=LS/YPMJMKYnX2roVk64fSHNqcm+dJKV20Ux3u0ysvLw=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=YnZh7X1ZCyzS8RlGlRepgWjJ35mlf4gP7+UZz3iTaGAdGDsgBCa8dhJaFmo6+LeST\n\tfu3HgMWdhUuIawt/QSqZzXNjEv3nLPRjt8EztHZ2t1vzpOzKMEBzOcySAofLCTLVl/\n\t6mAgUrDJE30f8UM+ZUqFNkOaUrnZufe8nALQa6v4="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"YnZh7X1Z\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 30 Jun 2022 12:16:57 +0200",
        "Message-Id": "<20220630101702.45781-1-jeanmichel.hautbois@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 0/5] Add a params buffer dump tool for IPU3",
        "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>",
        "From": "Jean-Michel Hautbois via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Hello !\n\nThis patch series is a branch I had for long locally and I want to\nshare. The params buffer on IPU3 is big, and quite difficult to read\nwithout having the documentation on another screen :-).\n\nTo simplify the debug, I wrote a very simple C tool which takes the\nparameters buffer dumped in a binary form and parses it in a human\nreadable form.\n\nI have a patch, not part of the series, to dump the parameter buffer [1].\nIt is a dumb one, as for every buffer it overwrites the file. It might\nbe interesting to keep all the buffers through time later, if we want to\nsee the changes during time. Or call it only when requested (but there\nis no way to pass this internal buffer to the userspace).\n\nI hope this tool can help, it does not contain all the structures of the\nparameters buffer, but the model is there, and can be upgraded ;-).\n\nThanks !\nJM\n\n[1] For reference:\n\n\nJean-Michel Hautbois (5):\n  utils: ipu3: Introduce a parameters dump tool\n  utils: ipu3: Display only if it is modified by userspace\n  utils: ipu3: Display BNR configuration\n  utils: ipu3: display green disparity params\n  utils: ipu3: dump lens shading params\n\n utils/ipu3/ipu3-dump-params.c | 222 ++++++++++++++++++++++++++++++++++\n utils/ipu3/meson.build        |   5 +\n 2 files changed, 227 insertions(+)\n create mode 100644 utils/ipu3/ipu3-dump-params.c",
    "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 6c5617cd..651069c6 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -6,9 +6,12 @@\n  */\n \n #include <algorithm>\n+#include <fcntl.h>\n #include <iomanip>\n #include <memory>\n #include <queue>\n+#include <sys/mman.h>\n+#include <unistd.h>\n #include <vector>\n \n #include <libcamera/base/log.h>\n@@ -61,6 +64,7 @@ public:\n        void queuePendingRequests();\n        void cancelPendingRequests();\n        void frameStart(uint32_t sequence);\n+       void dumpBuffer(FrameBuffer *paramBuffer);\n \n        CIO2Device cio2_;\n        ImgUDevice *imgu_;\n@@ -1288,6 +1292,7 @@ void IPU3CameraData::queueFrameAction(unsigned int id,\n                }\n \n                imgu_->param_->queueBuffer(info->paramBuffer);\n+               dumpBuffer(info->paramBuffer);\n                imgu_->stat_->queueBuffer(info->statBuffer);\n                imgu_->input_->queueBuffer(info->rawBuffer);\n \n@@ -1313,6 +1318,24 @@ void IPU3CameraData::queueFrameAction(unsigned int id,\n        }\n }\n \n+void IPU3CameraData::dumpBuffer(FrameBuffer *buffer)\n+{\n+       for (const FrameBuffer::Plane &plane : buffer->planes()) {\n+               void *address = mmap(nullptr, plane.length, PROT_WRITE,\n+                                    MAP_SHARED, plane.fd.get(), 0);\n+               if (address == MAP_FAILED) {\n+                       LOG(IPU3, Error) << \"Failed to mmap plane\";\n+                       break;\n+               }\n+\n+               int out_fd = open(\"/tmp/IPU3_params.bin\",\n+                                 O_WRONLY | O_TRUNC | O_CREAT, 0644);\n+               write(out_fd, address, plane.length);\n+               close(out_fd);\n+               munmap(address, plane.length);\n+       }\n+}\n+\n /* -----------------------------------------------------------------------------\n  * Buffer Ready slots\n  */>\n",
    "prefixes": [
        "libcamera-devel",
        "0/5"
    ]
}