summaryrefslogtreecommitdiff
path: root/src/libcamera/request.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2019-04-09 11:27:29 +0200
committerJacopo Mondi <jacopo@jmondi.org>2019-04-18 15:37:59 +0200
commitee027781b4c265b378ed16f91eeded7b42f5dfe4 (patch)
tree70e4551115ab141c99f0625bf8c98a4cbc967b4f /src/libcamera/request.cpp
parent0527ba92adb7d97941ec4b8cd861178634f632b6 (diff)
libcamera: buffer: Store Request reference in Buffer
Add to the Buffer class methods to set and retrieve a reference to the Request instance the buffer is part of. As buffers outlive the Request they are associated with, the reference is only temporary valid during the buffer completion interval (from when the buffer gets queued to Camera for processing, until it gets marked as completed). Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/libcamera/request.cpp')
-rw-r--r--src/libcamera/request.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index 7088a479..433c6f83 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -141,6 +141,7 @@ int Request::prepare()
for (auto const &pair : bufferMap_) {
Buffer *buffer = pair.second;
+ buffer->setRequest(this);
pending_.insert(buffer);
}
@@ -177,6 +178,8 @@ bool Request::completeBuffer(Buffer *buffer)
int ret = pending_.erase(buffer);
ASSERT(ret == 1);
+ buffer->setRequest(nullptr);
+
return !hasPendingBuffers();
}