libcamera: camera: Remove the prepared state
With the FrameBuffer rework completed there is no reason to keep the camera prepared state around as buffer allocations are now decoupled from the camera state. Remove the camera state simplifying the API. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
6cd505ac89
commit
a1c5450be5
10 changed files with 22 additions and 223 deletions
|
@ -91,9 +91,6 @@ public:
|
||||||
std::unique_ptr<CameraConfiguration> generateConfiguration(const StreamRoles &roles);
|
std::unique_ptr<CameraConfiguration> generateConfiguration(const StreamRoles &roles);
|
||||||
int configure(CameraConfiguration *config);
|
int configure(CameraConfiguration *config);
|
||||||
|
|
||||||
int allocateBuffers();
|
|
||||||
int freeBuffers();
|
|
||||||
|
|
||||||
Request *createRequest(uint64_t cookie = 0);
|
Request *createRequest(uint64_t cookie = 0);
|
||||||
int queueRequest(Request *request);
|
int queueRequest(Request *request);
|
||||||
|
|
||||||
|
@ -105,7 +102,6 @@ private:
|
||||||
CameraAvailable,
|
CameraAvailable,
|
||||||
CameraAcquired,
|
CameraAcquired,
|
||||||
CameraConfigured,
|
CameraConfigured,
|
||||||
CameraPrepared,
|
|
||||||
CameraRunning,
|
CameraRunning,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -77,8 +77,6 @@ int CameraDevice::open()
|
||||||
void CameraDevice::close()
|
void CameraDevice::close()
|
||||||
{
|
{
|
||||||
camera_->stop();
|
camera_->stop();
|
||||||
|
|
||||||
camera_->freeBuffers();
|
|
||||||
camera_->release();
|
camera_->release();
|
||||||
|
|
||||||
running_ = false;
|
running_ = false;
|
||||||
|
@ -690,16 +688,9 @@ void CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reque
|
||||||
|
|
||||||
/* Start the camera if that's the first request we handle. */
|
/* Start the camera if that's the first request we handle. */
|
||||||
if (!running_) {
|
if (!running_) {
|
||||||
int ret = camera_->allocateBuffers();
|
int ret = camera_->start();
|
||||||
if (ret) {
|
|
||||||
LOG(HAL, Error) << "Failed to allocate buffers";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = camera_->start();
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
LOG(HAL, Error) << "Failed to start camera";
|
LOG(HAL, Error) << "Failed to start camera";
|
||||||
camera_->freeBuffers();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,12 +42,6 @@ int Capture::run(EventLoop *loop, const OptionsParser::Options &options)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = camera_->allocateBuffers();
|
|
||||||
if (ret) {
|
|
||||||
std::cerr << "Failed to allocate buffers" << std::endl;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
camera_->requestCompleted.connect(this, &Capture::requestComplete);
|
camera_->requestCompleted.connect(this, &Capture::requestComplete);
|
||||||
|
|
||||||
if (options.isSet(OptFile)) {
|
if (options.isSet(OptFile)) {
|
||||||
|
@ -67,8 +61,6 @@ int Capture::run(EventLoop *loop, const OptionsParser::Options &options)
|
||||||
writer_ = nullptr;
|
writer_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
camera_->freeBuffers();
|
|
||||||
|
|
||||||
delete allocator;
|
delete allocator;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -275,15 +275,13 @@ std::size_t CameraConfiguration::size() const
|
||||||
* \section camera_operation Operating the Camera
|
* \section camera_operation Operating the Camera
|
||||||
*
|
*
|
||||||
* An application needs to perform a sequence of operations on a camera before
|
* An application needs to perform a sequence of operations on a camera before
|
||||||
* it is ready to process requests. The camera needs to be acquired, configured
|
* it is ready to process requests. The camera needs to be acquired and
|
||||||
* and resources allocated or imported to prepare the camera for capture. Once
|
* configured to prepare the camera for capture. Once started the camera can
|
||||||
* started the camera can process requests until it is stopped. When an
|
* process requests until it is stopped. When an application is done with a
|
||||||
* application is done with a camera all resources allocated need to be freed
|
* camera, the camera needs to be released.
|
||||||
* and the camera released.
|
|
||||||
*
|
*
|
||||||
* An application may start and stop a camera multiple times as long as it is
|
* An application may start and stop a camera multiple times as long as it is
|
||||||
* not released. The camera may also be reconfigured provided that all
|
* not released. The camera may also be reconfigured.
|
||||||
* resources allocated are freed prior to the reconfiguration.
|
|
||||||
*
|
*
|
||||||
* \subsection Camera States
|
* \subsection Camera States
|
||||||
*
|
*
|
||||||
|
@ -297,7 +295,6 @@ std::size_t CameraConfiguration::size() const
|
||||||
* node [shape = doublecircle ]; Available;
|
* node [shape = doublecircle ]; Available;
|
||||||
* node [shape = circle ]; Acquired;
|
* node [shape = circle ]; Acquired;
|
||||||
* node [shape = circle ]; Configured;
|
* node [shape = circle ]; Configured;
|
||||||
* node [shape = circle ]; Prepared;
|
|
||||||
* node [shape = circle ]; Running;
|
* node [shape = circle ]; Running;
|
||||||
*
|
*
|
||||||
* Available -> Available [label = "release()"];
|
* Available -> Available [label = "release()"];
|
||||||
|
@ -307,14 +304,10 @@ std::size_t CameraConfiguration::size() const
|
||||||
* Acquired -> Configured [label = "configure()"];
|
* Acquired -> Configured [label = "configure()"];
|
||||||
*
|
*
|
||||||
* Configured -> Available [label = "release()"];
|
* Configured -> Available [label = "release()"];
|
||||||
* Configured -> Configured [label = "configure()"];
|
* Configured -> Configured [label = "configure(), createRequest()"];
|
||||||
* Configured -> Prepared [label = "allocateBuffers()"];
|
* Configured -> Running [label = "start()"];
|
||||||
*
|
*
|
||||||
* Prepared -> Configured [label = "freeBuffers()"];
|
* Running -> Configured [label = "stop()"];
|
||||||
* Prepared -> Prepared [label = "createRequest()"];
|
|
||||||
* Prepared -> Running [label = "start()"];
|
|
||||||
*
|
|
||||||
* Running -> Prepared [label = "stop()"];
|
|
||||||
* Running -> Running [label = "createRequest(), queueRequest()"];
|
* Running -> Running [label = "createRequest(), queueRequest()"];
|
||||||
* }
|
* }
|
||||||
* \enddot
|
* \enddot
|
||||||
|
@ -330,19 +323,14 @@ std::size_t CameraConfiguration::size() const
|
||||||
* Configured state.
|
* Configured state.
|
||||||
*
|
*
|
||||||
* \subsubsection Configured
|
* \subsubsection Configured
|
||||||
* The camera is configured and ready for the application to prepare it with
|
* The camera is configured and ready to be started. The application may
|
||||||
* resources. The camera may be reconfigured multiple times until resources
|
* release() the camera and to get back to the Available state or start()
|
||||||
* are provided and the state progresses to Prepared.
|
* it to progress to the Running state.
|
||||||
*
|
|
||||||
* \subsubsection Prepared
|
|
||||||
* The camera has been configured and provided with resources and is ready to be
|
|
||||||
* started. The application may free the camera's resources to get back to the
|
|
||||||
* Configured state or start() it to progress to the Running state.
|
|
||||||
*
|
*
|
||||||
* \subsubsection Running
|
* \subsubsection Running
|
||||||
* The camera is running and ready to process requests queued by the
|
* The camera is running and ready to process requests queued by the
|
||||||
* application. The camera remains in this state until it is stopped and moved
|
* application. The camera remains in this state until it is stopped and moved
|
||||||
* to the Prepared state.
|
* to the Configured state.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -420,7 +408,6 @@ static const char *const camera_state_names[] = {
|
||||||
"Available",
|
"Available",
|
||||||
"Acquired",
|
"Acquired",
|
||||||
"Configured",
|
"Configured",
|
||||||
"Prepared",
|
|
||||||
"Running",
|
"Running",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -465,8 +452,6 @@ bool Camera::stateIs(State state) const
|
||||||
*
|
*
|
||||||
* \todo Deal with pending requests if the camera is disconnected in a
|
* \todo Deal with pending requests if the camera is disconnected in a
|
||||||
* running state.
|
* running state.
|
||||||
* \todo Update comment about Running state when importing buffers as well as
|
|
||||||
* allocating them are supported.
|
|
||||||
*/
|
*/
|
||||||
void Camera::disconnect()
|
void Camera::disconnect()
|
||||||
{
|
{
|
||||||
|
@ -474,11 +459,11 @@ void Camera::disconnect()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the camera was running when the hardware was removed force the
|
* If the camera was running when the hardware was removed force the
|
||||||
* state to Prepared to allow applications to call freeBuffers() and
|
* state to Configured state to allow applications to free resources
|
||||||
* release() before deleting the camera.
|
* and call release() before deleting the camera.
|
||||||
*/
|
*/
|
||||||
if (state_ == CameraRunning)
|
if (state_ == CameraRunning)
|
||||||
state_ = CameraPrepared;
|
state_ = CameraConfigured;
|
||||||
|
|
||||||
disconnected_ = true;
|
disconnected_ = true;
|
||||||
disconnected.emit(this);
|
disconnected.emit(this);
|
||||||
|
@ -702,53 +687,6 @@ int Camera::configure(CameraConfiguration *config)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Allocate buffers for all configured streams
|
|
||||||
*
|
|
||||||
* This function affects the state of the camera, see \ref camera_operation.
|
|
||||||
*
|
|
||||||
* \return 0 on success or a negative error code otherwise
|
|
||||||
* \retval -ENODEV The camera has been disconnected from the system
|
|
||||||
* \retval -EACCES The camera is not in a state where buffers can be allocated
|
|
||||||
* \retval -EINVAL The configuration is not valid
|
|
||||||
*/
|
|
||||||
int Camera::allocateBuffers()
|
|
||||||
{
|
|
||||||
if (disconnected_)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
if (!stateIs(CameraConfigured))
|
|
||||||
return -EACCES;
|
|
||||||
|
|
||||||
if (activeStreams_.empty()) {
|
|
||||||
LOG(Camera, Error)
|
|
||||||
<< "Can't allocate buffers without streams";
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
state_ = CameraPrepared;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Release all buffers from allocated pools in each stream
|
|
||||||
*
|
|
||||||
* This function affects the state of the camera, see \ref camera_operation.
|
|
||||||
*
|
|
||||||
* \return 0 on success or a negative error code otherwise
|
|
||||||
* \retval -EACCES The camera is not in a state where buffers can be freed
|
|
||||||
*/
|
|
||||||
int Camera::freeBuffers()
|
|
||||||
{
|
|
||||||
if (!stateIs(CameraPrepared))
|
|
||||||
return -EACCES;
|
|
||||||
|
|
||||||
state_ = CameraConfigured;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Create a request object for the camera
|
* \brief Create a request object for the camera
|
||||||
* \param[in] cookie Opaque cookie for application use
|
* \param[in] cookie Opaque cookie for application use
|
||||||
|
@ -764,14 +702,14 @@ int Camera::freeBuffers()
|
||||||
* The ownership of the returned request is passed to the caller, which is
|
* The ownership of the returned request is passed to the caller, which is
|
||||||
* responsible for either queueing the request or deleting it.
|
* responsible for either queueing the request or deleting it.
|
||||||
*
|
*
|
||||||
* This function shall only be called when the camera is in the Prepared
|
* This function shall only be called when the camera is in the Configured
|
||||||
* or Running state, see \ref camera_operation.
|
* or Running state, see \ref camera_operation.
|
||||||
*
|
*
|
||||||
* \return A pointer to the newly created request, or nullptr on error
|
* \return A pointer to the newly created request, or nullptr on error
|
||||||
*/
|
*/
|
||||||
Request *Camera::createRequest(uint64_t cookie)
|
Request *Camera::createRequest(uint64_t cookie)
|
||||||
{
|
{
|
||||||
if (disconnected_ || !stateBetween(CameraPrepared, CameraRunning))
|
if (disconnected_ || !stateBetween(CameraConfigured, CameraRunning))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return new Request(this, cookie);
|
return new Request(this, cookie);
|
||||||
|
@ -842,7 +780,7 @@ int Camera::start()
|
||||||
if (disconnected_)
|
if (disconnected_)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
if (!stateIs(CameraPrepared))
|
if (!stateIs(CameraConfigured))
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
|
|
||||||
LOG(Camera, Debug) << "Starting capture";
|
LOG(Camera, Debug) << "Starting capture";
|
||||||
|
@ -885,7 +823,7 @@ int Camera::stop()
|
||||||
|
|
||||||
LOG(Camera, Debug) << "Stopping capture";
|
LOG(Camera, Debug) << "Stopping capture";
|
||||||
|
|
||||||
state_ = CameraPrepared;
|
state_ = CameraConfigured;
|
||||||
|
|
||||||
pipe_->stop(this);
|
pipe_->stop(this);
|
||||||
|
|
||||||
|
|
|
@ -116,8 +116,7 @@ FrameBufferAllocator::~FrameBufferAllocator()
|
||||||
*/
|
*/
|
||||||
int FrameBufferAllocator::allocate(Stream *stream)
|
int FrameBufferAllocator::allocate(Stream *stream)
|
||||||
{
|
{
|
||||||
if (camera_->state_ != Camera::CameraConfigured &&
|
if (camera_->state_ != Camera::CameraConfigured) {
|
||||||
camera_->state_ != Camera::CameraPrepared) {
|
|
||||||
LOG(Allocator, Error)
|
LOG(Allocator, Error)
|
||||||
<< "Camera must be in the configured state to allocate buffers";
|
<< "Camera must be in the configured state to allocate buffers";
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
|
@ -163,7 +162,7 @@ int FrameBufferAllocator::allocate(Stream *stream)
|
||||||
*/
|
*/
|
||||||
int FrameBufferAllocator::free(Stream *stream)
|
int FrameBufferAllocator::free(Stream *stream)
|
||||||
{
|
{
|
||||||
if (camera_->state_ != Camera::CameraConfigured && camera_->state_ != Camera::CameraPrepared) {
|
if (camera_->state_ != Camera::CameraConfigured) {
|
||||||
LOG(Allocator, Error)
|
LOG(Allocator, Error)
|
||||||
<< "Camera must be in the configured state to free buffers";
|
<< "Camera must be in the configured state to free buffers";
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
|
|
|
@ -172,13 +172,6 @@ int MainWindow::startCapture()
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
|
||||||
ret = camera_->allocateBuffers();
|
|
||||||
if (ret) {
|
|
||||||
std::cerr << "Failed to allocate buffers"
|
|
||||||
<< std::endl;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = allocator_->allocate(stream);
|
ret = allocator_->allocate(stream);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
std::cerr << "Failed to allocate capture buffers" << std::endl;
|
std::cerr << "Failed to allocate capture buffers" << std::endl;
|
||||||
|
@ -244,7 +237,6 @@ error:
|
||||||
}
|
}
|
||||||
mappedBuffers_.clear();
|
mappedBuffers_.clear();
|
||||||
|
|
||||||
camera_->freeBuffers();
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +256,6 @@ void MainWindow::stopCapture()
|
||||||
}
|
}
|
||||||
mappedBuffers_.clear();
|
mappedBuffers_.clear();
|
||||||
|
|
||||||
camera_->freeBuffers();
|
|
||||||
isCapturing_ = false;
|
isCapturing_ = false;
|
||||||
|
|
||||||
config_.reset();
|
config_.reset();
|
||||||
|
|
|
@ -121,10 +121,6 @@ int V4L2Camera::configure(StreamConfiguration *streamConfigOut,
|
||||||
|
|
||||||
int V4L2Camera::allocBuffers(unsigned int count)
|
int V4L2Camera::allocBuffers(unsigned int count)
|
||||||
{
|
{
|
||||||
int ret = camera_->allocateBuffers();
|
|
||||||
if (ret)
|
|
||||||
return ret == -EACCES ? -EBUSY : ret;
|
|
||||||
|
|
||||||
Stream *stream = *camera_->streams().begin();
|
Stream *stream = *camera_->streams().begin();
|
||||||
|
|
||||||
return bufferAllocator_->allocate(stream);
|
return bufferAllocator_->allocate(stream);
|
||||||
|
@ -134,7 +130,6 @@ void V4L2Camera::freeBuffers()
|
||||||
{
|
{
|
||||||
Stream *stream = *camera_->streams().begin();
|
Stream *stream = *camera_->streams().begin();
|
||||||
bufferAllocator_->free(stream);
|
bufferAllocator_->free(stream);
|
||||||
camera_->freeBuffers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FileDescriptor V4L2Camera::getBufferFd(unsigned int index)
|
FileDescriptor V4L2Camera::getBufferFd(unsigned int index)
|
||||||
|
|
|
@ -174,11 +174,6 @@ protected:
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (camera_->allocateBuffers()) {
|
|
||||||
std::cout << "Failed to allocate buffers" << std::endl;
|
|
||||||
return TestFail;
|
|
||||||
}
|
|
||||||
|
|
||||||
Stream *stream = cfg.stream();
|
Stream *stream = cfg.stream();
|
||||||
|
|
||||||
BufferSource source;
|
BufferSource source;
|
||||||
|
@ -244,11 +239,6 @@ protected:
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (camera_->freeBuffers()) {
|
|
||||||
std::cout << "Failed to free buffers" << std::endl;
|
|
||||||
return TestFail;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TestPass;
|
return TestPass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,11 +87,6 @@ protected:
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (camera_->allocateBuffers()) {
|
|
||||||
cout << "Failed to allocate buffers" << endl;
|
|
||||||
return TestFail;
|
|
||||||
}
|
|
||||||
|
|
||||||
Stream *stream = cfg.stream();
|
Stream *stream = cfg.stream();
|
||||||
|
|
||||||
int ret = allocator_->allocate(stream);
|
int ret = allocator_->allocate(stream);
|
||||||
|
@ -158,11 +153,6 @@ protected:
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (camera_->freeBuffers()) {
|
|
||||||
cout << "Failed to free buffers" << endl;
|
|
||||||
return TestFail;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TestPass;
|
return TestPass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,12 +29,6 @@ protected:
|
||||||
if (camera_->configure(defconf_.get()) != -EACCES)
|
if (camera_->configure(defconf_.get()) != -EACCES)
|
||||||
return TestFail;
|
return TestFail;
|
||||||
|
|
||||||
if (camera_->allocateBuffers() != -EACCES)
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
if (camera_->freeBuffers() != -EACCES)
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
if (camera_->createRequest())
|
if (camera_->createRequest())
|
||||||
return TestFail;
|
return TestFail;
|
||||||
|
|
||||||
|
@ -65,12 +59,6 @@ protected:
|
||||||
if (camera_->acquire() != -EBUSY)
|
if (camera_->acquire() != -EBUSY)
|
||||||
return TestFail;
|
return TestFail;
|
||||||
|
|
||||||
if (camera_->allocateBuffers() != -EACCES)
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
if (camera_->freeBuffers() != -EACCES)
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
if (camera_->createRequest())
|
if (camera_->createRequest())
|
||||||
return TestFail;
|
return TestFail;
|
||||||
|
|
||||||
|
@ -103,57 +91,6 @@ protected:
|
||||||
if (camera_->acquire() != -EBUSY)
|
if (camera_->acquire() != -EBUSY)
|
||||||
return TestFail;
|
return TestFail;
|
||||||
|
|
||||||
if (camera_->freeBuffers() != -EACCES)
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
if (camera_->createRequest())
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
Request request(camera_.get());
|
|
||||||
if (camera_->queueRequest(&request) != -EACCES)
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
if (camera_->start() != -EACCES)
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
if (camera_->stop() != -EACCES)
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
/* Test operations which should pass. */
|
|
||||||
if (camera_->configure(defconf_.get()))
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
/* Test valid state transitions, end in Prepared state. */
|
|
||||||
if (camera_->release())
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
if (camera_->acquire())
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
if (camera_->configure(defconf_.get()))
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
if (camera_->allocateBuffers())
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
return TestPass;
|
|
||||||
}
|
|
||||||
|
|
||||||
int testPrepared()
|
|
||||||
{
|
|
||||||
/* Test operations which should fail. */
|
|
||||||
if (camera_->acquire() != -EBUSY)
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
if (camera_->release() != -EBUSY)
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
if (camera_->configure(defconf_.get()) != -EACCES)
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
if (camera_->allocateBuffers() != -EACCES)
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
Request request1(camera_.get());
|
Request request1(camera_.get());
|
||||||
if (camera_->queueRequest(&request1) != -EACCES)
|
if (camera_->queueRequest(&request1) != -EACCES)
|
||||||
return TestFail;
|
return TestFail;
|
||||||
|
@ -170,9 +107,6 @@ protected:
|
||||||
delete request2;
|
delete request2;
|
||||||
|
|
||||||
/* Test valid state transitions, end in Running state. */
|
/* Test valid state transitions, end in Running state. */
|
||||||
if (camera_->freeBuffers())
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
if (camera_->release())
|
if (camera_->release())
|
||||||
return TestFail;
|
return TestFail;
|
||||||
|
|
||||||
|
@ -182,9 +116,6 @@ protected:
|
||||||
if (camera_->configure(defconf_.get()))
|
if (camera_->configure(defconf_.get()))
|
||||||
return TestFail;
|
return TestFail;
|
||||||
|
|
||||||
if (camera_->allocateBuffers())
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
/* Use internally allocated buffers. */
|
/* Use internally allocated buffers. */
|
||||||
allocator_ = FrameBufferAllocator::create(camera_);
|
allocator_ = FrameBufferAllocator::create(camera_);
|
||||||
Stream *stream = *camera_->streams().begin();
|
Stream *stream = *camera_->streams().begin();
|
||||||
|
@ -209,12 +140,6 @@ protected:
|
||||||
if (camera_->configure(defconf_.get()) != -EACCES)
|
if (camera_->configure(defconf_.get()) != -EACCES)
|
||||||
return TestFail;
|
return TestFail;
|
||||||
|
|
||||||
if (camera_->allocateBuffers() != -EACCES)
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
if (camera_->freeBuffers() != -EACCES)
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
if (camera_->start() != -EACCES)
|
if (camera_->start() != -EACCES)
|
||||||
return TestFail;
|
return TestFail;
|
||||||
|
|
||||||
|
@ -236,9 +161,6 @@ protected:
|
||||||
|
|
||||||
delete allocator_;
|
delete allocator_;
|
||||||
|
|
||||||
if (camera_->freeBuffers())
|
|
||||||
return TestFail;
|
|
||||||
|
|
||||||
if (camera_->release())
|
if (camera_->release())
|
||||||
return TestFail;
|
return TestFail;
|
||||||
|
|
||||||
|
@ -276,11 +198,6 @@ protected:
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (testPrepared() != TestPass) {
|
|
||||||
cout << "State machine in Prepared state failed" << endl;
|
|
||||||
return TestFail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (testRuning() != TestPass) {
|
if (testRuning() != TestPass) {
|
||||||
cout << "State machine in Running state failed" << endl;
|
cout << "State machine in Running state failed" << endl;
|
||||||
return TestFail;
|
return TestFail;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue