summaryrefslogtreecommitdiff
path: root/src/libcamera/request.cpp
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-01-12 01:10:51 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-01-12 16:10:37 +0100
commit856a4a25278ce5e4b64497deaa3b20c4df16fdee (patch)
treea60c0e8d418e306db82db15668f3ea8033a11a72 /src/libcamera/request.cpp
parent96eaad1238131721207c6a9bde077f7f1aad5f60 (diff)
libcamera: request: remove prepare()
The association of buffers to a request can be done directly in addBuffer() instead of when the request is queued to the camera. Keep the check that a request contains buffers by moving it to Camera::queueRequest() where prepare() was previously called. As a bonus we can remove a friend statement in Request. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/request.cpp')
-rw-r--r--src/libcamera/request.cpp26
1 files changed, 2 insertions, 24 deletions
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index c14ed1a4..84a5f558 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -139,6 +139,8 @@ int Request::addBuffer(std::unique_ptr<Buffer> buffer)
return -EEXIST;
}
+ buffer->setRequest(this);
+ pending_.insert(buffer.get());
bufferMap_[stream] = buffer.release();
return 0;
@@ -204,30 +206,6 @@ Buffer *Request::findBuffer(Stream *stream) const
*/
/**
- * \brief Validate the request and prepare it for the completion handler
- *
- * Requests that contain no buffers are invalid and are rejected.
- *
- * \return 0 on success or a negative error code otherwise
- * \retval -EINVAL The request is invalid
- */
-int Request::prepare()
-{
- if (bufferMap_.empty()) {
- LOG(Request, Error) << "Invalid request due to missing buffers";
- return -EINVAL;
- }
-
- for (auto const &pair : bufferMap_) {
- Buffer *buffer = pair.second;
- buffer->setRequest(this);
- pending_.insert(buffer);
- }
-
- return 0;
-}
-
-/**
* \brief Complete a queued request
*
* Mark the request as complete by updating its status to RequestComplete,