Show a patch.

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

{
    "id": 2126,
    "url": "https://patchwork.libcamera.org/api/patches/2126/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2126/",
    "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": "<20191007085842.7608-5-jacopo@jmondi.org>",
    "date": "2019-10-07T08:58:41",
    "name": "[libcamera-devel,v4,4/5] ipa: vimc: Add support for tracing operations",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "53898332b35c0b6999163c1b333ee2a029d1b13e",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2126/mbox/",
    "series": [
        {
            "id": 525,
            "url": "https://patchwork.libcamera.org/api/series/525/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=525",
            "date": "2019-10-07T08:58:37",
            "name": "test: Add IPA interface test support",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/525/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2126/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2126/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8E80C61565\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  7 Oct 2019 10:57:03 +0200 (CEST)",
            "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay10.mail.gandi.net (Postfix) with ESMTPSA id 4A74D24000D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  7 Oct 2019 08:57:03 +0000 (UTC)"
        ],
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon,  7 Oct 2019 10:58:41 +0200",
        "Message-Id": "<20191007085842.7608-5-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.23.0",
        "In-Reply-To": "<20191007085842.7608-1-jacopo@jmondi.org>",
        "References": "<20191007085842.7608-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 4/5] ipa: vimc: Add support for tracing\n\toperations",
        "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": "Mon, 07 Oct 2019 08:57:04 -0000"
    },
    "content": "Add support to the dummy VIMC IPA for tracing operation by using a FIFO\nchannel that will be used by the IPA Interface test to verify\ncommunications with the IPA.\n\nAt the moment only add support for the init() operation as it's the only\ndefined one.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/ipa/ipa_vimc.h | 22 ++++++++++++++\n src/ipa/ipa_vimc.cpp   | 68 +++++++++++++++++++++++++++++++++++++++++-\n 2 files changed, 89 insertions(+), 1 deletion(-)\n create mode 100644 include/ipa/ipa_vimc.h\n\n--\n2.23.0",
    "diff": "diff --git a/include/ipa/ipa_vimc.h b/include/ipa/ipa_vimc.h\nnew file mode 100644\nindex 000000000000..3e0375fe3a2c\n--- /dev/null\n+++ b/include/ipa/ipa_vimc.h\n@@ -0,0 +1,22 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * ipa_vimc.h - Vimc Image Processing Algorithm module\n+ */\n+\n+#ifndef __LIBCAMERA_IPA_VIMC_H__\n+#define __LIBCAMERA_IPA_VIMC_H__\n+\n+namespace libcamera {\n+\n+#define VIMC_IPA_FIFO_PATH \"/tmp/vimc_ipa_fifo\"\n+\n+enum IPAOperationCode {\n+\tIPAOperationNone,\n+\tIPAOperationInit,\n+};\n+\n+}; /* namespace libcamera */\n+\n+#endif /* __LIBCAMERA_IPA_VIMC_H__ */\ndiff --git a/src/ipa/ipa_vimc.cpp b/src/ipa/ipa_vimc.cpp\nindex abc06e7f5fd5..83ce6bc19fd1 100644\n--- a/src/ipa/ipa_vimc.cpp\n+++ b/src/ipa/ipa_vimc.cpp\n@@ -5,25 +5,91 @@\n  * ipa_vimc.cpp - Vimc Image Processing Algorithm module\n  */\n\n+#include <ipa/ipa_vimc.h>\n+\n+#include <fcntl.h>\n+#include <string.h>\n+#include <sys/stat.h>\n+#include <unistd.h>\n+\n #include <iostream>\n\n #include <ipa/ipa_interface.h>\n #include <ipa/ipa_module_info.h>\n\n+#include \"log.h\"\n+\n namespace libcamera {\n\n+LOG_DEFINE_CATEGORY(IPAVimc)\n+\n class IPAVimc : public IPAInterface\n {\n public:\n+\tIPAVimc();\n+\t~IPAVimc();\n+\n \tint init();\n+\n+private:\n+\tvoid initTrace();\n+\tvoid trace(enum IPAOperationCode operation);\n+\n+\tint fd_;\n };\n\n+IPAVimc::IPAVimc()\n+\t: fd_(-1)\n+{\n+\tinitTrace();\n+}\n+\n+IPAVimc::~IPAVimc()\n+{\n+\tif (fd_)\n+\t\t::close(fd_);\n+}\n+\n int IPAVimc::init()\n {\n-\tstd::cout << \"initializing vimc IPA!\" << std::endl;\n+\ttrace(IPAOperationInit);\n+\n+\tLOG(IPAVimc, Debug) << \"initializing vimc IPA!\";\n+\n \treturn 0;\n }\n\n+void IPAVimc::initTrace()\n+{\n+\tstruct stat fifoStat;\n+\tint ret = stat(VIMC_IPA_FIFO_PATH, &fifoStat);\n+\tif (ret)\n+\t\treturn;\n+\n+\tret = ::open(VIMC_IPA_FIFO_PATH, O_WRONLY);\n+\tif (ret < 0) {\n+\t\tret = errno;\n+\t\tLOG(IPAVimc, Error) << \"Failed to open vimc IPA test FIFO: \"\n+\t\t\t\t    << strerror(ret);\n+\t\treturn;\n+\t}\n+\n+\tfd_ = ret;\n+}\n+\n+void IPAVimc::trace(enum IPAOperationCode operation)\n+{\n+\tif (fd_ < 0)\n+\t\treturn;\n+\n+\tint ret = ::write(fd_, &operation, sizeof(operation));\n+\tif (ret < 0) {\n+\t\tret = errno;\n+\t\tLOG(IPAVimc, Error) << \"Failed to write to vimc IPA test FIFO: \"\n+\t\t\t\t    << strerror(ret);\n+\t}\n+}\n+\n /*\n  * External IPA module interface\n  */\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "4/5"
    ]
}