From patchwork Wed May 22 21:02:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1256 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BD82860C02 for ; Wed, 22 May 2019 23:02:39 +0200 (CEST) Received: from localhost.localdomain (unknown [96.44.9.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1647B52F; Wed, 22 May 2019 23:02:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1558558959; bh=vN8KJVilLEyUj3gFJrwFW6Tl+JunqsuxEp/m5qYq8/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hZR3rSrx7ZVYJMxhxbs3COC/bNwjW0BjH19gitN0Zm5111/v3XrmOkqbIhr6b6rTm uEXzKioqXyw42fm8es/TgF8VFB3cVuPPctp0PBhbP2kRdB3HwDt1UHyXAs7A2sBy7n Opb7UURID4Oj3zGH9+VPQZRuxe8dyVDqiN6nSTsY= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 22 May 2019 17:02:16 -0400 Message-Id: <20190522210220.1631-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190522210220.1631-1-paul.elder@ideasonboard.com> References: <20190522210220.1631-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH 1/5] libcamera: ipa_module_info: update struct to allow IPA matching X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 21:02:40 -0000 We need a way to match pipelines with IPA modules, so add fields in IPAModuleInfo to hold the IPA API version number and the pipeline matching string. Also update IPA module tests accordingly. Signed-off-by: Paul Elder --- include/libcamera/ipa/ipa_module_info.h | 8 ++++-- test/ipa/ipa_test.cpp | 37 +++++++++++++++++-------- test/ipa/shared_test.c | 4 ++- test/ipa/shared_test.cpp | 6 ++-- 4 files changed, 39 insertions(+), 16 deletions(-) diff --git a/include/libcamera/ipa/ipa_module_info.h b/include/libcamera/ipa/ipa_module_info.h index 4e0d668..f3ae97d 100644 --- a/include/libcamera/ipa/ipa_module_info.h +++ b/include/libcamera/ipa/ipa_module_info.h @@ -7,14 +7,18 @@ #ifndef __LIBCAMERA_IPA_MODULE_INFO_H__ #define __LIBCAMERA_IPA_MODULE_INFO_H__ +#include + #ifdef __cplusplus namespace libcamera { #endif struct IPAModuleInfo { + uint32_t ipaAPIVersion; + uint32_t pipelineVersion; + char pipelineName[256]; char name[256]; - unsigned int version; -}; +} __attribute__((packed)); #ifdef __cplusplus extern "C" { diff --git a/test/ipa/ipa_test.cpp b/test/ipa/ipa_test.cpp index 9861ee2..ca15fbd 100644 --- a/test/ipa/ipa_test.cpp +++ b/test/ipa/ipa_test.cpp @@ -33,6 +33,19 @@ protected: const struct IPAModuleInfo &info = ll->info(); + if (info.ipaAPIVersion != testInfo.ipaAPIVersion) { + cerr << "test IPA module has incorrect ipaAPIVersion" << endl; + cerr << "expected \"" << testInfo.ipaAPIVersion << "\", got \"" + << info.ipaAPIVersion << "\"" << endl; + ret = -1; + } + if (info.pipelineVersion != testInfo.pipelineVersion) { + cerr << "test IPA module has incorrect pipelineVersion" << endl; + cerr << "expected \"" << testInfo.pipelineVersion << "\", got \"" + << info.pipelineVersion << "\"" << endl; + ret = -1; + } + if (strcmp(info.name, testInfo.name)) { cerr << "test IPA module has incorrect name" << endl; cerr << "expected \"" << testInfo.name << "\", got \"" @@ -40,13 +53,6 @@ protected: ret = -1; } - if (info.version != testInfo.version) { - cerr << "test IPA module has incorrect version" << endl; - cerr << "expected \"" << testInfo.version << "\", got \"" - << info.version << "\"" << endl; - ret = -1; - } - delete ll; return ret; } @@ -55,14 +61,23 @@ protected: { int count = 0; - const struct IPAModuleInfo testInfo = { - "It's over nine thousand!", + const struct IPAModuleInfo testInfo1 = { + 1, 9001, + "bloop", + "It's over nine thousand!", + }; + + const struct IPAModuleInfo testInfo2 = { + 1, + 8999, + "bleep", + "It's under nine thousand!", }; - count += runTest("test/ipa/ipa-dummy-c.so", testInfo); + count += runTest("test/ipa/ipa-dummy-c.so", testInfo1); - count += runTest("test/ipa/ipa-dummy-cpp.so", testInfo); + count += runTest("test/ipa/ipa-dummy-cpp.so", testInfo2); if (count < 0) return TestFail; diff --git a/test/ipa/shared_test.c b/test/ipa/shared_test.c index 87d182b..0046ace 100644 --- a/test/ipa/shared_test.c +++ b/test/ipa/shared_test.c @@ -1,6 +1,8 @@ #include const struct IPAModuleInfo ipaModuleInfo = { + .ipaAPIVersion = 1, + .pipelineVersion = 9001, + .pipelineName = "bloop", .name = "It's over nine thousand!", - .version = 9001, }; diff --git a/test/ipa/shared_test.cpp b/test/ipa/shared_test.cpp index 4e5c976..78405b1 100644 --- a/test/ipa/shared_test.cpp +++ b/test/ipa/shared_test.cpp @@ -4,8 +4,10 @@ namespace libcamera { extern "C" { const struct libcamera::IPAModuleInfo ipaModuleInfo = { - "It's over nine thousand!", - 9001, + 1, + 8999, + "bleep", + "It's under nine thousand!", }; };