{"id":2101,"url":"https://patchwork.libcamera.org/api/1.1/patches/2101/?format=json","web_url":"https://patchwork.libcamera.org/patch/2101/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20191004163734.15594-6-jacopo@jmondi.org>","date":"2019-10-04T16:37:33","name":"[libcamera-devel,v2,5/6] ipa: vimc: Add support for tracing operations","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"feb3eebe82d0dfea7cf9ddee4c98a2c40cbd2824","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2101/mbox/","series":[{"id":519,"url":"https://patchwork.libcamera.org/api/1.1/series/519/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=519","date":"2019-10-04T16:37:28","name":"test: Add IPA interface test support","version":2,"mbox":"https://patchwork.libcamera.org/series/519/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2101/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2101/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9348B6165B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  4 Oct 2019 18:36:01 +0200 (CEST)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id 2B079200009;\n\tFri,  4 Oct 2019 16:36:00 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  4 Oct 2019 18:37:33 +0200","Message-Id":"<20191004163734.15594-6-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.23.0","In-Reply-To":"<20191004163734.15594-1-jacopo@jmondi.org>","References":"<20191004163734.15594-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 5/6] 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":"Fri, 04 Oct 2019 16:36:02 -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 src/ipa/ipa_vimc.cpp | 66 ++++++++++++++++++++++++++++++++++++++++++++\n src/ipa/ipa_vimc.h   | 21 ++++++++++++++\n 2 files changed, 87 insertions(+)\n create mode 100644 src/ipa/ipa_vimc.h","diff":"diff --git a/src/ipa/ipa_vimc.cpp b/src/ipa/ipa_vimc.cpp\nindex abc06e7f5fd5..5fb62129fef9 100644\n--- a/src/ipa/ipa_vimc.cpp\n+++ b/src/ipa/ipa_vimc.cpp\n@@ -5,22 +5,88 @@\n  * ipa_vimc.cpp - Vimc Image Processing Algorithm module\n  */\n \n+#include \"ipa_vimc.h\"\n+\n #include <iostream>\n \n+#include <fcntl.h>\n+#include <string.h>\n+#include <sys/stat.h>\n+#include <unistd.h>\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+\tint trace(enum IPAOperationCodes 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+\n+\treturn trace(IPAOperationInit);\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\tLOG(IPAVimc, Debug) << \"Failed to open vimc IPA test FIFO: \"\n+\t\t\t\t    << strerror(errno) << std::endl;\n+\t\treturn;\n+\t}\n+\n+\tfd_ = ret;\n+}\n+\n+int IPAVimc::trace(enum IPAOperationCodes operation)\n+{\n+\tif (fd_ < 0)\n+\t\treturn 0;\n+\n+\tint ret = ::write(fd_, &operation, sizeof(operation));\n+\tif (ret < 0) {\n+\t\tret = -errno;\n+\t\tLOG(IPAVimc, Debug) << \"Failed to write to vimc IPA test FIFO: \"\n+\t\t\t\t    << strerror(-ret) << std::endl;\n+\t\treturn ret;\n+\t}\n+\n \treturn 0;\n }\n \ndiff --git a/src/ipa/ipa_vimc.h b/src/ipa/ipa_vimc.h\nnew file mode 100644\nindex 000000000000..62e40c5a6714\n--- /dev/null\n+++ b/src/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 IPAOperationCodes {\n+\tIPAOperationNone,\n+\tIPAOperationInit,\n+};\n+\n+}; /* namespace libcamera */\n+\n+#endif /* __LIBCAMERA_IPA_VIMC_H__ */\n","prefixes":["libcamera-devel","v2","5/6"]}