[libcamera-devel,23/30] libcamera: pipelines: Switch to V4L2Stream

Message ID 20191126233620.1695316-24-niklas.soderlund@ragnatech.se
State Superseded
Headers show
Series
  • libcamera: Rework buffer API
Related show

Commit Message

Niklas Söderlund Nov. 26, 2019, 11:36 p.m. UTC
Prepare to switch to the FrameBuffer interface by using V4L2Stream. This
does not break current operations as changes in applications are needed
to switch interface.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 src/libcamera/pipeline/ipu3/ipu3.cpp     | 5 +++--
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 2 +-
 src/libcamera/pipeline/uvcvideo.cpp      | 2 +-
 src/libcamera/pipeline/vimc.cpp          | 2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)

Comments

Jacopo Mondi Dec. 2, 2019, 12:20 p.m. UTC | #1
Hi Niklas,

On Wed, Nov 27, 2019 at 12:36:13AM +0100, Niklas Söderlund wrote:
> Prepare to switch to the FrameBuffer interface by using V4L2Stream. This
> does not break current operations as changes in applications are needed
> to switch interface.

I would move 21/30 after 22/30 and merge it with this one
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> ---
>  src/libcamera/pipeline/ipu3/ipu3.cpp     | 5 +++--
>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 2 +-
>  src/libcamera/pipeline/uvcvideo.cpp      | 2 +-
>  src/libcamera/pipeline/vimc.cpp          | 2 +-
>  4 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index 094c4db6bc32b683..5080ac6c4d0abe3b 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -135,11 +135,12 @@ public:
>  	BufferPool pool_;
>  };
>
> -class IPU3Stream : public Stream
> +class IPU3Stream : public V4L2Stream
>  {
>  public:
>  	IPU3Stream(ImgUDevice::ImgUOutput *device, const std::string &name)
> -		: active_(false), name_(name), device_(device)
> +		: V4L2Stream(device->dev), active_(false), name_(name),
> +		  device_(device)
>  	{
>  	}
>
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> index 1ae50bec0d401b3f..ca3d92c7ad637c3a 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> @@ -888,7 +888,7 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)
>  	std::unique_ptr<RkISP1CameraData> data =
>  		utils::make_unique<RkISP1CameraData>(this);
>
> -	data->stream_ = new Stream();
> +	data->stream_ = new V4L2Stream(video_);
>
>  	ControlInfoMap::Map ctrls;
>  	ctrls.emplace(std::piecewise_construct,
> diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp
> index 64fc488912e5a82f..9cc90bf454cb4392 100644
> --- a/src/libcamera/pipeline/uvcvideo.cpp
> +++ b/src/libcamera/pipeline/uvcvideo.cpp
> @@ -331,7 +331,7 @@ int UVCCameraData::init(MediaEntity *entity)
>  	if (ret)
>  		return ret;
>
> -	stream_ = new Stream();
> +	stream_ = new V4L2Stream(video_);
>
>  	video_->bufferReady.connect(this, &UVCCameraData::bufferReady);
>
> diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp
> index 3f9e92163642f0c2..b1222bd21fb629a0 100644
> --- a/src/libcamera/pipeline/vimc.cpp
> +++ b/src/libcamera/pipeline/vimc.cpp
> @@ -420,7 +420,7 @@ int VimcCameraData::init(MediaDevice *media)
>  	if (video_->open())
>  		return -ENODEV;
>
> -	stream_ = new Stream();
> +	stream_ = new V4L2Stream(video_);
>
>  	video_->bufferReady.connect(this, &VimcCameraData::bufferReady);
>
> --
> 2.24.0
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Laurent Pinchart Dec. 15, 2019, 1:51 a.m. UTC | #2
Hi Niklas,

Thank you for the patch.

On Mon, Dec 02, 2019 at 01:20:15PM +0100, Jacopo Mondi wrote:
> On Wed, Nov 27, 2019 at 12:36:13AM +0100, Niklas Söderlund wrote:
> > Prepare to switch to the FrameBuffer interface by using V4L2Stream. This
> > does not break current operations as changes in applications are needed
> > to switch interface.
> 
> I would move 21/30 after 22/30 and merge it with this one

Agreed.

> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> > ---
> >  src/libcamera/pipeline/ipu3/ipu3.cpp     | 5 +++--
> >  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 2 +-
> >  src/libcamera/pipeline/uvcvideo.cpp      | 2 +-
> >  src/libcamera/pipeline/vimc.cpp          | 2 +-
> >  4 files changed, 6 insertions(+), 5 deletions(-)
> >
> > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> > index 094c4db6bc32b683..5080ac6c4d0abe3b 100644
> > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> > @@ -135,11 +135,12 @@ public:
> >  	BufferPool pool_;
> >  };
> >
> > -class IPU3Stream : public Stream
> > +class IPU3Stream : public V4L2Stream
> >  {
> >  public:
> >  	IPU3Stream(ImgUDevice::ImgUOutput *device, const std::string &name)
> > -		: active_(false), name_(name), device_(device)
> > +		: V4L2Stream(device->dev), active_(false), name_(name),
> > +		  device_(device)
> >  	{
> >  	}
> >
> > diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> > index 1ae50bec0d401b3f..ca3d92c7ad637c3a 100644
> > --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> > +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> > @@ -888,7 +888,7 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)
> >  	std::unique_ptr<RkISP1CameraData> data =
> >  		utils::make_unique<RkISP1CameraData>(this);
> >
> > -	data->stream_ = new Stream();
> > +	data->stream_ = new V4L2Stream(video_);
> >
> >  	ControlInfoMap::Map ctrls;
> >  	ctrls.emplace(std::piecewise_construct,
> > diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp
> > index 64fc488912e5a82f..9cc90bf454cb4392 100644
> > --- a/src/libcamera/pipeline/uvcvideo.cpp
> > +++ b/src/libcamera/pipeline/uvcvideo.cpp
> > @@ -331,7 +331,7 @@ int UVCCameraData::init(MediaEntity *entity)
> >  	if (ret)
> >  		return ret;
> >
> > -	stream_ = new Stream();
> > +	stream_ = new V4L2Stream(video_);
> >
> >  	video_->bufferReady.connect(this, &UVCCameraData::bufferReady);
> >
> > diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp
> > index 3f9e92163642f0c2..b1222bd21fb629a0 100644
> > --- a/src/libcamera/pipeline/vimc.cpp
> > +++ b/src/libcamera/pipeline/vimc.cpp
> > @@ -420,7 +420,7 @@ int VimcCameraData::init(MediaDevice *media)
> >  	if (video_->open())
> >  		return -ENODEV;
> >
> > -	stream_ = new Stream();
> > +	stream_ = new V4L2Stream(video_);
> >
> >  	video_->bufferReady.connect(this, &VimcCameraData::bufferReady);
> >

Patch

diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 094c4db6bc32b683..5080ac6c4d0abe3b 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -135,11 +135,12 @@  public:
 	BufferPool pool_;
 };
 
-class IPU3Stream : public Stream
+class IPU3Stream : public V4L2Stream
 {
 public:
 	IPU3Stream(ImgUDevice::ImgUOutput *device, const std::string &name)
-		: active_(false), name_(name), device_(device)
+		: V4L2Stream(device->dev), active_(false), name_(name),
+		  device_(device)
 	{
 	}
 
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 1ae50bec0d401b3f..ca3d92c7ad637c3a 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -888,7 +888,7 @@  int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)
 	std::unique_ptr<RkISP1CameraData> data =
 		utils::make_unique<RkISP1CameraData>(this);
 
-	data->stream_ = new Stream();
+	data->stream_ = new V4L2Stream(video_);
 
 	ControlInfoMap::Map ctrls;
 	ctrls.emplace(std::piecewise_construct,
diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp
index 64fc488912e5a82f..9cc90bf454cb4392 100644
--- a/src/libcamera/pipeline/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo.cpp
@@ -331,7 +331,7 @@  int UVCCameraData::init(MediaEntity *entity)
 	if (ret)
 		return ret;
 
-	stream_ = new Stream();
+	stream_ = new V4L2Stream(video_);
 
 	video_->bufferReady.connect(this, &UVCCameraData::bufferReady);
 
diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp
index 3f9e92163642f0c2..b1222bd21fb629a0 100644
--- a/src/libcamera/pipeline/vimc.cpp
+++ b/src/libcamera/pipeline/vimc.cpp
@@ -420,7 +420,7 @@  int VimcCameraData::init(MediaDevice *media)
 	if (video_->open())
 		return -ENODEV;
 
-	stream_ = new Stream();
+	stream_ = new V4L2Stream(video_);
 
 	video_->bufferReady.connect(this, &VimcCameraData::bufferReady);