From 3b54b56a2d0228f879fb2502706a00dd67f84989 Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Wed, 3 Aug 2022 20:03:03 +0900 Subject: ipa: vimc: Add Flags to parameters 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 --- src/ipa/vimc/vimc.cpp | 20 +++++++++++++++++--- src/libcamera/pipeline/vimc/vimc.cpp | 15 ++++++++++++--- 2 files changed, 29 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp index 5d494b63..9256bbba 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; @@ -66,7 +69,10 @@ IPAVimc::~IPAVimc() ::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 +82,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::TestFlag::Flag2 ? "" : "not ") + << "set"; + + *outFlags |= ipa::vimc::TestFlag::Flag1; + File conf(settings.configurationFile); if (!conf.open(File::OpenModeFlag::ReadOnly)) { LOG(IPAVimc, Error) << "Failed to open configuration file"; @@ -144,7 +157,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 df749bf7..f85d05f7 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,15 @@ 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 = ipa::vimc::TestFlag::Flag2; + Flags outFlags; + data->ipa_->init(IPASettings{ conf, data->sensor_->model() }, + ipa::vimc::IPAOperationInit, inFlags, &outFlags); + + LOG(VIMC, Debug) + << "Flag 1 was " + << (outFlags & ipa::vimc::TestFlag::Flag1 ? "" : "not ") + << "set"; /* Create and register the camera. */ std::set streams{ &data->stream_ }; @@ -608,7 +616,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) { } -- cgit v1.2.1