{"id":2120,"url":"https://patchwork.libcamera.org/api/patches/2120/?format=json","web_url":"https://patchwork.libcamera.org/patch/2120/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20191006200852.11775-5-jacopo@jmondi.org>","date":"2019-10-06T20:08:51","name":"[libcamera-devel,v3,4/5] ipa: vimc: Add support for tracing operations","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"c4e554b6d1130efbd00a372114f7a310680a7b33","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2120/mbox/","series":[{"id":524,"url":"https://patchwork.libcamera.org/api/series/524/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=524","date":"2019-10-06T20:08:47","name":"test: Add IPA interface test support","version":3,"mbox":"https://patchwork.libcamera.org/series/524/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2120/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2120/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2094360E1E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  6 Oct 2019 22:07:14 +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 relay6-d.mail.gandi.net (Postfix) with ESMTPSA id DDA1EC0003\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  6 Oct 2019 20:07:13 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Sun,  6 Oct 2019 22:08:51 +0200","Message-Id":"<20191006200852.11775-5-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.23.0","In-Reply-To":"<20191006200852.11775-1-jacopo@jmondi.org>","References":"<20191006200852.11775-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 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":"Sun, 06 Oct 2019 20:07:14 -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\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/ipa/ipa_vimc.h | 21 +++++++++++++\n src/ipa/ipa_vimc.cpp   | 68 +++++++++++++++++++++++++++++++++++++++++-\n 2 files changed, 88 insertions(+), 1 deletion(-)\n create mode 100644 include/ipa/ipa_vimc.h","diff":"diff --git a/include/ipa/ipa_vimc.h b/include/ipa/ipa_vimc.h\nnew file mode 100644\nindex 000000000000..f4a3ef4f32a4\n--- /dev/null\n+++ b/include/ipa/ipa_vimc.h\n@@ -0,0 +1,21 @@\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+static const char *vimcFifoPath = \"/tmp/vimc_ipa_fifo\";\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..0bc0b73c2d3f 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(vimcFifoPath, &fifoStat);\n+\tif (ret)\n+\t\treturn;\n+\n+\tret = ::open(vimcFifoPath, 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","v3","4/5"]}