summaryrefslogtreecommitdiff
path: root/src/ipa
diff options
context:
space:
mode:
authorUmang Jain <umang.jain@ideasonboard.com>2021-08-14 10:39:11 +0530
committerUmang Jain <umang.jain@ideasonboard.com>2021-08-16 13:22:11 +0530
commit3c5732d04a879d71d928e200d399c8d61b0da27a (patch)
treec41b4d27e72950dbb1ad577af1844fc50bf6fdb9 /src/ipa
parentaad68099e514737f51ad30c61ffe54fc95037042 (diff)
ipa: vimc: Map and unmap buffers
VIMC pipeline handler has dmabuf-backed mock FrameBuffers which are specifically targetted mimicking IPA buffers (parameter and statistics). Map these mock buffers to the VIMC IPA that would enable exercising IPA IPC code paths. This will provide leverage to our test suite to test IPA IPC code paths, which are common to various platforms. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/ipa')
-rw-r--r--src/ipa/vimc/vimc.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp
index fb134084..7d9d22d0 100644
--- a/src/ipa/vimc/vimc.cpp
+++ b/src/ipa/vimc/vimc.cpp
@@ -19,6 +19,8 @@
#include <libcamera/ipa/ipa_interface.h>
#include <libcamera/ipa/ipa_module_info.h>
+#include "libcamera/internal/mapped_framebuffer.h"
+
namespace libcamera {
LOG_DEFINE_CATEGORY(IPAVimc)
@@ -38,11 +40,15 @@ public:
const std::map<unsigned int, IPAStream> &streamConfig,
const std::map<unsigned int, ControlInfoMap> &entityControls) override;
+ void mapBuffers(const std::vector<IPABuffer> &buffers) override;
+ void unmapBuffers(const std::vector<unsigned int> &ids) override;
+
private:
void initTrace();
void trace(enum ipa::vimc::IPAOperationCode operation);
int fd_;
+ std::map<unsigned int, MappedFrameBuffer> buffers_;
};
IPAVimc::IPAVimc()
@@ -99,6 +105,27 @@ int IPAVimc::configure([[maybe_unused]] const IPACameraSensorInfo &sensorInfo,
return 0;
}
+void IPAVimc::mapBuffers(const std::vector<IPABuffer> &buffers)
+{
+ for (const IPABuffer &buffer : buffers) {
+ const FrameBuffer fb(buffer.planes);
+ buffers_.emplace(std::piecewise_construct,
+ std::forward_as_tuple(buffer.id),
+ std::forward_as_tuple(&fb, MappedFrameBuffer::MapFlag::Read));
+ }
+}
+
+void IPAVimc::unmapBuffers(const std::vector<unsigned int> &ids)
+{
+ for (unsigned int id : ids) {
+ auto it = buffers_.find(id);
+ if (it == buffers_.end())
+ continue;
+
+ buffers_.erase(it);
+ }
+}
+
void IPAVimc::initTrace()
{
struct stat fifoStat;