From patchwork Thu Aug 18 06:49:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 17153 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 4FA9DC3272 for ; Thu, 18 Aug 2022 06:49:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0CFAA61FD4; Thu, 18 Aug 2022 08:49:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660805391; bh=8wG9DxocDQCfQ+PTkwmkOOlfdCW2U6NvA1pxl5SZGU0=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=B9fMb5GgICl1LgpxDZuocTeP4T0XlQSKrlquyeJgZ2BtV9D4d1dafr2h0z0MLQ53u 8Y/d8/QbSWSSlvKJ+uFtOjxTxEk4SHOMuQ3zPN0OOboZA7XUB4lSRH8dTm9fGcsa0n 6GrQsvNUp3ssPNiv7ZBFRxMBS85003Ch7CL+WtVfq3+KRnc2HSvHlaj6bXjtmDYFAh QoPMBAbeC5PRngwy5YbUIFsSTHeJm/KB9RAdgJaCei9H0C3foIlDvmTshQ0udtk7q7 4txGz854d2VgI+c2v+5lJ201G+qzlBCpmUzp8r+mmbd7IW7jyhUeoCQLGBhk+/NyBz QbUsNc3I7zZtg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D72CA61FD4 for ; Thu, 18 Aug 2022 08:49:49 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="hpriGal6"; dkim-atps=neutral Received: from pyrite.rasen.tech (KD027085204050.au-net.ne.jp [27.85.204.50]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 64B724A8; Thu, 18 Aug 2022 08:49:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1660805389; bh=8wG9DxocDQCfQ+PTkwmkOOlfdCW2U6NvA1pxl5SZGU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hpriGal6XnOstTE7sVnfYn374vW6kJNuattpzUS4C3KDAyJLkN/nn+XYOWnZ2jf/I UkYAp4U76lNnfzRXpEMRxnCp+hqmB+5TkO1Fmz1bb6VEggMxeEDqEDkc/mzHwAPMU/ 6kWNQuaVgxO9OZ2t2LQO2WRM4WNVsylNK2IJJVNI= To: libcamera-devel@lists.libcamera.org Date: Thu, 18 Aug 2022 15:49:22 +0900 Message-Id: <20220818064923.2573060-8-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220818064923.2573060-1-paul.elder@ideasonboard.com> References: <20220818064923.2573060-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 7/7] [TEST] ipa: vimc: Add Flags to parameters X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Paul Elder via libcamera-devel From: Paul Elder Reply-To: Paul Elder Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" For the purpose of testing serializing/deserializing Flags in function parameters, add an enum class TestFlags and Flags to some function parameters, both for input and output and Signals. While at it, update the ipa_interface_test. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- Changes in v2: - use new attribute-based mojom definition for Flags --- include/libcamera/ipa/vimc.mojom | 14 ++++++++++++-- src/ipa/vimc/vimc.cpp | 21 +++++++++++++++++---- src/libcamera/pipeline/vimc/vimc.cpp | 16 +++++++++++++--- test/ipa/ipa_interface_test.cpp | 6 +++++- 4 files changed, 47 insertions(+), 10 deletions(-) diff --git a/include/libcamera/ipa/vimc.mojom b/include/libcamera/ipa/vimc.mojom index 16149787..15948d77 100644 --- a/include/libcamera/ipa/vimc.mojom +++ b/include/libcamera/ipa/vimc.mojom @@ -17,8 +17,18 @@ enum IPAOperationCode { IPAOperationStop, }; +[Flags] enum TestFlags { + Flag1 = 0x1, + Flag2 = 0x2, + Flag3 = 0x4, + Flag4 = 0x8, +}; + interface IPAVimcInterface { - init(libcamera.IPASettings settings, IPAOperationCode code) => (int32 ret); + init(libcamera.IPASettings settings, + IPAOperationCode code, + [Flags] TestFlags inFlags) + => (int32 ret, [Flags] TestFlags outFlags); configure(libcamera.IPACameraSensorInfo sensorInfo, map streamConfig, @@ -41,5 +51,5 @@ interface IPAVimcInterface { }; interface IPAVimcEventInterface { - paramsBufferReady(uint32 bufferId); + paramsBufferReady(uint32 bufferId, [Flags] TestFlags flags); }; diff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp index 6bf39a1c..bb4ca355 100644 --- a/src/ipa/vimc/vimc.cpp +++ b/src/ipa/vimc/vimc.cpp @@ -31,7 +31,10 @@ public: IPAVimc(); ~IPAVimc(); - int init(const IPASettings &settings, const ipa::vimc::IPAOperationCode &code) override; + int init(const IPASettings &settings, + const ipa::vimc::IPAOperationCode &code, + const Flags &inFlags, + Flags *outFlags) override; int start() override; void stop() override; @@ -65,8 +68,10 @@ IPAVimc::~IPAVimc() if (fd_ != -1) ::close(fd_); } - -int IPAVimc::init(const IPASettings &settings, const ipa::vimc::IPAOperationCode &code) +int IPAVimc::init(const IPASettings &settings, + const ipa::vimc::IPAOperationCode &code, + const Flags &inFlags, + Flags *outFlags) { trace(ipa::vimc::IPAOperationInit); @@ -76,6 +81,13 @@ int IPAVimc::init(const IPASettings &settings, const ipa::vimc::IPAOperationCode LOG(IPAVimc, Debug) << "Got opcode " << code; + LOG(IPAVimc, Debug) + << "Flag 2 was " + << ((inFlags & ipa::vimc::TestFlags::Flag2) ? "" : "not ") + << "set"; + + *outFlags |= ipa::vimc::TestFlags::Flag1; + File conf(settings.configurationFile); if (!conf.open(File::OpenModeFlag::ReadOnly)) { LOG(IPAVimc, Error) << "Failed to open configuration file"; @@ -144,7 +156,8 @@ void IPAVimc::fillParamsBuffer([[maybe_unused]] uint32_t frame, uint32_t bufferI return; } - paramsBufferReady.emit(bufferId); + Flags flags; + paramsBufferReady.emit(bufferId, flags); } void IPAVimc::initTrace() diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp index 983bd514..e74a8679 100644 --- a/src/libcamera/pipeline/vimc/vimc.cpp +++ b/src/libcamera/pipeline/vimc/vimc.cpp @@ -54,7 +54,7 @@ public: int init(); int allocateMockIPABuffers(); void bufferReady(FrameBuffer *buffer); - void paramsBufferReady(unsigned int id); + void paramsBufferReady(unsigned int id, const Flags &flags); MediaDevice *media_; std::unique_ptr sensor_; @@ -471,7 +471,16 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator) data->ipa_->paramsBufferReady.connect(data.get(), &VimcCameraData::paramsBufferReady); std::string conf = data->ipa_->configurationFile("vimc.conf"); - data->ipa_->init(IPASettings{ conf, data->sensor_->model() }, ipa::vimc::IPAOperationInit); + Flags inFlags; + Flags outFlags; + inFlags |= ipa::vimc::TestFlags::Flag2; + data->ipa_->init(IPASettings{ conf, data->sensor_->model() }, + ipa::vimc::IPAOperationInit, inFlags, &outFlags); + + LOG(VIMC, Debug) + << "Flag 1 was " + << ((outFlags & ipa::vimc::TestFlags::Flag1) ? "" : "not ") + << "set"; /* Create and register the camera. */ std::set streams{ &data->stream_ }; @@ -608,7 +617,8 @@ int VimcCameraData::allocateMockIPABuffers() return video_->exportBuffers(kBufCount, &mockIPABufs_); } -void VimcCameraData::paramsBufferReady([[maybe_unused]] unsigned int id) +void VimcCameraData::paramsBufferReady([[maybe_unused]] unsigned int id, + [[maybe_unused]] const Flags &flags) { } diff --git a/test/ipa/ipa_interface_test.cpp b/test/ipa/ipa_interface_test.cpp index b9fa15cd..47c7352b 100644 --- a/test/ipa/ipa_interface_test.cpp +++ b/test/ipa/ipa_interface_test.cpp @@ -106,7 +106,11 @@ protected: /* Test initialization of IPA module. */ std::string conf = ipa_->configurationFile("vimc.conf"); - int ret = ipa_->init(IPASettings{ conf, "vimc" }, ipa::vimc::IPAOperationInit); + Flags inFlags; + Flags outFlags; + int ret = ipa_->init(IPASettings{ conf, "vimc" }, + ipa::vimc::IPAOperationInit, + inFlags, &outFlags); if (ret < 0) { cerr << "IPA interface init() failed" << endl; return TestFail;