pipeline: raspberrypi: Rename RPi::RPiStream and RPi::RPiDevice
Rename RPi::RPiStream -> RPi::Stream and RPi::RPiDevice -> RPi::Device. There are no functional changes in this commit. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
94b667b43f
commit
2ba3c68b67
3 changed files with 46 additions and 46 deletions
|
@ -152,16 +152,16 @@ public:
|
||||||
void ispOutputDequeue(FrameBuffer *buffer);
|
void ispOutputDequeue(FrameBuffer *buffer);
|
||||||
|
|
||||||
void clearIncompleteRequests();
|
void clearIncompleteRequests();
|
||||||
void handleStreamBuffer(FrameBuffer *buffer, RPi::RPiStream *stream);
|
void handleStreamBuffer(FrameBuffer *buffer, RPi::Stream *stream);
|
||||||
void handleExternalBuffer(FrameBuffer *buffer, RPi::RPiStream *stream);
|
void handleExternalBuffer(FrameBuffer *buffer, RPi::Stream *stream);
|
||||||
void handleState();
|
void handleState();
|
||||||
|
|
||||||
CameraSensor *sensor_;
|
CameraSensor *sensor_;
|
||||||
/* Array of Unicam and ISP device streams and associated buffers/streams. */
|
/* Array of Unicam and ISP device streams and associated buffers/streams. */
|
||||||
RPi::RPiDevice<Unicam, 2> unicam_;
|
RPi::Device<Unicam, 2> unicam_;
|
||||||
RPi::RPiDevice<Isp, 4> isp_;
|
RPi::Device<Isp, 4> isp_;
|
||||||
/* The vector below is just for convenience when iterating over all streams. */
|
/* The vector below is just for convenience when iterating over all streams. */
|
||||||
std::vector<RPi::RPiStream *> streams_;
|
std::vector<RPi::Stream *> streams_;
|
||||||
/* Stores the ids of the buffers mapped in the IPA. */
|
/* Stores the ids of the buffers mapped in the IPA. */
|
||||||
std::unordered_set<unsigned int> ipaBuffers_;
|
std::unordered_set<unsigned int> ipaBuffers_;
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ private:
|
||||||
void tryRunPipeline();
|
void tryRunPipeline();
|
||||||
void tryFlushQueues();
|
void tryFlushQueues();
|
||||||
FrameBuffer *updateQueue(std::queue<FrameBuffer *> &q, uint64_t timestamp,
|
FrameBuffer *updateQueue(std::queue<FrameBuffer *> &q, uint64_t timestamp,
|
||||||
RPi::RPiStream *stream);
|
RPi::Stream *stream);
|
||||||
|
|
||||||
unsigned int ispOutputCount_;
|
unsigned int ispOutputCount_;
|
||||||
};
|
};
|
||||||
|
@ -703,7 +703,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
|
||||||
int PipelineHandlerRPi::exportFrameBuffers([[maybe_unused]] Camera *camera, Stream *stream,
|
int PipelineHandlerRPi::exportFrameBuffers([[maybe_unused]] Camera *camera, Stream *stream,
|
||||||
std::vector<std::unique_ptr<FrameBuffer>> *buffers)
|
std::vector<std::unique_ptr<FrameBuffer>> *buffers)
|
||||||
{
|
{
|
||||||
RPi::RPiStream *s = static_cast<RPi::RPiStream *>(stream);
|
RPi::Stream *s = static_cast<RPi::Stream *>(stream);
|
||||||
unsigned int count = stream->configuration().bufferCount;
|
unsigned int count = stream->configuration().bufferCount;
|
||||||
int ret = s->dev()->exportBuffers(count, buffers);
|
int ret = s->dev()->exportBuffers(count, buffers);
|
||||||
|
|
||||||
|
@ -872,14 +872,14 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Locate and open the unicam video streams. */
|
/* Locate and open the unicam video streams. */
|
||||||
data->unicam_[Unicam::Embedded] = RPi::RPiStream("Unicam Embedded", unicam_->getEntityByName("unicam-embedded"));
|
data->unicam_[Unicam::Embedded] = RPi::Stream("Unicam Embedded", unicam_->getEntityByName("unicam-embedded"));
|
||||||
data->unicam_[Unicam::Image] = RPi::RPiStream("Unicam Image", unicam_->getEntityByName("unicam-image"));
|
data->unicam_[Unicam::Image] = RPi::Stream("Unicam Image", unicam_->getEntityByName("unicam-image"));
|
||||||
|
|
||||||
/* Tag the ISP input stream as an import stream. */
|
/* Tag the ISP input stream as an import stream. */
|
||||||
data->isp_[Isp::Input] = RPi::RPiStream("ISP Input", isp_->getEntityByName("bcm2835-isp0-output0"), true);
|
data->isp_[Isp::Input] = RPi::Stream("ISP Input", isp_->getEntityByName("bcm2835-isp0-output0"), true);
|
||||||
data->isp_[Isp::Output0] = RPi::RPiStream("ISP Output0", isp_->getEntityByName("bcm2835-isp0-capture1"));
|
data->isp_[Isp::Output0] = RPi::Stream("ISP Output0", isp_->getEntityByName("bcm2835-isp0-capture1"));
|
||||||
data->isp_[Isp::Output1] = RPi::RPiStream("ISP Output1", isp_->getEntityByName("bcm2835-isp0-capture2"));
|
data->isp_[Isp::Output1] = RPi::Stream("ISP Output1", isp_->getEntityByName("bcm2835-isp0-capture2"));
|
||||||
data->isp_[Isp::Stats] = RPi::RPiStream("ISP Stats", isp_->getEntityByName("bcm2835-isp0-capture3"));
|
data->isp_[Isp::Stats] = RPi::Stream("ISP Stats", isp_->getEntityByName("bcm2835-isp0-capture3"));
|
||||||
|
|
||||||
/* This is just for convenience so that we can easily iterate over all streams. */
|
/* This is just for convenience so that we can easily iterate over all streams. */
|
||||||
for (auto &stream : data->unicam_)
|
for (auto &stream : data->unicam_)
|
||||||
|
@ -1031,7 +1031,7 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera)
|
||||||
*/
|
*/
|
||||||
unsigned int maxBuffers = 0;
|
unsigned int maxBuffers = 0;
|
||||||
for (const Stream *s : camera->streams())
|
for (const Stream *s : camera->streams())
|
||||||
if (static_cast<const RPi::RPiStream *>(s)->isExternal())
|
if (static_cast<const RPi::Stream *>(s)->isExternal())
|
||||||
maxBuffers = std::max(maxBuffers, s->configuration().bufferCount);
|
maxBuffers = std::max(maxBuffers, s->configuration().bufferCount);
|
||||||
|
|
||||||
for (auto const stream : data->streams_) {
|
for (auto const stream : data->streams_) {
|
||||||
|
@ -1272,13 +1272,13 @@ done:
|
||||||
|
|
||||||
void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)
|
void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)
|
||||||
{
|
{
|
||||||
RPi::RPiStream *stream = nullptr;
|
RPi::Stream *stream = nullptr;
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
if (state_ == State::Stopped)
|
if (state_ == State::Stopped)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (RPi::RPiStream &s : unicam_) {
|
for (RPi::Stream &s : unicam_) {
|
||||||
index = s.getBufferId(buffer);
|
index = s.getBufferId(buffer);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
stream = &s;
|
stream = &s;
|
||||||
|
@ -1340,13 +1340,13 @@ void RPiCameraData::ispInputDequeue(FrameBuffer *buffer)
|
||||||
|
|
||||||
void RPiCameraData::ispOutputDequeue(FrameBuffer *buffer)
|
void RPiCameraData::ispOutputDequeue(FrameBuffer *buffer)
|
||||||
{
|
{
|
||||||
RPi::RPiStream *stream = nullptr;
|
RPi::Stream *stream = nullptr;
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
if (state_ == State::Stopped)
|
if (state_ == State::Stopped)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (RPi::RPiStream &s : isp_) {
|
for (RPi::Stream &s : isp_) {
|
||||||
index = s.getBufferId(buffer);
|
index = s.getBufferId(buffer);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
stream = &s;
|
stream = &s;
|
||||||
|
@ -1436,7 +1436,7 @@ void RPiCameraData::clearIncompleteRequests()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RPiCameraData::handleStreamBuffer(FrameBuffer *buffer, RPi::RPiStream *stream)
|
void RPiCameraData::handleStreamBuffer(FrameBuffer *buffer, RPi::Stream *stream)
|
||||||
{
|
{
|
||||||
if (stream->isExternal()) {
|
if (stream->isExternal()) {
|
||||||
/*
|
/*
|
||||||
|
@ -1469,7 +1469,7 @@ void RPiCameraData::handleStreamBuffer(FrameBuffer *buffer, RPi::RPiStream *stre
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RPiCameraData::handleExternalBuffer(FrameBuffer *buffer, RPi::RPiStream *stream)
|
void RPiCameraData::handleExternalBuffer(FrameBuffer *buffer, RPi::Stream *stream)
|
||||||
{
|
{
|
||||||
unsigned int id = stream->getBufferId(buffer);
|
unsigned int id = stream->getBufferId(buffer);
|
||||||
|
|
||||||
|
@ -1649,7 +1649,7 @@ void RPiCameraData::tryFlushQueues()
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameBuffer *RPiCameraData::updateQueue(std::queue<FrameBuffer *> &q, uint64_t timestamp,
|
FrameBuffer *RPiCameraData::updateQueue(std::queue<FrameBuffer *> &q, uint64_t timestamp,
|
||||||
RPi::RPiStream *stream)
|
RPi::Stream *stream)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* If the unicam streams are external (both have be to the same), then we
|
* If the unicam streams are external (both have be to the same), then we
|
||||||
|
|
|
@ -14,46 +14,46 @@ LOG_DEFINE_CATEGORY(RPISTREAM)
|
||||||
|
|
||||||
namespace RPi {
|
namespace RPi {
|
||||||
|
|
||||||
V4L2VideoDevice *RPiStream::dev() const
|
V4L2VideoDevice *Stream::dev() const
|
||||||
{
|
{
|
||||||
return dev_.get();
|
return dev_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string RPiStream::name() const
|
std::string Stream::name() const
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RPiStream::reset()
|
void Stream::reset()
|
||||||
{
|
{
|
||||||
external_ = false;
|
external_ = false;
|
||||||
clearBuffers();
|
clearBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RPiStream::setExternal(bool external)
|
void Stream::setExternal(bool external)
|
||||||
{
|
{
|
||||||
/* Import streams cannot be external. */
|
/* Import streams cannot be external. */
|
||||||
ASSERT(!external || !importOnly_);
|
ASSERT(!external || !importOnly_);
|
||||||
external_ = external;
|
external_ = external;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RPiStream::isExternal() const
|
bool Stream::isExternal() const
|
||||||
{
|
{
|
||||||
return external_;
|
return external_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RPiStream::setExportedBuffers(std::vector<std::unique_ptr<FrameBuffer>> *buffers)
|
void Stream::setExportedBuffers(std::vector<std::unique_ptr<FrameBuffer>> *buffers)
|
||||||
{
|
{
|
||||||
for (auto const &buffer : *buffers)
|
for (auto const &buffer : *buffers)
|
||||||
bufferMap_.emplace(id_.get(), buffer.get());
|
bufferMap_.emplace(id_.get(), buffer.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
const BufferMap &RPiStream::getBuffers() const
|
const BufferMap &Stream::getBuffers() const
|
||||||
{
|
{
|
||||||
return bufferMap_;
|
return bufferMap_;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RPiStream::getBufferId(FrameBuffer *buffer) const
|
int Stream::getBufferId(FrameBuffer *buffer) const
|
||||||
{
|
{
|
||||||
if (importOnly_)
|
if (importOnly_)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -68,12 +68,12 @@ int RPiStream::getBufferId(FrameBuffer *buffer) const
|
||||||
return it->first;
|
return it->first;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RPiStream::setExternalBuffer(FrameBuffer *buffer)
|
void Stream::setExternalBuffer(FrameBuffer *buffer)
|
||||||
{
|
{
|
||||||
bufferMap_.emplace(RPiBufferMask::EXTERNAL_BUFFER | id_.get(), buffer);
|
bufferMap_.emplace(RPiBufferMask::EXTERNAL_BUFFER | id_.get(), buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RPiStream::removeExternalBuffer(FrameBuffer *buffer)
|
void Stream::removeExternalBuffer(FrameBuffer *buffer)
|
||||||
{
|
{
|
||||||
int id = getBufferId(buffer);
|
int id = getBufferId(buffer);
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ void RPiStream::removeExternalBuffer(FrameBuffer *buffer)
|
||||||
bufferMap_.erase(id);
|
bufferMap_.erase(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RPiStream::prepareBuffers(unsigned int count)
|
int Stream::prepareBuffers(unsigned int count)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ int RPiStream::prepareBuffers(unsigned int count)
|
||||||
return dev_->importBuffers(count);
|
return dev_->importBuffers(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RPiStream::queueBuffer(FrameBuffer *buffer)
|
int Stream::queueBuffer(FrameBuffer *buffer)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* A nullptr buffer implies an external stream, but no external
|
* A nullptr buffer implies an external stream, but no external
|
||||||
|
@ -147,7 +147,7 @@ int RPiStream::queueBuffer(FrameBuffer *buffer)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RPiStream::returnBuffer(FrameBuffer *buffer)
|
void Stream::returnBuffer(FrameBuffer *buffer)
|
||||||
{
|
{
|
||||||
/* This can only be called for external streams. */
|
/* This can only be called for external streams. */
|
||||||
ASSERT(external_);
|
ASSERT(external_);
|
||||||
|
@ -186,7 +186,7 @@ void RPiStream::returnBuffer(FrameBuffer *buffer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int RPiStream::queueAllBuffers()
|
int Stream::queueAllBuffers()
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -204,13 +204,13 @@ int RPiStream::queueAllBuffers()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RPiStream::releaseBuffers()
|
void Stream::releaseBuffers()
|
||||||
{
|
{
|
||||||
dev_->releaseBuffers();
|
dev_->releaseBuffers();
|
||||||
clearBuffers();
|
clearBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RPiStream::clearBuffers()
|
void Stream::clearBuffers()
|
||||||
{
|
{
|
||||||
availableBuffers_ = std::queue<FrameBuffer *>{};
|
availableBuffers_ = std::queue<FrameBuffer *>{};
|
||||||
requestBuffers_ = std::queue<FrameBuffer *>{};
|
requestBuffers_ = std::queue<FrameBuffer *>{};
|
||||||
|
@ -219,7 +219,7 @@ void RPiStream::clearBuffers()
|
||||||
id_.reset();
|
id_.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
int RPiStream::queueToDevice(FrameBuffer *buffer)
|
int Stream::queueToDevice(FrameBuffer *buffer)
|
||||||
{
|
{
|
||||||
LOG(RPISTREAM, Debug) << "Queuing buffer " << getBufferId(buffer)
|
LOG(RPISTREAM, Debug) << "Queuing buffer " << getBufferId(buffer)
|
||||||
<< " for " << name_;
|
<< " for " << name_;
|
||||||
|
|
|
@ -27,15 +27,15 @@ using BufferMap = std::unordered_map<unsigned int, FrameBuffer *>;
|
||||||
* Device stream abstraction for either an internal or external stream.
|
* Device stream abstraction for either an internal or external stream.
|
||||||
* Used for both Unicam and the ISP.
|
* Used for both Unicam and the ISP.
|
||||||
*/
|
*/
|
||||||
class RPiStream : public Stream
|
class Stream : public libcamera::Stream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RPiStream()
|
Stream()
|
||||||
: id_(RPiBufferMask::ID)
|
: id_(RPiBufferMask::ID)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
RPiStream(const char *name, MediaEntity *dev, bool importOnly = false)
|
Stream(const char *name, MediaEntity *dev, bool importOnly = false)
|
||||||
: external_(false), importOnly_(importOnly), name_(name),
|
: external_(false), importOnly_(importOnly), name_(name),
|
||||||
dev_(std::make_unique<V4L2VideoDevice>(dev)), id_(RPiBufferMask::ID)
|
dev_(std::make_unique<V4L2VideoDevice>(dev)), id_(RPiBufferMask::ID)
|
||||||
{
|
{
|
||||||
|
@ -155,7 +155,7 @@ private:
|
||||||
* streams indexed with an enum class.
|
* streams indexed with an enum class.
|
||||||
*/
|
*/
|
||||||
template<typename E, std::size_t N>
|
template<typename E, std::size_t N>
|
||||||
class RPiDevice : public std::array<class RPiStream, N>
|
class Device : public std::array<class Stream, N>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
constexpr auto index(E e) const noexcept
|
constexpr auto index(E e) const noexcept
|
||||||
|
@ -163,13 +163,13 @@ private:
|
||||||
return static_cast<std::underlying_type_t<E>>(e);
|
return static_cast<std::underlying_type_t<E>>(e);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
RPiStream &operator[](E e)
|
Stream &operator[](E e)
|
||||||
{
|
{
|
||||||
return std::array<class RPiStream, N>::operator[](index(e));
|
return std::array<class Stream, N>::operator[](index(e));
|
||||||
}
|
}
|
||||||
const RPiStream &operator[](E e) const
|
const Stream &operator[](E e) const
|
||||||
{
|
{
|
||||||
return std::array<class RPiStream, N>::operator[](index(e));
|
return std::array<class Stream, N>::operator[](index(e));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue