[libcamera-devel] [PATCH v2 08/13] libcamera: pipeline: rkisp1: Prefix main path video and resizer
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Tue Sep 15 02:48:27 CEST 2020
Hi Niklas,
Thank you for the patch.
On Mon, Sep 14, 2020 at 04:21:44PM +0200, Niklas Söderlund wrote:
> In preparation of supporting both the main and self path prefix the main
> path specific variables with mainPath.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
> src/libcamera/pipeline/rkisp1/rkisp1.cpp | 82 ++++++++++++------------
> 1 file changed, 41 insertions(+), 41 deletions(-)
>
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> index 45c5e40186df693d..4e1295486c184178 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> @@ -68,7 +68,7 @@ struct RkISP1FrameInfo {
>
> FrameBuffer *paramBuffer;
> FrameBuffer *statBuffer;
> - FrameBuffer *videoBuffer;
> + FrameBuffer *mainPathBuffer;
>
> bool paramFilled;
> bool paramDequeued;
> @@ -133,7 +133,7 @@ class RkISP1CameraData : public CameraData
> public:
> RkISP1CameraData(PipelineHandler *pipe, V4L2VideoDevice *video)
> : CameraData(pipe), sensor_(nullptr), frame_(0),
> - frameInfo_(pipe), video_(video)
> + frameInfo_(pipe), mainPathVideo_(video)
> {
> }
>
> @@ -144,14 +144,14 @@ public:
>
> int loadIPA();
>
> - Stream stream_;
> + Stream mainPathStream_;
> CameraSensor *sensor_;
> unsigned int frame_;
> std::vector<IPABuffer> ipaBuffers_;
> RkISP1Frames frameInfo_;
> RkISP1Timeline timeline_;
>
> - V4L2VideoDevice *video_;
> + V4L2VideoDevice *mainPathVideo_;
>
> private:
> void queueFrameAction(unsigned int frame,
> @@ -227,8 +227,8 @@ private:
>
> MediaDevice *media_;
> V4L2Subdevice *isp_;
> - V4L2Subdevice *resizer_;
> - V4L2VideoDevice *video_;
> + V4L2Subdevice *mainPathResizer_;
> + V4L2VideoDevice *mainPathVideo_;
With the assumption you will follow up with a patch that creates a
RkISP1Path (or RkISP1Stream) class, stored in the RkISP1PipelineHandler
class, as discussed in the review of v1,
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> V4L2VideoDevice *param_;
> V4L2VideoDevice *stat_;
>
> @@ -261,8 +261,8 @@ RkISP1FrameInfo *RkISP1Frames::create(const RkISP1CameraData *data, Request *req
> }
> FrameBuffer *statBuffer = pipe_->availableStatBuffers_.front();
>
> - FrameBuffer *videoBuffer = request->findBuffer(&data->stream_);
> - if (!videoBuffer) {
> + FrameBuffer *mainPathBuffer = request->findBuffer(&data->mainPathStream_);
> + if (!mainPathBuffer) {
> LOG(RkISP1, Error)
> << "Attempt to queue request with invalid stream";
> return nullptr;
> @@ -276,7 +276,7 @@ RkISP1FrameInfo *RkISP1Frames::create(const RkISP1CameraData *data, Request *req
> info->frame = frame;
> info->request = request;
> info->paramBuffer = paramBuffer;
> - info->videoBuffer = videoBuffer;
> + info->mainPathBuffer = mainPathBuffer;
> info->statBuffer = statBuffer;
> info->paramFilled = false;
> info->paramDequeued = false;
> @@ -335,7 +335,7 @@ RkISP1FrameInfo *RkISP1Frames::find(FrameBuffer *buffer)
>
> if (info->paramBuffer == buffer ||
> info->statBuffer == buffer ||
> - info->videoBuffer == buffer)
> + info->mainPathBuffer == buffer)
> return info;
> }
>
> @@ -407,7 +407,7 @@ protected:
>
> pipe_->param_->queueBuffer(info->paramBuffer);
> pipe_->stat_->queueBuffer(info->statBuffer);
> - pipe_->video_->queueBuffer(info->videoBuffer);
> + pipe_->mainPathVideo_->queueBuffer(info->mainPathBuffer);
> }
>
> private:
> @@ -546,10 +546,10 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()
> cfg.bufferCount = RKISP1_BUFFER_COUNT;
>
> V4L2DeviceFormat format = {};
> - format.fourcc = data_->video_->toV4L2PixelFormat(cfg.pixelFormat);
> + format.fourcc = data_->mainPathVideo_->toV4L2PixelFormat(cfg.pixelFormat);
> format.size = cfg.size;
>
> - int ret = data_->video_->tryFormat(&format);
> + int ret = data_->mainPathVideo_->tryFormat(&format);
> if (ret)
> return Invalid;
>
> @@ -560,8 +560,8 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()
> }
>
> PipelineHandlerRkISP1::PipelineHandlerRkISP1(CameraManager *manager)
> - : PipelineHandler(manager), isp_(nullptr), resizer_(nullptr),
> - video_(nullptr), param_(nullptr), stat_(nullptr)
> + : PipelineHandler(manager), isp_(nullptr), mainPathResizer_(nullptr),
> + mainPathVideo_(nullptr), param_(nullptr), stat_(nullptr)
> {
> }
>
> @@ -569,8 +569,8 @@ PipelineHandlerRkISP1::~PipelineHandlerRkISP1()
> {
> delete param_;
> delete stat_;
> - delete video_;
> - delete resizer_;
> + delete mainPathVideo_;
> + delete mainPathResizer_;
> delete isp_;
> }
>
> @@ -651,7 +651,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)
>
> LOG(RkISP1, Debug) << "ISP output pad configured with " << format.toString();
>
> - ret = resizer_->setFormat(0, &format);
> + ret = mainPathResizer_->setFormat(0, &format);
> if (ret < 0)
> return ret;
>
> @@ -661,7 +661,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)
>
> LOG(RkISP1, Debug) << "Configuring resizer output pad with " << format.toString();
>
> - ret = resizer_->setFormat(1, &format);
> + ret = mainPathResizer_->setFormat(1, &format);
> if (ret < 0)
> return ret;
>
> @@ -669,16 +669,16 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)
>
> const PixelFormatInfo &info = PixelFormatInfo::info(cfg.pixelFormat);
> V4L2DeviceFormat outputFormat = {};
> - outputFormat.fourcc = video_->toV4L2PixelFormat(cfg.pixelFormat);
> + outputFormat.fourcc = mainPathVideo_->toV4L2PixelFormat(cfg.pixelFormat);
> outputFormat.size = cfg.size;
> outputFormat.planesCount = info.numPlanes();
>
> - ret = video_->setFormat(&outputFormat);
> + ret = mainPathVideo_->setFormat(&outputFormat);
> if (ret)
> return ret;
>
> if (outputFormat.size != cfg.size ||
> - outputFormat.fourcc != video_->toV4L2PixelFormat(cfg.pixelFormat)) {
> + outputFormat.fourcc != mainPathVideo_->toV4L2PixelFormat(cfg.pixelFormat)) {
> LOG(RkISP1, Error)
> << "Unable to configure capture in " << cfg.toString();
> return -EINVAL;
> @@ -696,7 +696,7 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)
> if (ret)
> return ret;
>
> - cfg.setStream(&data->stream_);
> + cfg.setStream(&data->mainPathStream_);
>
> return 0;
> }
> @@ -705,17 +705,17 @@ int PipelineHandlerRkISP1::exportFrameBuffers([[maybe_unused]] Camera *camera, S
> std::vector<std::unique_ptr<FrameBuffer>> *buffers)
> {
> unsigned int count = stream->configuration().bufferCount;
> - return video_->exportBuffers(count, buffers);
> + return mainPathVideo_->exportBuffers(count, buffers);
> }
>
> int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)
> {
> RkISP1CameraData *data = cameraData(camera);
> - unsigned int count = data->stream_.configuration().bufferCount;
> + unsigned int count = data->mainPathStream_.configuration().bufferCount;
> unsigned int ipaBufferId = 1;
> int ret;
>
> - ret = video_->importBuffers(count);
> + ret = mainPathVideo_->importBuffers(count);
> if (ret < 0)
> goto error;
>
> @@ -748,7 +748,7 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)
> error:
> paramBuffers_.clear();
> statBuffers_.clear();
> - video_->releaseBuffers();
> + mainPathVideo_->releaseBuffers();
>
> return ret;
> }
> @@ -779,8 +779,8 @@ int PipelineHandlerRkISP1::freeBuffers(Camera *camera)
> if (stat_->releaseBuffers())
> LOG(RkISP1, Error) << "Failed to release stat buffers";
>
> - if (video_->releaseBuffers())
> - LOG(RkISP1, Error) << "Failed to release video buffers";
> + if (mainPathVideo_->releaseBuffers())
> + LOG(RkISP1, Error) << "Failed to release main path buffers";
>
> return 0;
> }
> @@ -824,7 +824,7 @@ int PipelineHandlerRkISP1::start(Camera *camera)
> return ret;
> }
>
> - ret = video_->streamOn();
> + ret = mainPathVideo_->streamOn();
> if (ret) {
> param_->streamOff();
> stat_->streamOff();
> @@ -849,8 +849,8 @@ int PipelineHandlerRkISP1::start(Camera *camera)
>
> std::map<unsigned int, IPAStream> streamConfig;
> streamConfig[0] = {
> - .pixelFormat = data->stream_.configuration().pixelFormat,
> - .size = data->stream_.configuration().size,
> + .pixelFormat = data->mainPathStream_.configuration().pixelFormat,
> + .size = data->mainPathStream_.configuration().size,
> };
>
> std::map<unsigned int, const ControlInfoMap &> entityControls;
> @@ -868,7 +868,7 @@ void PipelineHandlerRkISP1::stop(Camera *camera)
> RkISP1CameraData *data = cameraData(camera);
> int ret;
>
> - ret = video_->streamOff();
> + ret = mainPathVideo_->streamOff();
> if (ret)
> LOG(RkISP1, Warning)
> << "Failed to stop camera " << camera->id();
> @@ -953,7 +953,7 @@ int PipelineHandlerRkISP1::initLinks(const Camera *camera,
>
> for (const StreamConfiguration &cfg : config) {
> MediaLink *link = nullptr;
> - if (cfg.stream() == &data->stream_)
> + if (cfg.stream() == &data->mainPathStream_)
> link = media_->link("rkisp1_isp", 2,
> "rkisp1_resizer_mainpath", 0);
> else
> @@ -975,7 +975,7 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)
> int ret;
>
> std::unique_ptr<RkISP1CameraData> data =
> - std::make_unique<RkISP1CameraData>(this, video_);
> + std::make_unique<RkISP1CameraData>(this, mainPathVideo_);
>
> ControlInfoMap::Map ctrls;
> ctrls.emplace(std::piecewise_construct,
> @@ -996,7 +996,7 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)
> if (ret)
> return ret;
>
> - std::set<Stream *> streams{ &data->stream_ };
> + std::set<Stream *> streams{ &data->mainPathStream_ };
> std::shared_ptr<Camera> camera =
> Camera::create(this, data->sensor_->id(), streams);
> registerCamera(std::move(camera), std::move(data));
> @@ -1026,13 +1026,13 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)
> if (isp_->open() < 0)
> return false;
>
> - resizer_ = V4L2Subdevice::fromEntityName(media_, "rkisp1_resizer_mainpath");
> - if (resizer_->open() < 0)
> + mainPathResizer_ = V4L2Subdevice::fromEntityName(media_, "rkisp1_resizer_mainpath");
> + if (mainPathResizer_->open() < 0)
> return false;
>
> /* Locate and open the capture video node. */
> - video_ = V4L2VideoDevice::fromEntityName(media_, "rkisp1_mainpath");
> - if (video_->open() < 0)
> + mainPathVideo_ = V4L2VideoDevice::fromEntityName(media_, "rkisp1_mainpath");
> + if (mainPathVideo_->open() < 0)
> return false;
>
> stat_ = V4L2VideoDevice::fromEntityName(media_, "rkisp1_stats");
> @@ -1043,7 +1043,7 @@ bool PipelineHandlerRkISP1::match(DeviceEnumerator *enumerator)
> if (param_->open() < 0)
> return false;
>
> - video_->bufferReady.connect(this, &PipelineHandlerRkISP1::bufferReady);
> + mainPathVideo_->bufferReady.connect(this, &PipelineHandlerRkISP1::bufferReady);
> stat_->bufferReady.connect(this, &PipelineHandlerRkISP1::statReady);
> param_->bufferReady.connect(this, &PipelineHandlerRkISP1::paramReady);
>
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list