mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-25 01:25:08 +03:00
pipeline: raspberrypi: Repurpose RPi::Stream::reset()
The original use of RPi::Stream::reset() was to clear the external flag state and free/clear out the framebuffers for the stream. However, the latter is now done through PipelineHandlerRPi::configure(). Rework PipelineHandlerRPi::configure() to call RPi::Stream::setExternal() instead of RPi::Stream::reset() to achieve the same thing. Repurpose RPi::Stream::reset() to instead reset the state of the buffer handling logic, where all internally allocated buffers are put back into the queue of available buffers. As such, rename the function to RPi::Stream::resetbuffers(). This resetbuffers() is now called from PipelineHandlerRPi::start(), allowing the pipeline handler to correctly deal with start()/stop()/start() sequences and reusing the buffers allocated on the first start(). Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Tested-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
6ab7d87ff2
commit
ec173ef5d3
3 changed files with 11 additions and 9 deletions
|
@ -693,7 +693,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
|
|||
/* Start by freeing all buffers and reset the Unicam and ISP stream states. */
|
||||
data->freeBuffers();
|
||||
for (auto const stream : data->streams_)
|
||||
stream->reset();
|
||||
stream->setExternal(false);
|
||||
|
||||
BayerFormat::Packing packing = BayerFormat::Packing::CSI2;
|
||||
Size maxSize, sensorSize;
|
||||
|
@ -991,6 +991,9 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)
|
|||
RPiCameraData *data = cameraData(camera);
|
||||
int ret;
|
||||
|
||||
for (auto const stream : data->streams_)
|
||||
stream->resetBuffers();
|
||||
|
||||
if (!data->buffersAllocated_) {
|
||||
/* Allocate buffers for internal pipeline usage. */
|
||||
ret = prepareBuffers(camera);
|
||||
|
|
|
@ -26,10 +26,12 @@ std::string Stream::name() const
|
|||
return name_;
|
||||
}
|
||||
|
||||
void Stream::reset()
|
||||
void Stream::resetBuffers()
|
||||
{
|
||||
external_ = false;
|
||||
clearBuffers();
|
||||
/* Add all internal buffers to the queue of usable buffers. */
|
||||
availableBuffers_ = {};
|
||||
for (auto const &buffer : internalBuffers_)
|
||||
availableBuffers_.push(buffer.get());
|
||||
}
|
||||
|
||||
void Stream::setExternal(bool external)
|
||||
|
@ -97,10 +99,7 @@ int Stream::prepareBuffers(unsigned int count)
|
|||
|
||||
/* Add these exported buffers to the internal/external buffer list. */
|
||||
setExportedBuffers(&internalBuffers_);
|
||||
|
||||
/* Add these buffers to the queue of internal usable buffers. */
|
||||
for (auto const &buffer : internalBuffers_)
|
||||
availableBuffers_.push(buffer.get());
|
||||
resetBuffers();
|
||||
}
|
||||
|
||||
/* We must import all internal/external exported buffers. */
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
V4L2VideoDevice *dev() const;
|
||||
std::string name() const;
|
||||
bool isImporter() const;
|
||||
void reset();
|
||||
void resetBuffers();
|
||||
|
||||
void setExternal(bool external);
|
||||
bool isExternal() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue