summaryrefslogtreecommitdiff
path: root/src/libcamera
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-15 01:27:43 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-18 19:15:18 +0200
commit4ff18e95063bbb70f6e0971774fcd2a1b0ad2b58 (patch)
treef3562d679096cfb95a203fed3b61ff0bd3a88267 /src/libcamera
parent33fedea818e2b6a9ed68ac86acf194b1a2da8828 (diff)
libcamera: framebuffer_allocator: Lift camera restrictions on allocator
The Camera class currently requires the allocator to have no allocated buffer before the camera is reconfigured, and the allocator to be destroyed before the camera is released. There's no basis for these restrictions anymore, remove them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/libcamera')
-rw-r--r--src/libcamera/camera.cpp18
-rw-r--r--src/libcamera/framebuffer_allocator.cpp25
2 files changed, 1 insertions, 42 deletions
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index 5593c1b3..8c3bb2c2 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -508,7 +508,7 @@ const std::string &Camera::name() const
Camera::Camera(PipelineHandler *pipe, const std::string &name,
const std::set<Stream *> &streams)
- : p_(new Private(pipe, name, streams)), allocator_(nullptr)
+ : p_(new Private(pipe, name, streams))
{
}
@@ -620,16 +620,6 @@ int Camera::release()
if (ret < 0)
return ret == -EACCES ? -EBUSY : ret;
- if (allocator_) {
- /*
- * \todo Try to find a better API that would make this error
- * impossible.
- */
- LOG(Camera, Error)
- << "Buffers must be freed before the camera can be reconfigured";
- return -EBUSY;
- }
-
p_->pipe_->unlock();
p_->setState(Private::CameraAvailable);
@@ -763,12 +753,6 @@ int Camera::configure(CameraConfiguration *config)
if (ret < 0)
return ret;
- if (allocator_ && allocator_->allocated()) {
- LOG(Camera, Error)
- << "Allocator must be deleted before camera can be reconfigured";
- return -EBUSY;
- }
-
if (config->validate() != CameraConfiguration::Valid) {
LOG(Camera, Error)
<< "Can't configure camera with invalid configuration";
diff --git a/src/libcamera/framebuffer_allocator.cpp b/src/libcamera/framebuffer_allocator.cpp
index 6f7a2e90..a37b564c 100644
--- a/src/libcamera/framebuffer_allocator.cpp
+++ b/src/libcamera/framebuffer_allocator.cpp
@@ -54,29 +54,6 @@ LOG_DEFINE_CATEGORY(Allocator)
*/
/**
- * \brief Create a FrameBuffer allocator
- * \param[in] camera The camera the allocator serves
- *
- * A single allocator may be created for a Camera instance.
- *
- * The caller is responsible for deleting the allocator before the camera is
- * released.
- *
- * \return A pointer to the newly created allocator object or nullptr on error
- */
-FrameBufferAllocator *
-FrameBufferAllocator::create(std::shared_ptr<Camera> camera)
-{
- if (camera->allocator_) {
- LOG(Allocator, Error) << "Camera already has an allocator";
- return nullptr;
- }
-
- camera->allocator_ = new FrameBufferAllocator(camera);
- return camera->allocator_;
-}
-
-/**
* \brief Construct a FrameBufferAllocator serving a camera
* \param[in] camera The camera
*/
@@ -88,8 +65,6 @@ FrameBufferAllocator::FrameBufferAllocator(std::shared_ptr<Camera> camera)
FrameBufferAllocator::~FrameBufferAllocator()
{
buffers_.clear();
-
- camera_->allocator_ = nullptr;
}
/**