summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2020-09-18 10:42:33 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-09-21 13:10:49 +0200
commit39798e8777b553ed9ae9863da02e16e417d8307e (patch)
treee2915e2dd0b0bc015227077851f4095cad59c7d4 /src/libcamera/pipeline/raspberrypi/rpi_stream.cpp
parentdd0df6d73965bc8566ad97d0e005545a71b7b409 (diff)
pipeline: ipa: raspberrypi: Handle any externally allocated FrameBuffer
Handle the case where a FrameBuffer that has been externally allocated (i.e. not through the v4l2 video device) is passed into a Request. We must store the buffer pointer in the stream internal buffer list to identify when used. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/libcamera/pipeline/raspberrypi/rpi_stream.cpp')
-rw-r--r--src/libcamera/pipeline/raspberrypi/rpi_stream.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp
index aee0aa2d..2dcf96ca 100644
--- a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp
+++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp
@@ -68,6 +68,20 @@ int RPiStream::getBufferId(FrameBuffer *buffer) const
return it->first;
}
+void RPiStream::setExternalBuffer(FrameBuffer *buffer)
+{
+ bufferMap_.emplace(RPiBufferMask::EXTERNAL_BUFFER | id_.get(), buffer);
+}
+
+void RPiStream::removeExternalBuffer(FrameBuffer *buffer)
+{
+ int id = getBufferId(buffer);
+
+ /* Ensure we have this buffer in the stream, and it is marked external. */
+ ASSERT(id != -1 && (id & RPiBufferMask::EXTERNAL_BUFFER));
+ bufferMap_.erase(id);
+}
+
int RPiStream::prepareBuffers(unsigned int count)
{
int ret;